@navaramap/worker 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +3 -0
  3. package/dist/helpers/transferConstructedPolygonGeometry.d.ts +6 -0
  4. package/dist/helpers/transferConstructedPolylineGeometry.d.ts +6 -0
  5. package/dist/helpers/transferReturnedConstructedTerrainMesh.d.ts +6 -0
  6. package/dist/index.d.ts +4 -0
  7. package/dist/index.js +3203 -0
  8. package/dist/index.umd.cjs +11 -0
  9. package/dist/manager.d.ts +19 -0
  10. package/dist/pool.d.ts +17 -0
  11. package/dist/recyclingPool.d.ts +86 -0
  12. package/dist/tasks/constructPolygonBatchedFeature.d.ts +2 -0
  13. package/dist/tasks/constructPolylineBatchedFeature.d.ts +2 -0
  14. package/dist/tasks/constructQuantizedMeshTerrainMesh.d.ts +4 -0
  15. package/dist/tasks/constructTerrainMesh.d.ts +4 -0
  16. package/dist/tasks/getImageDataFromBlob.d.ts +12 -0
  17. package/dist/tasks/getImageDataFromImageBitmap.d.ts +1 -0
  18. package/dist/tasks/index.d.ts +26 -0
  19. package/dist/tasks/parseMvtTile.d.ts +15 -0
  20. package/dist/tasks/upsampleQuantizedMeshTerrainMesh.d.ts +2 -0
  21. package/dist/tasks/upsampleTerrainMesh.d.ts +2 -0
  22. package/dist/tasks/waitWasm.d.ts +8 -0
  23. package/dist/utils/index.d.ts +5 -0
  24. package/dist/utils/toExtentRadianF32Like.d.ts +3 -0
  25. package/dist/utils/toPolygonMaterialLike.d.ts +3 -0
  26. package/dist/utils/toPolylineMaterialLike.d.ts +3 -0
  27. package/dist/utils/toTransferableMartiniLike.d.ts +3 -0
  28. package/dist/utils/toTransferablePolygonBatchedFeatureLike.d.ts +3 -0
  29. package/dist/utils/toTransferablePolylineBatchedFeatureLike.d.ts +3 -0
  30. package/dist/utils/toTransferableRasterDEMDataLike.d.ts +3 -0
  31. package/dist/utils/toTransferableTileLike.d.ts +5 -0
  32. package/dist/utils/toUpsamplableTerrainGeometryLike.d.ts +3 -0
  33. package/dist/utils/toVec3Like.d.ts +3 -0
  34. package/dist/worker/index.d.ts +4 -0
  35. package/dist/worker/transfer.d.ts +1 -0
  36. package/package.json +37 -0
  37. package/src/helpers/transferConstructedPolygonGeometry.ts +25 -0
  38. package/src/helpers/transferConstructedPolylineGeometry.ts +28 -0
  39. package/src/helpers/transferReturnedConstructedTerrainMesh.ts +21 -0
  40. package/src/index.ts +4 -0
  41. package/src/manager.test.ts +45 -0
  42. package/src/manager.ts +43 -0
  43. package/src/pool.test.ts +87 -0
  44. package/src/pool.ts +150 -0
  45. package/src/recyclingPool.test.ts +404 -0
  46. package/src/recyclingPool.ts +385 -0
  47. package/src/tasks/constructPolygonBatchedFeature.ts +40 -0
  48. package/src/tasks/constructPolylineBatchedFeature.ts +36 -0
  49. package/src/tasks/constructQuantizedMeshTerrainMesh.ts +36 -0
  50. package/src/tasks/constructTerrainMesh.ts +44 -0
  51. package/src/tasks/getImageDataFromBlob.ts +30 -0
  52. package/src/tasks/getImageDataFromImageBitmap.ts +19 -0
  53. package/src/tasks/index.ts +31 -0
  54. package/src/tasks/parseMvtTile.ts +67 -0
  55. package/src/tasks/upsampleQuantizedMeshTerrainMesh.ts +38 -0
  56. package/src/tasks/upsampleTerrainMesh.ts +40 -0
  57. package/src/tasks/waitWasm.ts +19 -0
  58. package/src/utils/index.ts +5 -0
  59. package/src/utils/toExtentRadianF32Like.ts +6 -0
  60. package/src/utils/toPolygonMaterialLike.ts +20 -0
  61. package/src/utils/toPolylineMaterialLike.ts +17 -0
  62. package/src/utils/toTransferableMartiniLike.ts +6 -0
  63. package/src/utils/toTransferablePolygonBatchedFeatureLike.ts +41 -0
  64. package/src/utils/toTransferablePolylineBatchedFeatureLike.ts +21 -0
  65. package/src/utils/toTransferableRasterDEMDataLike.ts +22 -0
  66. package/src/utils/toTransferableTileLike.ts +34 -0
  67. package/src/utils/toUpsamplableTerrainGeometryLike.ts +14 -0
  68. package/src/utils/toVec3Like.ts +6 -0
  69. package/src/vite-env.d.ts +1 -0
  70. package/src/worker/index.ts +44 -0
  71. package/src/worker/transfer.ts +6 -0
