@loaders.gl/mvt 4.3.0-alpha.8 → 4.3.0-beta.2
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.
- package/dist/dist.dev.js +271 -414
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +2 -2
- package/dist/lib/parse-mvt.d.ts +1 -2
- package/dist/lib/parse-mvt.d.ts.map +1 -1
- package/dist/lib/vector-tile/vector-tile-feature.d.ts +1 -2
- package/dist/lib/vector-tile/vector-tile-feature.d.ts.map +1 -1
- package/dist/lib/vector-tile/vector-tile-feature.js +1 -3
- package/dist/lib/vector-tiler/tile-to-geojson.d.ts.map +1 -1
- package/dist/lib/vector-tiler/tile-to-geojson.js +1 -2
- package/dist/mvt-loader.d.ts.map +1 -1
- package/dist/mvt-loader.js +1 -1
- package/dist/mvt-source.d.ts +1 -3
- package/dist/mvt-source.d.ts.map +1 -1
- package/dist/mvt-worker.js +80 -223
- package/dist/table-tile-source.d.ts +1 -1
- package/dist/table-tile-source.d.ts.map +1 -1
- package/dist/tilejson-loader.js +1 -1
- package/package.json +6 -6
- package/src/lib/parse-mvt.ts +7 -2
- package/src/lib/vector-tile/vector-tile-feature.ts +15 -5
- package/src/lib/vector-tiler/tile-to-geojson.ts +1 -2
- package/src/mvt-source.ts +9 -4
- package/src/table-tile-source.ts +8 -4
package/dist/dist.dev.js
CHANGED
|
@@ -152,7 +152,7 @@ var __exports__ = (() => {
|
|
|
152
152
|
var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
|
|
153
153
|
var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
|
|
154
154
|
var TEXT_DECODER_MIN_LENGTH = 12;
|
|
155
|
-
var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("
|
|
155
|
+
var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
|
|
156
156
|
Pbf.prototype = {
|
|
157
157
|
destroy: function() {
|
|
158
158
|
this.buf = null;
|
|
@@ -2033,85 +2033,37 @@ var __exports__ = (() => {
|
|
|
2033
2033
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
2034
2034
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
2035
2035
|
|
|
2036
|
-
// ../../node_modules/@
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
2043
|
-
}, _typeof(obj);
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
2047
|
-
function _toPrimitive(input, hint) {
|
|
2048
|
-
if (_typeof(input) !== "object" || input === null)
|
|
2049
|
-
return input;
|
|
2050
|
-
var prim = input[Symbol.toPrimitive];
|
|
2051
|
-
if (prim !== void 0) {
|
|
2052
|
-
var res = prim.call(input, hint || "default");
|
|
2053
|
-
if (_typeof(res) !== "object")
|
|
2054
|
-
return res;
|
|
2055
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2056
|
-
}
|
|
2057
|
-
return (hint === "string" ? String : Number)(input);
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
2061
|
-
function _toPropertyKey(arg) {
|
|
2062
|
-
var key = _toPrimitive(arg, "string");
|
|
2063
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
2067
|
-
function _defineProperty(obj, key, value) {
|
|
2068
|
-
key = _toPropertyKey(key);
|
|
2069
|
-
if (key in obj) {
|
|
2070
|
-
Object.defineProperty(obj, key, {
|
|
2071
|
-
value,
|
|
2072
|
-
enumerable: true,
|
|
2073
|
-
configurable: true,
|
|
2074
|
-
writable: true
|
|
2075
|
-
});
|
|
2076
|
-
} else {
|
|
2077
|
-
obj[key] = value;
|
|
2078
|
-
}
|
|
2079
|
-
return obj;
|
|
2080
|
-
}
|
|
2036
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
|
|
2037
|
+
var window_2 = globalThis;
|
|
2038
|
+
var document_2 = globalThis.document || {};
|
|
2039
|
+
var process_ = globalThis.process || {};
|
|
2040
|
+
var console_ = globalThis.console;
|
|
2041
|
+
var navigator_ = globalThis.navigator || {};
|
|
2081
2042
|
|
|
2082
2043
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
2083
2044
|
function isElectron(mockUserAgent) {
|
|
2084
|
-
if (typeof window !== "undefined" &&
|
|
2045
|
+
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
2085
2046
|
return true;
|
|
2086
2047
|
}
|
|
2087
|
-
if (typeof process !== "undefined" &&
|
|
2048
|
+
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
|
|
2088
2049
|
return true;
|
|
2089
2050
|
}
|
|
2090
|
-
const realUserAgent = typeof navigator
|
|
2051
|
+
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
|
|
2091
2052
|
const userAgent = mockUserAgent || realUserAgent;
|
|
2092
|
-
|
|
2093
|
-
return true;
|
|
2094
|
-
}
|
|
2095
|
-
return false;
|
|
2053
|
+
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
2096
2054
|
}
|
|
2097
2055
|
|
|
2098
2056
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
2099
2057
|
function isBrowser2() {
|
|
2100
|
-
const isNode =
|
|
2058
|
+
const isNode = (
|
|
2059
|
+
// @ts-expect-error
|
|
2060
|
+
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
2061
|
+
);
|
|
2101
2062
|
return !isNode || isElectron();
|
|
2102
2063
|
}
|
|
2103
2064
|
|
|
2104
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/
|
|
2105
|
-
var
|
|
2106
|
-
var window_2 = globalThis.window || globalThis.self || globalThis.global;
|
|
2107
|
-
var document_2 = globalThis.document || {};
|
|
2108
|
-
var process_ = globalThis.process || {};
|
|
2109
|
-
var console_ = globalThis.console;
|
|
2110
|
-
var navigator_ = globalThis.navigator || {};
|
|
2111
|
-
|
|
2112
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
2113
|
-
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
|
|
2114
|
-
var isBrowser3 = isBrowser2();
|
|
2065
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js
|
|
2066
|
+
var VERSION2 = true ? "4.0.7" : "untranspiled source";
|
|
2115
2067
|
|
|
2116
2068
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
2117
2069
|
function getStorage(type) {
|
|
@@ -2126,11 +2078,7 @@ var __exports__ = (() => {
|
|
|
2126
2078
|
}
|
|
2127
2079
|
}
|
|
2128
2080
|
var LocalStorage = class {
|
|
2129
|
-
constructor(id, defaultConfig) {
|
|
2130
|
-
let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
|
|
2131
|
-
_defineProperty(this, "storage", void 0);
|
|
2132
|
-
_defineProperty(this, "id", void 0);
|
|
2133
|
-
_defineProperty(this, "config", void 0);
|
|
2081
|
+
constructor(id, defaultConfig, type = "sessionStorage") {
|
|
2134
2082
|
this.storage = getStorage(type);
|
|
2135
2083
|
this.id = id;
|
|
2136
2084
|
this.config = defaultConfig;
|
|
@@ -2146,6 +2094,7 @@ var __exports__ = (() => {
|
|
|
2146
2094
|
this.storage.setItem(this.id, serialized);
|
|
2147
2095
|
}
|
|
2148
2096
|
}
|
|
2097
|
+
// Get config from persistent store, if available
|
|
2149
2098
|
_loadConfiguration() {
|
|
2150
2099
|
let configuration = {};
|
|
2151
2100
|
if (this.storage) {
|
|
@@ -2161,31 +2110,19 @@ var __exports__ = (() => {
|
|
|
2161
2110
|
function formatTime(ms) {
|
|
2162
2111
|
let formatted;
|
|
2163
2112
|
if (ms < 10) {
|
|
2164
|
-
formatted =
|
|
2113
|
+
formatted = `${ms.toFixed(2)}ms`;
|
|
2165
2114
|
} else if (ms < 100) {
|
|
2166
|
-
formatted =
|
|
2115
|
+
formatted = `${ms.toFixed(1)}ms`;
|
|
2167
2116
|
} else if (ms < 1e3) {
|
|
2168
|
-
formatted =
|
|
2117
|
+
formatted = `${ms.toFixed(0)}ms`;
|
|
2169
2118
|
} else {
|
|
2170
|
-
formatted =
|
|
2119
|
+
formatted = `${(ms / 1e3).toFixed(2)}s`;
|
|
2171
2120
|
}
|
|
2172
2121
|
return formatted;
|
|
2173
2122
|
}
|
|
2174
|
-
function leftPad(string) {
|
|
2175
|
-
let length = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
|
|
2123
|
+
function leftPad(string, length = 8) {
|
|
2176
2124
|
const padLength = Math.max(length - string.length, 0);
|
|
2177
|
-
return "
|
|
2178
|
-
}
|
|
2179
|
-
function formatImage(image, message, scale) {
|
|
2180
|
-
let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
|
|
2181
|
-
const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
|
|
2182
|
-
if (image.width > maxWidth) {
|
|
2183
|
-
scale = Math.min(scale, maxWidth / image.width);
|
|
2184
|
-
}
|
|
2185
|
-
const width = image.width * scale;
|
|
2186
|
-
const height = image.height * scale;
|
|
2187
|
-
const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
|
|
2188
|
-
return ["".concat(message, " %c+"), style];
|
|
2125
|
+
return `${" ".repeat(padLength)}${string}`;
|
|
2189
2126
|
}
|
|
2190
2127
|
|
|
2191
2128
|
// ../../node_modules/@probe.gl/log/dist/utils/color.js
|
|
@@ -2220,19 +2157,18 @@ var __exports__ = (() => {
|
|
|
2220
2157
|
if (!isBrowser2 && typeof string === "string") {
|
|
2221
2158
|
if (color) {
|
|
2222
2159
|
const colorCode = getColor(color);
|
|
2223
|
-
string =
|
|
2160
|
+
string = `\x1B[${colorCode}m${string}\x1B[39m`;
|
|
2224
2161
|
}
|
|
2225
2162
|
if (background) {
|
|
2226
2163
|
const colorCode = getColor(background);
|
|
2227
|
-
string =
|
|
2164
|
+
string = `\x1B[${colorCode + BACKGROUND_INCREMENT}m${string}\x1B[49m`;
|
|
2228
2165
|
}
|
|
2229
2166
|
}
|
|
2230
2167
|
return string;
|
|
2231
2168
|
}
|
|
2232
2169
|
|
|
2233
2170
|
// ../../node_modules/@probe.gl/log/dist/utils/autobind.js
|
|
2234
|
-
function autobind(obj) {
|
|
2235
|
-
let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
|
|
2171
|
+
function autobind(obj, predefined = ["constructor"]) {
|
|
2236
2172
|
const proto = Object.getPrototypeOf(obj);
|
|
2237
2173
|
const propNames = Object.getOwnPropertyNames(proto);
|
|
2238
2174
|
const object = obj;
|
|
@@ -2257,11 +2193,9 @@ var __exports__ = (() => {
|
|
|
2257
2193
|
function getHiResTimestamp() {
|
|
2258
2194
|
let timestamp;
|
|
2259
2195
|
if (isBrowser2() && window_2.performance) {
|
|
2260
|
-
|
|
2261
|
-
timestamp = window_2 === null || window_2 === void 0 ? void 0 : (_window$performance = window_2.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
|
|
2196
|
+
timestamp = window_2?.performance?.now?.();
|
|
2262
2197
|
} else if ("hrtime" in process_) {
|
|
2263
|
-
|
|
2264
|
-
const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
|
|
2198
|
+
const timeParts = process_?.hrtime?.();
|
|
2265
2199
|
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
2266
2200
|
} else {
|
|
2267
2201
|
timestamp = Date.now();
|
|
@@ -2284,27 +2218,18 @@ var __exports__ = (() => {
|
|
|
2284
2218
|
function noop() {
|
|
2285
2219
|
}
|
|
2286
2220
|
var cache = {};
|
|
2287
|
-
var ONCE = {
|
|
2288
|
-
once: true
|
|
2289
|
-
};
|
|
2221
|
+
var ONCE = { once: true };
|
|
2290
2222
|
var Log = class {
|
|
2291
|
-
constructor() {
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
_defineProperty(this, "id", void 0);
|
|
2298
|
-
_defineProperty(this, "VERSION", VERSION2);
|
|
2299
|
-
_defineProperty(this, "_startTs", getHiResTimestamp());
|
|
2300
|
-
_defineProperty(this, "_deltaTs", getHiResTimestamp());
|
|
2301
|
-
_defineProperty(this, "_storage", void 0);
|
|
2302
|
-
_defineProperty(this, "userData", {});
|
|
2303
|
-
_defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
|
|
2223
|
+
constructor({ id } = { id: "" }) {
|
|
2224
|
+
this.VERSION = VERSION2;
|
|
2225
|
+
this._startTs = getHiResTimestamp();
|
|
2226
|
+
this._deltaTs = getHiResTimestamp();
|
|
2227
|
+
this.userData = {};
|
|
2228
|
+
this.LOG_THROTTLE_TIMEOUT = 0;
|
|
2304
2229
|
this.id = id;
|
|
2305
2230
|
this.userData = {};
|
|
2306
|
-
this._storage = new LocalStorage(
|
|
2307
|
-
this.timeStamp(
|
|
2231
|
+
this._storage = new LocalStorage(`__probe-${this.id}__`, DEFAULT_LOG_CONFIGURATION);
|
|
2232
|
+
this.timeStamp(`${this.id} started`);
|
|
2308
2233
|
autobind(this);
|
|
2309
2234
|
Object.seal(this);
|
|
2310
2235
|
}
|
|
@@ -2320,42 +2245,44 @@ var __exports__ = (() => {
|
|
|
2320
2245
|
getLevel() {
|
|
2321
2246
|
return this._storage.config.level;
|
|
2322
2247
|
}
|
|
2248
|
+
/** @return milliseconds, with fractions */
|
|
2323
2249
|
getTotal() {
|
|
2324
2250
|
return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
|
|
2325
2251
|
}
|
|
2252
|
+
/** @return milliseconds, with fractions */
|
|
2326
2253
|
getDelta() {
|
|
2327
2254
|
return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
|
|
2328
2255
|
}
|
|
2256
|
+
/** @deprecated use logLevel */
|
|
2329
2257
|
set priority(newPriority) {
|
|
2330
2258
|
this.level = newPriority;
|
|
2331
2259
|
}
|
|
2260
|
+
/** @deprecated use logLevel */
|
|
2332
2261
|
get priority() {
|
|
2333
2262
|
return this.level;
|
|
2334
2263
|
}
|
|
2264
|
+
/** @deprecated use logLevel */
|
|
2335
2265
|
getPriority() {
|
|
2336
2266
|
return this.level;
|
|
2337
2267
|
}
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
this._storage.setConfiguration({
|
|
2341
|
-
enabled
|
|
2342
|
-
});
|
|
2268
|
+
// Configure
|
|
2269
|
+
enable(enabled = true) {
|
|
2270
|
+
this._storage.setConfiguration({ enabled });
|
|
2343
2271
|
return this;
|
|
2344
2272
|
}
|
|
2345
2273
|
setLevel(level) {
|
|
2346
|
-
this._storage.setConfiguration({
|
|
2347
|
-
level
|
|
2348
|
-
});
|
|
2274
|
+
this._storage.setConfiguration({ level });
|
|
2349
2275
|
return this;
|
|
2350
2276
|
}
|
|
2277
|
+
/** return the current status of the setting */
|
|
2351
2278
|
get(setting) {
|
|
2352
2279
|
return this._storage.config[setting];
|
|
2353
2280
|
}
|
|
2281
|
+
// update the status of the setting
|
|
2354
2282
|
set(setting, value) {
|
|
2355
|
-
this._storage.setConfiguration({
|
|
2356
|
-
[setting]: value
|
|
2357
|
-
});
|
|
2283
|
+
this._storage.setConfiguration({ [setting]: value });
|
|
2358
2284
|
}
|
|
2285
|
+
/** Logs the current settings as a table */
|
|
2359
2286
|
settings() {
|
|
2360
2287
|
if (console.table) {
|
|
2361
2288
|
console.table(this._storage.config);
|
|
@@ -2363,8 +2290,11 @@ var __exports__ = (() => {
|
|
|
2363
2290
|
console.log(this._storage.config);
|
|
2364
2291
|
}
|
|
2365
2292
|
}
|
|
2293
|
+
// Unconditional logging
|
|
2366
2294
|
assert(condition, message) {
|
|
2367
|
-
|
|
2295
|
+
if (!condition) {
|
|
2296
|
+
throw new Error(message || "Assertion failed");
|
|
2297
|
+
}
|
|
2368
2298
|
}
|
|
2369
2299
|
warn(message) {
|
|
2370
2300
|
return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
|
|
@@ -2372,11 +2302,13 @@ var __exports__ = (() => {
|
|
|
2372
2302
|
error(message) {
|
|
2373
2303
|
return this._getLogFunction(0, message, originalConsole.error, arguments);
|
|
2374
2304
|
}
|
|
2305
|
+
/** Print a deprecation warning */
|
|
2375
2306
|
deprecated(oldUsage, newUsage) {
|
|
2376
|
-
return this.warn(
|
|
2307
|
+
return this.warn(`\`${oldUsage}\` is deprecated and will be removed in a later version. Use \`${newUsage}\` instead`);
|
|
2377
2308
|
}
|
|
2309
|
+
/** Print a removal warning */
|
|
2378
2310
|
removed(oldUsage, newUsage) {
|
|
2379
|
-
return this.error(
|
|
2311
|
+
return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
|
|
2380
2312
|
}
|
|
2381
2313
|
probe(logLevel, message) {
|
|
2382
2314
|
return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
|
|
@@ -2393,6 +2325,7 @@ var __exports__ = (() => {
|
|
|
2393
2325
|
once(logLevel, message) {
|
|
2394
2326
|
return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
|
|
2395
2327
|
}
|
|
2328
|
+
/** Logs an object as a table */
|
|
2396
2329
|
table(logLevel, table, columns) {
|
|
2397
2330
|
if (table) {
|
|
2398
2331
|
return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
|
|
@@ -2401,27 +2334,6 @@ var __exports__ = (() => {
|
|
|
2401
2334
|
}
|
|
2402
2335
|
return noop;
|
|
2403
2336
|
}
|
|
2404
|
-
image(_ref) {
|
|
2405
|
-
let {
|
|
2406
|
-
logLevel,
|
|
2407
|
-
priority,
|
|
2408
|
-
image,
|
|
2409
|
-
message = "",
|
|
2410
|
-
scale = 1
|
|
2411
|
-
} = _ref;
|
|
2412
|
-
if (!this._shouldLog(logLevel || priority)) {
|
|
2413
|
-
return noop;
|
|
2414
|
-
}
|
|
2415
|
-
return isBrowser2() ? logImageInBrowser({
|
|
2416
|
-
image,
|
|
2417
|
-
message,
|
|
2418
|
-
scale
|
|
2419
|
-
}) : logImageInNode({
|
|
2420
|
-
image,
|
|
2421
|
-
message,
|
|
2422
|
-
scale
|
|
2423
|
-
});
|
|
2424
|
-
}
|
|
2425
2337
|
time(logLevel, message) {
|
|
2426
2338
|
return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
|
|
2427
2339
|
}
|
|
@@ -2431,30 +2343,19 @@ var __exports__ = (() => {
|
|
|
2431
2343
|
timeStamp(logLevel, message) {
|
|
2432
2344
|
return this._getLogFunction(logLevel, message, console.timeStamp || noop);
|
|
2433
2345
|
}
|
|
2434
|
-
group(logLevel, message) {
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
};
|
|
2438
|
-
const options = normalizeArguments({
|
|
2439
|
-
logLevel,
|
|
2440
|
-
message,
|
|
2441
|
-
opts
|
|
2442
|
-
});
|
|
2443
|
-
const {
|
|
2444
|
-
collapsed
|
|
2445
|
-
} = opts;
|
|
2346
|
+
group(logLevel, message, opts = { collapsed: false }) {
|
|
2347
|
+
const options = normalizeArguments({ logLevel, message, opts });
|
|
2348
|
+
const { collapsed } = opts;
|
|
2446
2349
|
options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
|
|
2447
2350
|
return this._getLogFunction(options);
|
|
2448
2351
|
}
|
|
2449
|
-
groupCollapsed(logLevel, message) {
|
|
2450
|
-
|
|
2451
|
-
return this.group(logLevel, message, Object.assign({}, opts, {
|
|
2452
|
-
collapsed: true
|
|
2453
|
-
}));
|
|
2352
|
+
groupCollapsed(logLevel, message, opts = {}) {
|
|
2353
|
+
return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
|
|
2454
2354
|
}
|
|
2455
2355
|
groupEnd(logLevel) {
|
|
2456
2356
|
return this._getLogFunction(logLevel, "", console.groupEnd || noop);
|
|
2457
2357
|
}
|
|
2358
|
+
// EXPERIMENTAL
|
|
2458
2359
|
withGroup(logLevel, message, func) {
|
|
2459
2360
|
this.group(logLevel, message)();
|
|
2460
2361
|
try {
|
|
@@ -2468,17 +2369,14 @@ var __exports__ = (() => {
|
|
|
2468
2369
|
console.trace();
|
|
2469
2370
|
}
|
|
2470
2371
|
}
|
|
2372
|
+
// PRIVATE METHODS
|
|
2373
|
+
/** Deduces log level from a variety of arguments */
|
|
2471
2374
|
_shouldLog(logLevel) {
|
|
2472
2375
|
return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
|
|
2473
2376
|
}
|
|
2474
2377
|
_getLogFunction(logLevel, message, method, args, opts) {
|
|
2475
2378
|
if (this._shouldLog(logLevel)) {
|
|
2476
|
-
opts = normalizeArguments({
|
|
2477
|
-
logLevel,
|
|
2478
|
-
message,
|
|
2479
|
-
args,
|
|
2480
|
-
opts
|
|
2481
|
-
});
|
|
2379
|
+
opts = normalizeArguments({ logLevel, message, args, opts });
|
|
2482
2380
|
method = method || opts.method;
|
|
2483
2381
|
assert2(method);
|
|
2484
2382
|
opts.total = this.getTotal();
|
|
@@ -2498,7 +2396,7 @@ var __exports__ = (() => {
|
|
|
2498
2396
|
return noop;
|
|
2499
2397
|
}
|
|
2500
2398
|
};
|
|
2501
|
-
|
|
2399
|
+
Log.VERSION = VERSION2;
|
|
2502
2400
|
function normalizeLogLevel(logLevel) {
|
|
2503
2401
|
if (!logLevel) {
|
|
2504
2402
|
return 0;
|
|
@@ -2518,10 +2416,7 @@ var __exports__ = (() => {
|
|
|
2518
2416
|
return resolvedLevel;
|
|
2519
2417
|
}
|
|
2520
2418
|
function normalizeArguments(opts) {
|
|
2521
|
-
const {
|
|
2522
|
-
logLevel,
|
|
2523
|
-
message
|
|
2524
|
-
} = opts;
|
|
2419
|
+
const { logLevel, message } = opts;
|
|
2525
2420
|
opts.logLevel = normalizeLogLevel(logLevel);
|
|
2526
2421
|
const args = opts.args ? Array.from(opts.args) : [];
|
|
2527
2422
|
while (args.length && args.shift() !== message) {
|
|
@@ -2544,55 +2439,16 @@ var __exports__ = (() => {
|
|
|
2544
2439
|
}
|
|
2545
2440
|
const messageType = typeof opts.message;
|
|
2546
2441
|
assert2(messageType === "string" || messageType === "object");
|
|
2547
|
-
return Object.assign(opts, {
|
|
2548
|
-
args
|
|
2549
|
-
}, opts.opts);
|
|
2442
|
+
return Object.assign(opts, { args }, opts.opts);
|
|
2550
2443
|
}
|
|
2551
2444
|
function decorateMessage(id, message, opts) {
|
|
2552
2445
|
if (typeof message === "string") {
|
|
2553
2446
|
const time = opts.time ? leftPad(formatTime(opts.total)) : "";
|
|
2554
|
-
message = opts.time ?
|
|
2447
|
+
message = opts.time ? `${id}: ${time} ${message}` : `${id}: ${message}`;
|
|
2555
2448
|
message = addColor(message, opts.color, opts.background);
|
|
2556
2449
|
}
|
|
2557
2450
|
return message;
|
|
2558
2451
|
}
|
|
2559
|
-
function logImageInNode(_ref2) {
|
|
2560
|
-
let {
|
|
2561
|
-
image,
|
|
2562
|
-
message = "",
|
|
2563
|
-
scale = 1
|
|
2564
|
-
} = _ref2;
|
|
2565
|
-
console.warn("removed");
|
|
2566
|
-
return noop;
|
|
2567
|
-
}
|
|
2568
|
-
function logImageInBrowser(_ref3) {
|
|
2569
|
-
let {
|
|
2570
|
-
image,
|
|
2571
|
-
message = "",
|
|
2572
|
-
scale = 1
|
|
2573
|
-
} = _ref3;
|
|
2574
|
-
if (typeof image === "string") {
|
|
2575
|
-
const img = new Image();
|
|
2576
|
-
img.onload = () => {
|
|
2577
|
-
const args = formatImage(img, message, scale);
|
|
2578
|
-
console.log(...args);
|
|
2579
|
-
};
|
|
2580
|
-
img.src = image;
|
|
2581
|
-
return noop;
|
|
2582
|
-
}
|
|
2583
|
-
const element = image.nodeName || "";
|
|
2584
|
-
if (element.toLowerCase() === "img") {
|
|
2585
|
-
console.log(...formatImage(image, message, scale));
|
|
2586
|
-
return noop;
|
|
2587
|
-
}
|
|
2588
|
-
if (element.toLowerCase() === "canvas") {
|
|
2589
|
-
const img = new Image();
|
|
2590
|
-
img.onload = () => console.log(...formatImage(img, message, scale));
|
|
2591
|
-
img.src = image.toDataURL();
|
|
2592
|
-
return noop;
|
|
2593
|
-
}
|
|
2594
|
-
return noop;
|
|
2595
|
-
}
|
|
2596
2452
|
function getTableHeader(table) {
|
|
2597
2453
|
for (const key in table) {
|
|
2598
2454
|
for (const title in table[key]) {
|
|
@@ -2602,10 +2458,11 @@ var __exports__ = (() => {
|
|
|
2602
2458
|
return "empty";
|
|
2603
2459
|
}
|
|
2604
2460
|
|
|
2461
|
+
// ../../node_modules/@probe.gl/log/dist/init.js
|
|
2462
|
+
globalThis.probe = {};
|
|
2463
|
+
|
|
2605
2464
|
// ../../node_modules/@probe.gl/log/dist/index.js
|
|
2606
|
-
var dist_default = new Log({
|
|
2607
|
-
id: "@probe.gl/log"
|
|
2608
|
-
});
|
|
2465
|
+
var dist_default = new Log({ id: "@probe.gl/log" });
|
|
2609
2466
|
|
|
2610
2467
|
// ../loader-utils/src/lib/log-utils/log.ts
|
|
2611
2468
|
var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
@@ -2621,6 +2478,199 @@ var __exports__ = (() => {
|
|
|
2621
2478
|
}
|
|
2622
2479
|
var log = createLog();
|
|
2623
2480
|
|
|
2481
|
+
// ../../node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
|
|
2482
|
+
function getHiResTimestamp2() {
|
|
2483
|
+
let timestamp;
|
|
2484
|
+
if (typeof window !== "undefined" && window.performance) {
|
|
2485
|
+
timestamp = window.performance.now();
|
|
2486
|
+
} else if (typeof process !== "undefined" && process.hrtime) {
|
|
2487
|
+
const timeParts = process.hrtime();
|
|
2488
|
+
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
2489
|
+
} else {
|
|
2490
|
+
timestamp = Date.now();
|
|
2491
|
+
}
|
|
2492
|
+
return timestamp;
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
// ../../node_modules/@probe.gl/stats/dist/lib/stat.js
|
|
2496
|
+
var Stat = class {
|
|
2497
|
+
constructor(name, type) {
|
|
2498
|
+
this.sampleSize = 1;
|
|
2499
|
+
this.time = 0;
|
|
2500
|
+
this.count = 0;
|
|
2501
|
+
this.samples = 0;
|
|
2502
|
+
this.lastTiming = 0;
|
|
2503
|
+
this.lastSampleTime = 0;
|
|
2504
|
+
this.lastSampleCount = 0;
|
|
2505
|
+
this._count = 0;
|
|
2506
|
+
this._time = 0;
|
|
2507
|
+
this._samples = 0;
|
|
2508
|
+
this._startTime = 0;
|
|
2509
|
+
this._timerPending = false;
|
|
2510
|
+
this.name = name;
|
|
2511
|
+
this.type = type;
|
|
2512
|
+
this.reset();
|
|
2513
|
+
}
|
|
2514
|
+
reset() {
|
|
2515
|
+
this.time = 0;
|
|
2516
|
+
this.count = 0;
|
|
2517
|
+
this.samples = 0;
|
|
2518
|
+
this.lastTiming = 0;
|
|
2519
|
+
this.lastSampleTime = 0;
|
|
2520
|
+
this.lastSampleCount = 0;
|
|
2521
|
+
this._count = 0;
|
|
2522
|
+
this._time = 0;
|
|
2523
|
+
this._samples = 0;
|
|
2524
|
+
this._startTime = 0;
|
|
2525
|
+
this._timerPending = false;
|
|
2526
|
+
return this;
|
|
2527
|
+
}
|
|
2528
|
+
setSampleSize(samples) {
|
|
2529
|
+
this.sampleSize = samples;
|
|
2530
|
+
return this;
|
|
2531
|
+
}
|
|
2532
|
+
/** Call to increment count (+1) */
|
|
2533
|
+
incrementCount() {
|
|
2534
|
+
this.addCount(1);
|
|
2535
|
+
return this;
|
|
2536
|
+
}
|
|
2537
|
+
/** Call to decrement count (-1) */
|
|
2538
|
+
decrementCount() {
|
|
2539
|
+
this.subtractCount(1);
|
|
2540
|
+
return this;
|
|
2541
|
+
}
|
|
2542
|
+
/** Increase count */
|
|
2543
|
+
addCount(value) {
|
|
2544
|
+
this._count += value;
|
|
2545
|
+
this._samples++;
|
|
2546
|
+
this._checkSampling();
|
|
2547
|
+
return this;
|
|
2548
|
+
}
|
|
2549
|
+
/** Decrease count */
|
|
2550
|
+
subtractCount(value) {
|
|
2551
|
+
this._count -= value;
|
|
2552
|
+
this._samples++;
|
|
2553
|
+
this._checkSampling();
|
|
2554
|
+
return this;
|
|
2555
|
+
}
|
|
2556
|
+
/** Add an arbitrary timing and bump the count */
|
|
2557
|
+
addTime(time) {
|
|
2558
|
+
this._time += time;
|
|
2559
|
+
this.lastTiming = time;
|
|
2560
|
+
this._samples++;
|
|
2561
|
+
this._checkSampling();
|
|
2562
|
+
return this;
|
|
2563
|
+
}
|
|
2564
|
+
/** Start a timer */
|
|
2565
|
+
timeStart() {
|
|
2566
|
+
this._startTime = getHiResTimestamp2();
|
|
2567
|
+
this._timerPending = true;
|
|
2568
|
+
return this;
|
|
2569
|
+
}
|
|
2570
|
+
/** End a timer. Adds to time and bumps the timing count. */
|
|
2571
|
+
timeEnd() {
|
|
2572
|
+
if (!this._timerPending) {
|
|
2573
|
+
return this;
|
|
2574
|
+
}
|
|
2575
|
+
this.addTime(getHiResTimestamp2() - this._startTime);
|
|
2576
|
+
this._timerPending = false;
|
|
2577
|
+
this._checkSampling();
|
|
2578
|
+
return this;
|
|
2579
|
+
}
|
|
2580
|
+
getSampleAverageCount() {
|
|
2581
|
+
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
|
|
2582
|
+
}
|
|
2583
|
+
/** Calculate average time / count for the previous window */
|
|
2584
|
+
getSampleAverageTime() {
|
|
2585
|
+
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
|
|
2586
|
+
}
|
|
2587
|
+
/** Calculate counts per second for the previous window */
|
|
2588
|
+
getSampleHz() {
|
|
2589
|
+
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
|
|
2590
|
+
}
|
|
2591
|
+
getAverageCount() {
|
|
2592
|
+
return this.samples > 0 ? this.count / this.samples : 0;
|
|
2593
|
+
}
|
|
2594
|
+
/** Calculate average time / count */
|
|
2595
|
+
getAverageTime() {
|
|
2596
|
+
return this.samples > 0 ? this.time / this.samples : 0;
|
|
2597
|
+
}
|
|
2598
|
+
/** Calculate counts per second */
|
|
2599
|
+
getHz() {
|
|
2600
|
+
return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
|
|
2601
|
+
}
|
|
2602
|
+
_checkSampling() {
|
|
2603
|
+
if (this._samples === this.sampleSize) {
|
|
2604
|
+
this.lastSampleTime = this._time;
|
|
2605
|
+
this.lastSampleCount = this._count;
|
|
2606
|
+
this.count += this._count;
|
|
2607
|
+
this.time += this._time;
|
|
2608
|
+
this.samples += this._samples;
|
|
2609
|
+
this._time = 0;
|
|
2610
|
+
this._count = 0;
|
|
2611
|
+
this._samples = 0;
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
|
|
2616
|
+
// ../../node_modules/@probe.gl/stats/dist/lib/stats.js
|
|
2617
|
+
var Stats = class {
|
|
2618
|
+
constructor(options) {
|
|
2619
|
+
this.stats = {};
|
|
2620
|
+
this.id = options.id;
|
|
2621
|
+
this.stats = {};
|
|
2622
|
+
this._initializeStats(options.stats);
|
|
2623
|
+
Object.seal(this);
|
|
2624
|
+
}
|
|
2625
|
+
/** Acquire a stat. Create if it doesn't exist. */
|
|
2626
|
+
get(name, type = "count") {
|
|
2627
|
+
return this._getOrCreate({ name, type });
|
|
2628
|
+
}
|
|
2629
|
+
get size() {
|
|
2630
|
+
return Object.keys(this.stats).length;
|
|
2631
|
+
}
|
|
2632
|
+
/** Reset all stats */
|
|
2633
|
+
reset() {
|
|
2634
|
+
for (const stat of Object.values(this.stats)) {
|
|
2635
|
+
stat.reset();
|
|
2636
|
+
}
|
|
2637
|
+
return this;
|
|
2638
|
+
}
|
|
2639
|
+
forEach(fn) {
|
|
2640
|
+
for (const stat of Object.values(this.stats)) {
|
|
2641
|
+
fn(stat);
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
getTable() {
|
|
2645
|
+
const table = {};
|
|
2646
|
+
this.forEach((stat) => {
|
|
2647
|
+
table[stat.name] = {
|
|
2648
|
+
time: stat.time || 0,
|
|
2649
|
+
count: stat.count || 0,
|
|
2650
|
+
average: stat.getAverageTime() || 0,
|
|
2651
|
+
hz: stat.getHz() || 0
|
|
2652
|
+
};
|
|
2653
|
+
});
|
|
2654
|
+
return table;
|
|
2655
|
+
}
|
|
2656
|
+
_initializeStats(stats = []) {
|
|
2657
|
+
stats.forEach((stat) => this._getOrCreate(stat));
|
|
2658
|
+
}
|
|
2659
|
+
_getOrCreate(stat) {
|
|
2660
|
+
const { name, type } = stat;
|
|
2661
|
+
let result = this.stats[name];
|
|
2662
|
+
if (!result) {
|
|
2663
|
+
if (stat instanceof Stat) {
|
|
2664
|
+
result = stat;
|
|
2665
|
+
} else {
|
|
2666
|
+
result = new Stat(name, type);
|
|
2667
|
+
}
|
|
2668
|
+
this.stats[name] = result;
|
|
2669
|
+
}
|
|
2670
|
+
return result;
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
|
|
2624
2674
|
// ../loader-utils/src/lib/path-utils/file-aliases.ts
|
|
2625
2675
|
var pathPrefix = "";
|
|
2626
2676
|
var fileAliases = {};
|
|
@@ -3943,199 +3993,6 @@ var __exports__ = (() => {
|
|
|
3943
3993
|
return Math.abs(s.split("").reduce((a, b) => (a << 5) - a + b.charCodeAt(0) | 0, 0));
|
|
3944
3994
|
}
|
|
3945
3995
|
|
|
3946
|
-
// node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
|
|
3947
|
-
function getHiResTimestamp2() {
|
|
3948
|
-
let timestamp;
|
|
3949
|
-
if (typeof window !== "undefined" && window.performance) {
|
|
3950
|
-
timestamp = window.performance.now();
|
|
3951
|
-
} else if (typeof process !== "undefined" && process.hrtime) {
|
|
3952
|
-
const timeParts = process.hrtime();
|
|
3953
|
-
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
3954
|
-
} else {
|
|
3955
|
-
timestamp = Date.now();
|
|
3956
|
-
}
|
|
3957
|
-
return timestamp;
|
|
3958
|
-
}
|
|
3959
|
-
|
|
3960
|
-
// node_modules/@probe.gl/stats/dist/lib/stat.js
|
|
3961
|
-
var Stat = class {
|
|
3962
|
-
constructor(name, type) {
|
|
3963
|
-
this.sampleSize = 1;
|
|
3964
|
-
this.time = 0;
|
|
3965
|
-
this.count = 0;
|
|
3966
|
-
this.samples = 0;
|
|
3967
|
-
this.lastTiming = 0;
|
|
3968
|
-
this.lastSampleTime = 0;
|
|
3969
|
-
this.lastSampleCount = 0;
|
|
3970
|
-
this._count = 0;
|
|
3971
|
-
this._time = 0;
|
|
3972
|
-
this._samples = 0;
|
|
3973
|
-
this._startTime = 0;
|
|
3974
|
-
this._timerPending = false;
|
|
3975
|
-
this.name = name;
|
|
3976
|
-
this.type = type;
|
|
3977
|
-
this.reset();
|
|
3978
|
-
}
|
|
3979
|
-
reset() {
|
|
3980
|
-
this.time = 0;
|
|
3981
|
-
this.count = 0;
|
|
3982
|
-
this.samples = 0;
|
|
3983
|
-
this.lastTiming = 0;
|
|
3984
|
-
this.lastSampleTime = 0;
|
|
3985
|
-
this.lastSampleCount = 0;
|
|
3986
|
-
this._count = 0;
|
|
3987
|
-
this._time = 0;
|
|
3988
|
-
this._samples = 0;
|
|
3989
|
-
this._startTime = 0;
|
|
3990
|
-
this._timerPending = false;
|
|
3991
|
-
return this;
|
|
3992
|
-
}
|
|
3993
|
-
setSampleSize(samples) {
|
|
3994
|
-
this.sampleSize = samples;
|
|
3995
|
-
return this;
|
|
3996
|
-
}
|
|
3997
|
-
/** Call to increment count (+1) */
|
|
3998
|
-
incrementCount() {
|
|
3999
|
-
this.addCount(1);
|
|
4000
|
-
return this;
|
|
4001
|
-
}
|
|
4002
|
-
/** Call to decrement count (-1) */
|
|
4003
|
-
decrementCount() {
|
|
4004
|
-
this.subtractCount(1);
|
|
4005
|
-
return this;
|
|
4006
|
-
}
|
|
4007
|
-
/** Increase count */
|
|
4008
|
-
addCount(value) {
|
|
4009
|
-
this._count += value;
|
|
4010
|
-
this._samples++;
|
|
4011
|
-
this._checkSampling();
|
|
4012
|
-
return this;
|
|
4013
|
-
}
|
|
4014
|
-
/** Decrease count */
|
|
4015
|
-
subtractCount(value) {
|
|
4016
|
-
this._count -= value;
|
|
4017
|
-
this._samples++;
|
|
4018
|
-
this._checkSampling();
|
|
4019
|
-
return this;
|
|
4020
|
-
}
|
|
4021
|
-
/** Add an arbitrary timing and bump the count */
|
|
4022
|
-
addTime(time) {
|
|
4023
|
-
this._time += time;
|
|
4024
|
-
this.lastTiming = time;
|
|
4025
|
-
this._samples++;
|
|
4026
|
-
this._checkSampling();
|
|
4027
|
-
return this;
|
|
4028
|
-
}
|
|
4029
|
-
/** Start a timer */
|
|
4030
|
-
timeStart() {
|
|
4031
|
-
this._startTime = getHiResTimestamp2();
|
|
4032
|
-
this._timerPending = true;
|
|
4033
|
-
return this;
|
|
4034
|
-
}
|
|
4035
|
-
/** End a timer. Adds to time and bumps the timing count. */
|
|
4036
|
-
timeEnd() {
|
|
4037
|
-
if (!this._timerPending) {
|
|
4038
|
-
return this;
|
|
4039
|
-
}
|
|
4040
|
-
this.addTime(getHiResTimestamp2() - this._startTime);
|
|
4041
|
-
this._timerPending = false;
|
|
4042
|
-
this._checkSampling();
|
|
4043
|
-
return this;
|
|
4044
|
-
}
|
|
4045
|
-
getSampleAverageCount() {
|
|
4046
|
-
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
|
|
4047
|
-
}
|
|
4048
|
-
/** Calculate average time / count for the previous window */
|
|
4049
|
-
getSampleAverageTime() {
|
|
4050
|
-
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
|
|
4051
|
-
}
|
|
4052
|
-
/** Calculate counts per second for the previous window */
|
|
4053
|
-
getSampleHz() {
|
|
4054
|
-
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
|
|
4055
|
-
}
|
|
4056
|
-
getAverageCount() {
|
|
4057
|
-
return this.samples > 0 ? this.count / this.samples : 0;
|
|
4058
|
-
}
|
|
4059
|
-
/** Calculate average time / count */
|
|
4060
|
-
getAverageTime() {
|
|
4061
|
-
return this.samples > 0 ? this.time / this.samples : 0;
|
|
4062
|
-
}
|
|
4063
|
-
/** Calculate counts per second */
|
|
4064
|
-
getHz() {
|
|
4065
|
-
return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
|
|
4066
|
-
}
|
|
4067
|
-
_checkSampling() {
|
|
4068
|
-
if (this._samples === this.sampleSize) {
|
|
4069
|
-
this.lastSampleTime = this._time;
|
|
4070
|
-
this.lastSampleCount = this._count;
|
|
4071
|
-
this.count += this._count;
|
|
4072
|
-
this.time += this._time;
|
|
4073
|
-
this.samples += this._samples;
|
|
4074
|
-
this._time = 0;
|
|
4075
|
-
this._count = 0;
|
|
4076
|
-
this._samples = 0;
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
};
|
|
4080
|
-
|
|
4081
|
-
// node_modules/@probe.gl/stats/dist/lib/stats.js
|
|
4082
|
-
var Stats = class {
|
|
4083
|
-
constructor(options) {
|
|
4084
|
-
this.stats = {};
|
|
4085
|
-
this.id = options.id;
|
|
4086
|
-
this.stats = {};
|
|
4087
|
-
this._initializeStats(options.stats);
|
|
4088
|
-
Object.seal(this);
|
|
4089
|
-
}
|
|
4090
|
-
/** Acquire a stat. Create if it doesn't exist. */
|
|
4091
|
-
get(name, type = "count") {
|
|
4092
|
-
return this._getOrCreate({ name, type });
|
|
4093
|
-
}
|
|
4094
|
-
get size() {
|
|
4095
|
-
return Object.keys(this.stats).length;
|
|
4096
|
-
}
|
|
4097
|
-
/** Reset all stats */
|
|
4098
|
-
reset() {
|
|
4099
|
-
for (const stat of Object.values(this.stats)) {
|
|
4100
|
-
stat.reset();
|
|
4101
|
-
}
|
|
4102
|
-
return this;
|
|
4103
|
-
}
|
|
4104
|
-
forEach(fn) {
|
|
4105
|
-
for (const stat of Object.values(this.stats)) {
|
|
4106
|
-
fn(stat);
|
|
4107
|
-
}
|
|
4108
|
-
}
|
|
4109
|
-
getTable() {
|
|
4110
|
-
const table = {};
|
|
4111
|
-
this.forEach((stat) => {
|
|
4112
|
-
table[stat.name] = {
|
|
4113
|
-
time: stat.time || 0,
|
|
4114
|
-
count: stat.count || 0,
|
|
4115
|
-
average: stat.getAverageTime() || 0,
|
|
4116
|
-
hz: stat.getHz() || 0
|
|
4117
|
-
};
|
|
4118
|
-
});
|
|
4119
|
-
return table;
|
|
4120
|
-
}
|
|
4121
|
-
_initializeStats(stats = []) {
|
|
4122
|
-
stats.forEach((stat) => this._getOrCreate(stat));
|
|
4123
|
-
}
|
|
4124
|
-
_getOrCreate(stat) {
|
|
4125
|
-
const { name, type } = stat;
|
|
4126
|
-
let result = this.stats[name];
|
|
4127
|
-
if (!result) {
|
|
4128
|
-
if (stat instanceof Stat) {
|
|
4129
|
-
result = stat;
|
|
4130
|
-
} else {
|
|
4131
|
-
result = new Stat(name, type);
|
|
4132
|
-
}
|
|
4133
|
-
this.stats[name] = result;
|
|
4134
|
-
}
|
|
4135
|
-
return result;
|
|
4136
|
-
}
|
|
4137
|
-
};
|
|
4138
|
-
|
|
4139
3996
|
// src/lib/vector-tiler/proto-tile.ts
|
|
4140
3997
|
function createProtoTile(features2, z, tx, ty, options) {
|
|
4141
3998
|
const tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);
|