package/dist/index.js ADDED
@@ -0,0 +1,3203 @@
1
+ import "@navaramap/engine";
2
+ import e, { CachedMeshHandle as t, ElevationDecoder as n, ExtentRadianF32 as r, PolygonMaterial as i, PolylineMaterial as a, TileXYZ as o, TransferableMartini as s, TransferablePolygonBatchedFeature as c, TransferablePolylineBatchedFeature as l, TransferableRasterDEMData as u, TransferableTile as d, UpsamplableTerrainGeometry as f, constructPolygonBatchedFeature as p, constructPolylineBatchedFeature as m, constructQuantizedMeshTerrainMesh as h, constructTerrainMesh as g, parseMvtTile as _, upsampleQuantizedMeshTerrainMesh as v, upsampleTerrainMesh as y } from "@navaramap/engine-worker";
3
+ //#region \0rolldown/runtime.js
4
+ var b = Object.create, x = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, S = Object.getOwnPropertyNames, C = Object.getPrototypeOf, w = Object.prototype.hasOwnProperty, T = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), te = (e, t, n, r) => {
5
+ if (t && typeof t == "object" || typeof t == "function") for (var i = S(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !w.call(e, s) && s !== n && x(e, s, {
6
+ get: ((e) => t[e]).bind(null, s),
7
+ enumerable: !(r = ee(t, s)) || r.enumerable
8
+ });
9
+ return e;
10
+ }, ne = (e, t, n) => (n = e == null ? {} : b(C(e)), te(t || !e || !e.__esModule ? x(n, "default", {
11
+ value: e,
12
+ enumerable: !0
13
+ }) : n, e)), re = !0, ie = "Invariant failed";
14
+ function ae(e, t) {
15
+ if (!e) {
16
+ if (re) throw Error(ie);
17
+ var n = typeof t == "function" ? t() : t, r = n ? `${ie}: ${n}` : ie;
18
+ throw Error(r);
19
+ }
20
+ }
21
+ //#endregion
22
+ //#region __vite-browser-external
23
+ var E = /* @__PURE__ */ T(((e, t) => {
24
+ t.exports = {};
25
+ })), oe = /* @__PURE__ */ T(((e, t) => {
26
+ var n = function(e) {
27
+ return e !== void 0 && e.versions != null && e.versions.node != null && e + "" == "[object process]";
28
+ };
29
+ t.exports.isNode = n, t.exports.platform = typeof process < "u" && n(process) ? "node" : "browser";
30
+ var r = t.exports.platform === "node" && E();
31
+ t.exports.isMainThread = t.exports.platform === "node" ? (!r || r.isMainThread) && !process.connected : typeof Window < "u", t.exports.cpus = t.exports.platform === "browser" ? self.navigator.hardwareConcurrency : E().cpus().length;
32
+ })), se = /* @__PURE__ */ T(((e) => {
33
+ function t(e, a) {
34
+ var o = this;
35
+ if (!(this instanceof t)) throw SyntaxError("Constructor must be called with the new operator");
36
+ if (typeof e != "function") throw SyntaxError("Function parameter handler(resolve, reject) missing");
37
+ var s = [], c = [];
38
+ this.resolved = !1, this.rejected = !1, this.pending = !0, this[Symbol.toStringTag] = "Promise";
39
+ var l = function(e, t) {
40
+ s.push(e), c.push(t);
41
+ };
42
+ this.then = function(e, r) {
43
+ return new t(function(t, i) {
44
+ var a = e ? n(e, t, i) : t, o = r ? n(r, t, i) : i;
45
+ l(a, o);
46
+ }, o);
47
+ };
48
+ var u = function(e) {
49
+ return o.resolved = !0, o.rejected = !1, o.pending = !1, s.forEach(function(t) {
50
+ t(e);
51
+ }), l = function(t, n) {
52
+ t(e);
53
+ }, u = d = function() {}, o;
54
+ }, d = function(e) {
55
+ return o.resolved = !1, o.rejected = !0, o.pending = !1, c.forEach(function(t) {
56
+ t(e);
57
+ }), l = function(t, n) {
58
+ n(e);
59
+ }, u = d = function() {}, o;
60
+ };
61
+ this.cancel = function() {
62
+ return a ? a.cancel() : d(new r()), o;
63
+ }, this.timeout = function(e) {
64
+ if (a) a.timeout(e);
65
+ else {
66
+ var t = setTimeout(function() {
67
+ d(new i("Promise timed out after " + e + " ms"));
68
+ }, e);
69
+ o.always(function() {
70
+ clearTimeout(t);
71
+ });
72
+ }
73
+ return o;
74
+ }, e(function(e) {
75
+ u(e);
76
+ }, function(e) {
77
+ d(e);
78
+ });
79
+ }
80
+ function n(e, t, n) {
81
+ return function(r) {
82
+ try {
83
+ var i = e(r);
84
+ i && typeof i.then == "function" && typeof i.catch == "function" ? i.then(t, n) : t(i);
85
+ } catch (e) {
86
+ n(e);
87
+ }
88
+ };
89
+ }
90
+ t.prototype.catch = function(e) {
91
+ return this.then(null, e);
92
+ }, t.prototype.always = function(e) {
93
+ return this.then(e, e);
94
+ }, t.prototype.finally = function(e) {
95
+ let n = this, r = function() {
96
+ return new t((e) => e()).then(e).then(() => n);
97
+ };
98
+ return this.then(r, r);
99
+ }, t.all = function(e) {
100
+ return new t(function(t, n) {
101
+ var r = e.length, i = [];
102
+ r ? e.forEach(function(e, a) {
103
+ e.then(function(e) {
104
+ i[a] = e, r--, r == 0 && t(i);
105
+ }, function(e) {
106
+ r = 0, n(e);
107
+ });
108
+ }) : t(i);
109
+ });
110
+ }, t.defer = function() {
111
+ var e = {};
112
+ return e.promise = new t(function(t, n) {
113
+ e.resolve = t, e.reject = n;
114
+ }), e;
115
+ };
116
+ function r(e) {
117
+ this.message = e || "promise cancelled", this.stack = (/* @__PURE__ */ Error()).stack;
118
+ }
119
+ r.prototype = /* @__PURE__ */ Error(), r.prototype.constructor = Error, r.prototype.name = "CancellationError", t.CancellationError = r;
120
+ function i(e) {
121
+ this.message = e || "timeout exceeded", this.stack = (/* @__PURE__ */ Error()).stack;
122
+ }
123
+ i.prototype = /* @__PURE__ */ Error(), i.prototype.constructor = Error, i.prototype.name = "TimeoutError", t.TimeoutError = i, e.Promise = t;
124
+ })), ce = /* @__PURE__ */ T(((e) => {
125
+ e.validateOptions = function(e, t, n) {
126
+ if (e) {
127
+ var r = e ? Object.keys(e) : [], i = r.find((e) => !t.includes(e));
128
+ if (i) throw Error("Object \"" + n + "\" contains an unknown option \"" + i + "\"");
129
+ var a = t.find((e) => Object.prototype[e] && !r.includes(e));
130
+ if (a) throw Error("Object \"" + n + "\" contains an inherited option \"" + a + "\" which is not defined in the object itself but in its prototype. Only plain objects are allowed. Please remove the option from the prototype or override it with a value \"undefined\".");
131
+ return e;
132
+ }
133
+ }, e.workerOptsNames = [
134
+ "credentials",
135
+ "name",
136
+ "type"
137
+ ], e.forkOptsNames = [
138
+ "cwd",
139
+ "detached",
140
+ "env",
141
+ "execPath",
142
+ "execArgv",
143
+ "gid",
144
+ "serialization",
145
+ "signal",
146
+ "killSignal",
147
+ "silent",
148
+ "stdio",
149
+ "uid",
150
+ "windowsVerbatimArguments",
151
+ "timeout"
152
+ ], e.workerThreadOptsNames = [
153
+ "argv",
154
+ "env",
155
+ "eval",
156
+ "execArgv",
157
+ "stdin",
158
+ "stdout",
159
+ "stderr",
160
+ "workerData",
161
+ "trackUnmanagedFds",
162
+ "transferList",
163
+ "resourceLimits",
164
+ "name"
165
+ ];
166
+ })), le = /* @__PURE__ */ T(((e, t) => {
167
+ t.exports = "!function(e,n){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=n():\"function\"==typeof define&&define.amd?define(n):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).worker=n()}(this,(function(){\"use strict\";function e(n){return e=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e},e(n)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,\"default\")?e.default:e}var t={};var r=function(e,n){this.message=e,this.transfer=n},o={};function i(e,n){var t=this;if(!(this instanceof i))throw new SyntaxError(\"Constructor must be called with the new operator\");if(\"function\"!=typeof e)throw new SyntaxError(\"Function parameter handler(resolve, reject) missing\");var r=[],o=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]=\"Promise\";var a=function(e,n){r.push(e),o.push(n)};this.then=function(e,n){return new i((function(t,r){var o=e?s(e,t,r):t,i=n?s(n,t,r):r;a(o,i)}),t)};var f=function(e){return t.resolved=!0,t.rejected=!1,t.pending=!1,r.forEach((function(n){n(e)})),a=function(n,t){n(e)},f=d=function(){},t},d=function(e){return t.resolved=!1,t.rejected=!0,t.pending=!1,o.forEach((function(n){n(e)})),a=function(n,t){t(e)},f=d=function(){},t};this.cancel=function(){return n?n.cancel():d(new u),t},this.timeout=function(e){if(n)n.timeout(e);else{var r=setTimeout((function(){d(new c(\"Promise timed out after \"+e+\" ms\"))}),e);t.always((function(){clearTimeout(r)}))}return t},e((function(e){f(e)}),(function(e){d(e)}))}function s(e,n,t){return function(r){try{var o=e(r);o&&\"function\"==typeof o.then&&\"function\"==typeof o.catch?o.then(n,t):n(o)}catch(e){t(e)}}}function u(e){this.message=e||\"promise cancelled\",this.stack=(new Error).stack}function c(e){this.message=e||\"timeout exceeded\",this.stack=(new Error).stack}return i.prototype.catch=function(e){return this.then(null,e)},i.prototype.always=function(e){return this.then(e,e)},i.prototype.finally=function(e){var n=this,t=function(){return new i((function(e){return e()})).then(e).then((function(){return n}))};return this.then(t,t)},i.all=function(e){return new i((function(n,t){var r=e.length,o=[];r?e.forEach((function(e,i){e.then((function(e){o[i]=e,0==--r&&n(o)}),(function(e){r=0,t(e)}))})):n(o)}))},i.defer=function(){var e={};return e.promise=new i((function(n,t){e.resolve=n,e.reject=t})),e},u.prototype=new Error,u.prototype.constructor=Error,u.prototype.name=\"CancellationError\",i.CancellationError=u,c.prototype=new Error,c.prototype.constructor=Error,c.prototype.name=\"TimeoutError\",i.TimeoutError=c,o.Promise=i,function(n){var t=r,i=o.Promise,s=\"__workerpool-cleanup__\",u={exit:function(){}},c={addAbortListener:function(e){u.abortListeners.push(e)},emit:u.emit};if(\"undefined\"!=typeof self&&\"function\"==typeof postMessage&&\"function\"==typeof addEventListener)u.on=function(e,n){addEventListener(e,(function(e){n(e.data)}))},u.send=function(e,n){n?postMessage(e,n):postMessage(e)};else{if(\"undefined\"==typeof process)throw new Error(\"Script must be executed as a worker\");var a;try{a=require(\"worker_threads\")}catch(n){if(\"object\"!==e(n)||null===n||\"MODULE_NOT_FOUND\"!==n.code)throw n}if(a&&null!==a.parentPort){var f=a.parentPort;u.send=f.postMessage.bind(f),u.on=f.on.bind(f),u.exit=process.exit.bind(process)}else u.on=process.on.bind(process),u.send=function(e){process.send(e)},u.on(\"disconnect\",(function(){process.exit(1)})),u.exit=process.exit.bind(process)}function d(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function l(e){return e&&\"function\"==typeof e.then&&\"function\"==typeof e.catch}u.methods={},u.methods.run=function(e,n){var t=new Function(\"return (\"+e+\").apply(this, arguments);\");return t.worker=c,t.apply(t,n)},u.methods.methods=function(){return Object.keys(u.methods)},u.terminationHandler=void 0,u.abortListenerTimeout=1e3,u.abortListeners=[],u.terminateAndExit=function(e){var n=function(){u.exit(e)};if(!u.terminationHandler)return n();var t=u.terminationHandler(e);return l(t)?(t.then(n,n),t):(n(),new i((function(e,n){n(new Error(\"Worker terminating\"))})))},u.cleanup=function(e){if(!u.abortListeners.length)return u.send({id:e,method:s,error:d(new Error(\"Worker terminating\"))}),new i((function(e){e()}));var n,t=u.abortListeners.map((function(e){return e()})),r=new i((function(e,t){n=setTimeout((function(){t(new Error(\"Timeout occured waiting for abort handler, killing worker\"))}),u.abortListenerTimeout)})),o=i.all(t).then((function(){clearTimeout(n),u.abortListeners.length||(u.abortListeners=[])}),(function(){clearTimeout(n),u.exit()}));return new i((function(e,n){o.then(e,n),r.then(e,n)})).then((function(){u.send({id:e,method:s,error:null})}),(function(n){u.send({id:e,method:s,error:n?d(n):null})}))};var p=null;u.on(\"message\",(function(e){if(\"__workerpool-terminate__\"===e)return u.terminateAndExit(0);if(e.method===s)return u.cleanup(e.id);try{var n=u.methods[e.method];if(!n)throw new Error('Unknown method \"'+e.method+'\"');p=e.id;var r=n.apply(n,e.params);l(r)?r.then((function(n){n instanceof t?u.send({id:e.id,result:n.message,error:null},n.transfer):u.send({id:e.id,result:n,error:null}),p=null})).catch((function(n){u.send({id:e.id,result:null,error:d(n)}),p=null})):(r instanceof t?u.send({id:e.id,result:r.message,error:null},r.transfer):u.send({id:e.id,result:r,error:null}),p=null)}catch(n){u.send({id:e.id,result:null,error:d(n)})}})),u.register=function(e,n){if(e)for(var t in e)e.hasOwnProperty(t)&&(u.methods[t]=e[t],u.methods[t].worker=c);n&&(u.terminationHandler=n.onTerminate,u.abortListenerTimeout=n.abortListenerTimeout||1e3),u.send(\"ready\")},u.emit=function(e){if(p){if(e instanceof t)return void u.send({id:p,isEvent:!0,payload:e.message},e.transfer);u.send({id:p,isEvent:!0,payload:e})}},n.add=u.register,n.emit=u.emit}(t),n(t)}));\n//# sourceMappingURL=worker.min.js.map\n";
168
+ })), ue = /* @__PURE__ */ T(((e, t) => {
169
+ var { Promise: n } = se(), r = oe(), { validateOptions: i, forkOptsNames: a, workerThreadOptsNames: o, workerOptsNames: s } = ce(), c = "__workerpool-terminate__", l = "__workerpool-cleanup__";
170
+ function u() {
171
+ var e = f();
172
+ if (!e) throw Error("WorkerPool: workerType = 'thread' is not supported, Node >= 11.7.0 required");
173
+ return e;
174
+ }
175
+ function d() {
176
+ if (typeof Worker != "function" && (typeof Worker != "object" || typeof Worker.prototype.constructor != "function")) throw Error("WorkerPool: Web Workers not supported");
177
+ }
178
+ function f() {
179
+ try {
180
+ return E();
181
+ } catch (e) {
182
+ if (typeof e == "object" && e && e.code === "MODULE_NOT_FOUND") return null;
183
+ throw e;
184
+ }
185
+ }
186
+ function p() {
187
+ if (r.platform === "browser") {
188
+ if (typeof Blob > "u") throw Error("Blob not supported by the browser");
189
+ if (!window.URL || typeof window.URL.createObjectURL != "function") throw Error("URL.createObjectURL not supported by the browser");
190
+ var e = new Blob([le()], { type: "text/javascript" });
191
+ return window.URL.createObjectURL(e);
192
+ } else return __dirname + "/worker.js";
193
+ }
194
+ function m(e, t) {
195
+ if (t.workerType === "web") return d(), h(e, t.workerOpts, Worker);
196
+ if (t.workerType === "thread") return n = u(), g(e, n, t);
197
+ if (t.workerType === "process" || !t.workerType) return _(e, v(t), E());
198
+ if (r.platform === "browser") return d(), h(e, t.workerOpts, Worker);
199
+ var n = f();
200
+ return n ? g(e, n, t) : _(e, v(t), E());
201
+ }
202
+ function h(e, t, n) {
203
+ i(t, s, "workerOpts");
204
+ var r = new n(e, t);
205
+ return r.isBrowserWorker = !0, r.on = function(e, t) {
206
+ this.addEventListener(e, function(e) {
207
+ t(e.data);
208
+ });
209
+ }, r.send = function(e, t) {
210
+ this.postMessage(e, t);
211
+ }, r;
212
+ }
213
+ function g(e, t, n) {
214
+ i(n?.workerThreadOpts, o, "workerThreadOpts");
215
+ var r = new t.Worker(e, {
216
+ stdout: n?.emitStdStreams ?? !1,
217
+ stderr: n?.emitStdStreams ?? !1,
218
+ ...n?.workerThreadOpts
219
+ });
220
+ return r.isWorkerThread = !0, r.send = function(e, t) {
221
+ this.postMessage(e, t);
222
+ }, r.kill = function() {
223
+ return this.terminate(), !0;
224
+ }, r.disconnect = function() {
225
+ this.terminate();
226
+ }, n?.emitStdStreams && (r.stdout.on("data", (e) => r.emit("stdout", e)), r.stderr.on("data", (e) => r.emit("stderr", e))), r;
227
+ }
228
+ function _(e, t, n) {
229
+ i(t.forkOpts, a, "forkOpts");
230
+ var r = n.fork(e, t.forkArgs, t.forkOpts), o = r.send;
231
+ return r.send = function(e) {
232
+ return o.call(r, e);
233
+ }, t.emitStdStreams && (r.stdout.on("data", (e) => r.emit("stdout", e)), r.stderr.on("data", (e) => r.emit("stderr", e))), r.isChildProcess = !0, r;
234
+ }
235
+ function v(e) {
236
+ e ||= {};
237
+ var t = process.execArgv.join(" "), n = t.indexOf("--inspect") !== -1, r = t.indexOf("--debug-brk") !== -1, i = [];
238
+ return n && (i.push("--inspect=" + e.debugPort), r && i.push("--debug-brk")), process.execArgv.forEach(function(e) {
239
+ e.indexOf("--max-old-space-size") > -1 && i.push(e);
240
+ }), Object.assign({}, e, {
241
+ forkArgs: e.forkArgs,
242
+ forkOpts: Object.assign({}, e.forkOpts, {
243
+ execArgv: (e.forkOpts && e.forkOpts.execArgv || []).concat(i),
244
+ stdio: e.emitStdStreams ? "pipe" : void 0
245
+ })
246
+ });
247
+ }
248
+ function y(e) {
249
+ for (var t = /* @__PURE__ */ Error(""), n = Object.keys(e), r = 0; r < n.length; r++) t[n[r]] = e[n[r]];
250
+ return t;
251
+ }
252
+ function b(e, t) {
253
+ Object.values(e.processing).forEach((e) => e?.options?.on(t)), Object.values(e.tracking).forEach((e) => e?.options?.on(t));
254
+ }
255
+ function x(e, t) {
256
+ var n = this, r = t || {};
257
+ this.script = e || p(), this.worker = m(this.script, r), this.debugPort = r.debugPort, this.forkOpts = r.forkOpts, this.forkArgs = r.forkArgs, this.workerOpts = r.workerOpts, this.workerThreadOpts = r.workerThreadOpts, this.workerTerminateTimeout = r.workerTerminateTimeout, e || (this.worker.ready = !0), this.requestQueue = [], this.worker.on("stdout", function(e) {
258
+ b(n, { stdout: e.toString() });
259
+ }), this.worker.on("stderr", function(e) {
260
+ b(n, { stderr: e.toString() });
261
+ }), this.worker.on("message", function(e) {
262
+ if (!n.terminated) if (typeof e == "string" && e === "ready") n.worker.ready = !0, a();
263
+ else {
264
+ var t = e.id, r = n.processing[t];
265
+ if (r !== void 0) e.isEvent ? r.options && typeof r.options.on == "function" && r.options.on(e.payload) : (delete n.processing[t], n.terminating === !0 && n.terminate(), e.error ? r.resolver.reject(y(e.error)) : r.resolver.resolve(e.result));
266
+ else {
267
+ var r = n.tracking[t];
268
+ r !== void 0 && e.isEvent && r.options && typeof r.options.on == "function" && r.options.on(e.payload);
269
+ }
270
+ if (e.method === l) {
271
+ var i = n.tracking[e.id];
272
+ i !== void 0 && (e.error ? (clearTimeout(i.timeoutId), i.resolver.reject(y(e.error))) : (n.tracking && clearTimeout(i.timeoutId), i.resolver.reject(new ee(i.error)))), delete n.tracking[t];
273
+ }
274
+ }
275
+ });
276
+ function i(e) {
277
+ for (var t in n.terminated = !0, n.processing) n.processing[t] !== void 0 && n.processing[t].resolver.reject(e);
278
+ n.processing = Object.create(null);
279
+ }
280
+ function a() {
281
+ for (let e of n.requestQueue.splice(0)) n.worker.send(e.message, e.transfer);
282
+ }
283
+ var o = this.worker;
284
+ this.worker.on("error", function(e) {
285
+ i(new S("Workerpool Worker error: " + (e && e.message ? e.message : String(e || "Unknown worker error")), e));
286
+ }), this.worker.on("exit", function(e, t) {
287
+ var r = "Workerpool Worker terminated Unexpectedly\n";
288
+ r += " exitCode: `" + e + "`\n", r += " signalCode: `" + t + "`\n", r += " workerpool.script: `" + n.script + "`\n", r += " spawnArgs: `" + o.spawnargs + "`\n", r += " spawnfile: `" + o.spawnfile + "`\n", r += " stdout: `" + o.stdout + "`\n", r += " stderr: `" + o.stderr + "`\n", i(new S(r));
289
+ }), this.processing = Object.create(null), this.tracking = Object.create(null), this.terminating = !1, this.terminated = !1, this.cleaning = !1, this.terminationHandler = null, this.lastId = 0;
290
+ }
291
+ x.prototype.methods = function() {
292
+ return this.exec("methods");
293
+ }, x.prototype.exec = function(e, t, r, i) {
294
+ r ||= n.defer();
295
+ var a = ++this.lastId;
296
+ this.processing[a] = {
297
+ id: a,
298
+ resolver: r,
299
+ options: i
300
+ };
301
+ var o = {
302
+ message: {
303
+ id: a,
304
+ method: e,
305
+ params: t
306
+ },
307
+ transfer: i && i.transfer
308
+ };
309
+ this.terminated ? r.reject(new S("Worker is terminated")) : this.worker.ready ? this.worker.send(o.message, o.transfer) : this.requestQueue.push(o);
310
+ var s = this;
311
+ return r.promise.catch(function(e) {
312
+ if (e instanceof n.CancellationError || e instanceof n.TimeoutError) return s.tracking[a] = {
313
+ id: a,
314
+ resolver: n.defer(),
315
+ options: i,
316
+ error: e
317
+ }, delete s.processing[a], s.tracking[a].resolver.promise = s.tracking[a].resolver.promise.catch(function(e) {
318
+ if (delete s.tracking[a], e instanceof ee) throw e.error;
319
+ return s.terminateAndNotify(!0).then(function() {
320
+ throw e;
321
+ }, function(e) {
322
+ throw e;
323
+ });
324
+ }), s.worker.send({
325
+ id: a,
326
+ method: l
327
+ }), s.tracking[a].timeoutId = setTimeout(function() {
328
+ s.tracking[a].resolver.reject(e);
329
+ }, s.workerTerminateTimeout), s.tracking[a].resolver.promise;
330
+ throw e;
331
+ });
332
+ }, x.prototype.busy = function() {
333
+ return this.cleaning || Object.keys(this.processing).length > 0;
334
+ }, x.prototype.terminate = function(e, t) {
335
+ var n = this;
336
+ if (e) {
337
+ for (var r in this.processing) this.processing[r] !== void 0 && this.processing[r].resolver.reject(/* @__PURE__ */ Error("Worker terminated"));
338
+ this.processing = Object.create(null);
339
+ }
340
+ for (var i of Object.values(n.tracking)) clearTimeout(i.timeoutId), i.resolver.reject(/* @__PURE__ */ Error("Worker Terminating"));
341
+ if (n.tracking = Object.create(null), typeof t == "function" && (this.terminationHandler = t), this.busy()) this.terminating = !0;
342
+ else {
343
+ var a = function(e) {
344
+ if (n.terminated = !0, n.cleaning = !1, n.worker != null && n.worker.removeAllListeners && n.worker.removeAllListeners("message"), n.worker = null, n.terminating = !1, n.terminationHandler) n.terminationHandler(e, n);
345
+ else if (e) throw e;
346
+ };
347
+ if (this.worker) if (typeof this.worker.kill == "function") {
348
+ if (this.worker.killed) {
349
+ a(/* @__PURE__ */ Error("worker already killed!"));
350
+ return;
351
+ }
352
+ var o = setTimeout(function() {
353
+ n.worker && n.worker.kill();
354
+ }, this.workerTerminateTimeout);
355
+ this.worker.once("exit", function() {
356
+ clearTimeout(o), n.worker && (n.worker.killed = !0), a();
357
+ }), this.worker.ready ? this.worker.send(c) : this.requestQueue.push({ message: c }), this.cleaning = !0;
358
+ return;
359
+ } else if (typeof this.worker.terminate == "function") this.worker.terminate(), this.worker.killed = !0;
360
+ else throw Error("Failed to terminate worker");
361
+ a();
362
+ }
363
+ }, x.prototype.terminateAndNotify = function(e, t) {
364
+ var r = n.defer();
365
+ return t && r.promise.timeout(t), this.terminate(e, function(e, t) {
366
+ e ? r.reject(e) : r.resolve(t);
367
+ }), r.promise;
368
+ };
369
+ function ee(e) {
370
+ this.error = e, this.stack = (/* @__PURE__ */ Error()).stack;
371
+ }
372
+ var S = class extends Error {
373
+ constructor(e, t) {
374
+ super(e || "worker terminated"), this.cause = t;
375
+ }
376
+ };
377
+ t.exports = x, t.exports._tryRequireWorkerThreads = f, t.exports._setupProcessWorker = _, t.exports._setupBrowserWorker = h, t.exports._setupWorkerThreadWorker = g, t.exports.ensureWorkerThreads = u, t.exports.TerminateError = S;
378
+ })), de = /* @__PURE__ */ T(((e, t) => {
379
+ function n() {
380
+ this.tasks = [];
381
+ }
382
+ n.prototype.push = function(e) {
383
+ this.tasks.push(e);
384
+ }, n.prototype.pop = function() {
385
+ return this.tasks.shift();
386
+ }, n.prototype.size = function() {
387
+ return this.tasks.length;
388
+ }, n.prototype.contains = function(e) {
389
+ return this.tasks.includes(e);
390
+ }, n.prototype.clear = function() {
391
+ this.tasks.length = 0;
392
+ };
393
+ function r() {
394
+ this.tasks = [];
395
+ }
396
+ r.prototype.push = function(e) {
397
+ this.tasks.push(e);
398
+ }, r.prototype.pop = function() {
399
+ return this.tasks.pop();
400
+ }, r.prototype.size = function() {
401
+ return this.tasks.length;
402
+ }, r.prototype.contains = function(e) {
403
+ return this.tasks.includes(e);
404
+ }, r.prototype.clear = function() {
405
+ this.tasks.length = 0;
406
+ }, t.exports = {
407
+ FIFOQueue: n,
408
+ LIFOQueue: r
409
+ };
410
+ })), fe = /* @__PURE__ */ T(((e, t) => {
411
+ var n = 65535;
412
+ t.exports = r;
413
+ function r() {
414
+ this.ports = Object.create(null), this.length = 0;
415
+ }
416
+ r.prototype.nextAvailableStartingAt = function(e) {
417
+ for (; this.ports[e] === !0;) e++;
418
+ if (e >= n) throw Error("WorkerPool debug port limit reached: " + e + ">= " + n);
419
+ return this.ports[e] = !0, this.length++, e;
420
+ }, r.prototype.releasePort = function(e) {
421
+ delete this.ports[e], this.length--;
422
+ };
423
+ })), pe = /* @__PURE__ */ T(((e, t) => {
424
+ var { Promise: n } = se(), r = ue(), i = oe(), { FIFOQueue: a, LIFOQueue: o } = de(), s = new (fe())();
425
+ function c(e, t) {
426
+ typeof e == "string" ? this.script = e || null : (this.script = null, t = e), this.workers = [], this.taskQueue = this._createQueue(t && t.queueStrategy || "fifo"), t ||= {}, this.forkArgs = Object.freeze(t.forkArgs || []), this.forkOpts = Object.freeze(t.forkOpts || {}), this.workerOpts = Object.freeze(t.workerOpts || {}), this.workerThreadOpts = Object.freeze(t.workerThreadOpts || {}), this.debugPortStart = t.debugPortStart || 43210, this.nodeWorker = t.nodeWorker, this.workerType = t.workerType || t.nodeWorker || "auto", this.maxQueueSize = t.maxQueueSize || Infinity, this.workerTerminateTimeout = t.workerTerminateTimeout || 1e3, this.onCreateWorker = t.onCreateWorker || (() => null), this.onTerminateWorker = t.onTerminateWorker || (() => null), this.emitStdStreams = t.emitStdStreams || !1, t && "maxWorkers" in t ? (l(t.maxWorkers), this.maxWorkers = t.maxWorkers) : this.maxWorkers = Math.max((i.cpus || 4) - 1, 1), t && "minWorkers" in t && (t.minWorkers === "max" ? this.minWorkers = this.maxWorkers : (u(t.minWorkers), this.minWorkers = t.minWorkers, this.maxWorkers = Math.max(this.minWorkers, this.maxWorkers)), this._ensureMinWorkers()), this._boundNext = this._next.bind(this), this.workerType === "thread" && r.ensureWorkerThreads();
427
+ }
428
+ c.prototype.exec = function(e, t, r) {
429
+ if (t && !Array.isArray(t)) throw TypeError("Array expected as argument \"params\"");
430
+ if (typeof e == "string") {
431
+ var i = n.defer();
432
+ if (this.taskQueue.size() >= this.maxQueueSize) throw Error("Max queue size of " + this.maxQueueSize + " reached");
433
+ var a = {
434
+ method: e,
435
+ params: t,
436
+ resolver: i,
437
+ timeout: null,
438
+ options: r
439
+ };
440
+ this.taskQueue.push(a);
441
+ var o = i.promise.timeout, s = this.taskQueue;
442
+ return i.promise.timeout = function(e) {
443
+ return s.contains(a) ? (a.timeout = e, i.promise) : o.call(i.promise, e);
444
+ }, this._next(), i.promise;
445
+ } else if (typeof e == "function") return this.exec("run", [String(e), t], r);
446
+ else throw TypeError("Function or string expected as argument \"method\"");
447
+ }, c.prototype.proxy = function() {
448
+ if (arguments.length > 0) throw Error("No arguments expected");
449
+ var e = this;
450
+ return this.exec("methods").then(function(t) {
451
+ var n = {};
452
+ return t.forEach(function(t) {
453
+ n[t] = function() {
454
+ return e.exec(t, Array.prototype.slice.call(arguments));
455
+ };
456
+ }), n;
457
+ });
458
+ }, c.prototype._next = function() {
459
+ if (this.taskQueue.size() > 0) {
460
+ var e = this._getWorker();
461
+ if (e) {
462
+ var t = this, n = this.taskQueue.pop();
463
+ if (n.resolver.promise.pending) {
464
+ var r = e.exec(n.method, n.params, n.resolver, n.options).then(t._boundNext).catch(function() {
465
+ if (e.terminated) return t._removeWorker(e);
466
+ }).then(function() {
467
+ t._next();
468
+ });
469
+ typeof n.timeout == "number" && r.timeout(n.timeout);
470
+ } else t._next();
471
+ }
472
+ }
473
+ }, c.prototype._getWorker = function() {
474
+ for (var e = this.workers, t = 0; t < e.length; t++) {
475
+ var n = e[t];
476
+ if (n.busy() === !1) return n;
477
+ }
478
+ return e.length < this.maxWorkers ? (n = this._createWorkerHandler(), e.push(n), n) : null;
479
+ }, c.prototype._removeWorker = function(e) {
480
+ var t = this;
481
+ return s.releasePort(e.debugPort), this._removeWorkerFromList(e), this._ensureMinWorkers(), new n(function(n, r) {
482
+ e.terminate(!1, function(i) {
483
+ t.onTerminateWorker({
484
+ forkArgs: e.forkArgs,
485
+ forkOpts: e.forkOpts,
486
+ workerThreadOpts: e.workerThreadOpts,
487
+ script: e.script
488
+ }), i ? r(i) : n(e);
489
+ });
490
+ });
491
+ }, c.prototype._removeWorkerFromList = function(e) {
492
+ var t = this.workers.indexOf(e);
493
+ t !== -1 && this.workers.splice(t, 1);
494
+ }, c.prototype.terminate = function(e, t) {
495
+ for (var r = this, i = this.taskQueue; i.size() > 0;) {
496
+ var a = i.pop();
497
+ if (a) a.resolver.reject(/* @__PURE__ */ Error("Pool terminated"));
498
+ else break;
499
+ }
500
+ i.clear();
501
+ var o = function(e) {
502
+ s.releasePort(e.debugPort), this._removeWorkerFromList(e);
503
+ }.bind(this), c = [];
504
+ return this.workers.slice().forEach(function(n) {
505
+ var i = n.terminateAndNotify(e, t).then(o).always(function() {
506
+ r.onTerminateWorker({
507
+ forkArgs: n.forkArgs,
508
+ forkOpts: n.forkOpts,
509
+ workerThreadOpts: n.workerThreadOpts,
510
+ script: n.script
511
+ });
512
+ });
513
+ c.push(i);
514
+ }), n.all(c);
515
+ }, c.prototype.stats = function() {
516
+ var e = this.workers.length, t = this.workers.filter(function(e) {
517
+ return e.busy();
518
+ }).length;
519
+ return {
520
+ totalWorkers: e,
521
+ busyWorkers: t,
522
+ idleWorkers: e - t,
523
+ pendingTasks: this.taskQueue.size(),
524
+ activeTasks: t
525
+ };
526
+ }, c.prototype._ensureMinWorkers = function() {
527
+ if (this.minWorkers) for (var e = this.workers.length; e < this.minWorkers; e++) this.workers.push(this._createWorkerHandler());
528
+ }, c.prototype._createWorkerHandler = function() {
529
+ let e = this.onCreateWorker({
530
+ forkArgs: this.forkArgs,
531
+ forkOpts: this.forkOpts,
532
+ workerOpts: this.workerOpts,
533
+ workerThreadOpts: this.workerThreadOpts,
534
+ script: this.script
535
+ }) || {};
536
+ return new r(e.script || this.script, {
537
+ forkArgs: e.forkArgs || this.forkArgs,
538
+ forkOpts: e.forkOpts || this.forkOpts,
539
+ workerOpts: e.workerOpts || this.workerOpts,
540
+ workerThreadOpts: e.workerThreadOpts || this.workerThreadOpts,
541
+ debugPort: s.nextAvailableStartingAt(this.debugPortStart),
542
+ workerType: this.workerType,
543
+ workerTerminateTimeout: this.workerTerminateTimeout,
544
+ emitStdStreams: this.emitStdStreams
545
+ });
546
+ }, c.prototype._createQueue = function(e) {
547
+ if (typeof e == "string") switch (e) {
548
+ case "fifo": return new a();
549
+ case "lifo": return new o();
550
+ default: throw Error("Unknown queue strategy: " + e);
551
+ }
552
+ if (!e) throw Error("Queue strategy cannot be null or undefined");
553
+ for (var t = [
554
+ "push",
555
+ "pop",
556
+ "size",
557
+ "contains",
558
+ "clear"
559
+ ], n = 0; n < t.length; n++) {
560
+ var r = t[n];
561
+ if (typeof e[r] != "function") throw Error("Queue strategy must implement method: " + r);
562
+ }
563
+ return e;
564
+ };
565
+ function l(e) {
566
+ if (!d(e) || !f(e) || e < 1) throw TypeError("Option maxWorkers must be an integer number >= 1");
567
+ }
568
+ function u(e) {
569
+ if (!d(e) || !f(e) || e < 0) throw TypeError("Option minWorkers must be an integer number >= 0");
570
+ }
571
+ function d(e) {
572
+ return typeof e == "number";
573
+ }
574
+ function f(e) {
575
+ return Math.round(e) == e;
576
+ }
577
+ t.exports = c;
578
+ })), me = /* @__PURE__ */ T(((e, t) => {
579
+ function n(e, t) {
580
+ this.message = e, this.transfer = t;
581
+ }
582
+ t.exports = n;
583
+ })), he = /* @__PURE__ */ T(((e) => {
584
+ var t = me(), n = se().Promise, r = "__workerpool-terminate__", i = "__workerpool-cleanup__", a = 1e3, o = { exit: function() {} }, s = {
585
+ addAbortListener: function(e) {
586
+ o.abortListeners.push(e);
587
+ },
588
+ emit: o.emit
589
+ };
590
+ if (typeof self < "u" && typeof postMessage == "function" && typeof addEventListener == "function") o.on = function(e, t) {
591
+ addEventListener(e, function(e) {
592
+ t(e.data);
593
+ });
594
+ }, o.send = function(e, t) {
595
+ t ? postMessage(e, t) : postMessage(e);
596
+ };
597
+ else if (typeof process < "u") {
598
+ var c;
599
+ try {
600
+ c = E();
601
+ } catch (e) {
602
+ if (!(typeof e == "object" && e && e.code === "MODULE_NOT_FOUND")) throw e;
603
+ }
604
+ if (c && c.parentPort !== null) {
605
+ var l = c.parentPort;
606
+ o.send = l.postMessage.bind(l), o.on = l.on.bind(l), o.exit = process.exit.bind(process);
607
+ } else o.on = process.on.bind(process), o.send = function(e) {
608
+ process.send(e);
609
+ }, o.on("disconnect", function() {
610
+ process.exit(1);
611
+ }), o.exit = process.exit.bind(process);
612
+ } else throw Error("Script must be executed as a worker");
613
+ function u(e) {
614
+ return e && e.toJSON ? JSON.parse(JSON.stringify(e)) : JSON.parse(JSON.stringify(e, Object.getOwnPropertyNames(e)));
615
+ }
616
+ function d(e) {
617
+ return e && typeof e.then == "function" && typeof e.catch == "function";
618
+ }
619
+ o.methods = {}, o.methods.run = function(e, t) {
620
+ var n = Function("return (" + e + ").apply(this, arguments);");
621
+ return n.worker = s, n.apply(n, t);
622
+ }, o.methods.methods = function() {
623
+ return Object.keys(o.methods);
624
+ }, o.terminationHandler = void 0, o.abortListenerTimeout = a, o.abortListeners = [], o.terminateAndExit = function(e) {
625
+ var t = function() {
626
+ o.exit(e);
627
+ };
628
+ if (!o.terminationHandler) return t();
629
+ var r = o.terminationHandler(e);
630
+ return d(r) ? (r.then(t, t), r) : (t(), new n(function(e, t) {
631
+ t(/* @__PURE__ */ Error("Worker terminating"));
632
+ }));
633
+ }, o.cleanup = function(e) {
634
+ if (!o.abortListeners.length) return o.send({
635
+ id: e,
636
+ method: i,
637
+ error: u(/* @__PURE__ */ Error("Worker terminating"))
638
+ }), new n(function(e) {
639
+ e();
640
+ });
641
+ var t = function() {
642
+ o.exit();
643
+ }, r = function() {
644
+ o.abortListeners.length || (o.abortListeners = []);
645
+ };
646
+ let a = o.abortListeners.map((e) => e()), s, c = new n((e, t) => {
647
+ s = setTimeout(function() {
648
+ t(/* @__PURE__ */ Error("Timeout occured waiting for abort handler, killing worker"));
649
+ }, o.abortListenerTimeout);
650
+ }), l = n.all(a).then(function() {
651
+ clearTimeout(s), r();
652
+ }, function() {
653
+ clearTimeout(s), t();
654
+ });
655
+ return new n(function(e, t) {
656
+ l.then(e, t), c.then(e, t);
657
+ }).then(function() {
658
+ o.send({
659
+ id: e,
660
+ method: i,
661
+ error: null
662
+ });
663
+ }, function(t) {
664
+ o.send({
665
+ id: e,
666
+ method: i,
667
+ error: t ? u(t) : null
668
+ });
669
+ });
670
+ };
671
+ var f = null;
672
+ o.on("message", function(e) {
673
+ if (e === r) return o.terminateAndExit(0);
674
+ if (e.method === i) return o.cleanup(e.id);
675
+ try {
676
+ var n = o.methods[e.method];
677
+ if (n) {
678
+ f = e.id;
679
+ var a = n.apply(n, e.params);
680
+ d(a) ? a.then(function(n) {
681
+ n instanceof t ? o.send({
682
+ id: e.id,
683
+ result: n.message,
684
+ error: null
685
+ }, n.transfer) : o.send({
686
+ id: e.id,
687
+ result: n,
688
+ error: null
689
+ }), f = null;
690
+ }).catch(function(t) {
691
+ o.send({
692
+ id: e.id,
693
+ result: null,
694
+ error: u(t)
695
+ }), f = null;
696
+ }) : (a instanceof t ? o.send({
697
+ id: e.id,
698
+ result: a.message,
699
+ error: null
700
+ }, a.transfer) : o.send({
701
+ id: e.id,
702
+ result: a,
703
+ error: null
704
+ }), f = null);
705
+ } else throw Error("Unknown method \"" + e.method + "\"");
706
+ } catch (t) {
707
+ o.send({
708
+ id: e.id,
709
+ result: null,
710
+ error: u(t)
711
+ });
712
+ }
713
+ }), o.register = function(e, t) {
714
+ if (e) for (var n in e) e.hasOwnProperty(n) && (o.methods[n] = e[n], o.methods[n].worker = s);
715
+ t && (o.terminationHandler = t.onTerminate, o.abortListenerTimeout = t.abortListenerTimeout || a), o.send("ready");
716
+ }, o.emit = function(e) {
717
+ if (f) {
718
+ if (e instanceof t) {
719
+ o.send({
720
+ id: f,
721
+ isEvent: !0,
722
+ payload: e.message
723
+ }, e.transfer);
724
+ return;
725
+ }
726
+ o.send({
727
+ id: f,
728
+ isEvent: !0,
729
+ payload: e
730
+ });
731
+ }
732
+ }, e !== void 0 && (e.add = o.register, e.emit = o.emit);
733
+ })), ge = /* @__PURE__ */ ne((/* @__PURE__ */ T(((e) => {
734
+ var { platform: t, isMainThread: n, cpus: r } = oe(), { TerminateError: i } = ue();
735
+ function a(e, t) {
736
+ return new (pe())(e, t);
737
+ }
738
+ e.pool = a;
739
+ function o(e, t) {
740
+ he().add(e, t);
741
+ }
742
+ e.worker = o;
743
+ var { Promise: s } = se();
744
+ e.Transfer = me();
745
+ })))(), 1), _e = 5e3, ve = 3e4, ye = (e) => ge.pool(e, {
746
+ maxWorkers: 1,
747
+ minWorkers: 0,
748
+ workerTerminateTimeout: ve,
749
+ workerOpts: { type: void 0 }
750
+ }), be = class {
751
+ url;
752
+ maxWorkerHeapBytes;
753
+ slots;
754
+ idleSweepTimer;
755
+ terminated = !1;
756
+ constructor(e, t, n) {
757
+ ae(t > 0, "maxWorkers must be a positive number."), this.url = e, this.maxWorkerHeapBytes = n?.maxWorkerHeapBytes ?? 268435456, this.slots = Array.from({ length: t }, () => ({
758
+ pool: ye(e),
759
+ tasksSinceSpawn: 0,
760
+ inflight: 0,
761
+ draining: !1,
762
+ probing: !1,
763
+ lastHeapBytes: void 0
764
+ }));
765
+ }
766
+ exec(e, t, n) {
767
+ let r = this.pickSlot();
768
+ r.inflight++;
769
+ try {
770
+ return r.pool.exec(e, t, n).then((e) => (this.onSettled(r), e)).catch((e) => {
771
+ throw this.onSettled(r), e;
772
+ });
773
+ } catch (e) {
774
+ throw this.onSettled(r), e;
775
+ }
776
+ }
777
+ warmUp() {
778
+ let [e, ...t] = this.slots;
779
+ return this.warmSlot(e).then(() => {
780
+ for (let e of t) this.warmSlot(e).catch(() => void 0);
781
+ }, (e) => {
782
+ if (t.length === 0) throw e;
783
+ return Promise.any(t.map((e) => this.warmSlot(e))).then(() => void 0);
784
+ });
785
+ }
786
+ canAcceptTasks() {
787
+ return this.slots.some((e) => !e.draining);
788
+ }
789
+ stats() {
790
+ let e = {
791
+ totalWorkers: 0,
792
+ busyWorkers: 0,
793
+ idleWorkers: 0,
794
+ pendingTasks: 0,
795
+ activeTasks: 0,
796
+ tasksSinceSpawn: 0
797
+ };
798
+ for (let t of this.slots) {
799
+ let n = t.pool.stats();
800
+ e.totalWorkers += n.totalWorkers, e.busyWorkers += n.busyWorkers, e.idleWorkers += n.idleWorkers, e.pendingTasks += n.pendingTasks, e.activeTasks += n.activeTasks, e.tasksSinceSpawn += t.tasksSinceSpawn;
801
+ }
802
+ return e;
803
+ }
804
+ heapStats() {
805
+ let e = this.slots.map((e) => e.lastHeapBytes);
806
+ return {
807
+ perSlot: e,
808
+ totalBytes: e.reduce((e, t) => e + (t ?? 0), 0),
809
+ maxWorkerHeapBytes: this.maxWorkerHeapBytes
810
+ };
811
+ }
812
+ probeHeap() {
813
+ if (!this.terminated) for (let e of this.slots) e.draining || this.probeSlot(e);
814
+ }
815
+ terminate() {
816
+ this.idleSweepTimer !== void 0 && (clearTimeout(this.idleSweepTimer), this.idleSweepTimer = void 0), this.terminated = !0;
817
+ for (let e of this.slots) e.pool.terminate();
818
+ }
819
+ pickSlot() {
820
+ let e = this.slots.filter((e) => !e.draining);
821
+ return (e.length > 0 ? e : this.slots).reduce((e, t) => t.inflight < e.inflight ? t : e);
822
+ }
823
+ onSettled(e) {
824
+ e.inflight--, !this.terminated && (e.tasksSinceSpawn++, e.tasksSinceSpawn >= 128 && (e.draining = !0), e.draining && e.inflight === 0 ? this.recycleSlot(e) : e.draining || this.probeSlot(e), this.armIdleSweep());
825
+ }
826
+ recycleSlot(e) {
827
+ e.pool.terminate(), e.pool = ye(this.url), e.tasksSinceSpawn = 0, e.draining = !1, e.lastHeapBytes = void 0, this.warmSlot(e).catch(() => void 0);
828
+ }
829
+ warmSlot(e) {
830
+ e.inflight++;
831
+ let t = () => {
832
+ e.inflight--, !this.terminated && e.draining && e.inflight === 0 && this.recycleSlot(e);
833
+ };
834
+ return new Promise((n, r) => {
835
+ try {
836
+ e.pool.exec("warmUp").then(() => {
837
+ t(), n();
838
+ }).catch((e) => {
839
+ t(), r(e);
840
+ });
841
+ } catch (e) {
842
+ t(), r(e);
843
+ }
844
+ });
845
+ }
846
+ probeSlot(e) {
847
+ if (e.probing) return;
848
+ e.probing = !0, e.inflight++;
849
+ let t = (t) => {
850
+ e.probing = !1, e.inflight--, !this.terminated && (t && (e.draining = !0), e.draining && e.inflight === 0 && this.recycleSlot(e));
851
+ };
852
+ try {
853
+ e.pool.exec("getWasmMemoryUsage").then((n) => {
854
+ typeof n == "number" && (e.lastHeapBytes = n), t(typeof n == "number" && n >= this.maxWorkerHeapBytes);
855
+ }).catch(() => {
856
+ t(!0);
857
+ });
858
+ } catch {
859
+ t(!0);
860
+ }
861
+ }
862
+ armIdleSweep() {
863
+ this.idleSweepTimer !== void 0 && clearTimeout(this.idleSweepTimer), this.idleSweepTimer = setTimeout(() => {
864
+ this.idleSweepTimer = void 0;
865
+ for (let e of this.slots) e.tasksSinceSpawn > 0 && e.inflight === 0 && this.recycleSlot(e);
866
+ }, _e);
867
+ }
868
+ };
869
+ //#endregion
870
+ //#region ../navara_core/dist/index.js
871
+ function xe(e) {
872
+ return e != null;
873
+ }
874
+ var Se = class {
875
+ x;
876
+ y;
877
+ z;
878
+ constructor(e) {
879
+ this.x = e.x, this.y = e.y, this.z = e.z;
880
+ }
881
+ }, Ce = class {
882
+ vertices;
883
+ uvs;
884
+ indices;
885
+ heights;
886
+ max_height;
887
+ min_height;
888
+ rtc_translation;
889
+ normals;
890
+ skirt_vertices;
891
+ skirt_uvs;
892
+ skirt_indices;
893
+ skirt_normals;
894
+ watermask;
895
+ constructor(e) {
896
+ this.vertices = e.transferVertices(), this.uvs = e.transferUvs(), this.indices = e.transferIndices(), this.heights = e.transferHeights(), this.max_height = e.max_height, this.min_height = e.min_height, this.rtc_translation = e.rtc_translation ? new Se(e.rtc_translation) : void 0, e.hasNormals() && (this.normals = e.transferNormals()), e.hasSkirt() && (this.skirt_vertices = e.transferSkirtVertices(), this.skirt_uvs = e.transferSkirtUvs(), this.skirt_indices = e.transferSkirtIndices(), this.skirt_normals = e.transferSkirtNormals()), e.hasWatermask() && (this.watermask = e.transferWatermask());
897
+ }
898
+ transferVertices() {
899
+ throw Error();
900
+ }
901
+ transferUvs() {
902
+ throw Error();
903
+ }
904
+ transferIndices() {
905
+ throw Error();
906
+ }
907
+ transferHeights() {
908
+ throw Error();
909
+ }
910
+ transferNormals() {
911
+ throw Error();
912
+ }
913
+ transferSkirtVertices() {
914
+ throw Error();
915
+ }
916
+ transferSkirtUvs() {
917
+ throw Error();
918
+ }
919
+ transferSkirtIndices() {
920
+ throw Error();
921
+ }
922
+ transferSkirtNormals() {
923
+ throw Error();
924
+ }
925
+ transferWatermask() {
926
+ throw Error();
927
+ }
928
+ hasSkirt() {
929
+ return this.skirt_vertices !== void 0 && this.skirt_uvs !== void 0 && this.skirt_indices !== void 0;
930
+ }
931
+ hasNormals() {
932
+ return this.normals !== void 0;
933
+ }
934
+ hasWatermask() {
935
+ return this.watermask !== void 0;
936
+ }
937
+ }, we = class {
938
+ east;
939
+ north;
940
+ south;
941
+ west;
942
+ constructor(e) {
943
+ this.east = e.east, this.north = e.north, this.south = e.south, this.west = e.west;
944
+ }
945
+ }, Te = class {
946
+ extent;
947
+ position_3d_high;
948
+ position_3d_high_size;
949
+ position_3d_low;
950
+ position_3d_low_size;
951
+ position;
952
+ position_size;
953
+ normal;
954
+ normal_size;
955
+ scale_normal_and_cap;
956
+ scale_normal_and_cap_size;
957
+ batch_id;
958
+ batch_id_size;
959
+ batch_index;
960
+ batch_index_size;
961
+ indices;
962
+ rtc_translation;
963
+ outline_position;
964
+ outline_position_size;
965
+ outline_scale_normal_and_cap;
966
+ outline_scale_normal_and_cap_size;
967
+ outline_skip_indices;
968
+ outline_batch_index;
969
+ outline_batch_index_size;
970
+ constructor(e) {
971
+ let t = e.extent;
972
+ this.extent = t ? new we(t) : void 0, this.position_3d_high = e.position_3d_high()?.slice(), this.position_3d_high_size = e.position_3d_high_size(), this.position_3d_low = e.position_3d_low()?.slice(), this.position_3d_low_size = e.position_3d_low_size(), this.position = e.position()?.slice(), this.position_size = e.position_size(), this.normal = e.normal()?.slice(), this.normal_size = e.normal_size(), this.scale_normal_and_cap = e.scale_normal_and_cap()?.slice(), this.scale_normal_and_cap_size = e.scale_normal_and_cap_size(), this.batch_id = e.batch_id()?.slice(), this.batch_id_size = e.batch_id_size(), this.batch_index = e.batch_index()?.slice(), this.batch_index_size = e.batch_index_size(), this.indices = e.indices().slice(), this.rtc_translation = e.rtc_translation ? new Se(e.rtc_translation) : void 0;
973
+ let n = e.outline();
974
+ n && (this.outline_position = n.position()?.slice(), this.outline_position_size = n.position_size(), this.outline_scale_normal_and_cap = n.scale_normal_and_cap()?.slice(), this.outline_scale_normal_and_cap_size = n.scale_normal_and_cap_size(), this.outline_skip_indices = n.skip_indices()?.slice(), this.outline_batch_index = n.batch_index()?.slice(), this.outline_batch_index_size = n.batch_index_size(), n.free());
975
+ }
976
+ }, Ee = class {
977
+ extent;
978
+ position;
979
+ position_size;
980
+ position_high;
981
+ position_high_size;
982
+ position_low;
983
+ position_low_size;
984
+ start;
985
+ start_size;
986
+ start_high;
987
+ start_high_size;
988
+ start_low;
989
+ start_low_size;
990
+ forward_offset;
991
+ forward_offset_size;
992
+ end_high;
993
+ end_high_size;
994
+ end_low;
995
+ end_low_size;
996
+ start_normals;
997
+ start_normals_size;
998
+ end_normal_and_texture_coordinate_normalization_x;
999
+ end_normal_and_texture_coordinate_normalization_x_size;
1000
+ right_normal_and_texture_coordinate_normalization_y;
1001
+ right_normal_and_texture_coordinate_normalization_y_size;
1002
+ batch_id;
1003
+ batch_id_size;
1004
+ batch_index;
1005
+ batch_index_size;
1006
+ indices;
1007
+ constructor(e) {
1008
+ let t = e.extent;
1009
+ this.extent = t ? new we(t) : void 0, this.position = e.position().slice(), this.position_size = e.position_size(), this.position_high = e.position_high()?.slice(), this.position_high_size = e.position_high_size(), this.position_low = e.position_low()?.slice(), this.position_low_size = e.position_low_size(), this.start = e.start()?.slice(), this.start_size = e.start_size(), this.start_high = e.start_high()?.slice(), this.start_high_size = e.start_high_size(), this.start_low = e.start_low()?.slice(), this.start_low_size = e.start_low_size(), this.forward_offset = e.forward_offset()?.slice(), this.forward_offset_size = e.forward_offset_size(), this.end_high = e.end_high()?.slice(), this.end_high_size = e.end_high_size(), this.end_low = e.end_low()?.slice(), this.end_low_size = e.end_low_size(), this.start_normals = e.start_normals()?.slice(), this.start_normals_size = e.start_normals_size(), this.end_normal_and_texture_coordinate_normalization_x = e.end_normal_and_texture_coordinate_normalization_x()?.slice(), this.end_normal_and_texture_coordinate_normalization_x_size = e.end_normal_and_texture_coordinate_normalization_x_size(), this.right_normal_and_texture_coordinate_normalization_y = e.right_normal_and_texture_coordinate_normalization_y().slice(), this.right_normal_and_texture_coordinate_normalization_y_size = e.right_normal_and_texture_coordinate_normalization_y_size(), this.batch_id = e.batch_id()?.slice(), this.batch_id_size = e.batch_id_size(), this.batch_index = e.batch_index()?.slice(), this.batch_index_size = e.batch_index_size(), this.indices = e.indices().slice();
1010
+ }
1011
+ };
1012
+ function De(e, t) {
1013
+ return e == null || t == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
1014
+ }
1015
+ function Oe(e, t) {
1016
+ return e == null || t == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
1017
+ }
1018
+ function ke(e) {
1019
+ let t, n, r;
1020
+ e.length === 2 ? (t = e === De || e === Oe ? e : Ae, n = e, r = e) : (t = De, n = (t, n) => De(e(t), n), r = (t, n) => e(t) - n);
1021
+ function i(e, r, i = 0, a = e.length) {
1022
+ if (i < a) {
1023
+ if (t(r, r) !== 0) return a;
1024
+ do {
1025
+ let t = i + a >>> 1;
1026
+ n(e[t], r) < 0 ? i = t + 1 : a = t;
1027
+ } while (i < a);
1028
+ }
1029
+ return i;
1030
+ }
1031
+ function a(e, r, i = 0, a = e.length) {
1032
+ if (i < a) {
1033
+ if (t(r, r) !== 0) return a;
1034
+ do {
1035
+ let t = i + a >>> 1;
1036
+ n(e[t], r) <= 0 ? i = t + 1 : a = t;
1037
+ } while (i < a);
1038
+ }
1039
+ return i;
1040
+ }
1041
+ function o(e, t, n = 0, a = e.length) {
1042
+ let o = i(e, t, n, a - 1);
1043
+ return o > n && r(e[o - 1], t) > -r(e[o], t) ? o - 1 : o;
1044
+ }
1045
+ return {
1046
+ left: i,
1047
+ center: o,
1048
+ right: a
1049
+ };
1050
+ }
1051
+ function Ae() {
1052
+ return 0;
1053
+ }
1054
+ function je(e) {
1055
+ return e === null ? NaN : +e;
1056
+ }
1057
+ var Me = ke(De);
1058
+ Me.right, Me.left, ke(je).center;
1059
+ var Ne = { value: () => {} };
1060
+ function Pe() {
1061
+ for (var e = 0, t = arguments.length, n = {}, r; e < t; ++e) {
1062
+ if (!(r = arguments[e] + "") || r in n || /[\s.]/.test(r)) throw Error("illegal type: " + r);
1063
+ n[r] = [];
1064
+ }
1065
+ return new Fe(n);
1066
+ }
1067
+ function Fe(e) {
1068
+ this._ = e;
1069
+ }
1070
+ function Ie(e, t) {
1071
+ return e.trim().split(/^|\s+/).map(function(e) {
1072
+ var n = "", r = e.indexOf(".");
1073
+ if (r >= 0 && (n = e.slice(r + 1), e = e.slice(0, r)), e && !t.hasOwnProperty(e)) throw Error("unknown type: " + e);
1074
+ return {
1075
+ type: e,
1076
+ name: n
1077
+ };
1078
+ });
1079
+ }
1080
+ Fe.prototype = Pe.prototype = {
1081
+ constructor: Fe,
1082
+ on: function(e, t) {
1083
+ var n = this._, r = Ie(e + "", n), i, a = -1, o = r.length;
1084
+ if (arguments.length < 2) {
1085
+ for (; ++a < o;) if ((i = (e = r[a]).type) && (i = Le(n[i], e.name))) return i;
1086
+ return;
1087
+ }
1088
+ if (t != null && typeof t != "function") throw Error("invalid callback: " + t);
1089
+ for (; ++a < o;) if (i = (e = r[a]).type) n[i] = Re(n[i], e.name, t);
1090
+ else if (t == null) for (i in n) n[i] = Re(n[i], e.name, null);
1091
+ return this;
1092
+ },
1093
+ copy: function() {
1094
+ var e = {}, t = this._;
1095
+ for (var n in t) e[n] = t[n].slice();
1096
+ return new Fe(e);
1097
+ },
1098
+ call: function(e, t) {
1099
+ if ((i = arguments.length - 2) > 0) for (var n = Array(i), r = 0, i, a; r < i; ++r) n[r] = arguments[r + 2];
1100
+ if (!this._.hasOwnProperty(e)) throw Error("unknown type: " + e);
1101
+ for (a = this._[e], r = 0, i = a.length; r < i; ++r) a[r].value.apply(t, n);
1102
+ },
1103
+ apply: function(e, t, n) {
1104
+ if (!this._.hasOwnProperty(e)) throw Error("unknown type: " + e);
1105
+ for (var r = this._[e], i = 0, a = r.length; i < a; ++i) r[i].value.apply(t, n);
1106
+ }
1107
+ };
1108
+ function Le(e, t) {
1109
+ for (var n = 0, r = e.length, i; n < r; ++n) if ((i = e[n]).name === t) return i.value;
1110
+ }
1111
+ function Re(e, t, n) {
1112
+ for (var r = 0, i = e.length; r < i; ++r) if (e[r].name === t) {
1113
+ e[r] = Ne, e = e.slice(0, r).concat(e.slice(r + 1));
1114
+ break;
1115
+ }
1116
+ return n != null && e.push({
1117
+ name: t,
1118
+ value: n
1119
+ }), e;
1120
+ }
1121
+ var ze = {
1122
+ svg: "http://www.w3.org/2000/svg",
1123
+ xhtml: "http://www.w3.org/1999/xhtml",
1124
+ xlink: "http://www.w3.org/1999/xlink",
1125
+ xml: "http://www.w3.org/XML/1998/namespace",
1126
+ xmlns: "http://www.w3.org/2000/xmlns/"
1127
+ };
1128
+ function Be(e) {
1129
+ var t = e += "", n = t.indexOf(":");
1130
+ return n >= 0 && (t = e.slice(0, n)) !== "xmlns" && (e = e.slice(n + 1)), ze.hasOwnProperty(t) ? {
1131
+ space: ze[t],
1132
+ local: e
1133
+ } : e;
1134
+ }
1135
+ function Ve(e) {
1136
+ return function() {
1137
+ var t = this.ownerDocument, n = this.namespaceURI;
1138
+ return n === "http://www.w3.org/1999/xhtml" && t.documentElement.namespaceURI === "http://www.w3.org/1999/xhtml" ? t.createElement(e) : t.createElementNS(n, e);
1139
+ };
1140
+ }
1141
+ function He(e) {
1142
+ return function() {
1143
+ return this.ownerDocument.createElementNS(e.space, e.local);
1144
+ };
1145
+ }
1146
+ function Ue(e) {
1147
+ var t = Be(e);
1148
+ return (t.local ? He : Ve)(t);
1149
+ }
1150
+ function We() {}
1151
+ function Ge(e) {
1152
+ return e == null ? We : function() {
1153
+ return this.querySelector(e);
1154
+ };
1155
+ }
1156
+ function Ke(e) {
1157
+ typeof e != "function" && (e = Ge(e));
1158
+ for (var t = this._groups, n = t.length, r = Array(n), i = 0; i < n; ++i) for (var a = t[i], o = a.length, s = r[i] = Array(o), c, l, u = 0; u < o; ++u) (c = a[u]) && (l = e.call(c, c.__data__, u, a)) && ("__data__" in c && (l.__data__ = c.__data__), s[u] = l);
1159
+ return new O(r, this._parents);
1160
+ }
1161
+ function qe(e) {
1162
+ return e == null ? [] : Array.isArray(e) ? e : Array.from(e);
1163
+ }
1164
+ function Je() {
1165
+ return [];
1166
+ }
1167
+ function Ye(e) {
1168
+ return e == null ? Je : function() {
1169
+ return this.querySelectorAll(e);
1170
+ };
1171
+ }
1172
+ function Xe(e) {
1173
+ return function() {
1174
+ return qe(e.apply(this, arguments));
1175
+ };
1176
+ }
1177
+ function Ze(e) {
1178
+ e = typeof e == "function" ? Xe(e) : Ye(e);
1179
+ for (var t = this._groups, n = t.length, r = [], i = [], a = 0; a < n; ++a) for (var o = t[a], s = o.length, c, l = 0; l < s; ++l) (c = o[l]) && (r.push(e.call(c, c.__data__, l, o)), i.push(c));
1180
+ return new O(r, i);
1181
+ }
1182
+ function Qe(e) {
1183
+ return function() {
1184
+ return this.matches(e);
1185
+ };
1186
+ }
1187
+ function $e(e) {
1188
+ return function(t) {
1189
+ return t.matches(e);
1190
+ };
1191
+ }
1192
+ var et = Array.prototype.find;
1193
+ function tt(e) {
1194
+ return function() {
1195
+ return et.call(this.children, e);
1196
+ };
1197
+ }
1198
+ function nt() {
1199
+ return this.firstElementChild;
1200
+ }
1201
+ function rt(e) {
1202
+ return this.select(e == null ? nt : tt(typeof e == "function" ? e : $e(e)));
1203
+ }
1204
+ var it = Array.prototype.filter;
1205
+ function at() {
1206
+ return Array.from(this.children);
1207
+ }
1208
+ function ot(e) {
1209
+ return function() {
1210
+ return it.call(this.children, e);
1211
+ };
1212
+ }
1213
+ function st(e) {
1214
+ return this.selectAll(e == null ? at : ot(typeof e == "function" ? e : $e(e)));
1215
+ }
1216
+ function ct(e) {
1217
+ typeof e != "function" && (e = Qe(e));
1218
+ for (var t = this._groups, n = t.length, r = Array(n), i = 0; i < n; ++i) for (var a = t[i], o = a.length, s = r[i] = [], c, l = 0; l < o; ++l) (c = a[l]) && e.call(c, c.__data__, l, a) && s.push(c);
1219
+ return new O(r, this._parents);
1220
+ }
1221
+ function lt(e) {
1222
+ return Array(e.length);
1223
+ }
1224
+ function ut() {
1225
+ return new O(this._enter || this._groups.map(lt), this._parents);
1226
+ }
1227
+ function dt(e, t) {
1228
+ this.ownerDocument = e.ownerDocument, this.namespaceURI = e.namespaceURI, this._next = null, this._parent = e, this.__data__ = t;
1229
+ }
1230
+ dt.prototype = {
1231
+ constructor: dt,
1232
+ appendChild: function(e) {
1233
+ return this._parent.insertBefore(e, this._next);
1234
+ },
1235
+ insertBefore: function(e, t) {
1236
+ return this._parent.insertBefore(e, t);
1237
+ },
1238
+ querySelector: function(e) {
1239
+ return this._parent.querySelector(e);
1240
+ },
1241
+ querySelectorAll: function(e) {
1242
+ return this._parent.querySelectorAll(e);
1243
+ }
1244
+ };
1245
+ function ft(e) {
1246
+ return function() {
1247
+ return e;
1248
+ };
1249
+ }
1250
+ function pt(e, t, n, r, i, a) {
1251
+ for (var o = 0, s, c = t.length, l = a.length; o < l; ++o) (s = t[o]) ? (s.__data__ = a[o], r[o] = s) : n[o] = new dt(e, a[o]);
1252
+ for (; o < c; ++o) (s = t[o]) && (i[o] = s);
1253
+ }
1254
+ function mt(e, t, n, r, i, a, o) {
1255
+ var s, c, l = /* @__PURE__ */ new Map(), u = t.length, d = a.length, f = Array(u), p;
1256
+ for (s = 0; s < u; ++s) (c = t[s]) && (f[s] = p = o.call(c, c.__data__, s, t) + "", l.has(p) ? i[s] = c : l.set(p, c));
1257
+ for (s = 0; s < d; ++s) p = o.call(e, a[s], s, a) + "", (c = l.get(p)) ? (r[s] = c, c.__data__ = a[s], l.delete(p)) : n[s] = new dt(e, a[s]);
1258
+ for (s = 0; s < u; ++s) (c = t[s]) && l.get(f[s]) === c && (i[s] = c);
1259
+ }
1260
+ function ht(e) {
1261
+ return e.__data__;
1262
+ }
1263
+ function gt(e, t) {
1264
+ if (!arguments.length) return Array.from(this, ht);
1265
+ var n = t ? mt : pt, r = this._parents, i = this._groups;
1266
+ typeof e != "function" && (e = ft(e));
1267
+ for (var a = i.length, o = Array(a), s = Array(a), c = Array(a), l = 0; l < a; ++l) {
1268
+ var u = r[l], d = i[l], f = d.length, p = _t(e.call(u, u && u.__data__, l, r)), m = p.length, h = s[l] = Array(m), g = o[l] = Array(m);
1269
+ n(u, d, h, g, c[l] = Array(f), p, t);
1270
+ for (var _ = 0, v = 0, y, b; _ < m; ++_) if (y = h[_]) {
1271
+ for (_ >= v && (v = _ + 1); !(b = g[v]) && ++v < m;);
1272
+ y._next = b || null;
1273
+ }
1274
+ }
1275
+ return o = new O(o, r), o._enter = s, o._exit = c, o;
1276
+ }
1277
+ function _t(e) {
1278
+ return typeof e == "object" && "length" in e ? e : Array.from(e);
1279
+ }
1280
+ function vt() {
1281
+ return new O(this._exit || this._groups.map(lt), this._parents);
1282
+ }
1283
+ function yt(e, t, n) {
1284
+ var r = this.enter(), i = this, a = this.exit();
1285
+ return typeof e == "function" ? (r = e(r), r &&= r.selection()) : r = r.append(e + ""), t != null && (i = t(i), i &&= i.selection()), n == null ? a.remove() : n(a), r && i ? r.merge(i).order() : i;
1286
+ }
1287
+ function bt(e) {
1288
+ for (var t = e.selection ? e.selection() : e, n = this._groups, r = t._groups, i = n.length, a = r.length, o = Math.min(i, a), s = Array(i), c = 0; c < o; ++c) for (var l = n[c], u = r[c], d = l.length, f = s[c] = Array(d), p, m = 0; m < d; ++m) (p = l[m] || u[m]) && (f[m] = p);
1289
+ for (; c < i; ++c) s[c] = n[c];
1290
+ return new O(s, this._parents);
1291
+ }
1292
+ function xt() {
1293
+ for (var e = this._groups, t = -1, n = e.length; ++t < n;) for (var r = e[t], i = r.length - 1, a = r[i], o; --i >= 0;) (o = r[i]) && (a && o.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(o, a), a = o);
1294
+ return this;
1295
+ }
1296
+ function St(e) {
1297
+ e ||= Ct;
1298
+ function t(t, n) {
1299
+ return t && n ? e(t.__data__, n.__data__) : !t - !n;
1300
+ }
1301
+ for (var n = this._groups, r = n.length, i = Array(r), a = 0; a < r; ++a) {
1302
+ for (var o = n[a], s = o.length, c = i[a] = Array(s), l, u = 0; u < s; ++u) (l = o[u]) && (c[u] = l);
1303
+ c.sort(t);
1304
+ }
1305
+ return new O(i, this._parents).order();
1306
+ }
1307
+ function Ct(e, t) {
1308
+ return e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
1309
+ }
1310
+ function wt() {
1311
+ var e = arguments[0];
1312
+ return arguments[0] = this, e.apply(null, arguments), this;
1313
+ }
1314
+ function Tt() {
1315
+ return Array.from(this);
1316
+ }
1317
+ function Et() {
1318
+ for (var e = this._groups, t = 0, n = e.length; t < n; ++t) for (var r = e[t], i = 0, a = r.length; i < a; ++i) {
1319
+ var o = r[i];
1320
+ if (o) return o;
1321
+ }
1322
+ return null;
1323
+ }
1324
+ function Dt() {
1325
+ let e = 0;
1326
+ for (let t of this) ++e;
1327
+ return e;
1328
+ }
1329
+ function Ot() {
1330
+ return !this.node();
1331
+ }
1332
+ function kt(e) {
1333
+ for (var t = this._groups, n = 0, r = t.length; n < r; ++n) for (var i = t[n], a = 0, o = i.length, s; a < o; ++a) (s = i[a]) && e.call(s, s.__data__, a, i);
1334
+ return this;
1335
+ }
1336
+ function At(e) {
1337
+ return function() {
1338
+ this.removeAttribute(e);
1339
+ };
1340
+ }
1341
+ function jt(e) {
1342
+ return function() {
1343
+ this.removeAttributeNS(e.space, e.local);
1344
+ };
1345
+ }
1346
+ function Mt(e, t) {
1347
+ return function() {
1348
+ this.setAttribute(e, t);
1349
+ };
1350
+ }
1351
+ function Nt(e, t) {
1352
+ return function() {
1353
+ this.setAttributeNS(e.space, e.local, t);
1354
+ };
1355
+ }
1356
+ function Pt(e, t) {
1357
+ return function() {
1358
+ var n = t.apply(this, arguments);
1359
+ n == null ? this.removeAttribute(e) : this.setAttribute(e, n);
1360
+ };
1361
+ }
1362
+ function Ft(e, t) {
1363
+ return function() {
1364
+ var n = t.apply(this, arguments);
1365
+ n == null ? this.removeAttributeNS(e.space, e.local) : this.setAttributeNS(e.space, e.local, n);
1366
+ };
1367
+ }
1368
+ function It(e, t) {
1369
+ var n = Be(e);
1370
+ if (arguments.length < 2) {
1371
+ var r = this.node();
1372
+ return n.local ? r.getAttributeNS(n.space, n.local) : r.getAttribute(n);
1373
+ }
1374
+ return this.each((t == null ? n.local ? jt : At : typeof t == "function" ? n.local ? Ft : Pt : n.local ? Nt : Mt)(n, t));
1375
+ }
1376
+ function Lt(e) {
1377
+ return e.ownerDocument && e.ownerDocument.defaultView || e.document && e || e.defaultView;
1378
+ }
1379
+ function Rt(e) {
1380
+ return function() {
1381
+ this.style.removeProperty(e);
1382
+ };
1383
+ }
1384
+ function zt(e, t, n) {
1385
+ return function() {
1386
+ this.style.setProperty(e, t, n);
1387
+ };
1388
+ }
1389
+ function Bt(e, t, n) {
1390
+ return function() {
1391
+ var r = t.apply(this, arguments);
1392
+ r == null ? this.style.removeProperty(e) : this.style.setProperty(e, r, n);
1393
+ };
1394
+ }
1395
+ function Vt(e, t, n) {
1396
+ return arguments.length > 1 ? this.each((t == null ? Rt : typeof t == "function" ? Bt : zt)(e, t, n ?? "")) : D(this.node(), e);
1397
+ }
1398
+ function D(e, t) {
1399
+ return e.style.getPropertyValue(t) || Lt(e).getComputedStyle(e, null).getPropertyValue(t);
1400
+ }
1401
+ function Ht(e) {
1402
+ return function() {
1403
+ delete this[e];
1404
+ };
1405
+ }
1406
+ function Ut(e, t) {
1407
+ return function() {
1408
+ this[e] = t;
1409
+ };
1410
+ }
1411
+ function Wt(e, t) {
1412
+ return function() {
1413
+ var n = t.apply(this, arguments);
1414
+ n == null ? delete this[e] : this[e] = n;
1415
+ };
1416
+ }
1417
+ function Gt(e, t) {
1418
+ return arguments.length > 1 ? this.each((t == null ? Ht : typeof t == "function" ? Wt : Ut)(e, t)) : this.node()[e];
1419
+ }
1420
+ function Kt(e) {
1421
+ return e.trim().split(/^|\s+/);
1422
+ }
1423
+ function qt(e) {
1424
+ return e.classList || new Jt(e);
1425
+ }
1426
+ function Jt(e) {
1427
+ this._node = e, this._names = Kt(e.getAttribute("class") || "");
1428
+ }
1429
+ Jt.prototype = {
1430
+ add: function(e) {
1431
+ this._names.indexOf(e) < 0 && (this._names.push(e), this._node.setAttribute("class", this._names.join(" ")));
1432
+ },
1433
+ remove: function(e) {
1434
+ var t = this._names.indexOf(e);
1435
+ t >= 0 && (this._names.splice(t, 1), this._node.setAttribute("class", this._names.join(" ")));
1436
+ },
1437
+ contains: function(e) {
1438
+ return this._names.indexOf(e) >= 0;
1439
+ }
1440
+ };
1441
+ function Yt(e, t) {
1442
+ for (var n = qt(e), r = -1, i = t.length; ++r < i;) n.add(t[r]);
1443
+ }
1444
+ function Xt(e, t) {
1445
+ for (var n = qt(e), r = -1, i = t.length; ++r < i;) n.remove(t[r]);
1446
+ }
1447
+ function Zt(e) {
1448
+ return function() {
1449
+ Yt(this, e);
1450
+ };
1451
+ }
1452
+ function Qt(e) {
1453
+ return function() {
1454
+ Xt(this, e);
1455
+ };
1456
+ }
1457
+ function $t(e, t) {
1458
+ return function() {
1459
+ (t.apply(this, arguments) ? Yt : Xt)(this, e);
1460
+ };
1461
+ }
1462
+ function en(e, t) {
1463
+ var n = Kt(e + "");
1464
+ if (arguments.length < 2) {
1465
+ for (var r = qt(this.node()), i = -1, a = n.length; ++i < a;) if (!r.contains(n[i])) return !1;
1466
+ return !0;
1467
+ }
1468
+ return this.each((typeof t == "function" ? $t : t ? Zt : Qt)(n, t));
1469
+ }
1470
+ function tn() {
1471
+ this.textContent = "";
1472
+ }
1473
+ function nn(e) {
1474
+ return function() {
1475
+ this.textContent = e;
1476
+ };
1477
+ }
1478
+ function rn(e) {
1479
+ return function() {
1480
+ this.textContent = e.apply(this, arguments) ?? "";
1481
+ };
1482
+ }
1483
+ function an(e) {
1484
+ return arguments.length ? this.each(e == null ? tn : (typeof e == "function" ? rn : nn)(e)) : this.node().textContent;
1485
+ }
1486
+ function on() {
1487
+ this.innerHTML = "";
1488
+ }
1489
+ function sn(e) {
1490
+ return function() {
1491
+ this.innerHTML = e;
1492
+ };
1493
+ }
1494
+ function cn(e) {
1495
+ return function() {
1496
+ this.innerHTML = e.apply(this, arguments) ?? "";
1497
+ };
1498
+ }
1499
+ function ln(e) {
1500
+ return arguments.length ? this.each(e == null ? on : (typeof e == "function" ? cn : sn)(e)) : this.node().innerHTML;
1501
+ }
1502
+ function un() {
1503
+ this.nextSibling && this.parentNode.appendChild(this);
1504
+ }
1505
+ function dn() {
1506
+ return this.each(un);
1507
+ }
1508
+ function fn() {
1509
+ this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
1510
+ }
1511
+ function pn() {
1512
+ return this.each(fn);
1513
+ }
1514
+ function mn(e) {
1515
+ var t = typeof e == "function" ? e : Ue(e);
1516
+ return this.select(function() {
1517
+ return this.appendChild(t.apply(this, arguments));
1518
+ });
1519
+ }
1520
+ function hn() {
1521
+ return null;
1522
+ }
1523
+ function gn(e, t) {
1524
+ var n = typeof e == "function" ? e : Ue(e), r = t == null ? hn : typeof t == "function" ? t : Ge(t);
1525
+ return this.select(function() {
1526
+ return this.insertBefore(n.apply(this, arguments), r.apply(this, arguments) || null);
1527
+ });
1528
+ }
1529
+ function _n() {
1530
+ var e = this.parentNode;
1531
+ e && e.removeChild(this);
1532
+ }
1533
+ function vn() {
1534
+ return this.each(_n);
1535
+ }
1536
+ function yn() {
1537
+ var e = this.cloneNode(!1), t = this.parentNode;
1538
+ return t ? t.insertBefore(e, this.nextSibling) : e;
1539
+ }
1540
+ function bn() {
1541
+ var e = this.cloneNode(!0), t = this.parentNode;
1542
+ return t ? t.insertBefore(e, this.nextSibling) : e;
1543
+ }
1544
+ function xn(e) {
1545
+ return this.select(e ? bn : yn);
1546
+ }
1547
+ function Sn(e) {
1548
+ return arguments.length ? this.property("__data__", e) : this.node().__data__;
1549
+ }
1550
+ function Cn(e) {
1551
+ return function(t) {
1552
+ e.call(this, t, this.__data__);
1553
+ };
1554
+ }
1555
+ function wn(e) {
1556
+ return e.trim().split(/^|\s+/).map(function(e) {
1557
+ var t = "", n = e.indexOf(".");
1558
+ return n >= 0 && (t = e.slice(n + 1), e = e.slice(0, n)), {
1559
+ type: e,
1560
+ name: t
1561
+ };
1562
+ });
1563
+ }
1564
+ function Tn(e) {
1565
+ return function() {
1566
+ var t = this.__on;
1567
+ if (t) {
1568
+ for (var n = 0, r = -1, i = t.length, a; n < i; ++n) a = t[n], (!e.type || a.type === e.type) && a.name === e.name ? this.removeEventListener(a.type, a.listener, a.options) : t[++r] = a;
1569
+ ++r ? t.length = r : delete this.__on;
1570
+ }
1571
+ };
1572
+ }
1573
+ function En(e, t, n) {
1574
+ return function() {
1575
+ var r = this.__on, i, a = Cn(t);
1576
+ if (r) {
1577
+ for (var o = 0, s = r.length; o < s; ++o) if ((i = r[o]).type === e.type && i.name === e.name) {
1578
+ this.removeEventListener(i.type, i.listener, i.options), this.addEventListener(i.type, i.listener = a, i.options = n), i.value = t;
1579
+ return;
1580
+ }
1581
+ }
1582
+ this.addEventListener(e.type, a, n), i = {
1583
+ type: e.type,
1584
+ name: e.name,
1585
+ value: t,
1586
+ listener: a,
1587
+ options: n
1588
+ }, r ? r.push(i) : this.__on = [i];
1589
+ };
1590
+ }
1591
+ function Dn(e, t, n) {
1592
+ var r = wn(e + ""), i, a = r.length, o;
1593
+ if (arguments.length < 2) {
1594
+ var s = this.node().__on;
1595
+ if (s) {
1596
+ for (var c = 0, l = s.length, u; c < l; ++c) for (i = 0, u = s[c]; i < a; ++i) if ((o = r[i]).type === u.type && o.name === u.name) return u.value;
1597
+ }
1598
+ return;
1599
+ }
1600
+ for (s = t ? En : Tn, i = 0; i < a; ++i) this.each(s(r[i], t, n));
1601
+ return this;
1602
+ }
1603
+ function On(e, t, n) {
1604
+ var r = Lt(e), i = r.CustomEvent;
1605
+ typeof i == "function" ? i = new i(t, n) : (i = r.document.createEvent("Event"), n ? (i.initEvent(t, n.bubbles, n.cancelable), i.detail = n.detail) : i.initEvent(t, !1, !1)), e.dispatchEvent(i);
1606
+ }
1607
+ function kn(e, t) {
1608
+ return function() {
1609
+ return On(this, e, t);
1610
+ };
1611
+ }
1612
+ function An(e, t) {
1613
+ return function() {
1614
+ return On(this, e, t.apply(this, arguments));
1615
+ };
1616
+ }
1617
+ function jn(e, t) {
1618
+ return this.each((typeof t == "function" ? An : kn)(e, t));
1619
+ }
1620
+ function* Mn() {
1621
+ for (var e = this._groups, t = 0, n = e.length; t < n; ++t) for (var r = e[t], i = 0, a = r.length, o; i < a; ++i) (o = r[i]) && (yield o);
1622
+ }
1623
+ var Nn = [null];
1624
+ function O(e, t) {
1625
+ this._groups = e, this._parents = t;
1626
+ }
1627
+ function k() {
1628
+ return new O([[document.documentElement]], Nn);
1629
+ }
1630
+ function Pn() {
1631
+ return this;
1632
+ }
1633
+ O.prototype = k.prototype = {
1634
+ constructor: O,
1635
+ select: Ke,
1636
+ selectAll: Ze,
1637
+ selectChild: rt,
1638
+ selectChildren: st,
1639
+ filter: ct,
1640
+ data: gt,
1641
+ enter: ut,
1642
+ exit: vt,
1643
+ join: yt,
1644
+ merge: bt,
1645
+ selection: Pn,
1646
+ order: xt,
1647
+ sort: St,
1648
+ call: wt,
1649
+ nodes: Tt,
1650
+ node: Et,
1651
+ size: Dt,
1652
+ empty: Ot,
1653
+ each: kt,
1654
+ attr: It,
1655
+ style: Vt,
1656
+ property: Gt,
1657
+ classed: en,
1658
+ text: an,
1659
+ html: ln,
1660
+ raise: dn,
1661
+ lower: pn,
1662
+ append: mn,
1663
+ insert: gn,
1664
+ remove: vn,
1665
+ clone: xn,
1666
+ datum: Sn,
1667
+ on: Dn,
1668
+ dispatch: jn,
1669
+ [Symbol.iterator]: Mn
1670
+ };
1671
+ function Fn(e, t, n) {
1672
+ e.prototype = t.prototype = n, n.constructor = e;
1673
+ }
1674
+ function In(e, t) {
1675
+ var n = Object.create(e.prototype);
1676
+ for (var r in t) n[r] = t[r];
1677
+ return n;
1678
+ }
1679
+ function A() {}
1680
+ var j = .7, Ln = 1 / j, M = "\\s*([+-]?\\d+)\\s*", N = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", P = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Rn = /^#([0-9a-f]{3,8})$/, zn = RegExp(`^rgb\\(${M},${M},${M}\\)$`), Bn = RegExp(`^rgb\\(${P},${P},${P}\\)$`), Vn = RegExp(`^rgba\\(${M},${M},${M},${N}\\)$`), Hn = RegExp(`^rgba\\(${P},${P},${P},${N}\\)$`), Un = RegExp(`^hsl\\(${N},${P},${P}\\)$`), Wn = RegExp(`^hsla\\(${N},${P},${P},${N}\\)$`), Gn = {
1681
+ aliceblue: 15792383,
1682
+ antiquewhite: 16444375,
1683
+ aqua: 65535,
1684
+ aquamarine: 8388564,
1685
+ azure: 15794175,
1686
+ beige: 16119260,
1687
+ bisque: 16770244,
1688
+ black: 0,
1689
+ blanchedalmond: 16772045,
1690
+ blue: 255,
1691
+ blueviolet: 9055202,
1692
+ brown: 10824234,
1693
+ burlywood: 14596231,
1694
+ cadetblue: 6266528,
1695
+ chartreuse: 8388352,
1696
+ chocolate: 13789470,
1697
+ coral: 16744272,
1698
+ cornflowerblue: 6591981,
1699
+ cornsilk: 16775388,
1700
+ crimson: 14423100,
1701
+ cyan: 65535,
1702
+ darkblue: 139,
1703
+ darkcyan: 35723,
1704
+ darkgoldenrod: 12092939,
1705
+ darkgray: 11119017,
1706
+ darkgreen: 25600,
1707
+ darkgrey: 11119017,
1708
+ darkkhaki: 12433259,
1709
+ darkmagenta: 9109643,
1710
+ darkolivegreen: 5597999,
1711
+ darkorange: 16747520,
1712
+ darkorchid: 10040012,
1713
+ darkred: 9109504,
1714
+ darksalmon: 15308410,
1715
+ darkseagreen: 9419919,
1716
+ darkslateblue: 4734347,
1717
+ darkslategray: 3100495,
1718
+ darkslategrey: 3100495,
1719
+ darkturquoise: 52945,
1720
+ darkviolet: 9699539,
1721
+ deeppink: 16716947,
1722
+ deepskyblue: 49151,
1723
+ dimgray: 6908265,
1724
+ dimgrey: 6908265,
1725
+ dodgerblue: 2003199,
1726
+ firebrick: 11674146,
1727
+ floralwhite: 16775920,
1728
+ forestgreen: 2263842,
1729
+ fuchsia: 16711935,
1730
+ gainsboro: 14474460,
1731
+ ghostwhite: 16316671,
1732
+ gold: 16766720,
1733
+ goldenrod: 14329120,
1734
+ gray: 8421504,
1735
+ green: 32768,
1736
+ greenyellow: 11403055,
1737
+ grey: 8421504,
1738
+ honeydew: 15794160,
1739
+ hotpink: 16738740,
1740
+ indianred: 13458524,
1741
+ indigo: 4915330,
1742
+ ivory: 16777200,
1743
+ khaki: 15787660,
1744
+ lavender: 15132410,
1745
+ lavenderblush: 16773365,
1746
+ lawngreen: 8190976,
1747
+ lemonchiffon: 16775885,
1748
+ lightblue: 11393254,
1749
+ lightcoral: 15761536,
1750
+ lightcyan: 14745599,
1751
+ lightgoldenrodyellow: 16448210,
1752
+ lightgray: 13882323,
1753
+ lightgreen: 9498256,
1754
+ lightgrey: 13882323,
1755
+ lightpink: 16758465,
1756
+ lightsalmon: 16752762,
1757
+ lightseagreen: 2142890,
1758
+ lightskyblue: 8900346,
1759
+ lightslategray: 7833753,
1760
+ lightslategrey: 7833753,
1761
+ lightsteelblue: 11584734,
1762
+ lightyellow: 16777184,
1763
+ lime: 65280,
1764
+ limegreen: 3329330,
1765
+ linen: 16445670,
1766
+ magenta: 16711935,
1767
+ maroon: 8388608,
1768
+ mediumaquamarine: 6737322,
1769
+ mediumblue: 205,
1770
+ mediumorchid: 12211667,
1771
+ mediumpurple: 9662683,
1772
+ mediumseagreen: 3978097,
1773
+ mediumslateblue: 8087790,
1774
+ mediumspringgreen: 64154,
1775
+ mediumturquoise: 4772300,
1776
+ mediumvioletred: 13047173,
1777
+ midnightblue: 1644912,
1778
+ mintcream: 16121850,
1779
+ mistyrose: 16770273,
1780
+ moccasin: 16770229,
1781
+ navajowhite: 16768685,
1782
+ navy: 128,
1783
+ oldlace: 16643558,
1784
+ olive: 8421376,
1785
+ olivedrab: 7048739,
1786
+ orange: 16753920,
1787
+ orangered: 16729344,
1788
+ orchid: 14315734,
1789
+ palegoldenrod: 15657130,
1790
+ palegreen: 10025880,
1791
+ paleturquoise: 11529966,
1792
+ palevioletred: 14381203,
1793
+ papayawhip: 16773077,
1794
+ peachpuff: 16767673,
1795
+ peru: 13468991,
1796
+ pink: 16761035,
1797
+ plum: 14524637,
1798
+ powderblue: 11591910,
1799
+ purple: 8388736,
1800
+ rebeccapurple: 6697881,
1801
+ red: 16711680,
1802
+ rosybrown: 12357519,
1803
+ royalblue: 4286945,
1804
+ saddlebrown: 9127187,
1805
+ salmon: 16416882,
1806
+ sandybrown: 16032864,
1807
+ seagreen: 3050327,
1808
+ seashell: 16774638,
1809
+ sienna: 10506797,
1810
+ silver: 12632256,
1811
+ skyblue: 8900331,
1812
+ slateblue: 6970061,
1813
+ slategray: 7372944,
1814
+ slategrey: 7372944,
1815
+ snow: 16775930,
1816
+ springgreen: 65407,
1817
+ steelblue: 4620980,
1818
+ tan: 13808780,
1819
+ teal: 32896,
1820
+ thistle: 14204888,
1821
+ tomato: 16737095,
1822
+ turquoise: 4251856,
1823
+ violet: 15631086,
1824
+ wheat: 16113331,
1825
+ white: 16777215,
1826
+ whitesmoke: 16119285,
1827
+ yellow: 16776960,
1828
+ yellowgreen: 10145074
1829
+ };
1830
+ Fn(A, F, {
1831
+ copy(e) {
1832
+ return Object.assign(new this.constructor(), this, e);
1833
+ },
1834
+ displayable() {
1835
+ return this.rgb().displayable();
1836
+ },
1837
+ hex: Kn,
1838
+ formatHex: Kn,
1839
+ formatHex8: qn,
1840
+ formatHsl: Jn,
1841
+ formatRgb: Yn,
1842
+ toString: Yn
1843
+ });
1844
+ function Kn() {
1845
+ return this.rgb().formatHex();
1846
+ }
1847
+ function qn() {
1848
+ return this.rgb().formatHex8();
1849
+ }
1850
+ function Jn() {
1851
+ return ir(this).formatHsl();
1852
+ }
1853
+ function Yn() {
1854
+ return this.rgb().formatRgb();
1855
+ }
1856
+ function F(e) {
1857
+ var t, n;
1858
+ return e = (e + "").trim().toLowerCase(), (t = Rn.exec(e)) ? (n = t[1].length, t = parseInt(t[1], 16), n === 6 ? Xn(t) : n === 3 ? new I(t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, (t & 15) << 4 | t & 15, 1) : n === 8 ? Zn(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, (t & 255) / 255) : n === 4 ? Zn(t >> 12 & 15 | t >> 8 & 240, t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, ((t & 15) << 4 | t & 15) / 255) : null) : (t = zn.exec(e)) ? new I(t[1], t[2], t[3], 1) : (t = Bn.exec(e)) ? new I(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, 1) : (t = Vn.exec(e)) ? Zn(t[1], t[2], t[3], t[4]) : (t = Hn.exec(e)) ? Zn(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, t[4]) : (t = Un.exec(e)) ? rr(t[1], t[2] / 100, t[3] / 100, 1) : (t = Wn.exec(e)) ? rr(t[1], t[2] / 100, t[3] / 100, t[4]) : Gn.hasOwnProperty(e) ? Xn(Gn[e]) : e === "transparent" ? new I(NaN, NaN, NaN, 0) : null;
1859
+ }
1860
+ function Xn(e) {
1861
+ return new I(e >> 16 & 255, e >> 8 & 255, e & 255, 1);
1862
+ }
1863
+ function Zn(e, t, n, r) {
1864
+ return r <= 0 && (e = t = n = NaN), new I(e, t, n, r);
1865
+ }
1866
+ function Qn(e) {
1867
+ return e instanceof A || (e = F(e)), e ? (e = e.rgb(), new I(e.r, e.g, e.b, e.opacity)) : new I();
1868
+ }
1869
+ function $n(e, t, n, r) {
1870
+ return arguments.length === 1 ? Qn(e) : new I(e, t, n, r ?? 1);
1871
+ }
1872
+ function I(e, t, n, r) {
1873
+ this.r = +e, this.g = +t, this.b = +n, this.opacity = +r;
1874
+ }
1875
+ Fn(I, $n, In(A, {
1876
+ brighter(e) {
1877
+ return e = e == null ? Ln : Ln ** +e, new I(this.r * e, this.g * e, this.b * e, this.opacity);
1878
+ },
1879
+ darker(e) {
1880
+ return e = e == null ? j : j ** +e, new I(this.r * e, this.g * e, this.b * e, this.opacity);
1881
+ },
1882
+ rgb() {
1883
+ return this;
1884
+ },
1885
+ clamp() {
1886
+ return new I(R(this.r), R(this.g), R(this.b), L(this.opacity));
1887
+ },
1888
+ displayable() {
1889
+ return -.5 <= this.r && this.r < 255.5 && -.5 <= this.g && this.g < 255.5 && -.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
1890
+ },
1891
+ hex: er,
1892
+ formatHex: er,
1893
+ formatHex8: tr,
1894
+ formatRgb: nr,
1895
+ toString: nr
1896
+ }));
1897
+ function er() {
1898
+ return `#${z(this.r)}${z(this.g)}${z(this.b)}`;
1899
+ }
1900
+ function tr() {
1901
+ return `#${z(this.r)}${z(this.g)}${z(this.b)}${z((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
1902
+ }
1903
+ function nr() {
1904
+ let e = L(this.opacity);
1905
+ return `${e === 1 ? "rgb(" : "rgba("}${R(this.r)}, ${R(this.g)}, ${R(this.b)}${e === 1 ? ")" : `, ${e})`}`;
1906
+ }
1907
+ function L(e) {
1908
+ return isNaN(e) ? 1 : Math.max(0, Math.min(1, e));
1909
+ }
1910
+ function R(e) {
1911
+ return Math.max(0, Math.min(255, Math.round(e) || 0));
1912
+ }
1913
+ function z(e) {
1914
+ return e = R(e), (e < 16 ? "0" : "") + e.toString(16);
1915
+ }
1916
+ function rr(e, t, n, r) {
1917
+ return r <= 0 ? e = t = n = NaN : n <= 0 || n >= 1 ? e = t = NaN : t <= 0 && (e = NaN), new B(e, t, n, r);
1918
+ }
1919
+ function ir(e) {
1920
+ if (e instanceof B) return new B(e.h, e.s, e.l, e.opacity);
1921
+ if (e instanceof A || (e = F(e)), !e) return new B();
1922
+ if (e instanceof B) return e;
1923
+ e = e.rgb();
1924
+ var t = e.r / 255, n = e.g / 255, r = e.b / 255, i = Math.min(t, n, r), a = Math.max(t, n, r), o = NaN, s = a - i, c = (a + i) / 2;
1925
+ return s ? (o = t === a ? (n - r) / s + (n < r) * 6 : n === a ? (r - t) / s + 2 : (t - n) / s + 4, s /= c < .5 ? a + i : 2 - a - i, o *= 60) : s = c > 0 && c < 1 ? 0 : o, new B(o, s, c, e.opacity);
1926
+ }
1927
+ function ar(e, t, n, r) {
1928
+ return arguments.length === 1 ? ir(e) : new B(e, t, n, r ?? 1);
1929
+ }
1930
+ function B(e, t, n, r) {
1931
+ this.h = +e, this.s = +t, this.l = +n, this.opacity = +r;
1932
+ }
1933
+ Fn(B, ar, In(A, {
1934
+ brighter(e) {
1935
+ return e = e == null ? Ln : Ln ** +e, new B(this.h, this.s, this.l * e, this.opacity);
1936
+ },
1937
+ darker(e) {
1938
+ return e = e == null ? j : j ** +e, new B(this.h, this.s, this.l * e, this.opacity);
1939
+ },
1940
+ rgb() {
1941
+ var e = this.h % 360 + (this.h < 0) * 360, t = isNaN(e) || isNaN(this.s) ? 0 : this.s, n = this.l, r = n + (n < .5 ? n : 1 - n) * t, i = 2 * n - r;
1942
+ return new I(cr(e >= 240 ? e - 240 : e + 120, i, r), cr(e, i, r), cr(e < 120 ? e + 240 : e - 120, i, r), this.opacity);
1943
+ },
1944
+ clamp() {
1945
+ return new B(or(this.h), sr(this.s), sr(this.l), L(this.opacity));
1946
+ },
1947
+ displayable() {
1948
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
1949
+ },
1950
+ formatHsl() {
1951
+ let e = L(this.opacity);
1952
+ return `${e === 1 ? "hsl(" : "hsla("}${or(this.h)}, ${sr(this.s) * 100}%, ${sr(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
1953
+ }
1954
+ }));
1955
+ function or(e) {
1956
+ return e = (e || 0) % 360, e < 0 ? e + 360 : e;
1957
+ }
1958
+ function sr(e) {
1959
+ return Math.max(0, Math.min(1, e || 0));
1960
+ }
1961
+ function cr(e, t, n) {
1962
+ return (e < 60 ? t + (n - t) * e / 60 : e < 180 ? n : e < 240 ? t + (n - t) * (240 - e) / 60 : t) * 255;
1963
+ }
1964
+ var lr = (e) => () => e;
1965
+ function ur(e, t) {
1966
+ return function(n) {
1967
+ return e + n * t;
1968
+ };
1969
+ }
1970
+ function dr(e, t, n) {
1971
+ return e **= +n, t = t ** +n - e, n = 1 / n, function(r) {
1972
+ return (e + r * t) ** +n;
1973
+ };
1974
+ }
1975
+ function fr(e) {
1976
+ return (e = +e) == 1 ? pr : function(t, n) {
1977
+ return n - t ? dr(t, n, e) : lr(isNaN(t) ? n : t);
1978
+ };
1979
+ }
1980
+ function pr(e, t) {
1981
+ var n = t - e;
1982
+ return n ? ur(e, n) : lr(isNaN(e) ? t : e);
1983
+ }
1984
+ var mr = (function e(t) {
1985
+ var n = fr(t);
1986
+ function r(e, t) {
1987
+ var r = n((e = $n(e)).r, (t = $n(t)).r), i = n(e.g, t.g), a = n(e.b, t.b), o = pr(e.opacity, t.opacity);
1988
+ return function(t) {
1989
+ return e.r = r(t), e.g = i(t), e.b = a(t), e.opacity = o(t), e + "";
1990
+ };
1991
+ }
1992
+ return r.gamma = e, r;
1993
+ })(1);
1994
+ function V(e, t) {
1995
+ return e = +e, t = +t, function(n) {
1996
+ return e * (1 - n) + t * n;
1997
+ };
1998
+ }
1999
+ var hr = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, gr = new RegExp(hr.source, "g");
2000
+ function _r(e) {
2001
+ return function() {
2002
+ return e;
2003
+ };
2004
+ }
2005
+ function vr(e) {
2006
+ return function(t) {
2007
+ return e(t) + "";
2008
+ };
2009
+ }
2010
+ function yr(e, t) {
2011
+ var n = hr.lastIndex = gr.lastIndex = 0, r, i, a, o = -1, s = [], c = [];
2012
+ for (e += "", t += ""; (r = hr.exec(e)) && (i = gr.exec(t));) (a = i.index) > n && (a = t.slice(n, a), s[o] ? s[o] += a : s[++o] = a), (r = r[0]) === (i = i[0]) ? s[o] ? s[o] += i : s[++o] = i : (s[++o] = null, c.push({
2013
+ i: o,
2014
+ x: V(r, i)
2015
+ })), n = gr.lastIndex;
2016
+ return n < t.length && (a = t.slice(n), s[o] ? s[o] += a : s[++o] = a), s.length < 2 ? c[0] ? vr(c[0].x) : _r(t) : (t = c.length, function(e) {
2017
+ for (var n = 0, r; n < t; ++n) s[(r = c[n]).i] = r.x(e);
2018
+ return s.join("");
2019
+ });
2020
+ }
2021
+ var br = 180 / Math.PI, xr = {
2022
+ translateX: 0,
2023
+ translateY: 0,
2024
+ rotate: 0,
2025
+ skewX: 0,
2026
+ scaleX: 1,
2027
+ scaleY: 1
2028
+ };
2029
+ function Sr(e, t, n, r, i, a) {
2030
+ var o, s, c;
2031
+ return (o = Math.sqrt(e * e + t * t)) && (e /= o, t /= o), (c = e * n + t * r) && (n -= e * c, r -= t * c), (s = Math.sqrt(n * n + r * r)) && (n /= s, r /= s, c /= s), e * r < t * n && (e = -e, t = -t, c = -c, o = -o), {
2032
+ translateX: i,
2033
+ translateY: a,
2034
+ rotate: Math.atan2(t, e) * br,
2035
+ skewX: Math.atan(c) * br,
2036
+ scaleX: o,
2037
+ scaleY: s
2038
+ };
2039
+ }
2040
+ var Cr;
2041
+ function wr(e) {
2042
+ let t = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(e + "");
2043
+ return t.isIdentity ? xr : Sr(t.a, t.b, t.c, t.d, t.e, t.f);
2044
+ }
2045
+ function Tr(e) {
2046
+ return e == null || (Cr ||= document.createElementNS("http://www.w3.org/2000/svg", "g"), Cr.setAttribute("transform", e), !(e = Cr.transform.baseVal.consolidate())) ? xr : (e = e.matrix, Sr(e.a, e.b, e.c, e.d, e.e, e.f));
2047
+ }
2048
+ function Er(e, t, n, r) {
2049
+ function i(e) {
2050
+ return e.length ? e.pop() + " " : "";
2051
+ }
2052
+ function a(e, r, i, a, o, s) {
2053
+ if (e !== i || r !== a) {
2054
+ var c = o.push("translate(", null, t, null, n);
2055
+ s.push({
2056
+ i: c - 4,
2057
+ x: V(e, i)
2058
+ }, {
2059
+ i: c - 2,
2060
+ x: V(r, a)
2061
+ });
2062
+ } else (i || a) && o.push("translate(" + i + t + a + n);
2063
+ }
2064
+ function o(e, t, n, a) {
2065
+ e === t ? t && n.push(i(n) + "rotate(" + t + r) : (e - t > 180 ? t += 360 : t - e > 180 && (e += 360), a.push({
2066
+ i: n.push(i(n) + "rotate(", null, r) - 2,
2067
+ x: V(e, t)
2068
+ }));
2069
+ }
2070
+ function s(e, t, n, a) {
2071
+ e === t ? t && n.push(i(n) + "skewX(" + t + r) : a.push({
2072
+ i: n.push(i(n) + "skewX(", null, r) - 2,
2073
+ x: V(e, t)
2074
+ });
2075
+ }
2076
+ function c(e, t, n, r, a, o) {
2077
+ if (e !== n || t !== r) {
2078
+ var s = a.push(i(a) + "scale(", null, ",", null, ")");
2079
+ o.push({
2080
+ i: s - 4,
2081
+ x: V(e, n)
2082
+ }, {
2083
+ i: s - 2,
2084
+ x: V(t, r)
2085
+ });
2086
+ } else (n !== 1 || r !== 1) && a.push(i(a) + "scale(" + n + "," + r + ")");
2087
+ }
2088
+ return function(t, n) {
2089
+ var r = [], i = [];
2090
+ return t = e(t), n = e(n), a(t.translateX, t.translateY, n.translateX, n.translateY, r, i), o(t.rotate, n.rotate, r, i), s(t.skewX, n.skewX, r, i), c(t.scaleX, t.scaleY, n.scaleX, n.scaleY, r, i), t = n = null, function(e) {
2091
+ for (var t = -1, n = i.length, a; ++t < n;) r[(a = i[t]).i] = a.x(e);
2092
+ return r.join("");
2093
+ };
2094
+ };
2095
+ }
2096
+ var Dr = Er(wr, "px, ", "px)", "deg)"), Or = Er(Tr, ", ", ")", ")"), H = 0, kr = 0, Ar = 0, jr = 1e3, Mr, U, Nr = 0, W = 0, Pr = 0, G = typeof performance == "object" && performance.now ? performance : Date, Fr = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(e) {
2097
+ setTimeout(e, 17);
2098
+ };
2099
+ function Ir() {
2100
+ return W ||= (Fr(Lr), G.now() + Pr);
2101
+ }
2102
+ function Lr() {
2103
+ W = 0;
2104
+ }
2105
+ function Rr() {
2106
+ this._call = this._time = this._next = null;
2107
+ }
2108
+ Rr.prototype = zr.prototype = {
2109
+ constructor: Rr,
2110
+ restart: function(e, t, n) {
2111
+ if (typeof e != "function") throw TypeError("callback is not a function");
2112
+ n = (n == null ? Ir() : +n) + (t == null ? 0 : +t), !this._next && U !== this && (U ? U._next = this : Mr = this, U = this), this._call = e, this._time = n, Wr();
2113
+ },
2114
+ stop: function() {
2115
+ this._call && (this._call = null, this._time = Infinity, Wr());
2116
+ }
2117
+ };
2118
+ function zr(e, t, n) {
2119
+ var r = new Rr();
2120
+ return r.restart(e, t, n), r;
2121
+ }
2122
+ function Br() {
2123
+ Ir(), ++H;
2124
+ for (var e = Mr, t; e;) (t = W - e._time) >= 0 && e._call.call(void 0, t), e = e._next;
2125
+ --H;
2126
+ }
2127
+ function Vr() {
2128
+ W = (Nr = G.now()) + Pr, H = kr = 0;
2129
+ try {
2130
+ Br();
2131
+ } finally {
2132
+ H = 0, Ur(), W = 0;
2133
+ }
2134
+ }
2135
+ function Hr() {
2136
+ var e = G.now(), t = e - Nr;
2137
+ t > jr && (Pr -= t, Nr = e);
2138
+ }
2139
+ function Ur() {
2140
+ for (var e, t = Mr, n, r = Infinity; t;) t._call ? (r > t._time && (r = t._time), e = t, t = t._next) : (n = t._next, t._next = null, t = e ? e._next = n : Mr = n);
2141
+ U = e, Wr(r);
2142
+ }
2143
+ function Wr(e) {
2144
+ H || (kr &&= clearTimeout(kr), e - W > 24 ? (e < Infinity && (kr = setTimeout(Vr, e - G.now() - Pr)), Ar &&= clearInterval(Ar)) : (Ar ||= (Nr = G.now(), setInterval(Hr, jr)), H = 1, Fr(Vr)));
2145
+ }
2146
+ function Gr(e, t, n) {
2147
+ var r = new Rr();
2148
+ return t = t == null ? 0 : +t, r.restart((n) => {
2149
+ r.stop(), e(n + t);
2150
+ }, t, n), r;
2151
+ }
2152
+ var Kr = Pe("start", "end", "cancel", "interrupt"), qr = [];
2153
+ function Jr(e, t, n, r, i, a) {
2154
+ var o = e.__transition;
2155
+ if (!o) e.__transition = {};
2156
+ else if (n in o) return;
2157
+ Xr(e, n, {
2158
+ name: t,
2159
+ index: r,
2160
+ group: i,
2161
+ on: Kr,
2162
+ tween: qr,
2163
+ time: a.time,
2164
+ delay: a.delay,
2165
+ duration: a.duration,
2166
+ ease: a.ease,
2167
+ timer: null,
2168
+ state: 0
2169
+ });
2170
+ }
2171
+ function Yr(e, t) {
2172
+ var n = q(e, t);
2173
+ if (n.state > 0) throw Error("too late; already scheduled");
2174
+ return n;
2175
+ }
2176
+ function K(e, t) {
2177
+ var n = q(e, t);
2178
+ if (n.state > 3) throw Error("too late; already running");
2179
+ return n;
2180
+ }
2181
+ function q(e, t) {
2182
+ var n = e.__transition;
2183
+ if (!n || !(n = n[t])) throw Error("transition not found");
2184
+ return n;
2185
+ }
2186
+ function Xr(e, t, n) {
2187
+ var r = e.__transition, i;
2188
+ r[t] = n, n.timer = zr(a, 0, n.time);
2189
+ function a(e) {
2190
+ n.state = 1, n.timer.restart(o, n.delay, n.time), n.delay <= e && o(e - n.delay);
2191
+ }
2192
+ function o(a) {
2193
+ var l, u, d, f;
2194
+ if (n.state !== 1) return c();
2195
+ for (l in r) if (f = r[l], f.name === n.name) {
2196
+ if (f.state === 3) return Gr(o);
2197
+ f.state === 4 ? (f.state = 6, f.timer.stop(), f.on.call("interrupt", e, e.__data__, f.index, f.group), delete r[l]) : +l < t && (f.state = 6, f.timer.stop(), f.on.call("cancel", e, e.__data__, f.index, f.group), delete r[l]);
2198
+ }
2199
+ if (Gr(function() {
2200
+ n.state === 3 && (n.state = 4, n.timer.restart(s, n.delay, n.time), s(a));
2201
+ }), n.state = 2, n.on.call("start", e, e.__data__, n.index, n.group), n.state === 2) {
2202
+ for (n.state = 3, i = Array(d = n.tween.length), l = 0, u = -1; l < d; ++l) (f = n.tween[l].value.call(e, e.__data__, n.index, n.group)) && (i[++u] = f);
2203
+ i.length = u + 1;
2204
+ }
2205
+ }
2206
+ function s(t) {
2207
+ for (var r = t < n.duration ? n.ease.call(null, t / n.duration) : (n.timer.restart(c), n.state = 5, 1), a = -1, o = i.length; ++a < o;) i[a].call(e, r);
2208
+ n.state === 5 && (n.on.call("end", e, e.__data__, n.index, n.group), c());
2209
+ }
2210
+ function c() {
2211
+ for (var i in n.state = 6, n.timer.stop(), delete r[t], r) return;
2212
+ delete e.__transition;
2213
+ }
2214
+ }
2215
+ function Zr(e, t) {
2216
+ var n = e.__transition, r, i, a = !0, o;
2217
+ if (n) {
2218
+ for (o in t = t == null ? null : t + "", n) {
2219
+ if ((r = n[o]).name !== t) {
2220
+ a = !1;
2221
+ continue;
2222
+ }
2223
+ i = r.state > 2 && r.state < 5, r.state = 6, r.timer.stop(), r.on.call(i ? "interrupt" : "cancel", e, e.__data__, r.index, r.group), delete n[o];
2224
+ }
2225
+ a && delete e.__transition;
2226
+ }
2227
+ }
2228
+ function Qr(e) {
2229
+ return this.each(function() {
2230
+ Zr(this, e);
2231
+ });
2232
+ }
2233
+ function $r(e, t) {
2234
+ var n, r;
2235
+ return function() {
2236
+ var i = K(this, e), a = i.tween;
2237
+ if (a !== n) {
2238
+ r = n = a;
2239
+ for (var o = 0, s = r.length; o < s; ++o) if (r[o].name === t) {
2240
+ r = r.slice(), r.splice(o, 1);
2241
+ break;
2242
+ }
2243
+ }
2244
+ i.tween = r;
2245
+ };
2246
+ }
2247
+ function ei(e, t, n) {
2248
+ var r, i;
2249
+ if (typeof n != "function") throw Error();
2250
+ return function() {
2251
+ var a = K(this, e), o = a.tween;
2252
+ if (o !== r) {
2253
+ i = (r = o).slice();
2254
+ for (var s = {
2255
+ name: t,
2256
+ value: n
2257
+ }, c = 0, l = i.length; c < l; ++c) if (i[c].name === t) {
2258
+ i[c] = s;
2259
+ break;
2260
+ }
2261
+ c === l && i.push(s);
2262
+ }
2263
+ a.tween = i;
2264
+ };
2265
+ }
2266
+ function ti(e, t) {
2267
+ var n = this._id;
2268
+ if (e += "", arguments.length < 2) {
2269
+ for (var r = q(this.node(), n).tween, i = 0, a = r.length, o; i < a; ++i) if ((o = r[i]).name === e) return o.value;
2270
+ return null;
2271
+ }
2272
+ return this.each((t == null ? $r : ei)(n, e, t));
2273
+ }
2274
+ function ni(e, t, n) {
2275
+ var r = e._id;
2276
+ return e.each(function() {
2277
+ var e = K(this, r);
2278
+ (e.value ||= {})[t] = n.apply(this, arguments);
2279
+ }), function(e) {
2280
+ return q(e, r).value[t];
2281
+ };
2282
+ }
2283
+ function ri(e, t) {
2284
+ var n;
2285
+ return (typeof t == "number" ? V : t instanceof F ? mr : (n = F(t)) ? (t = n, mr) : yr)(e, t);
2286
+ }
2287
+ function ii(e) {
2288
+ return function() {
2289
+ this.removeAttribute(e);
2290
+ };
2291
+ }
2292
+ function ai(e) {
2293
+ return function() {
2294
+ this.removeAttributeNS(e.space, e.local);
2295
+ };
2296
+ }
2297
+ function oi(e, t, n) {
2298
+ var r, i = n + "", a;
2299
+ return function() {
2300
+ var o = this.getAttribute(e);
2301
+ return o === i ? null : o === r ? a : a = t(r = o, n);
2302
+ };
2303
+ }
2304
+ function si(e, t, n) {
2305
+ var r, i = n + "", a;
2306
+ return function() {
2307
+ var o = this.getAttributeNS(e.space, e.local);
2308
+ return o === i ? null : o === r ? a : a = t(r = o, n);
2309
+ };
2310
+ }
2311
+ function ci(e, t, n) {
2312
+ var r, i, a;
2313
+ return function() {
2314
+ var o, s = n(this), c;
2315
+ return s == null ? void this.removeAttribute(e) : (o = this.getAttribute(e), c = s + "", o === c ? null : o === r && c === i ? a : (i = c, a = t(r = o, s)));
2316
+ };
2317
+ }
2318
+ function li(e, t, n) {
2319
+ var r, i, a;
2320
+ return function() {
2321
+ var o, s = n(this), c;
2322
+ return s == null ? void this.removeAttributeNS(e.space, e.local) : (o = this.getAttributeNS(e.space, e.local), c = s + "", o === c ? null : o === r && c === i ? a : (i = c, a = t(r = o, s)));
2323
+ };
2324
+ }
2325
+ function ui(e, t) {
2326
+ var n = Be(e), r = n === "transform" ? Or : ri;
2327
+ return this.attrTween(e, typeof t == "function" ? (n.local ? li : ci)(n, r, ni(this, "attr." + e, t)) : t == null ? (n.local ? ai : ii)(n) : (n.local ? si : oi)(n, r, t));
2328
+ }
2329
+ function di(e, t) {
2330
+ return function(n) {
2331
+ this.setAttribute(e, t.call(this, n));
2332
+ };
2333
+ }
2334
+ function fi(e, t) {
2335
+ return function(n) {
2336
+ this.setAttributeNS(e.space, e.local, t.call(this, n));
2337
+ };
2338
+ }
2339
+ function pi(e, t) {
2340
+ var n, r;
2341
+ function i() {
2342
+ var i = t.apply(this, arguments);
2343
+ return i !== r && (n = (r = i) && fi(e, i)), n;
2344
+ }
2345
+ return i._value = t, i;
2346
+ }
2347
+ function mi(e, t) {
2348
+ var n, r;
2349
+ function i() {
2350
+ var i = t.apply(this, arguments);
2351
+ return i !== r && (n = (r = i) && di(e, i)), n;
2352
+ }
2353
+ return i._value = t, i;
2354
+ }
2355
+ function hi(e, t) {
2356
+ var n = "attr." + e;
2357
+ if (arguments.length < 2) return (n = this.tween(n)) && n._value;
2358
+ if (t == null) return this.tween(n, null);
2359
+ if (typeof t != "function") throw Error();
2360
+ var r = Be(e);
2361
+ return this.tween(n, (r.local ? pi : mi)(r, t));
2362
+ }
2363
+ function gi(e, t) {
2364
+ return function() {
2365
+ Yr(this, e).delay = +t.apply(this, arguments);
2366
+ };
2367
+ }
2368
+ function _i(e, t) {
2369
+ return t = +t, function() {
2370
+ Yr(this, e).delay = t;
2371
+ };
2372
+ }
2373
+ function vi(e) {
2374
+ var t = this._id;
2375
+ return arguments.length ? this.each((typeof e == "function" ? gi : _i)(t, e)) : q(this.node(), t).delay;
2376
+ }
2377
+ function yi(e, t) {
2378
+ return function() {
2379
+ K(this, e).duration = +t.apply(this, arguments);
2380
+ };
2381
+ }
2382
+ function bi(e, t) {
2383
+ return t = +t, function() {
2384
+ K(this, e).duration = t;
2385
+ };
2386
+ }
2387
+ function xi(e) {
2388
+ var t = this._id;
2389
+ return arguments.length ? this.each((typeof e == "function" ? yi : bi)(t, e)) : q(this.node(), t).duration;
2390
+ }
2391
+ function Si(e, t) {
2392
+ if (typeof t != "function") throw Error();
2393
+ return function() {
2394
+ K(this, e).ease = t;
2395
+ };
2396
+ }
2397
+ function Ci(e) {
2398
+ var t = this._id;
2399
+ return arguments.length ? this.each(Si(t, e)) : q(this.node(), t).ease;
2400
+ }
2401
+ function wi(e, t) {
2402
+ return function() {
2403
+ var n = t.apply(this, arguments);
2404
+ if (typeof n != "function") throw Error();
2405
+ K(this, e).ease = n;
2406
+ };
2407
+ }
2408
+ function Ti(e) {
2409
+ if (typeof e != "function") throw Error();
2410
+ return this.each(wi(this._id, e));
2411
+ }
2412
+ function Ei(e) {
2413
+ typeof e != "function" && (e = Qe(e));
2414
+ for (var t = this._groups, n = t.length, r = Array(n), i = 0; i < n; ++i) for (var a = t[i], o = a.length, s = r[i] = [], c, l = 0; l < o; ++l) (c = a[l]) && e.call(c, c.__data__, l, a) && s.push(c);
2415
+ return new J(r, this._parents, this._name, this._id);
2416
+ }
2417
+ function Di(e) {
2418
+ if (e._id !== this._id) throw Error();
2419
+ for (var t = this._groups, n = e._groups, r = t.length, i = n.length, a = Math.min(r, i), o = Array(r), s = 0; s < a; ++s) for (var c = t[s], l = n[s], u = c.length, d = o[s] = Array(u), f, p = 0; p < u; ++p) (f = c[p] || l[p]) && (d[p] = f);
2420
+ for (; s < r; ++s) o[s] = t[s];
2421
+ return new J(o, this._parents, this._name, this._id);
2422
+ }
2423
+ function Oi(e) {
2424
+ return (e + "").trim().split(/^|\s+/).every(function(e) {
2425
+ var t = e.indexOf(".");
2426
+ return t >= 0 && (e = e.slice(0, t)), !e || e === "start";
2427
+ });
2428
+ }
2429
+ function ki(e, t, n) {
2430
+ var r, i, a = Oi(t) ? Yr : K;
2431
+ return function() {
2432
+ var o = a(this, e), s = o.on;
2433
+ s !== r && (i = (r = s).copy()).on(t, n), o.on = i;
2434
+ };
2435
+ }
2436
+ function Ai(e, t) {
2437
+ var n = this._id;
2438
+ return arguments.length < 2 ? q(this.node(), n).on.on(e) : this.each(ki(n, e, t));
2439
+ }
2440
+ function ji(e) {
2441
+ return function() {
2442
+ var t = this.parentNode;
2443
+ for (var n in this.__transition) if (+n !== e) return;
2444
+ t && t.removeChild(this);
2445
+ };
2446
+ }
2447
+ function Mi() {
2448
+ return this.on("end.remove", ji(this._id));
2449
+ }
2450
+ function Ni(e) {
2451
+ var t = this._name, n = this._id;
2452
+ typeof e != "function" && (e = Ge(e));
2453
+ for (var r = this._groups, i = r.length, a = Array(i), o = 0; o < i; ++o) for (var s = r[o], c = s.length, l = a[o] = Array(c), u, d, f = 0; f < c; ++f) (u = s[f]) && (d = e.call(u, u.__data__, f, s)) && ("__data__" in u && (d.__data__ = u.__data__), l[f] = d, Jr(l[f], t, n, f, l, q(u, n)));
2454
+ return new J(a, this._parents, t, n);
2455
+ }
2456
+ function Pi(e) {
2457
+ var t = this._name, n = this._id;
2458
+ typeof e != "function" && (e = Ye(e));
2459
+ for (var r = this._groups, i = r.length, a = [], o = [], s = 0; s < i; ++s) for (var c = r[s], l = c.length, u, d = 0; d < l; ++d) if (u = c[d]) {
2460
+ for (var f = e.call(u, u.__data__, d, c), p, m = q(u, n), h = 0, g = f.length; h < g; ++h) (p = f[h]) && Jr(p, t, n, h, f, m);
2461
+ a.push(f), o.push(u);
2462
+ }
2463
+ return new J(a, o, t, n);
2464
+ }
2465
+ var Fi = k.prototype.constructor;
2466
+ function Ii() {
2467
+ return new Fi(this._groups, this._parents);
2468
+ }
2469
+ function Li(e, t) {
2470
+ var n, r, i;
2471
+ return function() {
2472
+ var a = D(this, e), o = (this.style.removeProperty(e), D(this, e));
2473
+ return a === o ? null : a === n && o === r ? i : i = t(n = a, r = o);
2474
+ };
2475
+ }
2476
+ function Ri(e) {
2477
+ return function() {
2478
+ this.style.removeProperty(e);
2479
+ };
2480
+ }
2481
+ function zi(e, t, n) {
2482
+ var r, i = n + "", a;
2483
+ return function() {
2484
+ var o = D(this, e);
2485
+ return o === i ? null : o === r ? a : a = t(r = o, n);
2486
+ };
2487
+ }
2488
+ function Bi(e, t, n) {
2489
+ var r, i, a;
2490
+ return function() {
2491
+ var o = D(this, e), s = n(this), c = s + "";
2492
+ return s ?? (c = s = (this.style.removeProperty(e), D(this, e))), o === c ? null : o === r && c === i ? a : (i = c, a = t(r = o, s));
2493
+ };
2494
+ }
2495
+ function Vi(e, t) {
2496
+ var n, r, i, a = "style." + t, o = "end." + a, s;
2497
+ return function() {
2498
+ var c = K(this, e), l = c.on, u = c.value[a] == null ? s ||= Ri(t) : void 0;
2499
+ (l !== n || i !== u) && (r = (n = l).copy()).on(o, i = u), c.on = r;
2500
+ };
2501
+ }
2502
+ function Hi(e, t, n) {
2503
+ var r = (e += "") == "transform" ? Dr : ri;
2504
+ return t == null ? this.styleTween(e, Li(e, r)).on("end.style." + e, Ri(e)) : typeof t == "function" ? this.styleTween(e, Bi(e, r, ni(this, "style." + e, t))).each(Vi(this._id, e)) : this.styleTween(e, zi(e, r, t), n).on("end.style." + e, null);
2505
+ }
2506
+ function Ui(e, t, n) {
2507
+ return function(r) {
2508
+ this.style.setProperty(e, t.call(this, r), n);
2509
+ };
2510
+ }
2511
+ function Wi(e, t, n) {
2512
+ var r, i;
2513
+ function a() {
2514
+ var a = t.apply(this, arguments);
2515
+ return a !== i && (r = (i = a) && Ui(e, a, n)), r;
2516
+ }
2517
+ return a._value = t, a;
2518
+ }
2519
+ function Gi(e, t, n) {
2520
+ var r = "style." + (e += "");
2521
+ if (arguments.length < 2) return (r = this.tween(r)) && r._value;
2522
+ if (t == null) return this.tween(r, null);
2523
+ if (typeof t != "function") throw Error();
2524
+ return this.tween(r, Wi(e, t, n ?? ""));
2525
+ }
2526
+ function Ki(e) {
2527
+ return function() {
2528
+ this.textContent = e;
2529
+ };
2530
+ }
2531
+ function qi(e) {
2532
+ return function() {
2533
+ this.textContent = e(this) ?? "";
2534
+ };
2535
+ }
2536
+ function Ji(e) {
2537
+ return this.tween("text", typeof e == "function" ? qi(ni(this, "text", e)) : Ki(e == null ? "" : e + ""));
2538
+ }
2539
+ function Yi(e) {
2540
+ return function(t) {
2541
+ this.textContent = e.call(this, t);
2542
+ };
2543
+ }
2544
+ function Xi(e) {
2545
+ var t, n;
2546
+ function r() {
2547
+ var r = e.apply(this, arguments);
2548
+ return r !== n && (t = (n = r) && Yi(r)), t;
2549
+ }
2550
+ return r._value = e, r;
2551
+ }
2552
+ function Zi(e) {
2553
+ var t = "text";
2554
+ if (arguments.length < 1) return (t = this.tween(t)) && t._value;
2555
+ if (e == null) return this.tween(t, null);
2556
+ if (typeof e != "function") throw Error();
2557
+ return this.tween(t, Xi(e));
2558
+ }
2559
+ function Qi() {
2560
+ for (var e = this._name, t = this._id, n = na(), r = this._groups, i = r.length, a = 0; a < i; ++a) for (var o = r[a], s = o.length, c, l = 0; l < s; ++l) if (c = o[l]) {
2561
+ var u = q(c, t);
2562
+ Jr(c, e, n, l, o, {
2563
+ time: u.time + u.delay + u.duration,
2564
+ delay: 0,
2565
+ duration: u.duration,
2566
+ ease: u.ease
2567
+ });
2568
+ }
2569
+ return new J(r, this._parents, e, n);
2570
+ }
2571
+ function $i() {
2572
+ var e, t, n = this, r = n._id, i = n.size();
2573
+ return new Promise(function(a, o) {
2574
+ var s = { value: o }, c = { value: function() {
2575
+ --i === 0 && a();
2576
+ } };
2577
+ n.each(function() {
2578
+ var n = K(this, r), i = n.on;
2579
+ i !== e && (t = (e = i).copy(), t._.cancel.push(s), t._.interrupt.push(s), t._.end.push(c)), n.on = t;
2580
+ }), i === 0 && a();
2581
+ });
2582
+ }
2583
+ var ea = 0;
2584
+ function J(e, t, n, r) {
2585
+ this._groups = e, this._parents = t, this._name = n, this._id = r;
2586
+ }
2587
+ function ta(e) {
2588
+ return k().transition(e);
2589
+ }
2590
+ function na() {
2591
+ return ++ea;
2592
+ }
2593
+ var Y = k.prototype;
2594
+ J.prototype = ta.prototype = {
2595
+ constructor: J,
2596
+ select: Ni,
2597
+ selectAll: Pi,
2598
+ selectChild: Y.selectChild,
2599
+ selectChildren: Y.selectChildren,
2600
+ filter: Ei,
2601
+ merge: Di,
2602
+ selection: Ii,
2603
+ transition: Qi,
2604
+ call: Y.call,
2605
+ nodes: Y.nodes,
2606
+ node: Y.node,
2607
+ size: Y.size,
2608
+ empty: Y.empty,
2609
+ each: Y.each,
2610
+ on: Ai,
2611
+ attr: ui,
2612
+ attrTween: hi,
2613
+ style: Hi,
2614
+ styleTween: Gi,
2615
+ text: Ji,
2616
+ textTween: Zi,
2617
+ remove: Mi,
2618
+ tween: ti,
2619
+ delay: vi,
2620
+ duration: xi,
2621
+ ease: Ci,
2622
+ easeVarying: Ti,
2623
+ end: $i,
2624
+ [Symbol.iterator]: Y[Symbol.iterator]
2625
+ };
2626
+ function ra(e) {
2627
+ return ((e *= 2) <= 1 ? e * e * e : (e -= 2) * e * e + 2) / 2;
2628
+ }
2629
+ var ia = {
2630
+ time: null,
2631
+ delay: 0,
2632
+ duration: 250,
2633
+ ease: ra
2634
+ };
2635
+ function aa(e, t) {
2636
+ for (var n; !(n = e.__transition) || !(n = n[t]);) if (!(e = e.parentNode)) throw Error(`transition ${t} not found`);
2637
+ return n;
2638
+ }
2639
+ function oa(e) {
2640
+ var t, n;
2641
+ e instanceof J ? (t = e._id, e = e._name) : (t = na(), (n = ia).time = Ir(), e = e == null ? null : e + "");
2642
+ for (var r = this._groups, i = r.length, a = 0; a < i; ++a) for (var o = r[a], s = o.length, c, l = 0; l < s; ++l) (c = o[l]) && Jr(c, e, t, l, o, n || aa(c, t));
2643
+ return new J(r, this._parents, e, t);
2644
+ }
2645
+ k.prototype.interrupt = Qr, k.prototype.transition = oa;
2646
+ var { abs: sa, max: ca, min: la } = Math;
2647
+ ["w", "e"].map(ua), ["n", "s"].map(ua), [
2648
+ "n",
2649
+ "w",
2650
+ "e",
2651
+ "s",
2652
+ "nw",
2653
+ "ne",
2654
+ "sw",
2655
+ "se"
2656
+ ].map(ua);
2657
+ function ua(e) {
2658
+ return { type: e };
2659
+ }
2660
+ function da(e) {
2661
+ return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
2662
+ }
2663
+ function fa(e, t) {
2664
+ if ((n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e")) < 0) return null;
2665
+ var n, r = e.slice(0, n);
2666
+ return [r.length > 1 ? r[0] + r.slice(2) : r, +e.slice(n + 1)];
2667
+ }
2668
+ function pa(e) {
2669
+ return e = fa(Math.abs(e)), e ? e[1] : NaN;
2670
+ }
2671
+ function ma(e, t) {
2672
+ return function(n, r) {
2673
+ for (var i = n.length, a = [], o = 0, s = e[0], c = 0; i > 0 && s > 0 && (c + s + 1 > r && (s = Math.max(1, r - c)), a.push(n.substring(i -= s, i + s)), !((c += s + 1) > r));) s = e[o = (o + 1) % e.length];
2674
+ return a.reverse().join(t);
2675
+ };
2676
+ }
2677
+ function ha(e) {
2678
+ return function(t) {
2679
+ return t.replace(/[0-9]/g, function(t) {
2680
+ return e[+t];
2681
+ });
2682
+ };
2683
+ }
2684
+ var ga = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
2685
+ function _a(e) {
2686
+ if (!(t = ga.exec(e))) throw Error("invalid format: " + e);
2687
+ var t;
2688
+ return new va({
2689
+ fill: t[1],
2690
+ align: t[2],
2691
+ sign: t[3],
2692
+ symbol: t[4],
2693
+ zero: t[5],
2694
+ width: t[6],
2695
+ comma: t[7],
2696
+ precision: t[8] && t[8].slice(1),
2697
+ trim: t[9],
2698
+ type: t[10]
2699
+ });
2700
+ }
2701
+ _a.prototype = va.prototype;
2702
+ function va(e) {
2703
+ this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
2704
+ }
2705
+ va.prototype.toString = function() {
2706
+ return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
2707
+ };
2708
+ function ya(e) {
2709
+ out: for (var t = e.length, n = 1, r = -1, i; n < t; ++n) switch (e[n]) {
2710
+ case ".":
2711
+ r = i = n;
2712
+ break;
2713
+ case "0":
2714
+ r === 0 && (r = n), i = n;
2715
+ break;
2716
+ default:
2717
+ if (!+e[n]) break out;
2718
+ r > 0 && (r = 0);
2719
+ break;
2720
+ }
2721
+ return r > 0 ? e.slice(0, r) + e.slice(i + 1) : e;
2722
+ }
2723
+ var ba;
2724
+ function xa(e, t) {
2725
+ var n = fa(e, t);
2726
+ if (!n) return e + "";
2727
+ var r = n[0], i = n[1], a = i - (ba = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, o = r.length;
2728
+ return a === o ? r : a > o ? r + Array(a - o + 1).join("0") : a > 0 ? r.slice(0, a) + "." + r.slice(a) : "0." + Array(1 - a).join("0") + fa(e, Math.max(0, t + a - 1))[0];
2729
+ }
2730
+ function Sa(e, t) {
2731
+ var n = fa(e, t);
2732
+ if (!n) return e + "";
2733
+ var r = n[0], i = n[1];
2734
+ return i < 0 ? "0." + Array(-i).join("0") + r : r.length > i + 1 ? r.slice(0, i + 1) + "." + r.slice(i + 1) : r + Array(i - r.length + 2).join("0");
2735
+ }
2736
+ var Ca = {
2737
+ "%": (e, t) => (e * 100).toFixed(t),
2738
+ b: (e) => Math.round(e).toString(2),
2739
+ c: (e) => e + "",
2740
+ d: da,
2741
+ e: (e, t) => e.toExponential(t),
2742
+ f: (e, t) => e.toFixed(t),
2743
+ g: (e, t) => e.toPrecision(t),
2744
+ o: (e) => Math.round(e).toString(8),
2745
+ p: (e, t) => Sa(e * 100, t),
2746
+ r: Sa,
2747
+ s: xa,
2748
+ X: (e) => Math.round(e).toString(16).toUpperCase(),
2749
+ x: (e) => Math.round(e).toString(16)
2750
+ };
2751
+ function wa(e) {
2752
+ return e;
2753
+ }
2754
+ var Ta = Array.prototype.map, Ea = [
2755
+ "y",
2756
+ "z",
2757
+ "a",
2758
+ "f",
2759
+ "p",
2760
+ "n",
2761
+ "µ",
2762
+ "m",
2763
+ "",
2764
+ "k",
2765
+ "M",
2766
+ "G",
2767
+ "T",
2768
+ "P",
2769
+ "E",
2770
+ "Z",
2771
+ "Y"
2772
+ ];
2773
+ function Da(e) {
2774
+ var t = e.grouping === void 0 || e.thousands === void 0 ? wa : ma(Ta.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", r = e.currency === void 0 ? "" : e.currency[1] + "", i = e.decimal === void 0 ? "." : e.decimal + "", a = e.numerals === void 0 ? wa : ha(Ta.call(e.numerals, String)), o = e.percent === void 0 ? "%" : e.percent + "", s = e.minus === void 0 ? "−" : e.minus + "", c = e.nan === void 0 ? "NaN" : e.nan + "";
2775
+ function l(e) {
2776
+ e = _a(e);
2777
+ var l = e.fill, u = e.align, d = e.sign, f = e.symbol, p = e.zero, m = e.width, h = e.comma, g = e.precision, _ = e.trim, v = e.type;
2778
+ v === "n" ? (h = !0, v = "g") : Ca[v] || (g === void 0 && (g = 12), _ = !0, v = "g"), (p || l === "0" && u === "=") && (p = !0, l = "0", u = "=");
2779
+ var y = f === "$" ? n : f === "#" && /[boxX]/.test(v) ? "0" + v.toLowerCase() : "", b = f === "$" ? r : /[%p]/.test(v) ? o : "", x = Ca[v], ee = /[defgprs%]/.test(v);
2780
+ g = g === void 0 ? 6 : /[gprs]/.test(v) ? Math.max(1, Math.min(21, g)) : Math.max(0, Math.min(20, g));
2781
+ function S(e) {
2782
+ var n = y, r = b, o, f, S;
2783
+ if (v === "c") r = x(e) + r, e = "";
2784
+ else {
2785
+ e = +e;
2786
+ var C = e < 0 || 1 / e < 0;
2787
+ if (e = isNaN(e) ? c : x(Math.abs(e), g), _ && (e = ya(e)), C && +e == 0 && d !== "+" && (C = !1), n = (C ? d === "(" ? d : s : d === "-" || d === "(" ? "" : d) + n, r = (v === "s" ? Ea[8 + ba / 3] : "") + r + (C && d === "(" ? ")" : ""), ee) {
2788
+ for (o = -1, f = e.length; ++o < f;) if (S = e.charCodeAt(o), 48 > S || S > 57) {
2789
+ r = (S === 46 ? i + e.slice(o + 1) : e.slice(o)) + r, e = e.slice(0, o);
2790
+ break;
2791
+ }
2792
+ }
2793
+ }
2794
+ h && !p && (e = t(e, Infinity));
2795
+ var w = n.length + e.length + r.length, T = w < m ? Array(m - w + 1).join(l) : "";
2796
+ switch (h && p && (e = t(T + e, T.length ? m - r.length : Infinity), T = ""), u) {
2797
+ case "<":
2798
+ e = n + e + r + T;
2799
+ break;
2800
+ case "=":
2801
+ e = n + T + e + r;
2802
+ break;
2803
+ case "^":
2804
+ e = T.slice(0, w = T.length >> 1) + n + e + r + T.slice(w);
2805
+ break;
2806
+ default:
2807
+ e = T + n + e + r;
2808
+ break;
2809
+ }
2810
+ return a(e);
2811
+ }
2812
+ return S.toString = function() {
2813
+ return e + "";
2814
+ }, S;
2815
+ }
2816
+ function u(e, t) {
2817
+ var n = l((e = _a(e), e.type = "f", e)), r = Math.max(-8, Math.min(8, Math.floor(pa(t) / 3))) * 3, i = 10 ** -r, a = Ea[8 + r / 3];
2818
+ return function(e) {
2819
+ return n(i * e) + a;
2820
+ };
2821
+ }
2822
+ return {
2823
+ format: l,
2824
+ formatPrefix: u
2825
+ };
2826
+ }
2827
+ var Oa;
2828
+ ka({
2829
+ thousands: ",",
2830
+ grouping: [3],
2831
+ currency: ["$", ""]
2832
+ });
2833
+ function ka(e) {
2834
+ return Oa = Da(e), Oa.format, Oa.formatPrefix, Oa;
2835
+ }
2836
+ function X(e, t, n) {
2837
+ this.k = e, this.x = t, this.y = n;
2838
+ }
2839
+ X.prototype = {
2840
+ constructor: X,
2841
+ scale: function(e) {
2842
+ return e === 1 ? this : new X(this.k * e, this.x, this.y);
2843
+ },
2844
+ translate: function(e, t) {
2845
+ return e === 0 & t === 0 ? this : new X(this.k, this.x + this.k * e, this.y + this.k * t);
2846
+ },
2847
+ apply: function(e) {
2848
+ return [e[0] * this.k + this.x, e[1] * this.k + this.y];
2849
+ },
2850
+ applyX: function(e) {
2851
+ return e * this.k + this.x;
2852
+ },
2853
+ applyY: function(e) {
2854
+ return e * this.k + this.y;
2855
+ },
2856
+ invert: function(e) {
2857
+ return [(e[0] - this.x) / this.k, (e[1] - this.y) / this.k];
2858
+ },
2859
+ invertX: function(e) {
2860
+ return (e - this.x) / this.k;
2861
+ },
2862
+ invertY: function(e) {
2863
+ return (e - this.y) / this.k;
2864
+ },
2865
+ rescaleX: function(e) {
2866
+ return e.copy().domain(e.range().map(this.invertX, this).map(e.invert, e));
2867
+ },
2868
+ rescaleY: function(e) {
2869
+ return e.copy().domain(e.range().map(this.invertY, this).map(e.invert, e));
2870
+ },
2871
+ toString: function() {
2872
+ return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
2873
+ }
2874
+ };
2875
+ var Aa = new X(1, 0, 0);
2876
+ ja.prototype = X.prototype;
2877
+ function ja(e) {
2878
+ for (; !e.__zoom;) if (!(e = e.parentNode)) return Aa;
2879
+ return e.__zoom;
2880
+ }
2881
+ //#endregion
2882
+ //#region src/helpers/transferConstructedPolygonGeometry.ts
2883
+ function Ma(e) {
2884
+ let t = new Te(e);
2885
+ return {
2886
+ result: t,
2887
+ transfers: [
2888
+ t.batch_id?.buffer,
2889
+ t.batch_index?.buffer,
2890
+ t.normal?.buffer,
2891
+ t.position_3d_high?.buffer,
2892
+ t.position_3d_low?.buffer,
2893
+ t.position?.buffer,
2894
+ t.scale_normal_and_cap?.buffer,
2895
+ t.indices.buffer,
2896
+ t.outline_position?.buffer,
2897
+ t.outline_scale_normal_and_cap?.buffer,
2898
+ t.outline_skip_indices?.buffer,
2899
+ t.outline_batch_index?.buffer
2900
+ ].filter(xe)
2901
+ };
2902
+ }
2903
+ //#endregion
2904
+ //#region src/utils/toTransferableTileLike.ts
2905
+ function Z(e) {
2906
+ return new d(Na(e.coords), e.max_height, e.min_height, e.cached_mesh_handle ? Pa(e.cached_mesh_handle) : void 0);
2907
+ }
2908
+ function Na(e) {
2909
+ return new o(e.x, e.y, e.z);
2910
+ }
2911
+ function Pa(e) {
2912
+ return new t(e.vertices, e.indices, e.uvs, e.heights);
2913
+ }
2914
+ //#endregion
2915
+ //#region src/utils/toUpsamplableTerrainGeometryLike.ts
2916
+ function Fa(e) {
2917
+ return new f(e.uvs, e.indices, e.heights, e.normals, e.watermask);
2918
+ }
2919
+ //#endregion
2920
+ //#region src/utils/toExtentRadianF32Like.ts
2921
+ function Ia(e) {
2922
+ return new r(e.west, e.south, e.east, e.north);
2923
+ }
2924
+ //#endregion
2925
+ //#region src/utils/toPolygonMaterialLike.ts
2926
+ function La(e) {
2927
+ return new i(e.show, e.castShadow, e.receiveShadow, e.color, e.clampToGround, e.tiled, e.height, e.extrudedHeight, e.wireframe, e.outline, e.perPositionHeight, e.__internal__);
2928
+ }
2929
+ //#endregion
2930
+ //#region src/utils/toTransferablePolygonBatchedFeatureLike.ts
2931
+ function Ra(e) {
2932
+ let t = new c(e.crs, e.length);
2933
+ return t.setOuterRing(e.outer_ring.length, (t) => {
2934
+ t.set(e.outer_ring);
2935
+ }), t.setOuterRingSizes(e.outer_ring_sizes.length, (t) => {
2936
+ t.set(e.outer_ring_sizes);
2937
+ }), t.setHoles(e.holes.length, (t) => {
2938
+ t.set(e.holes);
2939
+ }), t.setHolesSizes(e.holes_sizes.length, (t) => {
2940
+ t.set(e.holes_sizes);
2941
+ }), t.setHolesTotalSizes(e.holes_total_sizes.length, (t) => {
2942
+ t.set(e.holes_total_sizes);
2943
+ }), t.setHolesBoundaries(e.holes_boundaries.length, (t) => {
2944
+ t.set(e.holes_boundaries);
2945
+ }), t.setExpectedWindingOrders(e.expected_winding_orders.length, (t) => {
2946
+ t.set(e.expected_winding_orders);
2947
+ }), t.setBatchIds(e.batch_ids.length, (t) => {
2948
+ t.set(e.batch_ids);
2949
+ }), t.setBatchIndices(e.batch_indices.length, (t) => {
2950
+ t.set(e.batch_indices);
2951
+ }), t;
2952
+ }
2953
+ //#endregion
2954
+ //#region src/tasks/waitWasm.ts
2955
+ var za;
2956
+ async function Q() {
2957
+ return za ??= e(), za;
2958
+ }
2959
+ async function Ba() {
2960
+ if (!za) return 0;
2961
+ let { memory: e } = await za;
2962
+ return e.buffer.byteLength;
2963
+ }
2964
+ //#endregion
2965
+ //#region src/tasks/constructPolygonBatchedFeature.ts
2966
+ async function Va(e, t, n, r) {
2967
+ await Q();
2968
+ let i = p(Ra(e), La(t), n, r ? Ia(r) : void 0);
2969
+ if (!i) return;
2970
+ let { result: a, transfers: o } = Ma(i);
2971
+ return i.free(), $(a, o);
2972
+ }
2973
+ //#endregion
2974
+ //#region src/helpers/transferConstructedPolylineGeometry.ts
2975
+ function Ha(e) {
2976
+ let t = new Ee(e);
2977
+ return {
2978
+ result: t,
2979
+ transfers: [
2980
+ t.position.buffer,
2981
+ t.position_high?.buffer,
2982
+ t.position_low?.buffer,
2983
+ t.start?.buffer,
2984
+ t.start_high?.buffer,
2985
+ t.start_low?.buffer,
2986
+ t.end_high?.buffer,
2987
+ t.end_low?.buffer,
2988
+ t.start_normals?.buffer,
2989
+ t.forward_offset?.buffer,
2990
+ t.end_normal_and_texture_coordinate_normalization_x?.buffer,
2991
+ t.right_normal_and_texture_coordinate_normalization_y.buffer,
2992
+ t.batch_id?.buffer,
2993
+ t.batch_index?.buffer,
2994
+ t.indices.buffer
2995
+ ].filter(xe)
2996
+ };
2997
+ }
2998
+ //#endregion
2999
+ //#region src/utils/toPolylineMaterialLike.ts
3000
+ function Ua(e) {
3001
+ return new a(e.show, e.castShadow, e.receiveShadow, e.color, e.clampToGround, e.tiled, e.height, e.width, e.maxWidth, e.__internal__);
3002
+ }
3003
+ //#endregion
3004
+ //#region src/utils/toTransferablePolylineBatchedFeatureLike.ts
3005
+ function Wa(e) {
3006
+ let t = new l(e.crs, e.length);
3007
+ return t.setPoints(e.points.length, (t) => {
3008
+ t.set(e.points);
3009
+ }), t.setPointsSizes(e.points_sizes.length, (t) => {
3010
+ t.set(e.points_sizes);
3011
+ }), t.setBatchIds(e.batch_ids.length, (t) => {
3012
+ t.set(e.batch_ids);
3013
+ }), t.setBatchIndices(e.batch_indices.length, (t) => {
3014
+ t.set(e.batch_indices);
3015
+ }), t;
3016
+ }
3017
+ //#endregion
3018
+ //#region src/tasks/constructPolylineBatchedFeature.ts
3019
+ async function Ga(e, t, n) {
3020
+ await Q();
3021
+ let r = m(Wa(e), Ua(t), n);
3022
+ if (!r) return;
3023
+ let { result: i, transfers: a } = Ha(r);
3024
+ return r.free(), $(i, a);
3025
+ }
3026
+ //#endregion
3027
+ //#region src/helpers/transferReturnedConstructedTerrainMesh.ts
3028
+ function Ka(e) {
3029
+ let t = new Ce(e), n = [
3030
+ t.vertices.buffer,
3031
+ t.uvs.buffer,
3032
+ t.indices.buffer,
3033
+ t.heights.buffer
3034
+ ];
3035
+ return t.normals && n.push(t.normals.buffer), t.skirt_vertices && n.push(t.skirt_vertices.buffer), t.skirt_uvs && n.push(t.skirt_uvs.buffer), t.skirt_indices && n.push(t.skirt_indices.buffer), t.skirt_normals && n.push(t.skirt_normals.buffer), t.watermask && n.push(t.watermask.buffer), {
3036
+ result: t,
3037
+ transfers: n
3038
+ };
3039
+ }
3040
+ //#endregion
3041
+ //#region src/tasks/constructQuantizedMeshTerrainMesh.ts
3042
+ async function qa(e, t, n, r, i, a) {
3043
+ await Q();
3044
+ let o = h(e, Z(t), n, r, i, a), { result: s, transfers: c } = Ka(o);
3045
+ return o.free(), $({ result: s }, [...c]);
3046
+ }
3047
+ //#endregion
3048
+ //#region src/utils/toTransferableRasterDEMDataLike.ts
3049
+ function Ja(e) {
3050
+ return new u(new n(e.decoder.r_scaler, e.decoder.g_scaler, e.decoder.b_scaler, e.decoder.offset, e.decoder.max_offset, e.decoder.min_offset, e.decoder.boundary, e.decoder.epsilon));
3051
+ }
3052
+ //#endregion
3053
+ //#region src/tasks/constructTerrainMesh.ts
3054
+ async function Ya(e, t, n, r, i, a) {
3055
+ await Q();
3056
+ let o = r + 1, c = s.fromSize(o), l = g(e, Z(t), Ja(n), c, i, a), { result: u, transfers: d } = Ka(l);
3057
+ return l.free(), $({ result: u }, [...d]);
3058
+ }
3059
+ //#endregion
3060
+ //#region src/tasks/getImageDataFromBlob.ts
3061
+ async function Xa(e) {
3062
+ let t = await createImageBitmap(e);
3063
+ try {
3064
+ let e = new OffscreenCanvas(t.width, t.height).getContext("2d");
3065
+ if (e === null) throw Error("failed to get context of canvas");
3066
+ e.drawImage(t, 0, 0);
3067
+ let n = e.getImageData(0, 0, t.width, t.height).data;
3068
+ return $(n, [n.buffer]);
3069
+ } finally {
3070
+ t.close();
3071
+ }
3072
+ }
3073
+ //#endregion
3074
+ //#region src/tasks/getImageDataFromImageBitmap.ts
3075
+ async function Za(e, t) {
3076
+ try {
3077
+ let n = t.getContext("2d");
3078
+ if (n === null) throw Error("failed to get context of canvas");
3079
+ return n.drawImage(e, 0, 0), n.getImageData(0, 0, e.width, e.height).data;
3080
+ } finally {
3081
+ e.close();
3082
+ }
3083
+ }
3084
+ //#endregion
3085
+ //#region src/tasks/parseMvtTile.ts
3086
+ async function Qa(e, t, n, r, i, a, o) {
3087
+ await Q();
3088
+ let s = _(e, t, n, r, i ? Ia(i) : void 0, a, o), c, l, u, d, f;
3089
+ try {
3090
+ c = s.f64_stream(), l = s.f32_stream(), u = s.u32_stream(), d = s.u8_stream(), f = s.meta();
3091
+ } finally {
3092
+ s.free();
3093
+ }
3094
+ return $({
3095
+ f64_stream: c,
3096
+ f32_stream: l,
3097
+ u32_stream: u,
3098
+ u8_stream: d,
3099
+ meta: f
3100
+ }, [
3101
+ c.buffer,
3102
+ l.buffer,
3103
+ u.buffer,
3104
+ d.buffer
3105
+ ]);
3106
+ }
3107
+ //#endregion
3108
+ //#region src/tasks/upsampleQuantizedMeshTerrainMesh.ts
3109
+ async function $a(e, t, n, r, i, a, o) {
3110
+ await Q();
3111
+ let s = v(Z(e), Z(t), Fa(n), r, i, a, o), { result: c, transfers: l } = Ka(s);
3112
+ return s.free(), $(c, l);
3113
+ }
3114
+ //#endregion
3115
+ //#region src/tasks/upsampleTerrainMesh.ts
3116
+ async function eo(e, t, n, r, i, a, o) {
3117
+ await Q();
3118
+ let s = y(Z(e), Z(t), Ja(n), Fa(r), i, a, o), { result: c, transfers: l } = Ka(s);
3119
+ return s.free(), $(c, l);
3120
+ }
3121
+ //#endregion
3122
+ //#region src/tasks/index.ts
3123
+ async function to() {
3124
+ await Q();
3125
+ }
3126
+ var no = {
3127
+ constructTerrainMesh: Ya,
3128
+ constructQuantizedMeshTerrainMesh: qa,
3129
+ upsampleTerrainMesh: eo,
3130
+ upsampleQuantizedMeshTerrainMesh: $a,
3131
+ getImageDataFromImageBitmap: Za,
3132
+ getImageDataFromBlob: Xa,
3133
+ constructPolygonBatchedFeature: Va,
3134
+ constructPolylineBatchedFeature: Ga,
3135
+ parseMvtTile: Qa,
3136
+ warmUp: to,
3137
+ getWasmMemoryUsage: Ba
3138
+ }, $ = (e, t) => new ge.Transfer(e, t), ro = !1, io = (...e) => (ro ||= (ge.worker(no), ao(), !0), ge.worker(...e));
3139
+ function ao() {
3140
+ no.warmUp.worker?.addAbortListener(async () => {});
3141
+ }
3142
+ //#endregion
3143
+ //#region src/pool.ts
3144
+ var { initializeWorkerPool: oo, terminateWorkerPool: so, warmUpWorkerPool: co, worker: lo, workerPoolStats: uo, workerPoolHeapStats: fo, probeWorkerPoolHeap: po } = (() => {
3145
+ let e;
3146
+ return {
3147
+ initializeWorkerPool: (t, n, r) => {
3148
+ if (e) throw Error("Worker pool has already been initialized.");
3149
+ e = {
3150
+ pool: new be(t, n.total, r),
3151
+ manager: n
3152
+ };
3153
+ },
3154
+ terminateWorkerPool: () => {
3155
+ e &&= (e.pool.terminate(), void 0);
3156
+ },
3157
+ warmUpWorkerPool: () => (ae(e, "initializeWorkerPool() must be invoked first."), e.pool.warmUp()),
3158
+ worker: () => (ae(e, "initializeWorkerPool() must be invoked first."), {
3159
+ pool: e.pool,
3160
+ manager: e.manager
3161
+ }),
3162
+ workerPoolStats: () => e?.pool.stats(),
3163
+ workerPoolHeapStats: () => e?.pool.heapStats(),
3164
+ probeWorkerPoolHeap: () => e?.pool.probeHeap()
3165
+ };
3166
+ })(), mo = () => {
3167
+ let { pool: e, manager: t } = lo();
3168
+ return t.canIncrement() && e.canAcceptTasks();
3169
+ };
3170
+ function ho(e, t, n) {
3171
+ let { pool: r, manager: i } = lo();
3172
+ i.increment();
3173
+ try {
3174
+ return r.exec(e, t, n).then((e) => (i.decrement(), e)).catch((e) => {
3175
+ throw i.decrement(), e;
3176
+ });
3177
+ } catch (e) {
3178
+ throw i.decrement(), e;
3179
+ }
3180
+ }
3181
+ //#endregion
3182
+ //#region src/manager.ts
3183
+ var go = (e) => {
3184
+ let t = 0, n = () => t !== e, r = () => t !== 0;
3185
+ return {
3186
+ total: e,
3187
+ actives: () => t,
3188
+ idles: () => e - t,
3189
+ increment: () => {
3190
+ n() && t++;
3191
+ },
3192
+ decrement: () => {
3193
+ r() && t--;
3194
+ },
3195
+ canIncrement: n,
3196
+ canDecrement: r,
3197
+ reset: () => {
3198
+ t = 0;
3199
+ }
3200
+ };
3201
+ };
3202
+ //#endregion
3203
+ export { mo as canWorkerProcessImmediately, go as createConcurrencyManager, oo as initializeWorkerPool, po as probeWorkerPoolHeap, ho as queueTask, io as registerTasks, so as terminateWorkerPool, $ as transfer, co as warmUpWorkerPool, fo as workerPoolHeapStats, uo as workerPoolStats };