vega 0.4.0 → 0.5.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.
@@ -1,4587 +1,6 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vega'), require('vega-lite')) :
3
- typeof define === 'function' && define.amd ? define(['vega', 'vega-lite'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.vegaEmbed = factory(global.vega, global.vegaLite));
5
- })(this, (function (vegaImport, vegaLiteImport) { 'use strict';
6
-
7
- function _interopNamespaceDefault(e) {
8
- var n = Object.create(null);
9
- if (e) {
10
- Object.keys(e).forEach(function (k) {
11
- if (k !== 'default') {
12
- var d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: function () { return e[k]; }
16
- });
17
- }
18
- });
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
-
24
- var vegaImport__namespace = /*#__PURE__*/_interopNamespaceDefault(vegaImport);
25
- var vegaLiteImport__namespace = /*#__PURE__*/_interopNamespaceDefault(vegaLiteImport);
26
-
27
- /*!
28
- * https://github.com/Starcounter-Jack/JSON-Patch
29
- * (c) 2017-2022 Joachim Wester
30
- * MIT licensed
31
- */
32
- var __extends = undefined && undefined.__extends || function () {
33
- var extendStatics = function (d, b) {
34
- extendStatics = Object.setPrototypeOf || {
35
- __proto__: []
36
- } instanceof Array && function (d, b) {
37
- d.__proto__ = b;
38
- } || function (d, b) {
39
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
40
- };
41
- return extendStatics(d, b);
42
- };
43
- return function (d, b) {
44
- extendStatics(d, b);
45
- function __() {
46
- this.constructor = d;
47
- }
48
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49
- };
50
- }();
51
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
52
- function hasOwnProperty(obj, key) {
53
- return _hasOwnProperty.call(obj, key);
54
- }
55
- function _objectKeys(obj) {
56
- if (Array.isArray(obj)) {
57
- var keys_1 = new Array(obj.length);
58
- for (var k = 0; k < keys_1.length; k++) {
59
- keys_1[k] = "" + k;
60
- }
61
- return keys_1;
62
- }
63
- if (Object.keys) {
64
- return Object.keys(obj);
65
- }
66
- var keys = [];
67
- for (var i in obj) {
68
- if (hasOwnProperty(obj, i)) {
69
- keys.push(i);
70
- }
71
- }
72
- return keys;
73
- }
74
- /**
75
- * Deeply clone the object.
76
- * https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)
77
- * @param {any} obj value to clone
78
- * @return {any} cloned obj
79
- */
80
- function _deepClone(obj) {
81
- switch (typeof obj) {
82
- case "object":
83
- return JSON.parse(JSON.stringify(obj));
84
- //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5
85
- case "undefined":
86
- return null;
87
- //this is how JSON.stringify behaves for array items
88
- default:
89
- return obj;
90
- //no need to clone primitives
91
- }
92
- }
93
- //3x faster than cached /^\d+$/.test(str)
94
- function isInteger(str) {
95
- var i = 0;
96
- var len = str.length;
97
- var charCode;
98
- while (i < len) {
99
- charCode = str.charCodeAt(i);
100
- if (charCode >= 48 && charCode <= 57) {
101
- i++;
102
- continue;
103
- }
104
- return false;
105
- }
106
- return true;
107
- }
108
- /**
109
- * Escapes a json pointer path
110
- * @param path The raw pointer
111
- * @return the Escaped path
112
- */
113
- function escapePathComponent(path) {
114
- if (path.indexOf('/') === -1 && path.indexOf('~') === -1) return path;
115
- return path.replace(/~/g, '~0').replace(/\//g, '~1');
116
- }
117
- /**
118
- * Unescapes a json pointer path
119
- * @param path The escaped pointer
120
- * @return The unescaped path
121
- */
122
- function unescapePathComponent(path) {
123
- return path.replace(/~1/g, '/').replace(/~0/g, '~');
124
- }
125
- /**
126
- * Recursively checks whether an object has any undefined values inside.
127
- */
128
- function hasUndefined(obj) {
129
- if (obj === undefined) {
130
- return true;
131
- }
132
- if (obj) {
133
- if (Array.isArray(obj)) {
134
- for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {
135
- if (hasUndefined(obj[i_1])) {
136
- return true;
137
- }
138
- }
139
- } else if (typeof obj === "object") {
140
- var objKeys = _objectKeys(obj);
141
- var objKeysLength = objKeys.length;
142
- for (var i = 0; i < objKeysLength; i++) {
143
- if (hasUndefined(obj[objKeys[i]])) {
144
- return true;
145
- }
146
- }
147
- }
148
- }
149
- return false;
150
- }
151
- function patchErrorMessageFormatter(message, args) {
152
- var messageParts = [message];
153
- for (var key in args) {
154
- var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print
155
- if (typeof value !== 'undefined') {
156
- messageParts.push(key + ": " + value);
157
- }
158
- }
159
- return messageParts.join('\n');
160
- }
161
- var PatchError = /** @class */function (_super) {
162
- __extends(PatchError, _super);
163
- function PatchError(message, name, index, operation, tree) {
164
- var _newTarget = this.constructor;
165
- var _this = _super.call(this, patchErrorMessageFormatter(message, {
166
- name: name,
167
- index: index,
168
- operation: operation,
169
- tree: tree
170
- })) || this;
171
- _this.name = name;
172
- _this.index = index;
173
- _this.operation = operation;
174
- _this.tree = tree;
175
- Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359
176
- _this.message = patchErrorMessageFormatter(message, {
177
- name: name,
178
- index: index,
179
- operation: operation,
180
- tree: tree
181
- });
182
- return _this;
183
- }
184
- return PatchError;
185
- }(Error);
186
-
187
- var JsonPatchError = PatchError;
188
- var deepClone = _deepClone;
189
- /* We use a Javascript hash to store each
190
- function. Each hash entry (property) uses
191
- the operation identifiers specified in rfc6902.
192
- In this way, we can map each patch operation
193
- to its dedicated function in efficient way.
194
- */
195
- /* The operations applicable to an object */
196
- var objOps = {
197
- add: function (obj, key, document) {
198
- obj[key] = this.value;
199
- return {
200
- newDocument: document
201
- };
202
- },
203
- remove: function (obj, key, document) {
204
- var removed = obj[key];
205
- delete obj[key];
206
- return {
207
- newDocument: document,
208
- removed: removed
209
- };
210
- },
211
- replace: function (obj, key, document) {
212
- var removed = obj[key];
213
- obj[key] = this.value;
214
- return {
215
- newDocument: document,
216
- removed: removed
217
- };
218
- },
219
- move: function (obj, key, document) {
220
- /* in case move target overwrites an existing value,
221
- return the removed value, this can be taxing performance-wise,
222
- and is potentially unneeded */
223
- var removed = getValueByPointer(document, this.path);
224
- if (removed) {
225
- removed = _deepClone(removed);
226
- }
227
- var originalValue = applyOperation(document, {
228
- op: "remove",
229
- path: this.from
230
- }).removed;
231
- applyOperation(document, {
232
- op: "add",
233
- path: this.path,
234
- value: originalValue
235
- });
236
- return {
237
- newDocument: document,
238
- removed: removed
239
- };
240
- },
241
- copy: function (obj, key, document) {
242
- var valueToCopy = getValueByPointer(document, this.from);
243
- // enforce copy by value so further operations don't affect source (see issue #177)
244
- applyOperation(document, {
245
- op: "add",
246
- path: this.path,
247
- value: _deepClone(valueToCopy)
248
- });
249
- return {
250
- newDocument: document
251
- };
252
- },
253
- test: function (obj, key, document) {
254
- return {
255
- newDocument: document,
256
- test: _areEquals(obj[key], this.value)
257
- };
258
- },
259
- _get: function (obj, key, document) {
260
- this.value = obj[key];
261
- return {
262
- newDocument: document
263
- };
264
- }
265
- };
266
- /* The operations applicable to an array. Many are the same as for the object */
267
- var arrOps = {
268
- add: function (arr, i, document) {
269
- if (isInteger(i)) {
270
- arr.splice(i, 0, this.value);
271
- } else {
272
- // array props
273
- arr[i] = this.value;
274
- }
275
- // this may be needed when using '-' in an array
276
- return {
277
- newDocument: document,
278
- index: i
279
- };
280
- },
281
- remove: function (arr, i, document) {
282
- var removedList = arr.splice(i, 1);
283
- return {
284
- newDocument: document,
285
- removed: removedList[0]
286
- };
287
- },
288
- replace: function (arr, i, document) {
289
- var removed = arr[i];
290
- arr[i] = this.value;
291
- return {
292
- newDocument: document,
293
- removed: removed
294
- };
295
- },
296
- move: objOps.move,
297
- copy: objOps.copy,
298
- test: objOps.test,
299
- _get: objOps._get
300
- };
301
- /**
302
- * Retrieves a value from a JSON document by a JSON pointer.
303
- * Returns the value.
304
- *
305
- * @param document The document to get the value from
306
- * @param pointer an escaped JSON pointer
307
- * @return The retrieved value
308
- */
309
- function getValueByPointer(document, pointer) {
310
- if (pointer == '') {
311
- return document;
312
- }
313
- var getOriginalDestination = {
314
- op: "_get",
315
- path: pointer
316
- };
317
- applyOperation(document, getOriginalDestination);
318
- return getOriginalDestination.value;
319
- }
320
- /**
321
- * Apply a single JSON Patch Operation on a JSON document.
322
- * Returns the {newDocument, result} of the operation.
323
- * It modifies the `document` and `operation` objects - it gets the values by reference.
324
- * If you would like to avoid touching your values, clone them:
325
- * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.
326
- *
327
- * @param document The document to patch
328
- * @param operation The operation to apply
329
- * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
330
- * @param mutateDocument Whether to mutate the original document or clone it before applying
331
- * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
332
- * @return `{newDocument, result}` after the operation
333
- */
334
- function applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {
335
- if (validateOperation === void 0) {
336
- validateOperation = false;
337
- }
338
- if (mutateDocument === void 0) {
339
- mutateDocument = true;
340
- }
341
- if (banPrototypeModifications === void 0) {
342
- banPrototypeModifications = true;
343
- }
344
- if (index === void 0) {
345
- index = 0;
346
- }
347
- if (validateOperation) {
348
- if (typeof validateOperation == 'function') {
349
- validateOperation(operation, 0, document, operation.path);
350
- } else {
351
- validator(operation, 0);
352
- }
353
- }
354
- /* ROOT OPERATIONS */
355
- if (operation.path === "") {
356
- var returnValue = {
357
- newDocument: document
358
- };
359
- if (operation.op === 'add') {
360
- returnValue.newDocument = operation.value;
361
- return returnValue;
362
- } else if (operation.op === 'replace') {
363
- returnValue.newDocument = operation.value;
364
- returnValue.removed = document; //document we removed
365
- return returnValue;
366
- } else if (operation.op === 'move' || operation.op === 'copy') {
367
- // it's a move or copy to root
368
- returnValue.newDocument = getValueByPointer(document, operation.from); // get the value by json-pointer in `from` field
369
- if (operation.op === 'move') {
370
- // report removed item
371
- returnValue.removed = document;
372
- }
373
- return returnValue;
374
- } else if (operation.op === 'test') {
375
- returnValue.test = _areEquals(document, operation.value);
376
- if (returnValue.test === false) {
377
- throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
378
- }
379
- returnValue.newDocument = document;
380
- return returnValue;
381
- } else if (operation.op === 'remove') {
382
- // a remove on root
383
- returnValue.removed = document;
384
- returnValue.newDocument = null;
385
- return returnValue;
386
- } else if (operation.op === '_get') {
387
- operation.value = document;
388
- return returnValue;
389
- } else {
390
- /* bad operation */
391
- if (validateOperation) {
392
- throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
393
- } else {
394
- return returnValue;
395
- }
396
- }
397
- } /* END ROOT OPERATIONS */else {
398
- if (!mutateDocument) {
399
- document = _deepClone(document);
400
- }
401
- var path = operation.path || "";
402
- var keys = path.split('/');
403
- var obj = document;
404
- var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift
405
- var len = keys.length;
406
- var existingPathFragment = undefined;
407
- var key = void 0;
408
- var validateFunction = void 0;
409
- if (typeof validateOperation == 'function') {
410
- validateFunction = validateOperation;
411
- } else {
412
- validateFunction = validator;
413
- }
414
- while (true) {
415
- key = keys[t];
416
- if (key && key.indexOf('~') != -1) {
417
- key = unescapePathComponent(key);
418
- }
419
- if (banPrototypeModifications && (key == '__proto__' || key == 'prototype' && t > 0 && keys[t - 1] == 'constructor')) {
420
- throw new TypeError('JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');
421
- }
422
- if (validateOperation) {
423
- if (existingPathFragment === undefined) {
424
- if (obj[key] === undefined) {
425
- existingPathFragment = keys.slice(0, t).join('/');
426
- } else if (t == len - 1) {
427
- existingPathFragment = operation.path;
428
- }
429
- if (existingPathFragment !== undefined) {
430
- validateFunction(operation, 0, document, existingPathFragment);
431
- }
432
- }
433
- }
434
- t++;
435
- if (Array.isArray(obj)) {
436
- if (key === '-') {
437
- key = obj.length;
438
- } else {
439
- if (validateOperation && !isInteger(key)) {
440
- throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation, document);
441
- } // only parse key when it's an integer for `arr.prop` to work
442
- else if (isInteger(key)) {
443
- key = ~~key;
444
- }
445
- }
446
- if (t >= len) {
447
- if (validateOperation && operation.op === "add" && key > obj.length) {
448
- throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation, document);
449
- }
450
- var returnValue = arrOps[operation.op].call(operation, obj, key, document); // Apply patch
451
- if (returnValue.test === false) {
452
- throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
453
- }
454
- return returnValue;
455
- }
456
- } else {
457
- if (t >= len) {
458
- var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch
459
- if (returnValue.test === false) {
460
- throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
461
- }
462
- return returnValue;
463
- }
464
- }
465
- obj = obj[key];
466
- // If we have more keys in the path, but the next value isn't a non-null object,
467
- // throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.
468
- if (validateOperation && t < len && (!obj || typeof obj !== "object")) {
469
- throw new JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
470
- }
471
- }
472
- }
473
- }
474
- /**
475
- * Apply a full JSON Patch array on a JSON document.
476
- * Returns the {newDocument, result} of the patch.
477
- * It modifies the `document` object and `patch` - it gets the values by reference.
478
- * If you would like to avoid touching your values, clone them:
479
- * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.
480
- *
481
- * @param document The document to patch
482
- * @param patch The patch to apply
483
- * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
484
- * @param mutateDocument Whether to mutate the original document or clone it before applying
485
- * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
486
- * @return An array of `{newDocument, result}` after the patch
487
- */
488
- function applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) {
489
- if (mutateDocument === void 0) {
490
- mutateDocument = true;
491
- }
492
- if (banPrototypeModifications === void 0) {
493
- banPrototypeModifications = true;
494
- }
495
- if (validateOperation) {
496
- if (!Array.isArray(patch)) {
497
- throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
498
- }
499
- }
500
- if (!mutateDocument) {
501
- document = _deepClone(document);
502
- }
503
- var results = new Array(patch.length);
504
- for (var i = 0, length_1 = patch.length; i < length_1; i++) {
505
- // we don't need to pass mutateDocument argument because if it was true, we already deep cloned the object, we'll just pass `true`
506
- results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);
507
- document = results[i].newDocument; // in case root was replaced
508
- }
509
- results.newDocument = document;
510
- return results;
511
- }
512
- /**
513
- * Apply a single JSON Patch Operation on a JSON document.
514
- * Returns the updated document.
515
- * Suitable as a reducer.
516
- *
517
- * @param document The document to patch
518
- * @param operation The operation to apply
519
- * @return The updated document
520
- */
521
- function applyReducer(document, operation, index) {
522
- var operationResult = applyOperation(document, operation);
523
- if (operationResult.test === false) {
524
- // failed test
525
- throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
526
- }
527
- return operationResult.newDocument;
528
- }
529
- /**
530
- * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.
531
- * @param {object} operation - operation object (patch)
532
- * @param {number} index - index of operation in the sequence
533
- * @param {object} [document] - object where the operation is supposed to be applied
534
- * @param {string} [existingPathFragment] - comes along with `document`
535
- */
536
- function validator(operation, index, document, existingPathFragment) {
537
- if (typeof operation !== 'object' || operation === null || Array.isArray(operation)) {
538
- throw new JsonPatchError('Operation is not an object', 'OPERATION_NOT_AN_OBJECT', index, operation, document);
539
- } else if (!objOps[operation.op]) {
540
- throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
541
- } else if (typeof operation.path !== 'string') {
542
- throw new JsonPatchError('Operation `path` property is not a string', 'OPERATION_PATH_INVALID', index, operation, document);
543
- } else if (operation.path.indexOf('/') !== 0 && operation.path.length > 0) {
544
- // paths that aren't empty string should start with "/"
545
- throw new JsonPatchError('Operation `path` property must start with "/"', 'OPERATION_PATH_INVALID', index, operation, document);
546
- } else if ((operation.op === 'move' || operation.op === 'copy') && typeof operation.from !== 'string') {
547
- throw new JsonPatchError('Operation `from` property is not present (applicable in `move` and `copy` operations)', 'OPERATION_FROM_REQUIRED', index, operation, document);
548
- } else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {
549
- throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);
550
- } else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && hasUndefined(operation.value)) {
551
- throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);
552
- } else if (document) {
553
- if (operation.op == "add") {
554
- var pathLen = operation.path.split("/").length;
555
- var existingPathLen = existingPathFragment.split("/").length;
556
- if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {
557
- throw new JsonPatchError('Cannot perform an `add` operation at the desired path', 'OPERATION_PATH_CANNOT_ADD', index, operation, document);
558
- }
559
- } else if (operation.op === 'replace' || operation.op === 'remove' || operation.op === '_get') {
560
- if (operation.path !== existingPathFragment) {
561
- throw new JsonPatchError('Cannot perform the operation at a path that does not exist', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
562
- }
563
- } else if (operation.op === 'move' || operation.op === 'copy') {
564
- var existingValue = {
565
- op: "_get",
566
- path: operation.from,
567
- value: undefined
568
- };
569
- var error = validate([existingValue], document);
570
- if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {
571
- throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);
572
- }
573
- }
574
- }
575
- }
576
- /**
577
- * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.
578
- * If error is encountered, returns a JsonPatchError object
579
- * @param sequence
580
- * @param document
581
- * @returns {JsonPatchError|undefined}
582
- */
583
- function validate(sequence, document, externalValidator) {
584
- try {
585
- if (!Array.isArray(sequence)) {
586
- throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
587
- }
588
- if (document) {
589
- //clone document and sequence so that we can safely try applying operations
590
- applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true);
591
- } else {
592
- externalValidator = externalValidator || validator;
593
- for (var i = 0; i < sequence.length; i++) {
594
- externalValidator(sequence[i], i, document, undefined);
595
- }
596
- }
597
- } catch (e) {
598
- if (e instanceof JsonPatchError) {
599
- return e;
600
- } else {
601
- throw e;
602
- }
603
- }
604
- }
605
- // based on https://github.com/epoberezkin/fast-deep-equal
606
- // MIT License
607
- // Copyright (c) 2017 Evgeny Poberezkin
608
- // Permission is hereby granted, free of charge, to any person obtaining a copy
609
- // of this software and associated documentation files (the "Software"), to deal
610
- // in the Software without restriction, including without limitation the rights
611
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
612
- // copies of the Software, and to permit persons to whom the Software is
613
- // furnished to do so, subject to the following conditions:
614
- // The above copyright notice and this permission notice shall be included in all
615
- // copies or substantial portions of the Software.
616
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
617
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
618
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
619
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
620
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
621
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
622
- // SOFTWARE.
623
- function _areEquals(a, b) {
624
- if (a === b) return true;
625
- if (a && b && typeof a == 'object' && typeof b == 'object') {
626
- var arrA = Array.isArray(a),
627
- arrB = Array.isArray(b),
628
- i,
629
- length,
630
- key;
631
- if (arrA && arrB) {
632
- length = a.length;
633
- if (length != b.length) return false;
634
- for (i = length; i-- !== 0;) if (!_areEquals(a[i], b[i])) return false;
635
- return true;
636
- }
637
- if (arrA != arrB) return false;
638
- var keys = Object.keys(a);
639
- length = keys.length;
640
- if (length !== Object.keys(b).length) return false;
641
- for (i = length; i-- !== 0;) if (!b.hasOwnProperty(keys[i])) return false;
642
- for (i = length; i-- !== 0;) {
643
- key = keys[i];
644
- if (!_areEquals(a[key], b[key])) return false;
645
- }
646
- return true;
647
- }
648
- return a !== a && b !== b;
649
- }
650
-
651
- var core = /*#__PURE__*/Object.freeze({
652
- __proto__: null,
653
- JsonPatchError: JsonPatchError,
654
- _areEquals: _areEquals,
655
- applyOperation: applyOperation,
656
- applyPatch: applyPatch,
657
- applyReducer: applyReducer,
658
- deepClone: deepClone,
659
- getValueByPointer: getValueByPointer,
660
- validate: validate,
661
- validator: validator
662
- });
663
-
664
- /*!
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vega"),require("vega-lite")):"function"==typeof define&&define.amd?define(["vega","vega-lite"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).vegaEmbed=t(e.vega,e.vegaLite)}(this,(function(e,t){"use strict";function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,i=n(e),o=n(t),a=(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=Object.prototype.hasOwnProperty;function l(e,t){return s.call(e,t)}function c(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var r=[];for(var i in e)l(e,i)&&r.push(i);return r}function f(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function d(e){for(var t,n=0,r=e.length;n<r;){if(!((t=e.charCodeAt(n))>=48&&t<=57))return!1;n++}return!0}function p(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function h(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(u(e[t]))return!0}else if("object"==typeof e)for(var r=c(e),i=r.length,o=0;o<i;o++)if(u(e[r[o]]))return!0;return!1}function g(e,t){var n=[e];for(var r in t){var i="object"==typeof t[r]?JSON.stringify(t[r],null,2):t[r];void 0!==i&&n.push(r+": "+i)}return n.join("\n")}var m=function(e){function t(t,n,r,i,o){var a=this.constructor,s=e.call(this,g(t,{name:n,index:r,operation:i,tree:o}))||this;return s.name=n,s.index=r,s.operation=i,s.tree=o,Object.setPrototypeOf(s,a.prototype),s.message=g(t,{name:n,index:r,operation:i,tree:o}),s}return a(t,e),t}(Error),E=m,v=f,b={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=w(n,this.path);r&&(r=f(r));var i=O(n,{op:"remove",path:this.from}).removed;return O(n,{op:"add",path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=w(n,this.from);return O(n,{op:"add",path:this.path,value:f(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:x(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},y={add:function(e,t,n){return d(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:b.move,copy:b.copy,test:b.test,_get:b._get};function w(e,t){if(""==t)return e;var n={op:"_get",path:t};return O(e,n),n.value}function O(e,t,n,r,i,o){if(void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===i&&(i=!0),void 0===o&&(o=0),n&&("function"==typeof n?n(t,0,e,t.path):I(t,0)),""===t.path){var a={newDocument:e};if("add"===t.op)return a.newDocument=t.value,a;if("replace"===t.op)return a.newDocument=t.value,a.removed=e,a;if("move"===t.op||"copy"===t.op)return a.newDocument=w(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=x(e,t.value),!1===a.test)throw new E("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a.newDocument=e,a}if("remove"===t.op)return a.removed=e,a.newDocument=null,a;if("_get"===t.op)return t.value=e,a;if(n)throw new E("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return a}r||(e=f(e));var s=(t.path||"").split("/"),l=e,c=1,p=s.length,u=void 0,g=void 0,m=void 0;for(m="function"==typeof n?n:I;;){if((g=s[c])&&-1!=g.indexOf("~")&&(g=h(g)),i&&("__proto__"==g||"prototype"==g&&c>0&&"constructor"==s[c-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===u&&(void 0===l[g]?u=s.slice(0,c).join("/"):c==p-1&&(u=t.path),void 0!==u&&m(t,0,e,u)),c++,Array.isArray(l)){if("-"===g)g=l.length;else{if(n&&!d(g))throw new E("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);d(g)&&(g=~~g)}if(c>=p){if(n&&"add"===t.op&&g>l.length)throw new E("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);if(!1===(a=y[t.op].call(t,l,g,e)).test)throw new E("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(c>=p){if(!1===(a=b[t.op].call(t,l,g,e)).test)throw new E("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[g],n&&c<p&&(!l||"object"!=typeof l))throw new E("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}function A(e,t,n,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=!0),n&&!Array.isArray(t))throw new E("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=f(e));for(var o=new Array(t.length),a=0,s=t.length;a<s;a++)o[a]=O(e,t[a],n,!0,i,a),e=o[a].newDocument;return o.newDocument=e,o}function I(e,t,n,r){if("object"!=typeof e||null===e||Array.isArray(e))throw new E("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!b[e.op])throw new E("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new E("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new E('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new E("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&u(e.value))throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var i=e.path.split("/").length,o=r.split("/").length;if(i!==o+1&&i!==o)throw new E("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==r)throw new E("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var a=L([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new E("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function L(e,t,n){try{if(!Array.isArray(e))throw new E("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)A(f(t),f(e),n||!0);else{n=n||I;for(var r=0;r<e.length;r++)n(e[r],r,t,void 0)}}catch(e){if(e instanceof E)return e;throw e}}function x(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,r,i,o=Array.isArray(e),a=Array.isArray(t);if(o&&a){if((r=e.length)!=t.length)return!1;for(n=r;0!=n--;)if(!x(e[n],t[n]))return!1;return!0}if(o!=a)return!1;var s=Object.keys(e);if((r=s.length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!t.hasOwnProperty(s[n]))return!1;for(n=r;0!=n--;)if(!x(e[i=s[n]],t[i]))return!1;return!0}return e!=e&&t!=t}var $=Object.freeze({__proto__:null,JsonPatchError:E,_areEquals:x,applyOperation:O,applyPatch:A,applyReducer:function(e,t,n){var r=O(e,t);if(!1===r.test)throw new E("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return r.newDocument},deepClone:v,getValueByPointer:w,validate:L,validator:I}),N=new WeakMap,R=function(e){this.observers=new Map,this.obj=e},S=function(e,t){this.callback=e,this.observer=t};
2
+ /*!
665
3
  * https://github.com/Starcounter-Jack/JSON-Patch
666
4
  * (c) 2017-2021 Joachim Wester
667
5
  * MIT license
668
- */
669
- var beforeDict = new WeakMap();
670
- var Mirror = /** @class */function () {
671
- function Mirror(obj) {
672
- this.observers = new Map();
673
- this.obj = obj;
674
- }
675
- return Mirror;
676
- }();
677
- var ObserverInfo = /** @class */function () {
678
- function ObserverInfo(callback, observer) {
679
- this.callback = callback;
680
- this.observer = observer;
681
- }
682
- return ObserverInfo;
683
- }();
684
- function getMirror(obj) {
685
- return beforeDict.get(obj);
686
- }
687
- function getObserverFromMirror(mirror, callback) {
688
- return mirror.observers.get(callback);
689
- }
690
- function removeObserverFromMirror(mirror, observer) {
691
- mirror.observers.delete(observer.callback);
692
- }
693
- /**
694
- * Detach an observer from an object
695
- */
696
- function unobserve(root, observer) {
697
- observer.unobserve();
698
- }
699
- /**
700
- * Observes changes made to an object, which can then be retrieved using generate
701
- */
702
- function observe(obj, callback) {
703
- var patches = [];
704
- var observer;
705
- var mirror = getMirror(obj);
706
- if (!mirror) {
707
- mirror = new Mirror(obj);
708
- beforeDict.set(obj, mirror);
709
- } else {
710
- var observerInfo = getObserverFromMirror(mirror, callback);
711
- observer = observerInfo && observerInfo.observer;
712
- }
713
- if (observer) {
714
- return observer;
715
- }
716
- observer = {};
717
- mirror.value = _deepClone(obj);
718
- if (callback) {
719
- observer.callback = callback;
720
- observer.next = null;
721
- var dirtyCheck = function () {
722
- generate(observer);
723
- };
724
- var fastCheck = function () {
725
- clearTimeout(observer.next);
726
- observer.next = setTimeout(dirtyCheck);
727
- };
728
- if (typeof window !== 'undefined') {
729
- //not Node
730
- window.addEventListener('mouseup', fastCheck);
731
- window.addEventListener('keyup', fastCheck);
732
- window.addEventListener('mousedown', fastCheck);
733
- window.addEventListener('keydown', fastCheck);
734
- window.addEventListener('change', fastCheck);
735
- }
736
- }
737
- observer.patches = patches;
738
- observer.object = obj;
739
- observer.unobserve = function () {
740
- generate(observer);
741
- clearTimeout(observer.next);
742
- removeObserverFromMirror(mirror, observer);
743
- if (typeof window !== 'undefined') {
744
- window.removeEventListener('mouseup', fastCheck);
745
- window.removeEventListener('keyup', fastCheck);
746
- window.removeEventListener('mousedown', fastCheck);
747
- window.removeEventListener('keydown', fastCheck);
748
- window.removeEventListener('change', fastCheck);
749
- }
750
- };
751
- mirror.observers.set(callback, new ObserverInfo(callback, observer));
752
- return observer;
753
- }
754
- /**
755
- * Generate an array of patches from an observer
756
- */
757
- function generate(observer, invertible) {
758
- if (invertible === void 0) {
759
- invertible = false;
760
- }
761
- var mirror = beforeDict.get(observer.object);
762
- _generate(mirror.value, observer.object, observer.patches, "", invertible);
763
- if (observer.patches.length) {
764
- applyPatch(mirror.value, observer.patches);
765
- }
766
- var temp = observer.patches;
767
- if (temp.length > 0) {
768
- observer.patches = [];
769
- if (observer.callback) {
770
- observer.callback(temp);
771
- }
772
- }
773
- return temp;
774
- }
775
- // Dirty check if obj is different from mirror, generate patches and update mirror
776
- function _generate(mirror, obj, patches, path, invertible) {
777
- if (obj === mirror) {
778
- return;
779
- }
780
- if (typeof obj.toJSON === "function") {
781
- obj = obj.toJSON();
782
- }
783
- var newKeys = _objectKeys(obj);
784
- var oldKeys = _objectKeys(mirror);
785
- var deleted = false;
786
- //if ever "move" operation is implemented here, make sure this test runs OK: "should not generate the same patch twice (move)"
787
- for (var t = oldKeys.length - 1; t >= 0; t--) {
788
- var key = oldKeys[t];
789
- var oldVal = mirror[key];
790
- if (hasOwnProperty(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {
791
- var newVal = obj[key];
792
- if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {
793
- _generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key), invertible);
794
- } else {
795
- if (oldVal !== newVal) {
796
- if (invertible) {
797
- patches.push({
798
- op: "test",
799
- path: path + "/" + escapePathComponent(key),
800
- value: _deepClone(oldVal)
801
- });
802
- }
803
- patches.push({
804
- op: "replace",
805
- path: path + "/" + escapePathComponent(key),
806
- value: _deepClone(newVal)
807
- });
808
- }
809
- }
810
- } else if (Array.isArray(mirror) === Array.isArray(obj)) {
811
- if (invertible) {
812
- patches.push({
813
- op: "test",
814
- path: path + "/" + escapePathComponent(key),
815
- value: _deepClone(oldVal)
816
- });
817
- }
818
- patches.push({
819
- op: "remove",
820
- path: path + "/" + escapePathComponent(key)
821
- });
822
- deleted = true; // property has been deleted
823
- } else {
824
- if (invertible) {
825
- patches.push({
826
- op: "test",
827
- path: path,
828
- value: mirror
829
- });
830
- }
831
- patches.push({
832
- op: "replace",
833
- path: path,
834
- value: obj
835
- });
836
- }
837
- }
838
- if (!deleted && newKeys.length == oldKeys.length) {
839
- return;
840
- }
841
- for (var t = 0; t < newKeys.length; t++) {
842
- var key = newKeys[t];
843
- if (!hasOwnProperty(mirror, key) && obj[key] !== undefined) {
844
- patches.push({
845
- op: "add",
846
- path: path + "/" + escapePathComponent(key),
847
- value: _deepClone(obj[key])
848
- });
849
- }
850
- }
851
- }
852
- /**
853
- * Create an array of patches from the differences in two objects
854
- */
855
- function compare$7(tree1, tree2, invertible) {
856
- if (invertible === void 0) {
857
- invertible = false;
858
- }
859
- var patches = [];
860
- _generate(tree1, tree2, patches, '', invertible);
861
- return patches;
862
- }
863
-
864
- var duplex = /*#__PURE__*/Object.freeze({
865
- __proto__: null,
866
- compare: compare$7,
867
- generate: generate,
868
- observe: observe,
869
- unobserve: unobserve
870
- });
871
-
872
- Object.assign({}, core, duplex, {
873
- JsonPatchError: PatchError,
874
- deepClone: _deepClone,
875
- escapePathComponent,
876
- unescapePathComponent
877
- });
878
-
879
- function getDefaultExportFromCjs (x) {
880
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
881
- }
882
-
883
- // Note: This regex matches even invalid JSON strings, but since we’re
884
- // working on the output of `JSON.stringify` we know that only valid strings
885
- // are present (unless the user supplied a weird `options.indent` but in
886
- // that case we don’t care since the output would be invalid anyway).
887
- var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,]/g;
888
- var jsonStringifyPrettyCompact = function stringify(passedObj, options) {
889
- var indent, maxLength, replacer;
890
- options = options || {};
891
- indent = JSON.stringify([1], undefined, options.indent === undefined ? 2 : options.indent).slice(2, -3);
892
- maxLength = indent === "" ? Infinity : options.maxLength === undefined ? 80 : options.maxLength;
893
- replacer = options.replacer;
894
- return function _stringify(obj, currentIndent, reserved) {
895
- // prettier-ignore
896
- var end, index, items, key, keyPart, keys, length, nextIndent, prettified, start, string, value;
897
- if (obj && typeof obj.toJSON === "function") {
898
- obj = obj.toJSON();
899
- }
900
- string = JSON.stringify(obj, replacer);
901
- if (string === undefined) {
902
- return string;
903
- }
904
- length = maxLength - currentIndent.length - reserved;
905
- if (string.length <= length) {
906
- prettified = string.replace(stringOrChar, function (match, stringLiteral) {
907
- return stringLiteral || match + " ";
908
- });
909
- if (prettified.length <= length) {
910
- return prettified;
911
- }
912
- }
913
- if (replacer != null) {
914
- obj = JSON.parse(string);
915
- replacer = undefined;
916
- }
917
- if (typeof obj === "object" && obj !== null) {
918
- nextIndent = currentIndent + indent;
919
- items = [];
920
- index = 0;
921
- if (Array.isArray(obj)) {
922
- start = "[";
923
- end = "]";
924
- length = obj.length;
925
- for (; index < length; index++) {
926
- items.push(_stringify(obj[index], nextIndent, index === length - 1 ? 0 : 1) || "null");
927
- }
928
- } else {
929
- start = "{";
930
- end = "}";
931
- keys = Object.keys(obj);
932
- length = keys.length;
933
- for (; index < length; index++) {
934
- key = keys[index];
935
- keyPart = JSON.stringify(key) + ": ";
936
- value = _stringify(obj[key], nextIndent, keyPart.length + (index === length - 1 ? 0 : 1));
937
- if (value !== undefined) {
938
- items.push(keyPart + value);
939
- }
940
- }
941
- }
942
- if (items.length > 0) {
943
- return [start, indent + items.join(",\n" + nextIndent), end].join("\n" + currentIndent);
944
- }
945
- }
946
- return string;
947
- }(passedObj, "", 0);
948
- };
949
- var stringify$1 = /*@__PURE__*/getDefaultExportFromCjs(jsonStringifyPrettyCompact);
950
-
951
- class LRUCache {
952
- constructor() {
953
- this.max = 1000;
954
- this.map = new Map();
955
- }
956
- get(key) {
957
- const value = this.map.get(key);
958
- if (value === undefined) {
959
- return undefined;
960
- } else {
961
- // Remove the key from the map and add it to the end
962
- this.map.delete(key);
963
- this.map.set(key, value);
964
- return value;
965
- }
966
- }
967
- delete(key) {
968
- return this.map.delete(key);
969
- }
970
- set(key, value) {
971
- const deleted = this.delete(key);
972
- if (!deleted && value !== undefined) {
973
- // If cache is full, delete the least recently used item
974
- if (this.map.size >= this.max) {
975
- const firstKey = this.map.keys().next().value;
976
- this.delete(firstKey);
977
- }
978
- this.map.set(key, value);
979
- }
980
- return this;
981
- }
982
- }
983
- var lrucache = LRUCache;
984
-
985
- // parse out just the options we care about
986
- const looseOption = Object.freeze({
987
- loose: true
988
- });
989
- const emptyOpts = Object.freeze({});
990
- const parseOptions$1 = options => {
991
- if (!options) {
992
- return emptyOpts;
993
- }
994
- if (typeof options !== 'object') {
995
- return looseOption;
996
- }
997
- return options;
998
- };
999
- var parseOptions_1 = parseOptions$1;
1000
-
1001
- var re$1 = {exports: {}};
1002
-
1003
- // Note: this is the semver.org version of the spec that it implements
1004
- // Not necessarily the package version of this code.
1005
- const SEMVER_SPEC_VERSION = '2.0.0';
1006
- const MAX_LENGTH$1 = 256;
1007
- const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;
1008
-
1009
- // Max safe segment length for coercion.
1010
- const MAX_SAFE_COMPONENT_LENGTH = 16;
1011
-
1012
- // Max safe length for a build identifier. The max length minus 6 characters for
1013
- // the shortest version with a build 0.0.0+BUILD.
1014
- const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
1015
- const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
1016
- var constants = {
1017
- MAX_LENGTH: MAX_LENGTH$1,
1018
- MAX_SAFE_COMPONENT_LENGTH,
1019
- MAX_SAFE_BUILD_LENGTH,
1020
- MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
1021
- RELEASE_TYPES,
1022
- SEMVER_SPEC_VERSION,
1023
- FLAG_INCLUDE_PRERELEASE: 0b001,
1024
- FLAG_LOOSE: 0b010
1025
- };
1026
-
1027
- const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {};
1028
- var debug_1 = debug$1;
1029
-
1030
- (function (module, exports) {
1031
- const {
1032
- MAX_SAFE_COMPONENT_LENGTH,
1033
- MAX_SAFE_BUILD_LENGTH,
1034
- MAX_LENGTH
1035
- } = constants;
1036
- const debug = debug_1;
1037
- exports = module.exports = {};
1038
-
1039
- // The actual regexps go on exports.re
1040
- const re = exports.re = [];
1041
- const safeRe = exports.safeRe = [];
1042
- const src = exports.src = [];
1043
- const t = exports.t = {};
1044
- let R = 0;
1045
- const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
1046
-
1047
- // Replace some greedy regex tokens to prevent regex dos issues. These regex are
1048
- // used internally via the safeRe object since all inputs in this library get
1049
- // normalized first to trim and collapse all extra whitespace. The original
1050
- // regexes are exported for userland consumption and lower level usage. A
1051
- // future breaking change could export the safer regex only with a note that
1052
- // all input should have extra whitespace removed.
1053
- const safeRegexReplacements = [['\\s', 1], ['\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];
1054
- const makeSafeRegex = value => {
1055
- for (const [token, max] of safeRegexReplacements) {
1056
- value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
1057
- }
1058
- return value;
1059
- };
1060
- const createToken = (name, value, isGlobal) => {
1061
- const safe = makeSafeRegex(value);
1062
- const index = R++;
1063
- debug(name, index, value);
1064
- t[name] = index;
1065
- src[index] = value;
1066
- re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
1067
- safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
1068
- };
1069
-
1070
- // The following Regular Expressions can be used for tokenizing,
1071
- // validating, and parsing SemVer version strings.
1072
-
1073
- // ## Numeric Identifier
1074
- // A single `0`, or a non-zero digit followed by zero or more digits.
1075
-
1076
- createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
1077
- createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
1078
-
1079
- // ## Non-numeric Identifier
1080
- // Zero or more digits, followed by a letter or hyphen, and then zero or
1081
- // more letters, digits, or hyphens.
1082
-
1083
- createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
1084
-
1085
- // ## Main Version
1086
- // Three dot-separated numeric identifiers.
1087
-
1088
- createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
1089
- createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
1090
-
1091
- // ## Pre-release Version Identifier
1092
- // A numeric identifier, or a non-numeric identifier.
1093
-
1094
- createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
1095
- createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
1096
-
1097
- // ## Pre-release Version
1098
- // Hyphen, followed by one or more dot-separated pre-release version
1099
- // identifiers.
1100
-
1101
- createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
1102
- createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
1103
-
1104
- // ## Build Metadata Identifier
1105
- // Any combination of digits, letters, or hyphens.
1106
-
1107
- createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
1108
-
1109
- // ## Build Metadata
1110
- // Plus sign, followed by one or more period-separated build metadata
1111
- // identifiers.
1112
-
1113
- createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
1114
-
1115
- // ## Full Version String
1116
- // A main version, followed optionally by a pre-release version and
1117
- // build metadata.
1118
-
1119
- // Note that the only major, minor, patch, and pre-release sections of
1120
- // the version string are capturing groups. The build metadata is not a
1121
- // capturing group, because it should not ever be used in version
1122
- // comparison.
1123
-
1124
- createToken('FULLPLAIN', `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
1125
- createToken('FULL', `^${src[t.FULLPLAIN]}$`);
1126
-
1127
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
1128
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
1129
- // common in the npm registry.
1130
- createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
1131
- createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
1132
- createToken('GTLT', '((?:<|>)?=?)');
1133
-
1134
- // Something like "2.*" or "1.2.x".
1135
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
1136
- // Only the first item is strictly required.
1137
- createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
1138
- createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
1139
- createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
1140
- createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
1141
- createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
1142
- createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
1143
-
1144
- // Coercion.
1145
- // Extract anything that could conceivably be a part of a valid semver
1146
- createToken('COERCEPLAIN', `${'(^|[^\\d])' + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
1147
- createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
1148
- createToken('COERCEFULL', src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
1149
- createToken('COERCERTL', src[t.COERCE], true);
1150
- createToken('COERCERTLFULL', src[t.COERCEFULL], true);
1151
-
1152
- // Tilde ranges.
1153
- // Meaning is "reasonably at or greater than"
1154
- createToken('LONETILDE', '(?:~>?)');
1155
- createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
1156
- exports.tildeTrimReplace = '$1~';
1157
- createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
1158
- createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
1159
-
1160
- // Caret ranges.
1161
- // Meaning is "at least and backwards compatible with"
1162
- createToken('LONECARET', '(?:\\^)');
1163
- createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
1164
- exports.caretTrimReplace = '$1^';
1165
- createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
1166
- createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
1167
-
1168
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
1169
- createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
1170
- createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
1171
-
1172
- // An expression to strip any whitespace between the gtlt and the thing
1173
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
1174
- createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
1175
- exports.comparatorTrimReplace = '$1$2$3';
1176
-
1177
- // Something like `1.2.3 - 1.2.4`
1178
- // Note that these all use the loose form, because they'll be
1179
- // checked against either the strict or loose comparator form
1180
- // later.
1181
- createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
1182
- createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`);
1183
-
1184
- // Star ranges basically just allow anything at all.
1185
- createToken('STAR', '(<|>)?=?\\s*\\*');
1186
- // >=0.0.0 is like a star
1187
- createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
1188
- createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
1189
- })(re$1, re$1.exports);
1190
- var reExports = re$1.exports;
1191
-
1192
- const numeric = /^[0-9]+$/;
1193
- const compareIdentifiers$1 = (a, b) => {
1194
- const anum = numeric.test(a);
1195
- const bnum = numeric.test(b);
1196
- if (anum && bnum) {
1197
- a = +a;
1198
- b = +b;
1199
- }
1200
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
1201
- };
1202
- const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
1203
- var identifiers = {
1204
- compareIdentifiers: compareIdentifiers$1,
1205
- rcompareIdentifiers
1206
- };
1207
-
1208
- const debug = debug_1;
1209
- const {
1210
- MAX_LENGTH,
1211
- MAX_SAFE_INTEGER
1212
- } = constants;
1213
- const {
1214
- safeRe: re,
1215
- t
1216
- } = reExports;
1217
- const parseOptions = parseOptions_1;
1218
- const {
1219
- compareIdentifiers
1220
- } = identifiers;
1221
- let SemVer$1 = class SemVer {
1222
- constructor(version, options) {
1223
- options = parseOptions(options);
1224
- if (version instanceof SemVer) {
1225
- if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
1226
- return version;
1227
- } else {
1228
- version = version.version;
1229
- }
1230
- } else if (typeof version !== 'string') {
1231
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
1232
- }
1233
- if (version.length > MAX_LENGTH) {
1234
- throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
1235
- }
1236
- debug('SemVer', version, options);
1237
- this.options = options;
1238
- this.loose = !!options.loose;
1239
- // this isn't actually relevant for versions, but keep it so that we
1240
- // don't run into trouble passing this.options around.
1241
- this.includePrerelease = !!options.includePrerelease;
1242
- const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
1243
- if (!m) {
1244
- throw new TypeError(`Invalid Version: ${version}`);
1245
- }
1246
- this.raw = version;
1247
-
1248
- // these are actually numbers
1249
- this.major = +m[1];
1250
- this.minor = +m[2];
1251
- this.patch = +m[3];
1252
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
1253
- throw new TypeError('Invalid major version');
1254
- }
1255
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
1256
- throw new TypeError('Invalid minor version');
1257
- }
1258
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
1259
- throw new TypeError('Invalid patch version');
1260
- }
1261
-
1262
- // numberify any prerelease numeric ids
1263
- if (!m[4]) {
1264
- this.prerelease = [];
1265
- } else {
1266
- this.prerelease = m[4].split('.').map(id => {
1267
- if (/^[0-9]+$/.test(id)) {
1268
- const num = +id;
1269
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
1270
- return num;
1271
- }
1272
- }
1273
- return id;
1274
- });
1275
- }
1276
- this.build = m[5] ? m[5].split('.') : [];
1277
- this.format();
1278
- }
1279
- format() {
1280
- this.version = `${this.major}.${this.minor}.${this.patch}`;
1281
- if (this.prerelease.length) {
1282
- this.version += `-${this.prerelease.join('.')}`;
1283
- }
1284
- return this.version;
1285
- }
1286
- toString() {
1287
- return this.version;
1288
- }
1289
- compare(other) {
1290
- debug('SemVer.compare', this.version, this.options, other);
1291
- if (!(other instanceof SemVer)) {
1292
- if (typeof other === 'string' && other === this.version) {
1293
- return 0;
1294
- }
1295
- other = new SemVer(other, this.options);
1296
- }
1297
- if (other.version === this.version) {
1298
- return 0;
1299
- }
1300
- return this.compareMain(other) || this.comparePre(other);
1301
- }
1302
- compareMain(other) {
1303
- if (!(other instanceof SemVer)) {
1304
- other = new SemVer(other, this.options);
1305
- }
1306
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
1307
- }
1308
- comparePre(other) {
1309
- if (!(other instanceof SemVer)) {
1310
- other = new SemVer(other, this.options);
1311
- }
1312
-
1313
- // NOT having a prerelease is > having one
1314
- if (this.prerelease.length && !other.prerelease.length) {
1315
- return -1;
1316
- } else if (!this.prerelease.length && other.prerelease.length) {
1317
- return 1;
1318
- } else if (!this.prerelease.length && !other.prerelease.length) {
1319
- return 0;
1320
- }
1321
- let i = 0;
1322
- do {
1323
- const a = this.prerelease[i];
1324
- const b = other.prerelease[i];
1325
- debug('prerelease compare', i, a, b);
1326
- if (a === undefined && b === undefined) {
1327
- return 0;
1328
- } else if (b === undefined) {
1329
- return 1;
1330
- } else if (a === undefined) {
1331
- return -1;
1332
- } else if (a === b) {
1333
- continue;
1334
- } else {
1335
- return compareIdentifiers(a, b);
1336
- }
1337
- } while (++i);
1338
- }
1339
- compareBuild(other) {
1340
- if (!(other instanceof SemVer)) {
1341
- other = new SemVer(other, this.options);
1342
- }
1343
- let i = 0;
1344
- do {
1345
- const a = this.build[i];
1346
- const b = other.build[i];
1347
- debug('build compare', i, a, b);
1348
- if (a === undefined && b === undefined) {
1349
- return 0;
1350
- } else if (b === undefined) {
1351
- return 1;
1352
- } else if (a === undefined) {
1353
- return -1;
1354
- } else if (a === b) {
1355
- continue;
1356
- } else {
1357
- return compareIdentifiers(a, b);
1358
- }
1359
- } while (++i);
1360
- }
1361
-
1362
- // preminor will bump the version up to the next minor release, and immediately
1363
- // down to pre-release. premajor and prepatch work the same way.
1364
- inc(release, identifier, identifierBase) {
1365
- switch (release) {
1366
- case 'premajor':
1367
- this.prerelease.length = 0;
1368
- this.patch = 0;
1369
- this.minor = 0;
1370
- this.major++;
1371
- this.inc('pre', identifier, identifierBase);
1372
- break;
1373
- case 'preminor':
1374
- this.prerelease.length = 0;
1375
- this.patch = 0;
1376
- this.minor++;
1377
- this.inc('pre', identifier, identifierBase);
1378
- break;
1379
- case 'prepatch':
1380
- // If this is already a prerelease, it will bump to the next version
1381
- // drop any prereleases that might already exist, since they are not
1382
- // relevant at this point.
1383
- this.prerelease.length = 0;
1384
- this.inc('patch', identifier, identifierBase);
1385
- this.inc('pre', identifier, identifierBase);
1386
- break;
1387
- // If the input is a non-prerelease version, this acts the same as
1388
- // prepatch.
1389
- case 'prerelease':
1390
- if (this.prerelease.length === 0) {
1391
- this.inc('patch', identifier, identifierBase);
1392
- }
1393
- this.inc('pre', identifier, identifierBase);
1394
- break;
1395
- case 'major':
1396
- // If this is a pre-major version, bump up to the same major version.
1397
- // Otherwise increment major.
1398
- // 1.0.0-5 bumps to 1.0.0
1399
- // 1.1.0 bumps to 2.0.0
1400
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
1401
- this.major++;
1402
- }
1403
- this.minor = 0;
1404
- this.patch = 0;
1405
- this.prerelease = [];
1406
- break;
1407
- case 'minor':
1408
- // If this is a pre-minor version, bump up to the same minor version.
1409
- // Otherwise increment minor.
1410
- // 1.2.0-5 bumps to 1.2.0
1411
- // 1.2.1 bumps to 1.3.0
1412
- if (this.patch !== 0 || this.prerelease.length === 0) {
1413
- this.minor++;
1414
- }
1415
- this.patch = 0;
1416
- this.prerelease = [];
1417
- break;
1418
- case 'patch':
1419
- // If this is not a pre-release version, it will increment the patch.
1420
- // If it is a pre-release it will bump up to the same patch version.
1421
- // 1.2.0-5 patches to 1.2.0
1422
- // 1.2.0 patches to 1.2.1
1423
- if (this.prerelease.length === 0) {
1424
- this.patch++;
1425
- }
1426
- this.prerelease = [];
1427
- break;
1428
- // This probably shouldn't be used publicly.
1429
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
1430
- case 'pre':
1431
- {
1432
- const base = Number(identifierBase) ? 1 : 0;
1433
- if (!identifier && identifierBase === false) {
1434
- throw new Error('invalid increment argument: identifier is empty');
1435
- }
1436
- if (this.prerelease.length === 0) {
1437
- this.prerelease = [base];
1438
- } else {
1439
- let i = this.prerelease.length;
1440
- while (--i >= 0) {
1441
- if (typeof this.prerelease[i] === 'number') {
1442
- this.prerelease[i]++;
1443
- i = -2;
1444
- }
1445
- }
1446
- if (i === -1) {
1447
- // didn't increment anything
1448
- if (identifier === this.prerelease.join('.') && identifierBase === false) {
1449
- throw new Error('invalid increment argument: identifier already exists');
1450
- }
1451
- this.prerelease.push(base);
1452
- }
1453
- }
1454
- if (identifier) {
1455
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
1456
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
1457
- let prerelease = [identifier, base];
1458
- if (identifierBase === false) {
1459
- prerelease = [identifier];
1460
- }
1461
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
1462
- if (isNaN(this.prerelease[1])) {
1463
- this.prerelease = prerelease;
1464
- }
1465
- } else {
1466
- this.prerelease = prerelease;
1467
- }
1468
- }
1469
- break;
1470
- }
1471
- default:
1472
- throw new Error(`invalid increment argument: ${release}`);
1473
- }
1474
- this.raw = this.format();
1475
- if (this.build.length) {
1476
- this.raw += `+${this.build.join('.')}`;
1477
- }
1478
- return this;
1479
- }
1480
- };
1481
- var semver = SemVer$1;
1482
-
1483
- const SemVer = semver;
1484
- const compare$6 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
1485
- var compare_1 = compare$6;
1486
-
1487
- const compare$5 = compare_1;
1488
- const eq$1 = (a, b, loose) => compare$5(a, b, loose) === 0;
1489
- var eq_1 = eq$1;
1490
-
1491
- const compare$4 = compare_1;
1492
- const neq$1 = (a, b, loose) => compare$4(a, b, loose) !== 0;
1493
- var neq_1 = neq$1;
1494
-
1495
- const compare$3 = compare_1;
1496
- const gt$1 = (a, b, loose) => compare$3(a, b, loose) > 0;
1497
- var gt_1 = gt$1;
1498
-
1499
- const compare$2 = compare_1;
1500
- const gte$1 = (a, b, loose) => compare$2(a, b, loose) >= 0;
1501
- var gte_1 = gte$1;
1502
-
1503
- const compare$1 = compare_1;
1504
- const lt$1 = (a, b, loose) => compare$1(a, b, loose) < 0;
1505
- var lt_1 = lt$1;
1506
-
1507
- const compare = compare_1;
1508
- const lte$1 = (a, b, loose) => compare(a, b, loose) <= 0;
1509
- var lte_1 = lte$1;
1510
-
1511
- const eq = eq_1;
1512
- const neq = neq_1;
1513
- const gt = gt_1;
1514
- const gte = gte_1;
1515
- const lt = lt_1;
1516
- const lte = lte_1;
1517
- const cmp = (a, op, b, loose) => {
1518
- switch (op) {
1519
- case '===':
1520
- if (typeof a === 'object') {
1521
- a = a.version;
1522
- }
1523
- if (typeof b === 'object') {
1524
- b = b.version;
1525
- }
1526
- return a === b;
1527
- case '!==':
1528
- if (typeof a === 'object') {
1529
- a = a.version;
1530
- }
1531
- if (typeof b === 'object') {
1532
- b = b.version;
1533
- }
1534
- return a !== b;
1535
- case '':
1536
- case '=':
1537
- case '==':
1538
- return eq(a, b, loose);
1539
- case '!=':
1540
- return neq(a, b, loose);
1541
- case '>':
1542
- return gt(a, b, loose);
1543
- case '>=':
1544
- return gte(a, b, loose);
1545
- case '<':
1546
- return lt(a, b, loose);
1547
- case '<=':
1548
- return lte(a, b, loose);
1549
- default:
1550
- throw new TypeError(`Invalid operator: ${op}`);
1551
- }
1552
- };
1553
- var cmp_1 = cmp;
1554
-
1555
- var comparator;
1556
- var hasRequiredComparator;
1557
- function requireComparator() {
1558
- if (hasRequiredComparator) return comparator;
1559
- hasRequiredComparator = 1;
1560
- const ANY = Symbol('SemVer ANY');
1561
- // hoisted class for cyclic dependency
1562
- class Comparator {
1563
- static get ANY() {
1564
- return ANY;
1565
- }
1566
- constructor(comp, options) {
1567
- options = parseOptions(options);
1568
- if (comp instanceof Comparator) {
1569
- if (comp.loose === !!options.loose) {
1570
- return comp;
1571
- } else {
1572
- comp = comp.value;
1573
- }
1574
- }
1575
- comp = comp.trim().split(/\s+/).join(' ');
1576
- debug('comparator', comp, options);
1577
- this.options = options;
1578
- this.loose = !!options.loose;
1579
- this.parse(comp);
1580
- if (this.semver === ANY) {
1581
- this.value = '';
1582
- } else {
1583
- this.value = this.operator + this.semver.version;
1584
- }
1585
- debug('comp', this);
1586
- }
1587
- parse(comp) {
1588
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1589
- const m = comp.match(r);
1590
- if (!m) {
1591
- throw new TypeError(`Invalid comparator: ${comp}`);
1592
- }
1593
- this.operator = m[1] !== undefined ? m[1] : '';
1594
- if (this.operator === '=') {
1595
- this.operator = '';
1596
- }
1597
-
1598
- // if it literally is just '>' or '' then allow anything.
1599
- if (!m[2]) {
1600
- this.semver = ANY;
1601
- } else {
1602
- this.semver = new SemVer(m[2], this.options.loose);
1603
- }
1604
- }
1605
- toString() {
1606
- return this.value;
1607
- }
1608
- test(version) {
1609
- debug('Comparator.test', version, this.options.loose);
1610
- if (this.semver === ANY || version === ANY) {
1611
- return true;
1612
- }
1613
- if (typeof version === 'string') {
1614
- try {
1615
- version = new SemVer(version, this.options);
1616
- } catch (er) {
1617
- return false;
1618
- }
1619
- }
1620
- return cmp(version, this.operator, this.semver, this.options);
1621
- }
1622
- intersects(comp, options) {
1623
- if (!(comp instanceof Comparator)) {
1624
- throw new TypeError('a Comparator is required');
1625
- }
1626
- if (this.operator === '') {
1627
- if (this.value === '') {
1628
- return true;
1629
- }
1630
- return new Range(comp.value, options).test(this.value);
1631
- } else if (comp.operator === '') {
1632
- if (comp.value === '') {
1633
- return true;
1634
- }
1635
- return new Range(this.value, options).test(comp.semver);
1636
- }
1637
- options = parseOptions(options);
1638
-
1639
- // Special cases where nothing can possibly be lower
1640
- if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
1641
- return false;
1642
- }
1643
- if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
1644
- return false;
1645
- }
1646
-
1647
- // Same direction increasing (> or >=)
1648
- if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
1649
- return true;
1650
- }
1651
- // Same direction decreasing (< or <=)
1652
- if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
1653
- return true;
1654
- }
1655
- // same SemVer and both sides are inclusive (<= or >=)
1656
- if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) {
1657
- return true;
1658
- }
1659
- // opposite directions less than
1660
- if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) {
1661
- return true;
1662
- }
1663
- // opposite directions greater than
1664
- if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) {
1665
- return true;
1666
- }
1667
- return false;
1668
- }
1669
- }
1670
- comparator = Comparator;
1671
- const parseOptions = parseOptions_1;
1672
- const {
1673
- safeRe: re,
1674
- t
1675
- } = reExports;
1676
- const cmp = cmp_1;
1677
- const debug = debug_1;
1678
- const SemVer = semver;
1679
- const Range = requireRange();
1680
- return comparator;
1681
- }
1682
-
1683
- var range;
1684
- var hasRequiredRange;
1685
- function requireRange() {
1686
- if (hasRequiredRange) return range;
1687
- hasRequiredRange = 1;
1688
- // hoisted class for cyclic dependency
1689
- class Range {
1690
- constructor(range, options) {
1691
- options = parseOptions(options);
1692
- if (range instanceof Range) {
1693
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
1694
- return range;
1695
- } else {
1696
- return new Range(range.raw, options);
1697
- }
1698
- }
1699
- if (range instanceof Comparator) {
1700
- // just put it in the set and return
1701
- this.raw = range.value;
1702
- this.set = [[range]];
1703
- this.format();
1704
- return this;
1705
- }
1706
- this.options = options;
1707
- this.loose = !!options.loose;
1708
- this.includePrerelease = !!options.includePrerelease;
1709
-
1710
- // First reduce all whitespace as much as possible so we do not have to rely
1711
- // on potentially slow regexes like \s*. This is then stored and used for
1712
- // future error messages as well.
1713
- this.raw = range.trim().split(/\s+/).join(' ');
1714
-
1715
- // First, split on ||
1716
- this.set = this.raw.split('||')
1717
- // map the range to a 2d array of comparators
1718
- .map(r => this.parseRange(r.trim()))
1719
- // throw out any comparator lists that are empty
1720
- // this generally means that it was not a valid range, which is allowed
1721
- // in loose mode, but will still throw if the WHOLE range is invalid.
1722
- .filter(c => c.length);
1723
- if (!this.set.length) {
1724
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
1725
- }
1726
-
1727
- // if we have any that are not the null set, throw out null sets.
1728
- if (this.set.length > 1) {
1729
- // keep the first one, in case they're all null sets
1730
- const first = this.set[0];
1731
- this.set = this.set.filter(c => !isNullSet(c[0]));
1732
- if (this.set.length === 0) {
1733
- this.set = [first];
1734
- } else if (this.set.length > 1) {
1735
- // if we have any that are *, then the range is just *
1736
- for (const c of this.set) {
1737
- if (c.length === 1 && isAny(c[0])) {
1738
- this.set = [c];
1739
- break;
1740
- }
1741
- }
1742
- }
1743
- }
1744
- this.format();
1745
- }
1746
- format() {
1747
- this.range = this.set.map(comps => comps.join(' ').trim()).join('||').trim();
1748
- return this.range;
1749
- }
1750
- toString() {
1751
- return this.range;
1752
- }
1753
- parseRange(range) {
1754
- // memoize range parsing for performance.
1755
- // this is a very hot path, and fully deterministic.
1756
- const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
1757
- const memoKey = memoOpts + ':' + range;
1758
- const cached = cache.get(memoKey);
1759
- if (cached) {
1760
- return cached;
1761
- }
1762
- const loose = this.options.loose;
1763
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
1764
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1765
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1766
- debug('hyphen replace', range);
1767
-
1768
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
1769
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1770
- debug('comparator trim', range);
1771
-
1772
- // `~ 1.2.3` => `~1.2.3`
1773
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1774
- debug('tilde trim', range);
1775
-
1776
- // `^ 1.2.3` => `^1.2.3`
1777
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1778
- debug('caret trim', range);
1779
-
1780
- // At this point, the range is completely trimmed and
1781
- // ready to be split into comparators.
1782
-
1783
- let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\s+/)
1784
- // >=0.0.0 is equivalent to *
1785
- .map(comp => replaceGTE0(comp, this.options));
1786
- if (loose) {
1787
- // in loose mode, throw out any that are not valid comparators
1788
- rangeList = rangeList.filter(comp => {
1789
- debug('loose invalid filter', comp, this.options);
1790
- return !!comp.match(re[t.COMPARATORLOOSE]);
1791
- });
1792
- }
1793
- debug('range list', rangeList);
1794
-
1795
- // if any comparators are the null set, then replace with JUST null set
1796
- // if more than one comparator, remove any * comparators
1797
- // also, don't include the same comparator more than once
1798
- const rangeMap = new Map();
1799
- const comparators = rangeList.map(comp => new Comparator(comp, this.options));
1800
- for (const comp of comparators) {
1801
- if (isNullSet(comp)) {
1802
- return [comp];
1803
- }
1804
- rangeMap.set(comp.value, comp);
1805
- }
1806
- if (rangeMap.size > 1 && rangeMap.has('')) {
1807
- rangeMap.delete('');
1808
- }
1809
- const result = [...rangeMap.values()];
1810
- cache.set(memoKey, result);
1811
- return result;
1812
- }
1813
- intersects(range, options) {
1814
- if (!(range instanceof Range)) {
1815
- throw new TypeError('a Range is required');
1816
- }
1817
- return this.set.some(thisComparators => {
1818
- return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => {
1819
- return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => {
1820
- return rangeComparators.every(rangeComparator => {
1821
- return thisComparator.intersects(rangeComparator, options);
1822
- });
1823
- });
1824
- });
1825
- });
1826
- }
1827
-
1828
- // if ANY of the sets match ALL of its comparators, then pass
1829
- test(version) {
1830
- if (!version) {
1831
- return false;
1832
- }
1833
- if (typeof version === 'string') {
1834
- try {
1835
- version = new SemVer(version, this.options);
1836
- } catch (er) {
1837
- return false;
1838
- }
1839
- }
1840
- for (let i = 0; i < this.set.length; i++) {
1841
- if (testSet(this.set[i], version, this.options)) {
1842
- return true;
1843
- }
1844
- }
1845
- return false;
1846
- }
1847
- }
1848
- range = Range;
1849
- const LRU = lrucache;
1850
- const cache = new LRU();
1851
- const parseOptions = parseOptions_1;
1852
- const Comparator = requireComparator();
1853
- const debug = debug_1;
1854
- const SemVer = semver;
1855
- const {
1856
- safeRe: re,
1857
- t,
1858
- comparatorTrimReplace,
1859
- tildeTrimReplace,
1860
- caretTrimReplace
1861
- } = reExports;
1862
- const {
1863
- FLAG_INCLUDE_PRERELEASE,
1864
- FLAG_LOOSE
1865
- } = constants;
1866
- const isNullSet = c => c.value === '<0.0.0-0';
1867
- const isAny = c => c.value === '';
1868
-
1869
- // take a set of comparators and determine whether there
1870
- // exists a version which can satisfy it
1871
- const isSatisfiable = (comparators, options) => {
1872
- let result = true;
1873
- const remainingComparators = comparators.slice();
1874
- let testComparator = remainingComparators.pop();
1875
- while (result && remainingComparators.length) {
1876
- result = remainingComparators.every(otherComparator => {
1877
- return testComparator.intersects(otherComparator, options);
1878
- });
1879
- testComparator = remainingComparators.pop();
1880
- }
1881
- return result;
1882
- };
1883
-
1884
- // comprised of xranges, tildes, stars, and gtlt's at this point.
1885
- // already replaced the hyphen ranges
1886
- // turn into a set of JUST comparators.
1887
- const parseComparator = (comp, options) => {
1888
- debug('comp', comp, options);
1889
- comp = replaceCarets(comp, options);
1890
- debug('caret', comp);
1891
- comp = replaceTildes(comp, options);
1892
- debug('tildes', comp);
1893
- comp = replaceXRanges(comp, options);
1894
- debug('xrange', comp);
1895
- comp = replaceStars(comp, options);
1896
- debug('stars', comp);
1897
- return comp;
1898
- };
1899
- const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
1900
-
1901
- // ~, ~> --> * (any, kinda silly)
1902
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
1903
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
1904
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
1905
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
1906
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
1907
- // ~0.0.1 --> >=0.0.1 <0.1.0-0
1908
- const replaceTildes = (comp, options) => {
1909
- return comp.trim().split(/\s+/).map(c => replaceTilde(c, options)).join(' ');
1910
- };
1911
- const replaceTilde = (comp, options) => {
1912
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1913
- return comp.replace(r, (_, M, m, p, pr) => {
1914
- debug('tilde', comp, _, M, m, p, pr);
1915
- let ret;
1916
- if (isX(M)) {
1917
- ret = '';
1918
- } else if (isX(m)) {
1919
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1920
- } else if (isX(p)) {
1921
- // ~1.2 == >=1.2.0 <1.3.0-0
1922
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1923
- } else if (pr) {
1924
- debug('replaceTilde pr', pr);
1925
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1926
- } else {
1927
- // ~1.2.3 == >=1.2.3 <1.3.0-0
1928
- ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1929
- }
1930
- debug('tilde return', ret);
1931
- return ret;
1932
- });
1933
- };
1934
-
1935
- // ^ --> * (any, kinda silly)
1936
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
1937
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
1938
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
1939
- // ^1.2.3 --> >=1.2.3 <2.0.0-0
1940
- // ^1.2.0 --> >=1.2.0 <2.0.0-0
1941
- // ^0.0.1 --> >=0.0.1 <0.0.2-0
1942
- // ^0.1.0 --> >=0.1.0 <0.2.0-0
1943
- const replaceCarets = (comp, options) => {
1944
- return comp.trim().split(/\s+/).map(c => replaceCaret(c, options)).join(' ');
1945
- };
1946
- const replaceCaret = (comp, options) => {
1947
- debug('caret', comp, options);
1948
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1949
- const z = options.includePrerelease ? '-0' : '';
1950
- return comp.replace(r, (_, M, m, p, pr) => {
1951
- debug('caret', comp, _, M, m, p, pr);
1952
- let ret;
1953
- if (isX(M)) {
1954
- ret = '';
1955
- } else if (isX(m)) {
1956
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1957
- } else if (isX(p)) {
1958
- if (M === '0') {
1959
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1960
- } else {
1961
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1962
- }
1963
- } else if (pr) {
1964
- debug('replaceCaret pr', pr);
1965
- if (M === '0') {
1966
- if (m === '0') {
1967
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1968
- } else {
1969
- ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1970
- }
1971
- } else {
1972
- ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1973
- }
1974
- } else {
1975
- debug('no pr');
1976
- if (M === '0') {
1977
- if (m === '0') {
1978
- ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
1979
- } else {
1980
- ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
1981
- }
1982
- } else {
1983
- ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1984
- }
1985
- }
1986
- debug('caret return', ret);
1987
- return ret;
1988
- });
1989
- };
1990
- const replaceXRanges = (comp, options) => {
1991
- debug('replaceXRanges', comp, options);
1992
- return comp.split(/\s+/).map(c => replaceXRange(c, options)).join(' ');
1993
- };
1994
- const replaceXRange = (comp, options) => {
1995
- comp = comp.trim();
1996
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1997
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1998
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
1999
- const xM = isX(M);
2000
- const xm = xM || isX(m);
2001
- const xp = xm || isX(p);
2002
- const anyX = xp;
2003
- if (gtlt === '=' && anyX) {
2004
- gtlt = '';
2005
- }
2006
-
2007
- // if we're including prereleases in the match, then we need
2008
- // to fix this to -0, the lowest possible prerelease value
2009
- pr = options.includePrerelease ? '-0' : '';
2010
- if (xM) {
2011
- if (gtlt === '>' || gtlt === '<') {
2012
- // nothing is allowed
2013
- ret = '<0.0.0-0';
2014
- } else {
2015
- // nothing is forbidden
2016
- ret = '*';
2017
- }
2018
- } else if (gtlt && anyX) {
2019
- // we know patch is an x, because we have any x at all.
2020
- // replace X with 0
2021
- if (xm) {
2022
- m = 0;
2023
- }
2024
- p = 0;
2025
- if (gtlt === '>') {
2026
- // >1 => >=2.0.0
2027
- // >1.2 => >=1.3.0
2028
- gtlt = '>=';
2029
- if (xm) {
2030
- M = +M + 1;
2031
- m = 0;
2032
- p = 0;
2033
- } else {
2034
- m = +m + 1;
2035
- p = 0;
2036
- }
2037
- } else if (gtlt === '<=') {
2038
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
2039
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
2040
- gtlt = '<';
2041
- if (xm) {
2042
- M = +M + 1;
2043
- } else {
2044
- m = +m + 1;
2045
- }
2046
- }
2047
- if (gtlt === '<') {
2048
- pr = '-0';
2049
- }
2050
- ret = `${gtlt + M}.${m}.${p}${pr}`;
2051
- } else if (xm) {
2052
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
2053
- } else if (xp) {
2054
- ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
2055
- }
2056
- debug('xRange return', ret);
2057
- return ret;
2058
- });
2059
- };
2060
-
2061
- // Because * is AND-ed with everything else in the comparator,
2062
- // and '' means "any version", just remove the *s entirely.
2063
- const replaceStars = (comp, options) => {
2064
- debug('replaceStars', comp, options);
2065
- // Looseness is ignored here. star is always as loose as it gets!
2066
- return comp.trim().replace(re[t.STAR], '');
2067
- };
2068
- const replaceGTE0 = (comp, options) => {
2069
- debug('replaceGTE0', comp, options);
2070
- return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '');
2071
- };
2072
-
2073
- // This function is passed to string.replace(re[t.HYPHENRANGE])
2074
- // M, m, patch, prerelease, build
2075
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
2076
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
2077
- // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
2078
- // TODO build?
2079
- const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
2080
- if (isX(fM)) {
2081
- from = '';
2082
- } else if (isX(fm)) {
2083
- from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
2084
- } else if (isX(fp)) {
2085
- from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
2086
- } else if (fpr) {
2087
- from = `>=${from}`;
2088
- } else {
2089
- from = `>=${from}${incPr ? '-0' : ''}`;
2090
- }
2091
- if (isX(tM)) {
2092
- to = '';
2093
- } else if (isX(tm)) {
2094
- to = `<${+tM + 1}.0.0-0`;
2095
- } else if (isX(tp)) {
2096
- to = `<${tM}.${+tm + 1}.0-0`;
2097
- } else if (tpr) {
2098
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
2099
- } else if (incPr) {
2100
- to = `<${tM}.${tm}.${+tp + 1}-0`;
2101
- } else {
2102
- to = `<=${to}`;
2103
- }
2104
- return `${from} ${to}`.trim();
2105
- };
2106
- const testSet = (set, version, options) => {
2107
- for (let i = 0; i < set.length; i++) {
2108
- if (!set[i].test(version)) {
2109
- return false;
2110
- }
2111
- }
2112
- if (version.prerelease.length && !options.includePrerelease) {
2113
- // Find the set of versions that are allowed to have prereleases
2114
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
2115
- // That should allow `1.2.3-pr.2` to pass.
2116
- // However, `1.2.4-alpha.notready` should NOT be allowed,
2117
- // even though it's within the range set by the comparators.
2118
- for (let i = 0; i < set.length; i++) {
2119
- debug(set[i].semver);
2120
- if (set[i].semver === Comparator.ANY) {
2121
- continue;
2122
- }
2123
- if (set[i].semver.prerelease.length > 0) {
2124
- const allowed = set[i].semver;
2125
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
2126
- return true;
2127
- }
2128
- }
2129
- }
2130
-
2131
- // Version has a -pre, but it's not one of the ones we like.
2132
- return false;
2133
- }
2134
- return true;
2135
- };
2136
- return range;
2137
- }
2138
-
2139
- const Range = requireRange();
2140
- const satisfies = (version, range, options) => {
2141
- try {
2142
- range = new Range(range, options);
2143
- } catch (er) {
2144
- return false;
2145
- }
2146
- return range.test(version);
2147
- };
2148
- var satisfies_1 = satisfies;
2149
- var satisfies$1 = /*@__PURE__*/getDefaultExportFromCjs(satisfies_1);
2150
-
2151
- function adjustSpatial(item, encode, swap) {
2152
- let t;
2153
- if (encode.x2) {
2154
- if (encode.x) {
2155
- if (swap && item.x > item.x2) {
2156
- t = item.x;
2157
- item.x = item.x2;
2158
- item.x2 = t;
2159
- }
2160
- item.width = item.x2 - item.x;
2161
- } else {
2162
- item.x = item.x2 - (item.width || 0);
2163
- }
2164
- }
2165
- if (encode.xc) {
2166
- item.x = item.xc - (item.width || 0) / 2;
2167
- }
2168
- if (encode.y2) {
2169
- if (encode.y) {
2170
- if (swap && item.y > item.y2) {
2171
- t = item.y;
2172
- item.y = item.y2;
2173
- item.y2 = t;
2174
- }
2175
- item.height = item.y2 - item.y;
2176
- } else {
2177
- item.y = item.y2 - (item.height || 0);
2178
- }
2179
- }
2180
- if (encode.yc) {
2181
- item.y = item.yc - (item.height || 0) / 2;
2182
- }
2183
- }
2184
- var Constants = {
2185
- NaN: NaN,
2186
- E: Math.E,
2187
- LN2: Math.LN2,
2188
- LN10: Math.LN10,
2189
- LOG2E: Math.LOG2E,
2190
- LOG10E: Math.LOG10E,
2191
- PI: Math.PI,
2192
- SQRT1_2: Math.SQRT1_2,
2193
- SQRT2: Math.SQRT2,
2194
- MIN_VALUE: Number.MIN_VALUE,
2195
- MAX_VALUE: Number.MAX_VALUE
2196
- };
2197
- var Ops = {
2198
- '*': (a, b) => a * b,
2199
- '+': (a, b) => a + b,
2200
- '-': (a, b) => a - b,
2201
- '/': (a, b) => a / b,
2202
- '%': (a, b) => a % b,
2203
- '>': (a, b) => a > b,
2204
- '<': (a, b) => a < b,
2205
- '<=': (a, b) => a <= b,
2206
- '>=': (a, b) => a >= b,
2207
- '==': (a, b) => a == b,
2208
- '!=': (a, b) => a != b,
2209
- '===': (a, b) => a === b,
2210
- '!==': (a, b) => a !== b,
2211
- '&': (a, b) => a & b,
2212
- '|': (a, b) => a | b,
2213
- '^': (a, b) => a ^ b,
2214
- '<<': (a, b) => a << b,
2215
- '>>': (a, b) => a >> b,
2216
- '>>>': (a, b) => a >>> b
2217
- };
2218
- var Unary = {
2219
- '+': a => +a,
2220
- '-': a => -a,
2221
- '~': a => ~a,
2222
- '!': a => !a
2223
- };
2224
- const slice = Array.prototype.slice;
2225
- const apply = (m, args, cast) => {
2226
- const obj = cast ? cast(args[0]) : args[0];
2227
- return obj[m].apply(obj, slice.call(args, 1));
2228
- };
2229
- const datetime = (y, m, d, H, M, S, ms) => new Date(y, m || 0, d != null ? d : 1, H || 0, M || 0, S || 0, ms || 0);
2230
- var Functions = {
2231
- // math functions
2232
- isNaN: Number.isNaN,
2233
- isFinite: Number.isFinite,
2234
- abs: Math.abs,
2235
- acos: Math.acos,
2236
- asin: Math.asin,
2237
- atan: Math.atan,
2238
- atan2: Math.atan2,
2239
- ceil: Math.ceil,
2240
- cos: Math.cos,
2241
- exp: Math.exp,
2242
- floor: Math.floor,
2243
- log: Math.log,
2244
- max: Math.max,
2245
- min: Math.min,
2246
- pow: Math.pow,
2247
- random: Math.random,
2248
- round: Math.round,
2249
- sin: Math.sin,
2250
- sqrt: Math.sqrt,
2251
- tan: Math.tan,
2252
- clamp: (a, b, c) => Math.max(b, Math.min(c, a)),
2253
- // date functions
2254
- now: Date.now,
2255
- utc: Date.UTC,
2256
- datetime: datetime,
2257
- date: d => new Date(d).getDate(),
2258
- day: d => new Date(d).getDay(),
2259
- year: d => new Date(d).getFullYear(),
2260
- month: d => new Date(d).getMonth(),
2261
- hours: d => new Date(d).getHours(),
2262
- minutes: d => new Date(d).getMinutes(),
2263
- seconds: d => new Date(d).getSeconds(),
2264
- milliseconds: d => new Date(d).getMilliseconds(),
2265
- time: d => new Date(d).getTime(),
2266
- timezoneoffset: d => new Date(d).getTimezoneOffset(),
2267
- utcdate: d => new Date(d).getUTCDate(),
2268
- utcday: d => new Date(d).getUTCDay(),
2269
- utcyear: d => new Date(d).getUTCFullYear(),
2270
- utcmonth: d => new Date(d).getUTCMonth(),
2271
- utchours: d => new Date(d).getUTCHours(),
2272
- utcminutes: d => new Date(d).getUTCMinutes(),
2273
- utcseconds: d => new Date(d).getUTCSeconds(),
2274
- utcmilliseconds: d => new Date(d).getUTCMilliseconds(),
2275
- // sequence functions
2276
- length: x => x.length,
2277
- join: function () {
2278
- return apply('join', arguments);
2279
- },
2280
- indexof: function () {
2281
- return apply('indexOf', arguments);
2282
- },
2283
- lastindexof: function () {
2284
- return apply('lastIndexOf', arguments);
2285
- },
2286
- slice: function () {
2287
- return apply('slice', arguments);
2288
- },
2289
- reverse: x => x.slice().reverse(),
2290
- // string functions
2291
- parseFloat: parseFloat,
2292
- parseInt: parseInt,
2293
- upper: x => String(x).toUpperCase(),
2294
- lower: x => String(x).toLowerCase(),
2295
- substring: function () {
2296
- return apply('substring', arguments, String);
2297
- },
2298
- split: function () {
2299
- return apply('split', arguments, String);
2300
- },
2301
- replace: function () {
2302
- return apply('replace', arguments, String);
2303
- },
2304
- trim: x => String(x).trim(),
2305
- // regexp functions
2306
- regexp: RegExp,
2307
- test: (r, t) => RegExp(r).test(t)
2308
- };
2309
- const EventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'];
2310
- const DisallowedMethods = new Set([Function, eval, setTimeout, setInterval]);
2311
- if (typeof setImmediate === 'function') DisallowedMethods.add(setImmediate);
2312
- const Visitors = {
2313
- Literal: ($, n) => n.value,
2314
- Identifier: ($, n) => {
2315
- const id = n.name;
2316
- return $.memberDepth > 0 ? id : id === 'datum' ? $.datum : id === 'event' ? $.event : id === 'item' ? $.item : Constants[id] || $.params['$' + id];
2317
- },
2318
- MemberExpression: ($, n) => {
2319
- const d = !n.computed,
2320
- o = $(n.object);
2321
- if (d) $.memberDepth += 1;
2322
- const p = $(n.property);
2323
- if (d) $.memberDepth -= 1;
2324
- if (DisallowedMethods.has(o[p])) {
2325
- // eslint-disable-next-line no-console
2326
- console.error(`Prevented interpretation of member "${p}" which could lead to insecure code execution`);
2327
- return;
2328
- }
2329
- return o[p];
2330
- },
2331
- CallExpression: ($, n) => {
2332
- const args = n.arguments;
2333
- let name = n.callee.name;
2334
-
2335
- // handle special internal functions used by encoders
2336
- // re-route to corresponding standard function
2337
- if (name.startsWith('_')) {
2338
- name = name.slice(1);
2339
- }
2340
-
2341
- // special case "if" due to conditional evaluation of branches
2342
- return name === 'if' ? $(args[0]) ? $(args[1]) : $(args[2]) : ($.fn[name] || Functions[name]).apply($.fn, args.map($));
2343
- },
2344
- ArrayExpression: ($, n) => n.elements.map($),
2345
- BinaryExpression: ($, n) => Ops[n.operator]($(n.left), $(n.right)),
2346
- UnaryExpression: ($, n) => Unary[n.operator]($(n.argument)),
2347
- ConditionalExpression: ($, n) => $(n.test) ? $(n.consequent) : $(n.alternate),
2348
- LogicalExpression: ($, n) => n.operator === '&&' ? $(n.left) && $(n.right) : $(n.left) || $(n.right),
2349
- ObjectExpression: ($, n) => n.properties.reduce((o, p) => {
2350
- $.memberDepth += 1;
2351
- const k = $(p.key);
2352
- $.memberDepth -= 1;
2353
- if (DisallowedMethods.has($(p.value))) {
2354
- // eslint-disable-next-line no-console
2355
- console.error(`Prevented interpretation of property "${k}" which could lead to insecure code execution`);
2356
- } else {
2357
- o[k] = $(p.value);
2358
- }
2359
- return o;
2360
- }, {})
2361
- };
2362
- function interpret(ast, fn, params, datum, event, item) {
2363
- const $ = n => Visitors[n.type]($, n);
2364
- $.memberDepth = 0;
2365
- $.fn = Object.create(fn);
2366
- $.params = params;
2367
- $.datum = datum;
2368
- $.event = event;
2369
- $.item = item;
2370
-
2371
- // route event functions to annotated vega event context
2372
- EventFunctions.forEach(f => $.fn[f] = function () {
2373
- return event.vega[f](...arguments);
2374
- });
2375
- return $(ast);
2376
- }
2377
- var expression = {
2378
- /**
2379
- * Parse an expression used to update an operator value.
2380
- */
2381
- operator(ctx, expr) {
2382
- const ast = expr.ast,
2383
- fn = ctx.functions;
2384
- return _ => interpret(ast, fn, _);
2385
- },
2386
- /**
2387
- * Parse an expression provided as an operator parameter value.
2388
- */
2389
- parameter(ctx, expr) {
2390
- const ast = expr.ast,
2391
- fn = ctx.functions;
2392
- return (datum, _) => interpret(ast, fn, _, datum);
2393
- },
2394
- /**
2395
- * Parse an expression applied to an event stream.
2396
- */
2397
- event(ctx, expr) {
2398
- const ast = expr.ast,
2399
- fn = ctx.functions;
2400
- return event => interpret(ast, fn, undefined, undefined, event);
2401
- },
2402
- /**
2403
- * Parse an expression used to handle an event-driven operator update.
2404
- */
2405
- handler(ctx, expr) {
2406
- const ast = expr.ast,
2407
- fn = ctx.functions;
2408
- return (_, event) => {
2409
- const datum = event.item && event.item.datum;
2410
- return interpret(ast, fn, _, datum, event);
2411
- };
2412
- },
2413
- /**
2414
- * Parse an expression that performs visual encoding.
2415
- */
2416
- encode(ctx, encode) {
2417
- const {
2418
- marktype,
2419
- channels
2420
- } = encode,
2421
- fn = ctx.functions,
2422
- swap = marktype === 'group' || marktype === 'image' || marktype === 'rect';
2423
- return (item, _) => {
2424
- const datum = item.datum;
2425
- let m = 0,
2426
- v;
2427
- for (const name in channels) {
2428
- v = interpret(channels[name].ast, fn, _, datum, undefined, item);
2429
- if (item[name] !== v) {
2430
- item[name] = v;
2431
- m = 1;
2432
- }
2433
- }
2434
- if (marktype !== 'rule') {
2435
- adjustSpatial(item, channels, swap);
2436
- }
2437
- return m;
2438
- };
2439
- }
2440
- };
2441
-
2442
- function e(e) {
2443
- const [n, r] = /schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1, 3);
2444
- return {
2445
- library: n,
2446
- version: r
2447
- };
2448
- }
2449
-
2450
- var name$1 = "vega-themes";
2451
- var version$1$1 = "2.15.0";
2452
- var description$1 = "Themes for stylized Vega and Vega-Lite visualizations.";
2453
- var keywords$1 = ["vega", "vega-lite", "themes", "style"];
2454
- var license$1 = "BSD-3-Clause";
2455
- var author$1 = {
2456
- name: "UW Interactive Data Lab",
2457
- url: "https://idl.cs.washington.edu"
2458
- };
2459
- var contributors$1 = [{
2460
- name: "Emily Gu",
2461
- url: "https://github.com/emilygu"
2462
- }, {
2463
- name: "Arvind Satyanarayan",
2464
- url: "http://arvindsatya.com"
2465
- }, {
2466
- name: "Jeffrey Heer",
2467
- url: "https://idl.cs.washington.edu"
2468
- }, {
2469
- name: "Dominik Moritz",
2470
- url: "https://www.domoritz.de"
2471
- }];
2472
- var main$1 = "build/vega-themes.js";
2473
- var module$1 = "build/vega-themes.module.js";
2474
- var unpkg$1 = "build/vega-themes.min.js";
2475
- var jsdelivr$1 = "build/vega-themes.min.js";
2476
- var types$1 = "build/vega-themes.module.d.ts";
2477
- var repository$1 = {
2478
- type: "git",
2479
- url: "https://github.com/vega/vega-themes.git"
2480
- };
2481
- var files$1 = ["src", "build"];
2482
- var scripts$1 = {
2483
- prebuild: "yarn clean",
2484
- build: "rollup -c",
2485
- clean: "rimraf build && rimraf examples/build",
2486
- "copy:data": "rsync -r node_modules/vega-datasets/data/* examples/data",
2487
- "copy:build": "rsync -r build/* examples/build",
2488
- "deploy:gh": "yarn build && mkdir -p examples/build && rsync -r build/* examples/build && gh-pages -d examples",
2489
- preversion: "yarn lint",
2490
- serve: "browser-sync start -s -f build examples --serveStatic examples",
2491
- start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
2492
- format: "eslint . --fix",
2493
- lint: "eslint .",
2494
- release: "release-it"
2495
- };
2496
- var devDependencies$1 = {
2497
- "@babel/core": "^7.24.6",
2498
- "@babel/plugin-transform-runtime": "^7.24.6",
2499
- "@babel/preset-env": "^7.24.6",
2500
- "@babel/preset-typescript": "^7.24.6",
2501
- "@release-it/conventional-changelog": "^8.0.1",
2502
- "@rollup/plugin-json": "^6.1.0",
2503
- "@rollup/plugin-node-resolve": "^15.2.3",
2504
- "@rollup/plugin-terser": "^0.4.4",
2505
- "@typescript-eslint/eslint-plugin": "^7.11.0",
2506
- "@typescript-eslint/parser": "^7.11.0",
2507
- "browser-sync": "^3.0.2",
2508
- concurrently: "^8.2.2",
2509
- eslint: "^8.45.0",
2510
- "eslint-config-prettier": "^9.1.0",
2511
- "eslint-plugin-prettier": "^5.1.3",
2512
- "gh-pages": "^6.1.1",
2513
- prettier: "^3.2.5",
2514
- "release-it": "^17.3.0",
2515
- rollup: "^4.18.0",
2516
- "rollup-plugin-bundle-size": "^1.0.3",
2517
- "rollup-plugin-ts": "^3.4.5",
2518
- typescript: "^5.4.5",
2519
- vega: "^5.25.0",
2520
- "vega-lite": "^5.9.3"
2521
- };
2522
- var peerDependencies$1 = {
2523
- vega: "*",
2524
- "vega-lite": "*"
2525
- };
2526
- var dependencies$1 = {};
2527
- var pkg$1 = {
2528
- name: name$1,
2529
- version: version$1$1,
2530
- description: description$1,
2531
- keywords: keywords$1,
2532
- license: license$1,
2533
- author: author$1,
2534
- contributors: contributors$1,
2535
- main: main$1,
2536
- module: module$1,
2537
- unpkg: unpkg$1,
2538
- jsdelivr: jsdelivr$1,
2539
- types: types$1,
2540
- repository: repository$1,
2541
- files: files$1,
2542
- scripts: scripts$1,
2543
- devDependencies: devDependencies$1,
2544
- peerDependencies: peerDependencies$1,
2545
- dependencies: dependencies$1
2546
- };
2547
- const lightColor = '#fff';
2548
- const medColor = '#888';
2549
- const darkTheme = {
2550
- background: '#333',
2551
- view: {
2552
- stroke: medColor
2553
- },
2554
- title: {
2555
- color: lightColor,
2556
- subtitleColor: lightColor
2557
- },
2558
- style: {
2559
- 'guide-label': {
2560
- fill: lightColor
2561
- },
2562
- 'guide-title': {
2563
- fill: lightColor
2564
- }
2565
- },
2566
- axis: {
2567
- domainColor: lightColor,
2568
- gridColor: medColor,
2569
- tickColor: lightColor
2570
- }
2571
- };
2572
- const markColor$7 = '#4572a7';
2573
- const excelTheme = {
2574
- background: '#fff',
2575
- arc: {
2576
- fill: markColor$7
2577
- },
2578
- area: {
2579
- fill: markColor$7
2580
- },
2581
- line: {
2582
- stroke: markColor$7,
2583
- strokeWidth: 2
2584
- },
2585
- path: {
2586
- stroke: markColor$7
2587
- },
2588
- rect: {
2589
- fill: markColor$7
2590
- },
2591
- shape: {
2592
- stroke: markColor$7
2593
- },
2594
- symbol: {
2595
- fill: markColor$7,
2596
- strokeWidth: 1.5,
2597
- size: 50
2598
- },
2599
- axis: {
2600
- bandPosition: 0.5,
2601
- grid: true,
2602
- gridColor: '#000000',
2603
- gridOpacity: 1,
2604
- gridWidth: 0.5,
2605
- labelPadding: 10,
2606
- tickSize: 5,
2607
- tickWidth: 0.5
2608
- },
2609
- axisBand: {
2610
- grid: false,
2611
- tickExtra: true
2612
- },
2613
- legend: {
2614
- labelBaseline: 'middle',
2615
- labelFontSize: 11,
2616
- symbolSize: 50,
2617
- symbolType: 'square'
2618
- },
2619
- range: {
2620
- category: ['#4572a7', '#aa4643', '#8aa453', '#71598e', '#4598ae', '#d98445', '#94aace', '#d09393', '#b9cc98', '#a99cbc']
2621
- }
2622
- };
2623
- const markColor$6 = '#30a2da';
2624
- const axisColor$2 = '#cbcbcb';
2625
- const guideLabelColor = '#999';
2626
- const guideTitleColor = '#333';
2627
- const backgroundColor$2 = '#f0f0f0';
2628
- const blackTitle = '#333';
2629
- const fiveThirtyEightTheme = {
2630
- arc: {
2631
- fill: markColor$6
2632
- },
2633
- area: {
2634
- fill: markColor$6
2635
- },
2636
- axis: {
2637
- domainColor: axisColor$2,
2638
- grid: true,
2639
- gridColor: axisColor$2,
2640
- gridWidth: 1,
2641
- labelColor: guideLabelColor,
2642
- labelFontSize: 10,
2643
- titleColor: guideTitleColor,
2644
- tickColor: axisColor$2,
2645
- tickSize: 10,
2646
- titleFontSize: 14,
2647
- titlePadding: 10,
2648
- labelPadding: 4
2649
- },
2650
- axisBand: {
2651
- grid: false
2652
- },
2653
- background: backgroundColor$2,
2654
- group: {
2655
- fill: backgroundColor$2
2656
- },
2657
- legend: {
2658
- labelColor: blackTitle,
2659
- labelFontSize: 11,
2660
- padding: 1,
2661
- symbolSize: 30,
2662
- symbolType: 'square',
2663
- titleColor: blackTitle,
2664
- titleFontSize: 14,
2665
- titlePadding: 10
2666
- },
2667
- line: {
2668
- stroke: markColor$6,
2669
- strokeWidth: 2
2670
- },
2671
- path: {
2672
- stroke: markColor$6,
2673
- strokeWidth: 0.5
2674
- },
2675
- rect: {
2676
- fill: markColor$6
2677
- },
2678
- range: {
2679
- category: ['#30a2da', '#fc4f30', '#e5ae38', '#6d904f', '#8b8b8b', '#b96db8', '#ff9e27', '#56cc60', '#52d2ca', '#52689e', '#545454', '#9fe4f8'],
2680
- diverging: ['#cc0020', '#e77866', '#f6e7e1', '#d6e8ed', '#91bfd9', '#1d78b5'],
2681
- heatmap: ['#d6e8ed', '#cee0e5', '#91bfd9', '#549cc6', '#1d78b5']
2682
- },
2683
- point: {
2684
- filled: true,
2685
- shape: 'circle'
2686
- },
2687
- shape: {
2688
- stroke: markColor$6
2689
- },
2690
- bar: {
2691
- binSpacing: 2,
2692
- fill: markColor$6,
2693
- stroke: null
2694
- },
2695
- title: {
2696
- anchor: 'start',
2697
- fontSize: 24,
2698
- fontWeight: 600,
2699
- offset: 20
2700
- }
2701
- };
2702
- const markColor$5 = '#000';
2703
- const ggplot2Theme = {
2704
- group: {
2705
- fill: '#e5e5e5'
2706
- },
2707
- arc: {
2708
- fill: markColor$5
2709
- },
2710
- area: {
2711
- fill: markColor$5
2712
- },
2713
- line: {
2714
- stroke: markColor$5
2715
- },
2716
- path: {
2717
- stroke: markColor$5
2718
- },
2719
- rect: {
2720
- fill: markColor$5
2721
- },
2722
- shape: {
2723
- stroke: markColor$5
2724
- },
2725
- symbol: {
2726
- fill: markColor$5,
2727
- size: 40
2728
- },
2729
- axis: {
2730
- domain: false,
2731
- grid: true,
2732
- gridColor: '#FFFFFF',
2733
- gridOpacity: 1,
2734
- labelColor: '#7F7F7F',
2735
- labelPadding: 4,
2736
- tickColor: '#7F7F7F',
2737
- tickSize: 5.67,
2738
- titleFontSize: 16,
2739
- titleFontWeight: 'normal'
2740
- },
2741
- legend: {
2742
- labelBaseline: 'middle',
2743
- labelFontSize: 11,
2744
- symbolSize: 40
2745
- },
2746
- range: {
2747
- category: ['#000000', '#7F7F7F', '#1A1A1A', '#999999', '#333333', '#B0B0B0', '#4D4D4D', '#C9C9C9', '#666666', '#DCDCDC']
2748
- }
2749
- };
2750
- const headlineFontSize = 22;
2751
- const headlineFontWeight = 'normal';
2752
- const labelFont$1 = 'Benton Gothic, sans-serif';
2753
- const labelFontSize = 11.5;
2754
- const labelFontWeight = 'normal';
2755
- const markColor$4 = '#82c6df';
2756
- // const markHighlight = '#006d8f';
2757
- // const markDemocrat = '#5789b8';
2758
- // const markRepublican = '#d94f54';
2759
- const titleFont = 'Benton Gothic Bold, sans-serif';
2760
- const titleFontWeight = 'normal';
2761
- const titleFontSize$1 = 13;
2762
- const colorSchemes$1 = {
2763
- 'category-6': ['#ec8431', '#829eb1', '#c89d29', '#3580b1', '#adc839', '#ab7fb4'],
2764
- 'fire-7': ['#fbf2c7', '#f9e39c', '#f8d36e', '#f4bb6a', '#e68a4f', '#d15a40', '#ab4232'],
2765
- 'fireandice-6': ['#e68a4f', '#f4bb6a', '#f9e39c', '#dadfe2', '#a6b7c6', '#849eae'],
2766
- 'ice-7': ['#edefee', '#dadfe2', '#c4ccd2', '#a6b7c6', '#849eae', '#607785', '#47525d']
2767
- };
2768
- const latimesTheme = {
2769
- background: '#ffffff',
2770
- title: {
2771
- anchor: 'start',
2772
- color: '#000000',
2773
- font: titleFont,
2774
- fontSize: headlineFontSize,
2775
- fontWeight: headlineFontWeight
2776
- },
2777
- arc: {
2778
- fill: markColor$4
2779
- },
2780
- area: {
2781
- fill: markColor$4
2782
- },
2783
- line: {
2784
- stroke: markColor$4,
2785
- strokeWidth: 2
2786
- },
2787
- path: {
2788
- stroke: markColor$4
2789
- },
2790
- rect: {
2791
- fill: markColor$4
2792
- },
2793
- shape: {
2794
- stroke: markColor$4
2795
- },
2796
- symbol: {
2797
- fill: markColor$4,
2798
- size: 30
2799
- },
2800
- axis: {
2801
- labelFont: labelFont$1,
2802
- labelFontSize,
2803
- labelFontWeight,
2804
- titleFont,
2805
- titleFontSize: titleFontSize$1,
2806
- titleFontWeight
2807
- },
2808
- axisX: {
2809
- labelAngle: 0,
2810
- labelPadding: 4,
2811
- tickSize: 3
2812
- },
2813
- axisY: {
2814
- labelBaseline: 'middle',
2815
- maxExtent: 45,
2816
- minExtent: 45,
2817
- tickSize: 2,
2818
- titleAlign: 'left',
2819
- titleAngle: 0,
2820
- titleX: -45,
2821
- titleY: -11
2822
- },
2823
- legend: {
2824
- labelFont: labelFont$1,
2825
- labelFontSize,
2826
- symbolType: 'square',
2827
- titleFont,
2828
- titleFontSize: titleFontSize$1,
2829
- titleFontWeight
2830
- },
2831
- range: {
2832
- category: colorSchemes$1['category-6'],
2833
- diverging: colorSchemes$1['fireandice-6'],
2834
- heatmap: colorSchemes$1['fire-7'],
2835
- ordinal: colorSchemes$1['fire-7'],
2836
- ramp: colorSchemes$1['fire-7']
2837
- }
2838
- };
2839
- const markColor$3 = '#ab5787';
2840
- const axisColor$1 = '#979797';
2841
- const quartzTheme = {
2842
- background: '#f9f9f9',
2843
- arc: {
2844
- fill: markColor$3
2845
- },
2846
- area: {
2847
- fill: markColor$3
2848
- },
2849
- line: {
2850
- stroke: markColor$3
2851
- },
2852
- path: {
2853
- stroke: markColor$3
2854
- },
2855
- rect: {
2856
- fill: markColor$3
2857
- },
2858
- shape: {
2859
- stroke: markColor$3
2860
- },
2861
- symbol: {
2862
- fill: markColor$3,
2863
- size: 30
2864
- },
2865
- axis: {
2866
- domainColor: axisColor$1,
2867
- domainWidth: 0.5,
2868
- gridWidth: 0.2,
2869
- labelColor: axisColor$1,
2870
- tickColor: axisColor$1,
2871
- tickWidth: 0.2,
2872
- titleColor: axisColor$1
2873
- },
2874
- axisBand: {
2875
- grid: false
2876
- },
2877
- axisX: {
2878
- grid: true,
2879
- tickSize: 10
2880
- },
2881
- axisY: {
2882
- domain: false,
2883
- grid: true,
2884
- tickSize: 0
2885
- },
2886
- legend: {
2887
- labelFontSize: 11,
2888
- padding: 1,
2889
- symbolSize: 30,
2890
- symbolType: 'square'
2891
- },
2892
- range: {
2893
- category: ['#ab5787', '#51b2e5', '#703c5c', '#168dd9', '#d190b6', '#00609f', '#d365ba', '#154866', '#666666', '#c4c4c4']
2894
- }
2895
- };
2896
- const markColor$2 = '#3e5c69';
2897
- const voxTheme = {
2898
- background: '#fff',
2899
- arc: {
2900
- fill: markColor$2
2901
- },
2902
- area: {
2903
- fill: markColor$2
2904
- },
2905
- line: {
2906
- stroke: markColor$2
2907
- },
2908
- path: {
2909
- stroke: markColor$2
2910
- },
2911
- rect: {
2912
- fill: markColor$2
2913
- },
2914
- shape: {
2915
- stroke: markColor$2
2916
- },
2917
- symbol: {
2918
- fill: markColor$2
2919
- },
2920
- axis: {
2921
- domainWidth: 0.5,
2922
- grid: true,
2923
- labelPadding: 2,
2924
- tickSize: 5,
2925
- tickWidth: 0.5,
2926
- titleFontWeight: 'normal'
2927
- },
2928
- axisBand: {
2929
- grid: false
2930
- },
2931
- axisX: {
2932
- gridWidth: 0.2
2933
- },
2934
- axisY: {
2935
- gridDash: [3],
2936
- gridWidth: 0.4
2937
- },
2938
- legend: {
2939
- labelFontSize: 11,
2940
- padding: 1,
2941
- symbolType: 'square'
2942
- },
2943
- range: {
2944
- category: ['#3e5c69', '#6793a6', '#182429', '#0570b0', '#3690c0', '#74a9cf', '#a6bddb', '#e2ddf2']
2945
- }
2946
- };
2947
- const markColor$1 = '#1696d2';
2948
- const axisColor = '#000000';
2949
- const backgroundColor$1 = '#FFFFFF';
2950
- const font = 'Lato';
2951
- const labelFont = 'Lato';
2952
- const sourceFont = 'Lato';
2953
- const gridColor$1 = '#DEDDDD';
2954
- const titleFontSize = 18;
2955
- const colorSchemes = {
2956
- 'main-colors': ['#1696d2', '#d2d2d2', '#000000', '#fdbf11', '#ec008b', '#55b748', '#5c5859', '#db2b27'],
2957
- 'shades-blue': ['#CFE8F3', '#A2D4EC', '#73BFE2', '#46ABDB', '#1696D2', '#12719E', '#0A4C6A', '#062635'],
2958
- 'shades-gray': ['#F5F5F5', '#ECECEC', '#E3E3E3', '#DCDBDB', '#D2D2D2', '#9D9D9D', '#696969', '#353535'],
2959
- 'shades-yellow': ['#FFF2CF', '#FCE39E', '#FDD870', '#FCCB41', '#FDBF11', '#E88E2D', '#CA5800', '#843215'],
2960
- 'shades-magenta': ['#F5CBDF', '#EB99C2', '#E46AA7', '#E54096', '#EC008B', '#AF1F6B', '#761548', '#351123'],
2961
- 'shades-green': ['#DCEDD9', '#BCDEB4', '#98CF90', '#78C26D', '#55B748', '#408941', '#2C5C2D', '#1A2E19'],
2962
- 'shades-black': ['#D5D5D4', '#ADABAC', '#848081', '#5C5859', '#332D2F', '#262223', '#1A1717', '#0E0C0D'],
2963
- 'shades-red': ['#F8D5D4', '#F1AAA9', '#E9807D', '#E25552', '#DB2B27', '#A4201D', '#6E1614', '#370B0A'],
2964
- 'one-group': ['#1696d2', '#000000'],
2965
- 'two-groups-cat-1': ['#1696d2', '#000000'],
2966
- 'two-groups-cat-2': ['#1696d2', '#fdbf11'],
2967
- 'two-groups-cat-3': ['#1696d2', '#db2b27'],
2968
- 'two-groups-seq': ['#a2d4ec', '#1696d2'],
2969
- 'three-groups-cat': ['#1696d2', '#fdbf11', '#000000'],
2970
- 'three-groups-seq': ['#a2d4ec', '#1696d2', '#0a4c6a'],
2971
- 'four-groups-cat-1': ['#000000', '#d2d2d2', '#fdbf11', '#1696d2'],
2972
- 'four-groups-cat-2': ['#1696d2', '#ec0008b', '#fdbf11', '#5c5859'],
2973
- 'four-groups-seq': ['#cfe8f3', '#73bf42', '#1696d2', '#0a4c6a'],
2974
- 'five-groups-cat-1': ['#1696d2', '#fdbf11', '#d2d2d2', '#ec008b', '#000000'],
2975
- 'five-groups-cat-2': ['#1696d2', '#0a4c6a', '#d2d2d2', '#fdbf11', '#332d2f'],
2976
- 'five-groups-seq': ['#cfe8f3', '#73bf42', '#1696d2', '#0a4c6a', '#000000'],
2977
- 'six-groups-cat-1': ['#1696d2', '#ec008b', '#fdbf11', '#000000', '#d2d2d2', '#55b748'],
2978
- 'six-groups-cat-2': ['#1696d2', '#d2d2d2', '#ec008b', '#fdbf11', '#332d2f', '#0a4c6a'],
2979
- 'six-groups-seq': ['#cfe8f3', '#a2d4ec', '#73bfe2', '#46abdb', '#1696d2', '#12719e'],
2980
- 'diverging-colors': ['#ca5800', '#fdbf11', '#fdd870', '#fff2cf', '#cfe8f3', '#73bfe2', '#1696d2', '#0a4c6a']
2981
- };
2982
- const urbanInstituteTheme = {
2983
- background: backgroundColor$1,
2984
- title: {
2985
- anchor: 'start',
2986
- fontSize: titleFontSize,
2987
- font: font
2988
- },
2989
- axisX: {
2990
- domain: true,
2991
- domainColor: axisColor,
2992
- domainWidth: 1,
2993
- grid: false,
2994
- labelFontSize: 12,
2995
- labelFont: labelFont,
2996
- labelAngle: 0,
2997
- tickColor: axisColor,
2998
- tickSize: 5,
2999
- titleFontSize: 12,
3000
- titlePadding: 10,
3001
- titleFont: font
3002
- },
3003
- axisY: {
3004
- domain: false,
3005
- domainWidth: 1,
3006
- grid: true,
3007
- gridColor: gridColor$1,
3008
- gridWidth: 1,
3009
- labelFontSize: 12,
3010
- labelFont: labelFont,
3011
- labelPadding: 8,
3012
- ticks: false,
3013
- titleFontSize: 12,
3014
- titlePadding: 10,
3015
- titleFont: font,
3016
- titleAngle: 0,
3017
- titleY: -10,
3018
- titleX: 18
3019
- },
3020
- legend: {
3021
- labelFontSize: 12,
3022
- labelFont: labelFont,
3023
- symbolSize: 100,
3024
- titleFontSize: 12,
3025
- titlePadding: 10,
3026
- titleFont: font,
3027
- orient: 'right',
3028
- offset: 10
3029
- },
3030
- view: {
3031
- stroke: 'transparent'
3032
- },
3033
- range: {
3034
- category: colorSchemes['six-groups-cat-1'],
3035
- diverging: colorSchemes['diverging-colors'],
3036
- heatmap: colorSchemes['diverging-colors'],
3037
- ordinal: colorSchemes['six-groups-seq'],
3038
- ramp: colorSchemes['shades-blue']
3039
- },
3040
- area: {
3041
- fill: markColor$1
3042
- },
3043
- rect: {
3044
- fill: markColor$1
3045
- },
3046
- line: {
3047
- color: markColor$1,
3048
- stroke: markColor$1,
3049
- strokeWidth: 5
3050
- },
3051
- trail: {
3052
- color: markColor$1,
3053
- stroke: markColor$1,
3054
- strokeWidth: 0,
3055
- size: 1
3056
- },
3057
- path: {
3058
- stroke: markColor$1,
3059
- strokeWidth: 0.5
3060
- },
3061
- point: {
3062
- filled: true
3063
- },
3064
- text: {
3065
- font: sourceFont,
3066
- color: markColor$1,
3067
- fontSize: 11,
3068
- align: 'center',
3069
- fontWeight: 400,
3070
- size: 11
3071
- },
3072
- style: {
3073
- bar: {
3074
- fill: markColor$1,
3075
- stroke: null
3076
- }
3077
- },
3078
- arc: {
3079
- fill: markColor$1
3080
- },
3081
- shape: {
3082
- stroke: markColor$1
3083
- },
3084
- symbol: {
3085
- fill: markColor$1,
3086
- size: 30
3087
- }
3088
- };
3089
-
3090
- /**
3091
- * Copyright 2020 Google LLC.
3092
- *
3093
- * Use of this source code is governed by a BSD-style
3094
- * license that can be found in the LICENSE file or at
3095
- * https://developers.google.com/open-source/licenses/bsd
3096
- */
3097
-
3098
- const markColor = '#3366CC';
3099
- const gridColor = '#ccc';
3100
- const defaultFont$1 = 'Arial, sans-serif';
3101
- const googlechartsTheme = {
3102
- arc: {
3103
- fill: markColor
3104
- },
3105
- area: {
3106
- fill: markColor
3107
- },
3108
- path: {
3109
- stroke: markColor
3110
- },
3111
- rect: {
3112
- fill: markColor
3113
- },
3114
- shape: {
3115
- stroke: markColor
3116
- },
3117
- symbol: {
3118
- stroke: markColor
3119
- },
3120
- circle: {
3121
- fill: markColor
3122
- },
3123
- background: '#fff',
3124
- padding: {
3125
- top: 10,
3126
- right: 10,
3127
- bottom: 10,
3128
- left: 10
3129
- },
3130
- style: {
3131
- 'guide-label': {
3132
- font: defaultFont$1,
3133
- fontSize: 12
3134
- },
3135
- 'guide-title': {
3136
- font: defaultFont$1,
3137
- fontSize: 12
3138
- },
3139
- 'group-title': {
3140
- font: defaultFont$1,
3141
- fontSize: 12
3142
- }
3143
- },
3144
- title: {
3145
- font: defaultFont$1,
3146
- fontSize: 14,
3147
- fontWeight: 'bold',
3148
- dy: -3,
3149
- anchor: 'start'
3150
- },
3151
- axis: {
3152
- gridColor: gridColor,
3153
- tickColor: gridColor,
3154
- domain: false,
3155
- grid: true
3156
- },
3157
- range: {
3158
- category: ['#4285F4', '#DB4437', '#F4B400', '#0F9D58', '#AB47BC', '#00ACC1', '#FF7043', '#9E9D24', '#5C6BC0', '#F06292', '#00796B', '#C2185B'],
3159
- heatmap: ['#c6dafc', '#5e97f6', '#2a56c6']
3160
- }
3161
- };
3162
- const ptToPx = value => value * (1 / 3 + 1);
3163
- const fontSmallPx = ptToPx(9);
3164
- const legendFontPx = ptToPx(10);
3165
- const fontLargePx = ptToPx(12);
3166
- const fontStandard = 'Segoe UI';
3167
- const fontTitle = 'wf_standard-font, helvetica, arial, sans-serif';
3168
- const firstLevelElementColor = '#252423';
3169
- const secondLevelElementColor = '#605E5C';
3170
- const backgroundColor = 'transparent';
3171
- const backgroundSecondaryColor = '#C8C6C4';
3172
- const paletteColor1 = '#118DFF';
3173
- const paletteColor2 = '#12239E';
3174
- const paletteColor3 = '#E66C37';
3175
- const paletteColor4 = '#6B007B';
3176
- const paletteColor5 = '#E044A7';
3177
- const paletteColor6 = '#744EC2';
3178
- const paletteColor7 = '#D9B300';
3179
- const paletteColor8 = '#D64550';
3180
- const divergentColorMax = paletteColor1;
3181
- const divergentColorMin = '#DEEFFF';
3182
- const divergentPalette = [divergentColorMin, divergentColorMax];
3183
- const ordinalPalette = [divergentColorMin, '#c7e4ff', '#b0d9ff', '#9aceff', '#83c3ff', '#6cb9ff', '#55aeff', '#3fa3ff', '#2898ff', divergentColorMax];
3184
- const powerbiTheme = {
3185
- view: {
3186
- stroke: backgroundColor
3187
- },
3188
- background: backgroundColor,
3189
- font: fontStandard,
3190
- header: {
3191
- titleFont: fontTitle,
3192
- titleFontSize: fontLargePx,
3193
- titleColor: firstLevelElementColor,
3194
- labelFont: fontStandard,
3195
- labelFontSize: legendFontPx,
3196
- labelColor: secondLevelElementColor
3197
- },
3198
- axis: {
3199
- ticks: false,
3200
- grid: false,
3201
- domain: false,
3202
- labelColor: secondLevelElementColor,
3203
- labelFontSize: fontSmallPx,
3204
- titleFont: fontTitle,
3205
- titleColor: firstLevelElementColor,
3206
- titleFontSize: fontLargePx,
3207
- titleFontWeight: 'normal'
3208
- },
3209
- axisQuantitative: {
3210
- tickCount: 3,
3211
- grid: true,
3212
- gridColor: backgroundSecondaryColor,
3213
- gridDash: [1, 5],
3214
- labelFlush: false
3215
- },
3216
- axisBand: {
3217
- tickExtra: true
3218
- },
3219
- axisX: {
3220
- labelPadding: 5
3221
- },
3222
- axisY: {
3223
- labelPadding: 10
3224
- },
3225
- bar: {
3226
- fill: paletteColor1
3227
- },
3228
- line: {
3229
- stroke: paletteColor1,
3230
- strokeWidth: 3,
3231
- strokeCap: 'round',
3232
- strokeJoin: 'round'
3233
- },
3234
- text: {
3235
- font: fontStandard,
3236
- fontSize: fontSmallPx,
3237
- fill: secondLevelElementColor
3238
- },
3239
- arc: {
3240
- fill: paletteColor1
3241
- },
3242
- area: {
3243
- fill: paletteColor1,
3244
- line: true,
3245
- opacity: 0.6
3246
- },
3247
- path: {
3248
- stroke: paletteColor1
3249
- },
3250
- rect: {
3251
- fill: paletteColor1
3252
- },
3253
- point: {
3254
- fill: paletteColor1,
3255
- filled: true,
3256
- size: 75
3257
- },
3258
- shape: {
3259
- stroke: paletteColor1
3260
- },
3261
- symbol: {
3262
- fill: paletteColor1,
3263
- strokeWidth: 1.5,
3264
- size: 50
3265
- },
3266
- legend: {
3267
- titleFont: fontStandard,
3268
- titleFontWeight: 'bold',
3269
- titleColor: secondLevelElementColor,
3270
- labelFont: fontStandard,
3271
- labelFontSize: legendFontPx,
3272
- labelColor: secondLevelElementColor,
3273
- symbolType: 'circle',
3274
- symbolSize: 75
3275
- },
3276
- range: {
3277
- category: [paletteColor1, paletteColor2, paletteColor3, paletteColor4, paletteColor5, paletteColor6, paletteColor7, paletteColor8],
3278
- diverging: divergentPalette,
3279
- heatmap: divergentPalette,
3280
- ordinal: ordinalPalette
3281
- }
3282
- };
3283
- const defaultFont = 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif';
3284
- const condensedFont = 'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif';
3285
- const fontWeight = 400;
3286
- const TOKENS = {
3287
- textPrimary: {
3288
- g90: '#f4f4f4',
3289
- g100: '#f4f4f4',
3290
- white: '#161616',
3291
- g10: '#161616'
3292
- },
3293
- textSecondary: {
3294
- g90: '#c6c6c6',
3295
- g100: '#c6c6c6',
3296
- white: '#525252',
3297
- g10: '#525252'
3298
- },
3299
- // layer
3300
- layerAccent01: {
3301
- white: '#e0e0e0',
3302
- g10: '#e0e0e0',
3303
- g90: '#525252',
3304
- g100: '#393939'
3305
- },
3306
- // grid
3307
- gridBg: {
3308
- white: '#ffffff',
3309
- g10: '#ffffff',
3310
- g90: '#161616',
3311
- g100: '#161616'
3312
- }
3313
- };
3314
- const darkCategories = ['#8a3ffc', '#33b1ff', '#007d79', '#ff7eb6', '#fa4d56', '#fff1f1', '#6fdc8c', '#4589ff', '#d12771', '#d2a106', '#08bdba', '#bae6ff', '#ba4e00', '#d4bbff'];
3315
- const lightCategories = ['#6929c4', '#1192e8', '#005d5d', '#9f1853', '#fa4d56', '#570408', '#198038', '#002d9c', '#ee538b', '#b28600', '#009d9a', '#012749', '#8a3800', '#a56eff'];
3316
- function genCarbonConfig({
3317
- theme,
3318
- background
3319
- }) {
3320
- const type = ['white', 'g10'].includes(theme) ? 'light' : 'dark';
3321
- const viewbg = TOKENS.gridBg[theme];
3322
- const titleColor = TOKENS.textPrimary[theme];
3323
- const textColor = TOKENS.textSecondary[theme];
3324
- const category = type === 'dark' ? darkCategories : lightCategories;
3325
- const markColor = type === 'dark' ? '#d4bbff' : '#6929c4';
3326
- return {
3327
- background,
3328
- arc: {
3329
- fill: markColor
3330
- },
3331
- area: {
3332
- fill: markColor
3333
- },
3334
- path: {
3335
- stroke: markColor
3336
- },
3337
- rect: {
3338
- fill: markColor
3339
- },
3340
- shape: {
3341
- stroke: markColor
3342
- },
3343
- symbol: {
3344
- stroke: markColor
3345
- },
3346
- circle: {
3347
- fill: markColor
3348
- },
3349
- view: {
3350
- fill: viewbg,
3351
- stroke: viewbg
3352
- },
3353
- group: {
3354
- fill: viewbg
3355
- },
3356
- title: {
3357
- color: titleColor,
3358
- anchor: 'start',
3359
- dy: -15,
3360
- fontSize: 16,
3361
- font: defaultFont,
3362
- fontWeight: 600
3363
- },
3364
- axis: {
3365
- // Axis labels
3366
- labelColor: textColor,
3367
- labelFontSize: 12,
3368
- labelFont: condensedFont,
3369
- labelFontWeight: fontWeight,
3370
- // Axis titles
3371
- titleColor: titleColor,
3372
- titleFontWeight: 600,
3373
- titleFontSize: 12,
3374
- // MISC
3375
- grid: true,
3376
- gridColor: TOKENS.layerAccent01[theme],
3377
- labelAngle: 0
3378
- },
3379
- axisX: {
3380
- titlePadding: 10
3381
- },
3382
- axisY: {
3383
- titlePadding: 2.5
3384
- },
3385
- style: {
3386
- 'guide-label': {
3387
- font: defaultFont,
3388
- fill: textColor,
3389
- fontWeight: fontWeight
3390
- },
3391
- 'guide-title': {
3392
- font: defaultFont,
3393
- fill: textColor,
3394
- fontWeight: fontWeight
3395
- }
3396
- },
3397
- range: {
3398
- category,
3399
- diverging: ['#750e13', '#a2191f', '#da1e28', '#fa4d56', '#ff8389', '#ffb3b8', '#ffd7d9', '#fff1f1', '#e5f6ff', '#bae6ff', '#82cfff', '#33b1ff', '#1192e8', '#0072c3', '#00539a', '#003a6d'],
3400
- heatmap: ['#f6f2ff', '#e8daff', '#d4bbff', '#be95ff', '#a56eff', '#8a3ffc', '#6929c4', '#491d8b', '#31135e', '#1c0f30']
3401
- }
3402
- };
3403
- }
3404
- const carbonwhite = genCarbonConfig({
3405
- theme: 'white',
3406
- background: '#ffffff'
3407
- });
3408
- const carbong10 = genCarbonConfig({
3409
- theme: 'g10',
3410
- background: '#f4f4f4'
3411
- });
3412
- const carbong90 = genCarbonConfig({
3413
- theme: 'g90',
3414
- background: '#262626'
3415
- });
3416
- const carbong100 = genCarbonConfig({
3417
- theme: 'g100',
3418
- background: '#161616'
3419
- });
3420
- const version$2 = pkg$1.version;
3421
-
3422
- var themes = /*#__PURE__*/Object.freeze({
3423
- __proto__: null,
3424
- carbong10: carbong10,
3425
- carbong100: carbong100,
3426
- carbong90: carbong90,
3427
- carbonwhite: carbonwhite,
3428
- dark: darkTheme,
3429
- excel: excelTheme,
3430
- fivethirtyeight: fiveThirtyEightTheme,
3431
- ggplot2: ggplot2Theme,
3432
- googlecharts: googlechartsTheme,
3433
- latimes: latimesTheme,
3434
- powerbi: powerbiTheme,
3435
- quartz: quartzTheme,
3436
- urbaninstitute: urbanInstituteTheme,
3437
- version: version$2,
3438
- vox: voxTheme
3439
- });
3440
-
3441
- function accessor(fn, fields, name) {
3442
- fn.fields = fields || [];
3443
- fn.fname = name;
3444
- return fn;
3445
- }
3446
- function getter(path) {
3447
- return path.length === 1 ? get1(path[0]) : getN(path);
3448
- }
3449
- const get1 = field => function (obj) {
3450
- return obj[field];
3451
- };
3452
- const getN = path => {
3453
- const len = path.length;
3454
- return function (obj) {
3455
- for (let i = 0; i < len; ++i) {
3456
- obj = obj[path[i]];
3457
- }
3458
- return obj;
3459
- };
3460
- };
3461
- function error(message) {
3462
- throw Error(message);
3463
- }
3464
- function splitAccessPath(p) {
3465
- const path = [],
3466
- n = p.length;
3467
- let q = null,
3468
- b = 0,
3469
- s = '',
3470
- i,
3471
- j,
3472
- c;
3473
- p = p + '';
3474
- function push() {
3475
- path.push(s + p.substring(i, j));
3476
- s = '';
3477
- i = j + 1;
3478
- }
3479
- for (i = j = 0; j < n; ++j) {
3480
- c = p[j];
3481
- if (c === '\\') {
3482
- s += p.substring(i, j++);
3483
- i = j;
3484
- } else if (c === q) {
3485
- push();
3486
- q = null;
3487
- b = -1;
3488
- } else if (q) {
3489
- continue;
3490
- } else if (i === b && c === '"') {
3491
- i = j + 1;
3492
- q = c;
3493
- } else if (i === b && c === "'") {
3494
- i = j + 1;
3495
- q = c;
3496
- } else if (c === '.' && !b) {
3497
- if (j > i) {
3498
- push();
3499
- } else {
3500
- i = j + 1;
3501
- }
3502
- } else if (c === '[') {
3503
- if (j > i) push();
3504
- b = i = j + 1;
3505
- } else if (c === ']') {
3506
- if (!b) error('Access path missing open bracket: ' + p);
3507
- if (b > 0) push();
3508
- b = 0;
3509
- i = j + 1;
3510
- }
3511
- }
3512
- if (b) error('Access path missing closing bracket: ' + p);
3513
- if (q) error('Access path missing closing quote: ' + p);
3514
- if (j > i) {
3515
- j++;
3516
- push();
3517
- }
3518
- return path;
3519
- }
3520
- function field(field, name, opt) {
3521
- const path = splitAccessPath(field);
3522
- field = path.length === 1 ? path[0] : field;
3523
- return accessor((getter)(path), [field], field);
3524
- }
3525
- field('id');
3526
- accessor(_ => _, [], 'identity');
3527
- accessor(() => 0, [], 'zero');
3528
- accessor(() => 1, [], 'one');
3529
- accessor(() => true, [], 'true');
3530
- accessor(() => false, [], 'false');
3531
- var isArray = Array.isArray;
3532
- function isObject(_) {
3533
- return _ === Object(_);
3534
- }
3535
- function isString(_) {
3536
- return typeof _ === 'string';
3537
- }
3538
-
3539
- /**
3540
- * Format the value to be shown in the tooltip.
3541
- *
3542
- * @param value The value to show in the tooltip.
3543
- * @param valueToHtml Function to convert a single cell value to an HTML string
3544
- */
3545
- function formatValue(value, valueToHtml, maxDepth, baseURL) {
3546
- if (isArray(value)) {
3547
- return `[${value.map(v => valueToHtml(isString(v) ? v : stringify(v, maxDepth))).join(', ')}]`;
3548
- }
3549
- if (isObject(value)) {
3550
- let content = '';
3551
- const {
3552
- title,
3553
- image,
3554
- ...rest
3555
- } = value;
3556
- if (title) {
3557
- content += `<h2>${valueToHtml(title)}</h2>`;
3558
- }
3559
- if (image) {
3560
- content += `<img src="${new URL(valueToHtml(image), baseURL || location.href).href}">`;
3561
- }
3562
- const keys = Object.keys(rest);
3563
- if (keys.length > 0) {
3564
- content += '<table>';
3565
- for (const key of keys) {
3566
- let val = rest[key];
3567
-
3568
- // ignore undefined properties
3569
- if (val === undefined) {
3570
- continue;
3571
- }
3572
- if (isObject(val)) {
3573
- val = stringify(val, maxDepth);
3574
- }
3575
- content += `<tr><td class="key">${valueToHtml(key)}</td><td class="value">${valueToHtml(val)}</td></tr>`;
3576
- }
3577
- content += `</table>`;
3578
- }
3579
- return content || '{}'; // show empty object if there are no properties
3580
- }
3581
- return valueToHtml(value);
3582
- }
3583
- function replacer(maxDepth) {
3584
- const stack = [];
3585
- return function (key, value) {
3586
- if (typeof value !== 'object' || value === null) {
3587
- return value;
3588
- }
3589
- const pos = stack.indexOf(this) + 1;
3590
- stack.length = pos;
3591
- if (stack.length > maxDepth) {
3592
- return '[Object]';
3593
- }
3594
- if (stack.indexOf(value) >= 0) {
3595
- return '[Circular]';
3596
- }
3597
- stack.push(value);
3598
- return value;
3599
- };
3600
- }
3601
-
3602
- /**
3603
- * Stringify any JS object to valid JSON
3604
- */
3605
- function stringify(obj, maxDepth) {
3606
- return JSON.stringify(obj, replacer(maxDepth));
3607
- }
3608
-
3609
- // generated with build-style.sh
3610
- var defaultStyle = `#vg-tooltip-element {
3611
- visibility: hidden;
3612
- padding: 8px;
3613
- position: fixed;
3614
- z-index: 1000;
3615
- font-family: sans-serif;
3616
- font-size: 11px;
3617
- border-radius: 3px;
3618
- box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
3619
- /* The default theme is the light theme. */
3620
- background-color: rgba(255, 255, 255, 0.95);
3621
- border: 1px solid #d9d9d9;
3622
- color: black;
3623
- }
3624
- #vg-tooltip-element.visible {
3625
- visibility: visible;
3626
- }
3627
- #vg-tooltip-element h2 {
3628
- margin-top: 0;
3629
- margin-bottom: 10px;
3630
- font-size: 13px;
3631
- }
3632
- #vg-tooltip-element table {
3633
- border-spacing: 0;
3634
- }
3635
- #vg-tooltip-element table tr {
3636
- border: none;
3637
- }
3638
- #vg-tooltip-element table tr td {
3639
- overflow: hidden;
3640
- text-overflow: ellipsis;
3641
- padding-top: 2px;
3642
- padding-bottom: 2px;
3643
- }
3644
- #vg-tooltip-element table tr td.key {
3645
- color: #808080;
3646
- max-width: 150px;
3647
- text-align: right;
3648
- padding-right: 4px;
3649
- }
3650
- #vg-tooltip-element table tr td.value {
3651
- display: block;
3652
- max-width: 300px;
3653
- max-height: 7em;
3654
- text-align: left;
3655
- }
3656
- #vg-tooltip-element.dark-theme {
3657
- background-color: rgba(32, 32, 32, 0.9);
3658
- border: 1px solid #f5f5f5;
3659
- color: white;
3660
- }
3661
- #vg-tooltip-element.dark-theme td.key {
3662
- color: #bfbfbf;
3663
- }
3664
- `;
3665
- const EL_ID = 'vg-tooltip-element';
3666
- const DEFAULT_OPTIONS = {
3667
- /**
3668
- * X offset.
3669
- */
3670
- offsetX: 10,
3671
- /**
3672
- * Y offset.
3673
- */
3674
- offsetY: 10,
3675
- /**
3676
- * ID of the tooltip element.
3677
- */
3678
- id: EL_ID,
3679
- /**
3680
- * ID of the tooltip CSS style.
3681
- */
3682
- styleId: 'vega-tooltip-style',
3683
- /**
3684
- * The name of the theme. You can use the CSS class called [THEME]-theme to style the tooltips.
3685
- *
3686
- * There are two predefined themes: "light" (default) and "dark".
3687
- */
3688
- theme: 'light',
3689
- /**
3690
- * Do not use the default styles provided by Vega Tooltip. If you enable this option, you need to use your own styles. It is not necessary to disable the default style when using a custom theme.
3691
- */
3692
- disableDefaultStyle: false,
3693
- /**
3694
- * HTML sanitizer function that removes dangerous HTML to prevent XSS.
3695
- *
3696
- * This should be a function from string to string. You may replace it with a formatter such as a markdown formatter.
3697
- */
3698
- sanitize: escapeHTML,
3699
- /**
3700
- * The maximum recursion depth when printing objects in the tooltip.
3701
- */
3702
- maxDepth: 2,
3703
- /**
3704
- * A function to customize the rendered HTML of the tooltip.
3705
- * @param value A value string, or object of value strings keyed by field
3706
- * @param sanitize The `sanitize` function from `options.sanitize`
3707
- * @param baseURL The `baseURL` from `options.baseURL`
3708
- * @returns {string} The returned string will become the `innerHTML` of the tooltip element
3709
- */
3710
- formatTooltip: formatValue,
3711
- /**
3712
- * The baseurl to use in image paths.
3713
- */
3714
- baseURL: ''
3715
- };
3716
- /**
3717
- * Escape special HTML characters.
3718
- *
3719
- * @param value A value to convert to string and HTML-escape.
3720
- */
3721
- function escapeHTML(value) {
3722
- return String(value).replace(/&/g, '&amp;').replace(/</g, '&lt;');
3723
- }
3724
- function createDefaultStyle(id) {
3725
- // Just in case this id comes from a user, ensure these is no security issues
3726
- if (!/^[A-Za-z]+[-:.\w]*$/.test(id)) {
3727
- throw new Error('Invalid HTML ID');
3728
- }
3729
- return defaultStyle.toString().replace(EL_ID, id);
3730
- }
3731
-
3732
- /**
3733
- * Position the tooltip
3734
- *
3735
- * @param event The mouse event.
3736
- * @param tooltipBox
3737
- * @param offsetX Horizontal offset.
3738
- * @param offsetY Vertical offset.
3739
- */
3740
- function calculatePosition(event, tooltipBox, offsetX, offsetY) {
3741
- let x = event.clientX + offsetX;
3742
- if (x + tooltipBox.width > window.innerWidth) {
3743
- x = +event.clientX - offsetX - tooltipBox.width;
3744
- }
3745
- let y = event.clientY + offsetY;
3746
- if (y + tooltipBox.height > window.innerHeight) {
3747
- y = +event.clientY - offsetY - tooltipBox.height;
3748
- }
3749
- return {
3750
- x,
3751
- y
3752
- };
3753
- }
3754
-
3755
- /**
3756
- * The tooltip handler class.
3757
- */
3758
- class Handler {
3759
- /**
3760
- * The handler function. We bind this to this function in the constructor.
3761
- */
3762
-
3763
- /**
3764
- * Complete tooltip options.
3765
- */
3766
-
3767
- /**
3768
- * The tooltip html element.
3769
- */
3770
-
3771
- /**
3772
- * Create the tooltip handler and initialize the element and style.
3773
- *
3774
- * @param options Tooltip Options
3775
- */
3776
- constructor(options) {
3777
- this.options = {
3778
- ...DEFAULT_OPTIONS,
3779
- ...options
3780
- };
3781
- const elementId = this.options.id;
3782
- this.el = null;
3783
-
3784
- // bind this to call
3785
- this.call = this.tooltipHandler.bind(this);
3786
-
3787
- // prepend a default stylesheet for tooltips to the head
3788
- if (!this.options.disableDefaultStyle && !document.getElementById(this.options.styleId)) {
3789
- const style = document.createElement('style');
3790
- style.setAttribute('id', this.options.styleId);
3791
- style.innerHTML = createDefaultStyle(elementId);
3792
- const head = document.head;
3793
- if (head.childNodes.length > 0) {
3794
- head.insertBefore(style, head.childNodes[0]);
3795
- } else {
3796
- head.appendChild(style);
3797
- }
3798
- }
3799
- }
3800
-
3801
- /**
3802
- * The tooltip handler function.
3803
- */
3804
- tooltipHandler(handler, event, item, value) {
3805
- // console.log(handler, event, item, value);
3806
-
3807
- // append a div element that we use as a tooltip unless it already exists
3808
- this.el = document.getElementById(this.options.id);
3809
- if (!this.el) {
3810
- this.el = document.createElement('div');
3811
- this.el.setAttribute('id', this.options.id);
3812
- this.el.classList.add('vg-tooltip');
3813
- const tooltipContainer = document.fullscreenElement ?? document.body;
3814
- tooltipContainer.appendChild(this.el);
3815
- }
3816
-
3817
- // hide tooltip for null, undefined, or empty string values
3818
- if (value == null || value === '') {
3819
- this.el.classList.remove('visible', `${this.options.theme}-theme`);
3820
- return;
3821
- }
3822
-
3823
- // set the tooltip content
3824
- this.el.innerHTML = this.options.formatTooltip(value, this.options.sanitize, this.options.maxDepth, this.options.baseURL);
3825
-
3826
- // make the tooltip visible
3827
- this.el.classList.add('visible', `${this.options.theme}-theme`);
3828
- const {
3829
- x,
3830
- y
3831
- } = calculatePosition(event, this.el.getBoundingClientRect(), this.options.offsetX, this.options.offsetY);
3832
- this.el.style.top = `${y}px`;
3833
- this.el.style.left = `${x}px`;
3834
- }
3835
- }
3836
-
3837
- /**
3838
- * Open editor url in a new window, and pass a message.
3839
- */
3840
- function post (window, url, data) {
3841
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3842
- const editor = window.open(url);
3843
- const wait = 10_000;
3844
- const step = 250;
3845
- const {
3846
- origin
3847
- } = new URL(url);
3848
- // eslint-disable-next-line no-bitwise
3849
- let count = ~~(wait / step);
3850
- function listen(evt) {
3851
- if (evt.source === editor) {
3852
- count = 0;
3853
- window.removeEventListener('message', listen, false);
3854
- }
3855
- }
3856
- window.addEventListener('message', listen, false);
3857
-
3858
- // send message
3859
- // periodically resend until ack received or timeout
3860
- function send() {
3861
- if (count <= 0) {
3862
- return;
3863
- }
3864
- editor.postMessage(data, origin);
3865
- setTimeout(send, step);
3866
- count -= 1;
3867
- }
3868
- setTimeout(send, step);
3869
- }
3870
-
3871
- // generated with build-style.sh
3872
- var embedStyle = `.vega-embed {
3873
- position: relative;
3874
- display: inline-block;
3875
- box-sizing: border-box;
3876
- }
3877
- .vega-embed.has-actions {
3878
- padding-right: 38px;
3879
- }
3880
- .vega-embed details:not([open]) > :not(summary) {
3881
- display: none !important;
3882
- }
3883
- .vega-embed summary {
3884
- list-style: none;
3885
- position: absolute;
3886
- top: 0;
3887
- right: 0;
3888
- padding: 6px;
3889
- z-index: 1000;
3890
- background: white;
3891
- box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
3892
- color: #1b1e23;
3893
- border: 1px solid #aaa;
3894
- border-radius: 999px;
3895
- opacity: 0.2;
3896
- transition: opacity 0.4s ease-in;
3897
- cursor: pointer;
3898
- line-height: 0px;
3899
- }
3900
- .vega-embed summary::-webkit-details-marker {
3901
- display: none;
3902
- }
3903
- .vega-embed summary:active {
3904
- box-shadow: #aaa 0px 0px 0px 1px inset;
3905
- }
3906
- .vega-embed summary svg {
3907
- width: 14px;
3908
- height: 14px;
3909
- }
3910
- .vega-embed details[open] summary {
3911
- opacity: 0.7;
3912
- }
3913
- .vega-embed:hover summary, .vega-embed:focus-within summary {
3914
- opacity: 1 !important;
3915
- transition: opacity 0.2s ease;
3916
- }
3917
- .vega-embed .vega-actions {
3918
- position: absolute;
3919
- z-index: 1001;
3920
- top: 35px;
3921
- right: -9px;
3922
- display: flex;
3923
- flex-direction: column;
3924
- padding-bottom: 8px;
3925
- padding-top: 8px;
3926
- border-radius: 4px;
3927
- box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);
3928
- border: 1px solid #d9d9d9;
3929
- background: white;
3930
- animation-duration: 0.15s;
3931
- animation-name: scale-in;
3932
- animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);
3933
- text-align: left;
3934
- }
3935
- .vega-embed .vega-actions a {
3936
- padding: 8px 16px;
3937
- font-family: sans-serif;
3938
- font-size: 14px;
3939
- font-weight: 600;
3940
- white-space: nowrap;
3941
- color: #434a56;
3942
- text-decoration: none;
3943
- }
3944
- .vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {
3945
- background-color: #f7f7f9;
3946
- color: black;
3947
- }
3948
- .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {
3949
- content: "";
3950
- display: inline-block;
3951
- position: absolute;
3952
- }
3953
- .vega-embed .vega-actions::before {
3954
- left: auto;
3955
- right: 14px;
3956
- top: -16px;
3957
- border: 8px solid rgba(0, 0, 0, 0);
3958
- border-bottom-color: #d9d9d9;
3959
- }
3960
- .vega-embed .vega-actions::after {
3961
- left: auto;
3962
- right: 15px;
3963
- top: -14px;
3964
- border: 7px solid rgba(0, 0, 0, 0);
3965
- border-bottom-color: #fff;
3966
- }
3967
- .vega-embed .chart-wrapper.fit-x {
3968
- width: 100%;
3969
- }
3970
- .vega-embed .chart-wrapper.fit-y {
3971
- height: 100%;
3972
- }
3973
-
3974
- .vega-embed-wrapper {
3975
- max-width: 100%;
3976
- overflow: auto;
3977
- padding-right: 14px;
3978
- }
3979
-
3980
- @keyframes scale-in {
3981
- from {
3982
- opacity: 0;
3983
- transform: scale(0.6);
3984
- }
3985
- to {
3986
- opacity: 1;
3987
- transform: scale(1);
3988
- }
3989
- }
3990
- `;
3991
-
3992
- function isURL(s) {
3993
- return s.startsWith('http://') || s.startsWith('https://') || s.startsWith('//');
3994
- }
3995
- function mergeDeep(dest, ...src) {
3996
- for (const s of src) {
3997
- deepMerge_(dest, s);
3998
- }
3999
- return dest;
4000
- }
4001
- function deepMerge_(dest, src) {
4002
- for (const property of Object.keys(src)) {
4003
- vegaImport.writeConfig(dest, property, src[property], true);
4004
- }
4005
- }
4006
-
4007
- var name = "vega-embed";
4008
- var version$1 = "6.26.0";
4009
- var description = "Publish Vega visualizations as embedded web components.";
4010
- var keywords = ["vega", "data", "visualization", "component", "embed"];
4011
- var repository = {
4012
- type: "git",
4013
- url: "http://github.com/vega/vega-embed.git"
4014
- };
4015
- var author = {
4016
- name: "UW Interactive Data Lab",
4017
- url: "http://idl.cs.washington.edu"
4018
- };
4019
- var contributors = [{
4020
- name: "Dominik Moritz",
4021
- url: "https://www.domoritz.de"
4022
- }];
4023
- var bugs = {
4024
- url: "https://github.com/vega/vega-embed/issues"
4025
- };
4026
- var homepage = "https://github.com/vega/vega-embed#readme";
4027
- var license = "BSD-3-Clause";
4028
- var main = "build/vega-embed.js";
4029
- var module = "build/vega-embed.module.js";
4030
- var unpkg = "build/vega-embed.min.js";
4031
- var jsdelivr = "build/vega-embed.min.js";
4032
- var types = "build/vega-embed.module.d.ts";
4033
- var files = ["src", "build"];
4034
- var exports$1 = {
4035
- ".": {
4036
- "import": {
4037
- types: "./build/vega-embed.module.d.ts",
4038
- "default": "./build/vega-embed.module.js"
4039
- },
4040
- require: {
4041
- "default": "./build/vega-embed.js"
4042
- }
4043
- }
4044
- };
4045
- var devDependencies = {
4046
- "@babel/core": "^7.24.7",
4047
- "@babel/eslint-parser": "^7.24.7",
4048
- "@babel/plugin-transform-runtime": "^7.24.7",
4049
- "@babel/preset-env": "^7.24.7",
4050
- "@babel/preset-typescript": "^7.24.7",
4051
- "@release-it/conventional-changelog": "^8.0.1",
4052
- "@rollup/plugin-commonjs": "26.0.1",
4053
- "@rollup/plugin-json": "^6.1.0",
4054
- "@rollup/plugin-node-resolve": "^15.2.3",
4055
- "@rollup/plugin-terser": "^0.4.4",
4056
- "@types/semver": "^7.5.8",
4057
- "@typescript-eslint/parser": "^7.15.0",
4058
- "@vitest/coverage-v8": "^1.6.0",
4059
- "browser-sync": "^3.0.2",
4060
- concurrently: "^8.2.2",
4061
- "del-cli": "^5.1.0",
4062
- eslint: "^9.6.0",
4063
- "eslint-config-prettier": "^9.1.0",
4064
- "eslint-plugin-prettier": "^5.1.3",
4065
- "eslint-plugin-vitest": "^0.5.4",
4066
- jsdom: "^24.1.0",
4067
- "postinstall-postinstall": "^2.1.0",
4068
- prettier: "^3.3.2",
4069
- "release-it": "^17.4.1",
4070
- rollup: "4.18.0",
4071
- "rollup-plugin-bundle-size": "^1.0.3",
4072
- "rollup-plugin-ts": "^3.4.5",
4073
- sass: "^1.77.6",
4074
- typescript: "^5.5.3",
4075
- "typescript-eslint": "^7.15.0",
4076
- vega: "^5.30.0",
4077
- "vega-lite": "^5.19.0",
4078
- vitest: "^1.6.0",
4079
- "vitest-canvas-mock": "^0.3.3"
4080
- };
4081
- var peerDependencies = {
4082
- vega: "^5.21.0",
4083
- "vega-lite": "*"
4084
- };
4085
- var dependencies = {
4086
- "fast-json-patch": "^3.1.1",
4087
- "json-stringify-pretty-compact": "^3.0.0",
4088
- semver: "^7.6.2",
4089
- tslib: "^2.6.3",
4090
- "vega-interpreter": "^1.0.5",
4091
- "vega-schema-url-parser": "^2.2.0",
4092
- "vega-themes": "^2.15.0",
4093
- "vega-tooltip": "^0.34.0"
4094
- };
4095
- var scripts = {
4096
- prebuild: "yarn clean && yarn build:style",
4097
- build: "rollup -c",
4098
- "build:style": "./build-style.sh",
4099
- clean: "del-cli build src/style.ts",
4100
- prepublishOnly: "yarn clean && yarn build",
4101
- preversion: "yarn lint && yarn test",
4102
- serve: "browser-sync start --directory -s -f build *.html",
4103
- start: "yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",
4104
- pretest: "yarn build:style",
4105
- test: "vitest run",
4106
- prettierbase: "prettier '*.{css,scss,html}'",
4107
- format: "eslint . --fix && yarn prettierbase --write",
4108
- lint: "eslint . && yarn prettierbase --check",
4109
- release: "release-it"
4110
- };
4111
- var pkg = {
4112
- name: name,
4113
- version: version$1,
4114
- description: description,
4115
- keywords: keywords,
4116
- repository: repository,
4117
- author: author,
4118
- contributors: contributors,
4119
- bugs: bugs,
4120
- homepage: homepage,
4121
- license: license,
4122
- main: main,
4123
- module: module,
4124
- unpkg: unpkg,
4125
- jsdelivr: jsdelivr,
4126
- types: types,
4127
- files: files,
4128
- exports: exports$1,
4129
- devDependencies: devDependencies,
4130
- peerDependencies: peerDependencies,
4131
- dependencies: dependencies,
4132
- scripts: scripts
4133
- };
4134
-
4135
- const version = pkg.version;
4136
- const vega = vegaImport__namespace;
4137
- let vegaLite = vegaLiteImport__namespace;
4138
-
4139
- // For backwards compatibility with Vega-Lite before v4.
4140
- const w = typeof window !== 'undefined' ? window : undefined;
4141
- if (vegaLite === undefined && w?.vl?.compile) {
4142
- vegaLite = w.vl;
4143
- }
4144
- const DEFAULT_ACTIONS = {
4145
- export: {
4146
- svg: true,
4147
- png: true
4148
- },
4149
- source: true,
4150
- compiled: true,
4151
- editor: true
4152
- };
4153
- const I18N = {
4154
- CLICK_TO_VIEW_ACTIONS: 'Click to view actions',
4155
- COMPILED_ACTION: 'View Compiled Vega',
4156
- EDITOR_ACTION: 'Open in Vega Editor',
4157
- PNG_ACTION: 'Save as PNG',
4158
- SOURCE_ACTION: 'View Source',
4159
- SVG_ACTION: 'Save as SVG'
4160
- };
4161
- const NAMES = {
4162
- vega: 'Vega',
4163
- 'vega-lite': 'Vega-Lite'
4164
- };
4165
- const VERSION = {
4166
- vega: vega.version,
4167
- 'vega-lite': vegaLite ? vegaLite.version : 'not available'
4168
- };
4169
- const PREPROCESSOR = {
4170
- vega: vgSpec => vgSpec,
4171
- 'vega-lite': (vlSpec, config) => vegaLite.compile(vlSpec, {
4172
- config: config
4173
- }).spec
4174
- };
4175
- const SVG_CIRCLES = `
4176
- <svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
4177
- <circle r="2" cy="8" cx="2"></circle>
4178
- <circle r="2" cy="8" cx="8"></circle>
4179
- <circle r="2" cy="8" cx="14"></circle>
4180
- </svg>`;
4181
- const CHART_WRAPPER_CLASS = 'chart-wrapper';
4182
- function isTooltipHandler(h) {
4183
- return typeof h === 'function';
4184
- }
4185
- function viewSource(source, sourceHeader, sourceFooter, mode) {
4186
- const header = `<html><head>${sourceHeader}</head><body><pre><code class="json">`;
4187
- const footer = `</code></pre>${sourceFooter}</body></html>`;
4188
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
4189
- const win = window.open('');
4190
- win.document.write(header + source + footer);
4191
- win.document.title = `${NAMES[mode]} JSON Source`;
4192
- }
4193
-
4194
- /**
4195
- * Try to guess the type of spec.
4196
- *
4197
- * @param spec Vega or Vega-Lite spec.
4198
- */
4199
- function guessMode(spec, providedMode) {
4200
- // Decide mode
4201
- if (spec.$schema) {
4202
- const parsed = e(spec.$schema);
4203
- if (providedMode && providedMode !== parsed.library) {
4204
- console.warn(`The given visualization spec is written in ${NAMES[parsed.library]}, but mode argument sets ${NAMES[providedMode] ?? providedMode}.`);
4205
- }
4206
- const mode = parsed.library;
4207
- if (!satisfies$1(VERSION[mode], `^${parsed.version.slice(1)}`)) {
4208
- console.warn(`The input spec uses ${NAMES[mode]} ${parsed.version}, but the current version of ${NAMES[mode]} is v${VERSION[mode]}.`);
4209
- }
4210
- return mode;
4211
- }
4212
-
4213
- // try to guess from the provided spec
4214
- if ('mark' in spec || 'encoding' in spec || 'layer' in spec || 'hconcat' in spec || 'vconcat' in spec || 'facet' in spec || 'repeat' in spec) {
4215
- return 'vega-lite';
4216
- }
4217
- if ('marks' in spec || 'signals' in spec || 'scales' in spec || 'axes' in spec) {
4218
- return 'vega';
4219
- }
4220
- return providedMode ?? 'vega';
4221
- }
4222
- function isLoader(o) {
4223
- return !!(o && 'load' in o);
4224
- }
4225
- function createLoader(opts) {
4226
- return isLoader(opts) ? opts : vega.loader(opts);
4227
- }
4228
- function embedOptionsFromUsermeta(parsedSpec) {
4229
- const opts = parsedSpec.usermeta?.embedOptions ?? {};
4230
- if (vegaImport.isString(opts.defaultStyle)) {
4231
- // we don't allow styles set via usermeta since it would allow injection of logic (we set the style via innerHTML)
4232
- opts.defaultStyle = false;
4233
- }
4234
- return opts;
4235
- }
4236
-
4237
- /**
4238
- * Embed a Vega visualization component in a web page. This function returns a promise.
4239
- *
4240
- * @param el DOM element in which to place component (DOM node or CSS selector).
4241
- * @param spec String : A URL string from which to load the Vega specification.
4242
- * Object : The Vega/Vega-Lite specification as a parsed JSON object.
4243
- * @param opts A JavaScript object containing options for embedding.
4244
- */
4245
- async function embed(el, spec, opts = {}) {
4246
- let parsedSpec;
4247
- let loader;
4248
- if (vegaImport.isString(spec)) {
4249
- loader = createLoader(opts.loader);
4250
- parsedSpec = JSON.parse(await loader.load(spec));
4251
- } else {
4252
- parsedSpec = spec;
4253
- }
4254
- const loadedEmbedOptions = embedOptionsFromUsermeta(parsedSpec);
4255
- const usermetaLoader = loadedEmbedOptions.loader;
4256
-
4257
- // either create the loader for the first time or create a new loader if the spec has new loader options
4258
- if (!loader || usermetaLoader) {
4259
- loader = createLoader(opts.loader ?? usermetaLoader);
4260
- }
4261
- const usermetaOpts = await loadOpts(loadedEmbedOptions, loader);
4262
- const parsedOpts = await loadOpts(opts, loader);
4263
- const mergedOpts = {
4264
- ...mergeDeep(parsedOpts, usermetaOpts),
4265
- config: vegaImport.mergeConfig(parsedOpts.config ?? {}, usermetaOpts.config ?? {})
4266
- };
4267
- return await _embed(el, parsedSpec, mergedOpts, loader);
4268
- }
4269
- async function loadOpts(opt, loader) {
4270
- const config = vegaImport.isString(opt.config) ? JSON.parse(await loader.load(opt.config)) : opt.config ?? {};
4271
- const patch = vegaImport.isString(opt.patch) ? JSON.parse(await loader.load(opt.patch)) : opt.patch;
4272
- return {
4273
- ...opt,
4274
- ...(patch ? {
4275
- patch
4276
- } : {}),
4277
- ...(config ? {
4278
- config
4279
- } : {})
4280
- };
4281
- }
4282
- function getRoot(el) {
4283
- const possibleRoot = el.getRootNode ? el.getRootNode() : document;
4284
- return possibleRoot instanceof ShadowRoot ? {
4285
- root: possibleRoot,
4286
- rootContainer: possibleRoot
4287
- } : {
4288
- root: document,
4289
- rootContainer: document.head ?? document.body
4290
- };
4291
- }
4292
- async function _embed(el, spec, opts = {}, loader) {
4293
- const config = opts.theme ? vegaImport.mergeConfig(themes[opts.theme], opts.config ?? {}) : opts.config;
4294
- const actions = vegaImport.isBoolean(opts.actions) ? opts.actions : mergeDeep({}, DEFAULT_ACTIONS, opts.actions ?? {});
4295
- const i18n = {
4296
- ...I18N,
4297
- ...opts.i18n
4298
- };
4299
- const renderer = opts.renderer ?? 'canvas';
4300
- const logLevel = opts.logLevel ?? vega.Warn;
4301
- const downloadFileName = opts.downloadFileName ?? 'visualization';
4302
- const element = typeof el === 'string' ? document.querySelector(el) : el;
4303
- if (!element) {
4304
- throw new Error(`${el} does not exist`);
4305
- }
4306
- if (opts.defaultStyle !== false) {
4307
- const ID = 'vega-embed-style';
4308
- const {
4309
- root,
4310
- rootContainer
4311
- } = getRoot(element);
4312
- if (!root.getElementById(ID)) {
4313
- const style = document.createElement('style');
4314
- style.id = ID;
4315
- style.innerHTML = opts.defaultStyle === undefined || opts.defaultStyle === true ? (embedStyle ).toString() : opts.defaultStyle;
4316
- rootContainer.appendChild(style);
4317
- }
4318
- }
4319
- const mode = guessMode(spec, opts.mode);
4320
- let vgSpec = PREPROCESSOR[mode](spec, config);
4321
- if (mode === 'vega-lite') {
4322
- if (vgSpec.$schema) {
4323
- const parsed = e(vgSpec.$schema);
4324
- if (!satisfies$1(VERSION.vega, `^${parsed.version.slice(1)}`)) {
4325
- console.warn(`The compiled spec uses Vega ${parsed.version}, but current version is v${VERSION.vega}.`);
4326
- }
4327
- }
4328
- }
4329
- element.classList.add('vega-embed');
4330
- if (actions) {
4331
- element.classList.add('has-actions');
4332
- }
4333
- element.innerHTML = ''; // clear container
4334
-
4335
- let container = element;
4336
- if (actions) {
4337
- const chartWrapper = document.createElement('div');
4338
- chartWrapper.classList.add(CHART_WRAPPER_CLASS);
4339
- element.appendChild(chartWrapper);
4340
- container = chartWrapper;
4341
- }
4342
- const patch = opts.patch;
4343
- if (patch) {
4344
- vgSpec = patch instanceof Function ? patch(vgSpec) : applyPatch(vgSpec, patch, true, false).newDocument;
4345
- }
4346
-
4347
- // Set locale. Note that this is a global setting.
4348
- if (opts.formatLocale) {
4349
- vega.formatLocale(opts.formatLocale);
4350
- }
4351
- if (opts.timeFormatLocale) {
4352
- vega.timeFormatLocale(opts.timeFormatLocale);
4353
- }
4354
-
4355
- // Set custom expression functions
4356
- if (opts.expressionFunctions) {
4357
- for (const name in opts.expressionFunctions) {
4358
- const expressionFunction = opts.expressionFunctions[name];
4359
- if ('fn' in expressionFunction) {
4360
- vega.expressionFunction(name, expressionFunction.fn, expressionFunction['visitor']);
4361
- } else if (expressionFunction instanceof Function) {
4362
- vega.expressionFunction(name, expressionFunction);
4363
- }
4364
- }
4365
- }
4366
- const {
4367
- ast
4368
- } = opts;
4369
-
4370
- // Do not apply the config to Vega when we have already applied it to Vega-Lite.
4371
- // This call may throw an Error if parsing fails.
4372
- const runtime = vega.parse(vgSpec, mode === 'vega-lite' ? {} : config, {
4373
- ast
4374
- });
4375
- const view = new (opts.viewClass || vega.View)(runtime, {
4376
- loader,
4377
- logLevel,
4378
- renderer,
4379
- ...(ast ? {
4380
- expr: vega.expressionInterpreter ?? opts.expr ?? expression
4381
- } : {})
4382
- });
4383
- view.addSignalListener('autosize', (_, autosize) => {
4384
- const {
4385
- type
4386
- } = autosize;
4387
- if (type == 'fit-x') {
4388
- container.classList.add('fit-x');
4389
- container.classList.remove('fit-y');
4390
- } else if (type == 'fit-y') {
4391
- container.classList.remove('fit-x');
4392
- container.classList.add('fit-y');
4393
- } else if (type == 'fit') {
4394
- container.classList.add('fit-x', 'fit-y');
4395
- } else {
4396
- container.classList.remove('fit-x', 'fit-y');
4397
- }
4398
- });
4399
- if (opts.tooltip !== false) {
4400
- const {
4401
- loader: loader_,
4402
- tooltip
4403
- } = opts;
4404
- const baseURL = loader_ && !isLoader(loader_) ? loader_?.baseURL : undefined;
4405
- const handler = isTooltipHandler(tooltip) ? tooltip :
4406
- // user provided boolean true or tooltip options
4407
- new Handler({
4408
- baseURL,
4409
- ...(tooltip === true ? {} : tooltip)
4410
- }).call;
4411
- view.tooltip(handler);
4412
- }
4413
- let {
4414
- hover
4415
- } = opts;
4416
- if (hover === undefined) {
4417
- hover = mode === 'vega';
4418
- }
4419
- if (hover) {
4420
- const {
4421
- hoverSet,
4422
- updateSet
4423
- } = typeof hover === 'boolean' ? {} : hover;
4424
- view.hover(hoverSet, updateSet);
4425
- }
4426
- if (opts) {
4427
- if (opts.width != null) {
4428
- view.width(opts.width);
4429
- }
4430
- if (opts.height != null) {
4431
- view.height(opts.height);
4432
- }
4433
- if (opts.padding != null) {
4434
- view.padding(opts.padding);
4435
- }
4436
- }
4437
- await view.initialize(container, opts.bind).runAsync();
4438
- let documentClickHandler;
4439
- if (actions !== false) {
4440
- let wrapper = element;
4441
- if (opts.defaultStyle !== false || opts.forceActionsMenu) {
4442
- const details = document.createElement('details');
4443
- details.title = i18n.CLICK_TO_VIEW_ACTIONS;
4444
- element.append(details);
4445
- wrapper = details;
4446
- const summary = document.createElement('summary');
4447
- summary.innerHTML = SVG_CIRCLES;
4448
- details.append(summary);
4449
- documentClickHandler = ev => {
4450
- if (!details.contains(ev.target)) {
4451
- details.removeAttribute('open');
4452
- }
4453
- };
4454
- document.addEventListener('click', documentClickHandler);
4455
- }
4456
- const ctrl = document.createElement('div');
4457
- wrapper.append(ctrl);
4458
- ctrl.classList.add('vega-actions');
4459
-
4460
- // add 'Export' action
4461
- if (actions === true || actions.export !== false) {
4462
- for (const ext of ['svg', 'png']) {
4463
- if (actions === true || actions.export === true || actions.export[ext]) {
4464
- const i18nExportAction = i18n[`${ext.toUpperCase()}_ACTION`];
4465
- const exportLink = document.createElement('a');
4466
- const scaleFactor = vegaImport.isObject(opts.scaleFactor) ? opts.scaleFactor[ext] : opts.scaleFactor;
4467
- exportLink.text = i18nExportAction;
4468
- exportLink.href = '#';
4469
- exportLink.target = '_blank';
4470
- exportLink.download = `${downloadFileName}.${ext}`;
4471
- // add link on mousedown so that it's correct when the click happens
4472
- exportLink.addEventListener('mousedown', async function (e) {
4473
- e.preventDefault();
4474
- const url = await view.toImageURL(ext, scaleFactor);
4475
- this.href = url;
4476
- });
4477
- ctrl.append(exportLink);
4478
- }
4479
- }
4480
- }
4481
-
4482
- // add 'View Source' action
4483
- if (actions === true || actions.source !== false) {
4484
- const viewSourceLink = document.createElement('a');
4485
- viewSourceLink.text = i18n.SOURCE_ACTION;
4486
- viewSourceLink.href = '#';
4487
- viewSourceLink.addEventListener('click', function (e) {
4488
- viewSource(stringify$1(spec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', mode);
4489
- e.preventDefault();
4490
- });
4491
- ctrl.append(viewSourceLink);
4492
- }
4493
-
4494
- // add 'View Compiled' action
4495
- if (mode === 'vega-lite' && (actions === true || actions.compiled !== false)) {
4496
- const compileLink = document.createElement('a');
4497
- compileLink.text = i18n.COMPILED_ACTION;
4498
- compileLink.href = '#';
4499
- compileLink.addEventListener('click', function (e) {
4500
- viewSource(stringify$1(vgSpec), opts.sourceHeader ?? '', opts.sourceFooter ?? '', 'vega');
4501
- e.preventDefault();
4502
- });
4503
- ctrl.append(compileLink);
4504
- }
4505
-
4506
- // add 'Open in Vega Editor' action
4507
- if (actions === true || actions.editor !== false) {
4508
- const editorUrl = opts.editorUrl ?? 'https://vega.github.io/editor/';
4509
- const editorLink = document.createElement('a');
4510
- editorLink.text = i18n.EDITOR_ACTION;
4511
- editorLink.href = '#';
4512
- editorLink.addEventListener('click', function (e) {
4513
- post(window, editorUrl, {
4514
- config: config,
4515
- mode: patch ? 'vega' : mode,
4516
- renderer,
4517
- spec: stringify$1(patch ? vgSpec : spec)
4518
- });
4519
- e.preventDefault();
4520
- });
4521
- ctrl.append(editorLink);
4522
- }
4523
- }
4524
- function finalize() {
4525
- if (documentClickHandler) {
4526
- document.removeEventListener('click', documentClickHandler);
4527
- }
4528
- view.finalize();
4529
- }
4530
- return {
4531
- view,
4532
- spec,
4533
- vgSpec,
4534
- finalize,
4535
- embedOptions: opts
4536
- };
4537
- }
4538
-
4539
- /**
4540
- * Create a promise to an HTML Div element with an embedded Vega-Lite or Vega visualization.
4541
- * The element has a value property with the view. By default all actions except for the editor action are disabled.
4542
- *
4543
- * The main use case is in [Observable](https://observablehq.com/).
4544
- */
4545
- async function container (spec, opt = {}) {
4546
- const wrapper = document.createElement('div');
4547
- wrapper.classList.add('vega-embed-wrapper');
4548
- const div = document.createElement('div');
4549
- wrapper.appendChild(div);
4550
- const actions = opt.actions === true || opt.actions === false ? opt.actions : {
4551
- export: true,
4552
- source: false,
4553
- compiled: true,
4554
- editor: true,
4555
- ...opt.actions
4556
- };
4557
- const result = await embed(div, spec, {
4558
- actions,
4559
- ...opt
4560
- });
4561
- wrapper.value = result.view;
4562
- return wrapper;
4563
- }
4564
-
4565
- /**
4566
- * Returns true if the object is an HTML element.
4567
- */
4568
- function isElement(obj) {
4569
- return obj instanceof HTMLElement;
4570
- }
4571
- const wrapper = (...args) => {
4572
- if (args.length > 1 && (vegaImport.isString(args[0]) && !isURL(args[0]) || isElement(args[0]) || args.length === 3)) {
4573
- return embed(args[0], args[1], args[2]);
4574
- }
4575
- return container(args[0], args[1]);
4576
- };
4577
- wrapper.vegaLite = vegaLite;
4578
- wrapper.vl = vegaLite; // backwards compatibility
4579
- wrapper.container = container;
4580
- wrapper.embed = embed;
4581
- wrapper.vega = vega;
4582
- wrapper.default = embed;
4583
- wrapper.version = version;
4584
-
4585
- return wrapper;
4586
-
4587
- }));
6
+ */function T(e,t){void 0===t&&(t=!1);var n=N.get(e.object);C(n.value,e.object,e.patches,"",t),e.patches.length&&A(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function C(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=c(t),a=c(e),s=!1,d=a.length-1;d>=0;d--){var h=e[g=a[d]];if(!l(t,g)||void 0===t[g]&&void 0!==h&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+p(g),value:f(h)}),n.push({op:"remove",path:r+"/"+p(g)}),s=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}));else{var u=t[g];"object"==typeof h&&null!=h&&"object"==typeof u&&null!=u&&Array.isArray(h)===Array.isArray(u)?C(h,u,n,r+"/"+p(g),i):h!==u&&(i&&n.push({op:"test",path:r+"/"+p(g),value:f(h)}),n.push({op:"replace",path:r+"/"+p(g),value:f(u)}))}}if(s||o.length!=a.length)for(d=0;d<o.length;d++){var g;l(e,g=o[d])||void 0===t[g]||n.push({op:"add",path:r+"/"+p(g),value:f(t[g])})}}}var F=Object.freeze({__proto__:null,compare:function(e,t,n){void 0===n&&(n=!1);var r=[];return C(e,t,r,"",n),r},generate:T,observe:function(e,t){var n,r=function(e){return N.get(e)}(e);if(r){var i=function(e,t){return e.observers.get(t)}(r,t);n=i&&i.observer}else r=new R(e),N.set(e,r);if(n)return n;if(n={},r.value=f(e),t){n.callback=t,n.next=null;var o=function(){T(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(o)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=[],n.object=e,n.unobserve=function(){T(n),clearTimeout(n.next),function(e,t){e.observers.delete(t.callback)}(r,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},r.observers.set(t,new S(t,n)),n},unobserve:function(e,t){t.unobserve()}});Object.assign({},$,F,{JsonPatchError:m,deepClone:f,escapePathComponent:p,unescapePathComponent:h});const D=/("(?:[^\\"]|\\.)*")|[:,]/g;function k(e,t={}){const n=JSON.stringify([1],void 0,void 0===t.indent?2:t.indent).slice(2,-3),r=""===n?1/0:void 0===t.maxLength?80:t.maxLength;let{replacer:i}=t;return function e(t,o,a){t&&"function"==typeof t.toJSON&&(t=t.toJSON());const s=JSON.stringify(t,i);if(void 0===s)return s;const l=r-o.length-a;if(s.length<=l){const e=s.replace(D,((e,t)=>t||`${e} `));if(e.length<=l)return e}if(null!=i&&(t=JSON.parse(s),i=void 0),"object"==typeof t&&null!==t){const r=o+n,i=[];let a,s,l=0;if(Array.isArray(t)){a="[",s="]";const{length:n}=t;for(;l<n;l++)i.push(e(t[l],r,l===n-1?0:1)||"null")}else{a="{",s="}";const n=Object.keys(t),{length:o}=n;for(;l<o;l++){const a=n[l],s=`${JSON.stringify(a)}: `,c=e(t[a],r,s.length+(l===o-1?0:1));void 0!==c&&i.push(s+c)}}if(i.length>0)return[a,n+i.join(`,\n${r}`),s].join(`\n${o}`)}return s}(e,"",0)}function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _,M,z,j;function U(){if(j)return z;j=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return z=n=>n?"object"!=typeof n?e:n:t}var G,B,W,X,V,H,Y,J,q,Q,Z,K,ee,te,ne,re,ie,oe,ae,se,le,ce,fe,de,pe,he,ue,ge,me,Ee,ve,be={exports:{}};function ye(){if(B)return G;B=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return G={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}function we(){if(X)return W;X=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return W=e}function Oe(){return V||(V=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=ye(),o=we(),a=(t=e.exports={}).re=[],s=t.safeRe=[],l=t.src=[],c=t.safeSrc=[],f=t.t={};let d=0;const p="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",i],[p,r]],u=(e,t,n)=>{const r=(e=>{for(const[t,n]of h)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=d++;o(e,i,t),f[e]=i,l[i]=t,c[i]=r,a[i]=new RegExp(t,n?"g":void 0),s[i]=new RegExp(r,n?"g":void 0)};u("NUMERICIDENTIFIER","0|[1-9]\\d*"),u("NUMERICIDENTIFIERLOOSE","\\d+"),u("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),u("MAINVERSION",`(${l[f.NUMERICIDENTIFIER]})\\.(${l[f.NUMERICIDENTIFIER]})\\.(${l[f.NUMERICIDENTIFIER]})`),u("MAINVERSIONLOOSE",`(${l[f.NUMERICIDENTIFIERLOOSE]})\\.(${l[f.NUMERICIDENTIFIERLOOSE]})\\.(${l[f.NUMERICIDENTIFIERLOOSE]})`),u("PRERELEASEIDENTIFIER",`(?:${l[f.NUMERICIDENTIFIER]}|${l[f.NONNUMERICIDENTIFIER]})`),u("PRERELEASEIDENTIFIERLOOSE",`(?:${l[f.NUMERICIDENTIFIERLOOSE]}|${l[f.NONNUMERICIDENTIFIER]})`),u("PRERELEASE",`(?:-(${l[f.PRERELEASEIDENTIFIER]}(?:\\.${l[f.PRERELEASEIDENTIFIER]})*))`),u("PRERELEASELOOSE",`(?:-?(${l[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[f.PRERELEASEIDENTIFIERLOOSE]})*))`),u("BUILDIDENTIFIER",`${p}+`),u("BUILD",`(?:\\+(${l[f.BUILDIDENTIFIER]}(?:\\.${l[f.BUILDIDENTIFIER]})*))`),u("FULLPLAIN",`v?${l[f.MAINVERSION]}${l[f.PRERELEASE]}?${l[f.BUILD]}?`),u("FULL",`^${l[f.FULLPLAIN]}$`),u("LOOSEPLAIN",`[v=\\s]*${l[f.MAINVERSIONLOOSE]}${l[f.PRERELEASELOOSE]}?${l[f.BUILD]}?`),u("LOOSE",`^${l[f.LOOSEPLAIN]}$`),u("GTLT","((?:<|>)?=?)"),u("XRANGEIDENTIFIERLOOSE",`${l[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),u("XRANGEIDENTIFIER",`${l[f.NUMERICIDENTIFIER]}|x|X|\\*`),u("XRANGEPLAIN",`[v=\\s]*(${l[f.XRANGEIDENTIFIER]})(?:\\.(${l[f.XRANGEIDENTIFIER]})(?:\\.(${l[f.XRANGEIDENTIFIER]})(?:${l[f.PRERELEASE]})?${l[f.BUILD]}?)?)?`),u("XRANGEPLAINLOOSE",`[v=\\s]*(${l[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[f.XRANGEIDENTIFIERLOOSE]})(?:${l[f.PRERELEASELOOSE]})?${l[f.BUILD]}?)?)?`),u("XRANGE",`^${l[f.GTLT]}\\s*${l[f.XRANGEPLAIN]}$`),u("XRANGELOOSE",`^${l[f.GTLT]}\\s*${l[f.XRANGEPLAINLOOSE]}$`),u("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),u("COERCE",`${l[f.COERCEPLAIN]}(?:$|[^\\d])`),u("COERCEFULL",l[f.COERCEPLAIN]+`(?:${l[f.PRERELEASE]})?`+`(?:${l[f.BUILD]})?(?:$|[^\\d])`),u("COERCERTL",l[f.COERCE],!0),u("COERCERTLFULL",l[f.COERCEFULL],!0),u("LONETILDE","(?:~>?)"),u("TILDETRIM",`(\\s*)${l[f.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",u("TILDE",`^${l[f.LONETILDE]}${l[f.XRANGEPLAIN]}$`),u("TILDELOOSE",`^${l[f.LONETILDE]}${l[f.XRANGEPLAINLOOSE]}$`),u("LONECARET","(?:\\^)"),u("CARETTRIM",`(\\s*)${l[f.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",u("CARET",`^${l[f.LONECARET]}${l[f.XRANGEPLAIN]}$`),u("CARETLOOSE",`^${l[f.LONECARET]}${l[f.XRANGEPLAINLOOSE]}$`),u("COMPARATORLOOSE",`^${l[f.GTLT]}\\s*(${l[f.LOOSEPLAIN]})$|^$`),u("COMPARATOR",`^${l[f.GTLT]}\\s*(${l[f.FULLPLAIN]})$|^$`),u("COMPARATORTRIM",`(\\s*)${l[f.GTLT]}\\s*(${l[f.LOOSEPLAIN]}|${l[f.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",u("HYPHENRANGE",`^\\s*(${l[f.XRANGEPLAIN]})\\s+-\\s+(${l[f.XRANGEPLAIN]})\\s*$`),u("HYPHENRANGELOOSE",`^\\s*(${l[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[f.XRANGEPLAINLOOSE]})\\s*$`),u("STAR","(<|>)?=?\\s*\\*"),u("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),u("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(be,be.exports)),be.exports}function Ae(){if(q)return J;q=1;const e=we(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=ye(),{safeRe:r,safeSrc:i,t:o}=Oe(),a=U(),{compareIdentifiers:s}=function(){if(Y)return H;Y=1;const e=/^[0-9]+$/,t=(t,n)=>{const r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:t<n?-1:1};return H={compareIdentifiers:t,rcompareIdentifiers:(e,n)=>t(n,e)}}();class l{constructor(i,s){if(s=a(s),i instanceof l){if(i.loose===!!s.loose&&i.includePrerelease===!!s.includePrerelease)return i;i=i.version}else if("string"!=typeof i)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof i}".`);if(i.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",i,s),this.options=s,this.loose=!!s.loose,this.includePrerelease=!!s.includePrerelease;const c=i.trim().match(s.loose?r[o.LOOSE]:r[o.FULL]);if(!c)throw new TypeError(`Invalid Version: ${i}`);if(this.raw=i,this.major=+c[1],this.minor=+c[2],this.patch=+c[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");c[4]?this.prerelease=c[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e})):this.prerelease=[],this.build=c[5]?c[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(e("SemVer.compare",this.version,this.options,t),!(t instanceof l)){if("string"==typeof t&&t===this.version)return 0;t=new l(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(e){return e instanceof l||(e=new l(e,this.options)),s(this.major,e.major)||s(this.minor,e.minor)||s(this.patch,e.patch)}comparePre(t){if(t instanceof l||(t=new l(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const r=this.prerelease[n],i=t.prerelease[n];if(e("prerelease compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}compareBuild(t){t instanceof l||(t=new l(t,this.options));let n=0;do{const r=this.build[n],i=t.build[n];if(e("build compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=new RegExp(`^${this.options.loose?i[o.PRERELEASELOOSE]:i[o.PRERELEASE]}$`),n=`-${t}`.match(e);if(!n||n[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===s(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return J=l}function Ie(){if(Z)return Q;Z=1;const e=Ae();return Q=(t,n,r)=>new e(t,r).compare(new e(n,r))}function Le(){if(pe)return de;pe=1;const e=function(){if(ee)return K;ee=1;const e=Ie();return K=(t,n,r)=>0===e(t,n,r)}(),t=function(){if(ne)return te;ne=1;const e=Ie();return te=(t,n,r)=>0!==e(t,n,r)}(),n=function(){if(ie)return re;ie=1;const e=Ie();return re=(t,n,r)=>e(t,n,r)>0}(),r=function(){if(ae)return oe;ae=1;const e=Ie();return oe=(t,n,r)=>e(t,n,r)>=0}(),i=function(){if(le)return se;le=1;const e=Ie();return se=(t,n,r)=>e(t,n,r)<0}(),o=function(){if(fe)return ce;fe=1;const e=Ie();return ce=(t,n,r)=>e(t,n,r)<=0}();return de=(a,s,l,c)=>{switch(s){case"===":return"object"==typeof a&&(a=a.version),"object"==typeof l&&(l=l.version),a===l;case"!==":return"object"==typeof a&&(a=a.version),"object"==typeof l&&(l=l.version),a!==l;case"":case"=":case"==":return e(a,l,c);case"!=":return t(a,l,c);case">":return n(a,l,c);case">=":return r(a,l,c);case"<":return i(a,l,c);case"<=":return o(a,l,c);default:throw new TypeError(`Invalid operator: ${s}`)}}}function xe(){if(me)return ge;me=1;const e=/\s+/g;class t{constructor(n,o){if(o=r(o),n instanceof t)return n.loose===!!o.loose&&n.includePrerelease===!!o.includePrerelease?n:new t(n.raw,o);if(n instanceof i)return this.raw=n.value,this.set=[[n]],this.formatted=void 0,this;if(this.options=o,this.loose=!!o.loose,this.includePrerelease=!!o.includePrerelease,this.raw=n.trim().replace(e," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!u(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&g(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&p)|(this.options.loose&&h))+":"+e,r=n.get(t);if(r)return r;const a=this.options.loose,g=a?s[l.HYPHENRANGELOOSE]:s[l.HYPHENRANGE];e=e.replace(g,$(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[l.COMPARATORTRIM],c),o("comparator trim",e),e=e.replace(s[l.TILDETRIM],f),o("tilde trim",e),e=e.replace(s[l.CARETTRIM],d),o("caret trim",e);let m=e.split(" ").map((e=>E(e,this.options))).join(" ").split(/\s+/).map((e=>x(e,this.options)));a&&(m=m.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(s[l.COMPARATORLOOSE]))))),o("range list",m);const v=new Map,b=m.map((e=>new i(e,this.options)));for(const e of b){if(u(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const y=[...v.values()];return n.set(t,y),y}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((t=>m(t,n)&&e.set.some((e=>m(e,n)&&t.every((t=>e.every((e=>t.intersects(e,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(N(this.set[t],e,this.options))return!0;return!1}}ge=t;const n=new(M?_:(M=1,_=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}})),r=U(),i=function(){if(ue)return he;ue=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(r.loose===!!i.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(" "),a("comparator",r,i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],o=t.match(n);if(!o)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new s(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new s(t,this.options)}catch(e){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,r).test(this.value):""===e.operator?""===e.value||new l(this.value,r).test(e.semver):!((r=n(r)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(o(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(o(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}he=t;const n=U(),{safeRe:r,t:i}=Oe(),o=Le(),a=we(),s=Ae(),l=xe();return he}(),o=we(),a=Ae(),{safeRe:s,t:l,comparatorTrimReplace:c,tildeTrimReplace:f,caretTrimReplace:d}=Oe(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:h}=ye(),u=e=>"<0.0.0-0"===e.value,g=e=>""===e.value,m=(e,t)=>{let n=!0;const r=e.slice();let i=r.pop();for(;n&&r.length;)n=r.every((e=>i.intersects(e,t))),i=r.pop();return n},E=(e,t)=>(o("comp",e,t),e=w(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=A(e,t),o("xrange",e),e=L(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>y(e,t))).join(" "),y=(e,t)=>{const n=t.loose?s[l.TILDELOOSE]:s[l.TILDE];return e.replace(n,((t,n,r,i,a)=>{let s;return o("tilde",e,t,n,r,i,a),v(n)?s="":v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o("tilde return",s),s}))},w=(e,t)=>e.trim().split(/\s+/).map((e=>O(e,t))).join(" "),O=(e,t)=>{o("caret",e,t);const n=t.loose?s[l.CARETLOOSE]:s[l.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,((t,n,i,a,s)=>{let l;return o("caret",e,t,n,i,a,s),v(n)?l="":v(i)?l=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o("replaceCaret pr",s),l="0"===n?"0"===i?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o("no pr"),l="0"===n?"0"===i?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o("caret return",l),l}))},A=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>I(e,t))).join(" ")),I=(e,t)=>{e=e.trim();const n=t.loose?s[l.XRANGELOOSE]:s[l.XRANGE];return e.replace(n,((n,r,i,a,s,l)=>{o("xRange",e,n,r,i,a,s,l);const c=v(i),f=c||v(a),d=f||v(s),p=d;return"="===r&&p&&(r=""),l=t.includePrerelease?"-0":"",c?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&p?(f&&(a=0),s=0,">"===r?(r=">=",f?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):"<="===r&&(r="<",f?i=+i+1:a=+a+1),"<"===r&&(l="-0"),n=`${r+i}.${a}.${s}${l}`):f?n=`>=${i}.0.0${l} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${l} <${i}.${+a+1}.0-0`),o("xRange return",n),n}))},L=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[l.STAR],"")),x=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),$=e=>(t,n,r,i,o,a,s,l,c,f,d,p)=>`${n=v(r)?"":v(i)?`>=${r}.0.0${e?"-0":""}`:v(o)?`>=${r}.${i}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(c)?"":v(f)?`<${+c+1}.0.0-0`:v(d)?`<${c}.${+f+1}.0-0`:p?`<=${c}.${f}.${d}-${p}`:e?`<${c}.${f}.${+d+1}-0`:`<=${l}`}`.trim(),N=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==i.ANY&&e[n].semver.prerelease.length>0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return ge}var $e=function(){if(ve)return Ee;ve=1;const e=xe();return Ee=(t,n,r)=>{try{n=new e(n,r)}catch(e){return!1}return n.test(t)},Ee}(),Ne=P($e);function Re(e,t,n){return e.fields=t||[],e.fname=n,e}const Se=e=>function(t){return t[e]},Te=e=>{const t=e.length;return function(n){for(let r=0;r<t;++r)n=n[e[r]];return n}};function Ce(e){throw Error(e)}!function(e){const t=function(e){const t=[],n=e.length;let r,i,o,a=null,s=0,l="";function c(){t.push(l+e.substring(r,i)),l="",r=i+1}for(e+="",r=i=0;i<n;++i)if(o=e[i],"\\"===o)l+=e.substring(r,i++),r=i;else if(o===a)c(),a=null,s=-1;else{if(a)continue;r===s&&'"'===o||r===s&&"'"===o?(r=i+1,a=o):"."!==o||s?"["===o?(i>r&&c(),s=r=i+1):"]"===o&&(s||Ce("Access path missing open bracket: "+e),s>0&&c(),s=0,r=i+1):i>r?c():r=i+1}return s&&Ce("Access path missing closing bracket: "+e),a&&Ce("Access path missing closing quote: "+e),i>r&&(i++,c()),t}(e);e=1===t.length?t[0]:e,Re(function(e){return 1===e.length?Se(e[0]):Te(e)}(t),[e],e)}("id"),Re((e=>e),[],"identity"),Re((()=>0),[],"zero"),Re((()=>1),[],"one"),Re((()=>!0),[],"true"),Re((()=>!1),[],"false");var Fe=Array.isArray;function De(e){return e===Object(e)}const ke=(e,t)=>(e<t||null==e)&&null!=t?-1:(e>t||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0);function Pe(e){return"string"==typeof e}var _e={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},Me={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<<t,">>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},ze={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const je=Array.prototype.slice,Ue=(e,t,n)=>{const r=n?n(t[0]):t[0];return r[e].apply(r,je.call(t,1))};var Ge={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;return Pe(e)?new Date(e):new Date(e,t,n,r,i,o,a)},date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return Ue("join",arguments)},indexof:function(){return Ue("indexOf",arguments)},lastindexof:function(){return Ue("lastIndexOf",arguments)},slice:function(){return Ue("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(ke),parseFloat:parseFloat,parseInt:parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return Ue("substring",arguments,String)},split:function(){return Ue("split",arguments,String)},replace:function(){return Ue("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const Be=["view","item","group","xy","x","y"],We=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&We.add(setImmediate);const Xe={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:"datum"===n?e.datum:"event"===n?e.event:"item"===n?e.item:_e[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);const i=e(t.property);if(n&&(e.memberDepth-=1),!We.has(r[i]))return r[i];console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let r=t.callee.name;return r.startsWith("_")&&(r=r.slice(1)),"if"===r?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||Ge[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>Me[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>ze[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce(((t,n)=>{e.memberDepth+=1;const r=e(n.key);return e.memberDepth-=1,We.has(e(n.value))?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):t[r]=e(n.value),t}),{})};function Ve(e,t,n,r,i,o){const a=e=>Xe[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=r,a.event=i,a.item=o,Be.forEach((e=>a.fn[e]=function(){return i.vega[e](...arguments)})),a(e)}var He={operator(e,t){const n=t.ast,r=e.functions;return e=>Ve(n,r,e)},parameter(e,t){const n=t.ast,r=e.functions;return(e,t)=>Ve(n,r,t,e)},event(e,t){const n=t.ast,r=e.functions;return e=>Ve(n,r,void 0,void 0,e)},handler(e,t){const n=t.ast,r=e.functions;return(e,t)=>{const i=t.item&&t.item.datum;return Ve(n,r,e,i,t)}},encode(e,t){const{marktype:n,channels:r}=t,i=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in r)s=Ve(r[n].ast,i,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,r,o),l}}};function Ye(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var Je="3.0.0";const qe="#fff",Qe="#888",Ze={background:"#333",view:{stroke:Qe},title:{color:qe,subtitleColor:qe},style:{"guide-label":{fill:qe},"guide-title":{fill:qe}},axis:{domainColor:qe,gridColor:Qe,tickColor:qe}},Ke="#4572a7",et={background:"#fff",arc:{fill:Ke},area:{fill:Ke},line:{stroke:Ke,strokeWidth:2},path:{stroke:Ke},rect:{fill:Ke},shape:{stroke:Ke},symbol:{fill:Ke,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},tt="#30a2da",nt="#cbcbcb",rt="#f0f0f0",it="#333",ot={arc:{fill:tt},area:{fill:tt},axis:{domainColor:nt,grid:!0,gridColor:nt,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:nt,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:rt,group:{fill:rt},legend:{labelColor:it,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:it,titleFontSize:14,titlePadding:10},line:{stroke:tt,strokeWidth:2},path:{stroke:tt,strokeWidth:.5},rect:{fill:tt},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:tt},bar:{binSpacing:2,fill:tt,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},at="#000",st={group:{fill:"#e5e5e5"},arc:{fill:at},area:{fill:at},line:{stroke:at},path:{stroke:at},rect:{fill:at},shape:{stroke:at},symbol:{fill:at,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},lt="Benton Gothic, sans-serif",ct="#82c6df",ft="Benton Gothic Bold, sans-serif",dt="normal",pt={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},ht={background:"#ffffff",title:{anchor:"start",color:"#000000",font:ft,fontSize:22,fontWeight:"normal"},arc:{fill:ct},area:{fill:ct},line:{stroke:ct,strokeWidth:2},path:{stroke:ct},rect:{fill:ct},shape:{stroke:ct},symbol:{fill:ct,size:30},axis:{labelFont:lt,labelFontSize:11.5,labelFontWeight:"normal",titleFont:ft,titleFontSize:13,titleFontWeight:dt},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:lt,labelFontSize:11.5,symbolType:"square",titleFont:ft,titleFontSize:13,titleFontWeight:dt},range:{category:pt["category-6"],diverging:pt["fireandice-6"],heatmap:pt["fire-7"],ordinal:pt["fire-7"],ramp:pt["fire-7"]}},ut="#ab5787",gt="#979797",mt={background:"#f9f9f9",arc:{fill:ut},area:{fill:ut},line:{stroke:ut},path:{stroke:ut},rect:{fill:ut},shape:{stroke:ut},symbol:{fill:ut,size:30},axis:{domainColor:gt,domainWidth:.5,gridWidth:.2,labelColor:gt,tickColor:gt,tickWidth:.2,titleColor:gt},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},Et="#3e5c69",vt={background:"#fff",arc:{fill:Et},area:{fill:Et},line:{stroke:Et},path:{stroke:Et},rect:{fill:Et},shape:{stroke:Et},symbol:{fill:Et},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},bt="#1696d2",yt="#000000",wt="Lato",Ot="Lato",At={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},It={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:wt},axisX:{domain:!0,domainColor:yt,domainWidth:1,grid:!1,labelFontSize:12,labelFont:Ot,labelAngle:0,tickColor:yt,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:wt},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:Ot,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:wt,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:Ot,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:wt,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:At["six-groups-cat-1"],diverging:At["diverging-colors"],heatmap:At["diverging-colors"],ordinal:At["six-groups-seq"],ramp:At["shades-blue"]},area:{fill:bt},rect:{fill:bt},line:{color:bt,stroke:bt,strokeWidth:5},trail:{color:bt,stroke:bt,strokeWidth:0,size:1},path:{stroke:bt,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:bt,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:bt,stroke:null}},arc:{fill:bt},shape:{stroke:bt},symbol:{fill:bt,size:30}},Lt="#3366CC",xt="#ccc",$t="Arial, sans-serif",Nt={arc:{fill:Lt},area:{fill:Lt},path:{stroke:Lt},rect:{fill:Lt},shape:{stroke:Lt},symbol:{stroke:Lt},circle:{fill:Lt},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:$t,fontSize:12},"guide-title":{font:$t,fontSize:12},"group-title":{font:$t,fontSize:12}},title:{font:$t,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:xt,tickColor:xt,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},Rt=e=>e*(1/3+1),St=Rt(9),Tt=Rt(10),Ct=Rt(12),Ft="Segoe UI",Dt="wf_standard-font, helvetica, arial, sans-serif",kt="#252423",Pt="#605E5C",_t="transparent",Mt="#118DFF",zt="#DEEFFF",jt=[zt,Mt],Ut={view:{stroke:_t},background:_t,font:Ft,header:{titleFont:Dt,titleFontSize:Ct,titleColor:kt,labelFont:Ft,labelFontSize:Tt,labelColor:Pt},axis:{ticks:!1,grid:!1,domain:!1,labelColor:Pt,labelFontSize:St,titleFont:Dt,titleColor:kt,titleFontSize:Ct,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:Mt},line:{stroke:Mt,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:Ft,fontSize:St,fill:Pt},arc:{fill:Mt},area:{fill:Mt,line:!0,opacity:.6},path:{stroke:Mt},rect:{fill:Mt},point:{fill:Mt,filled:!0,size:75},shape:{stroke:Mt},symbol:{fill:Mt,strokeWidth:1.5,size:50},legend:{titleFont:Ft,titleFontWeight:"bold",titleColor:Pt,labelFont:Ft,labelFontSize:Tt,labelColor:Pt,symbolType:"circle",symbolSize:75},range:{category:[Mt,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:jt,heatmap:jt,ordinal:[zt,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",Mt]}},Gt='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',Bt={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},Wt=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],Xt=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function Vt({theme:e,background:t}){const n=["white","g10"].includes(e)?"light":"dark",r=Bt.gridBg[e],i=Bt.textPrimary[e],o=Bt.textSecondary[e],a="dark"===n?Wt:Xt,s="dark"===n?"#d4bbff":"#6929c4";return{background:t,arc:{fill:s},area:{fill:s},path:{stroke:s},rect:{fill:s},shape:{stroke:s},symbol:{stroke:s},circle:{fill:s},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:Gt,fontWeight:600},axis:{labelColor:o,labelFontSize:12,labelFont:'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',labelFontWeight:400,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:Bt.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:Gt,fill:o,fontWeight:400},"guide-title":{font:Gt,fill:o,fontWeight:400}},range:{category:a,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const Ht=Vt({theme:"white",background:"#ffffff"}),Yt=Vt({theme:"g10",background:"#f4f4f4"}),Jt=Vt({theme:"g90",background:"#262626"}),qt=Vt({theme:"g100",background:"#161616"}),Qt=Je;var Zt=Object.freeze({__proto__:null,carbong10:Yt,carbong100:qt,carbong90:Jt,carbonwhite:Ht,dark:Ze,excel:et,fivethirtyeight:ot,ggplot2:st,googlecharts:Nt,latimes:ht,powerbi:Ut,quartz:mt,urbaninstitute:It,version:Qt,vox:vt});function Kt(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,r){if("object"!=typeof r||null===r)return r;const i=t.indexOf(this)+1;return t.length=i,t.length>e?"[Object]":t.indexOf(r)>=0?"[Circular]":(t.push(r),r)}}(t))}var en="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n";const tn="vg-tooltip-element",nn={offsetX:10,offsetY:10,id:tn,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2,formatTooltip:function(e,t,n,r){if(Fe(e))return`[${e.map((e=>t(Pe(e)?e:Kt(e,n)))).join(", ")}]`;if(De(e)){let i="";const{title:o,image:a,...s}=e;o&&(i+=`<h2>${t(o)}</h2>`),a&&(i+=`<img src="${new URL(t(a),r||location.href).href}">`);const l=Object.keys(s);if(l.length>0){i+="<table>";for(const e of l){let r=s[e];void 0!==r&&(De(r)&&(r=Kt(r,n)),i+=`<tr><td class="key">${t(e)}</td><td class="value">${t(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return t(e)},baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function rn(e,t,{offsetX:n,offsetY:r}){const i=on({x1:e.clientX,x2:e.clientX,y1:e.clientY,y2:e.clientY},t,n,r),o=["bottom-right","bottom-left","top-right","top-left"];for(const e of o)if(an(i[e],t))return i[e];return i["top-left"]}function on(e,t,n,r){const i=(e.x1+e.x2)/2,o=(e.y1+e.y2)/2,a=e.x1-t.width-n,s=i-t.width/2,l=e.x2+n,c=e.y1-t.height-r,f=o-t.height/2,d=e.y2+r;return{top:{x:s,y:c},bottom:{x:s,y:d},left:{x:a,y:f},right:{x:l,y:f},"top-left":{x:a,y:c},"top-right":{x:l,y:c},"bottom-left":{x:a,y:d},"bottom-right":{x:l,y:d}}}function an(e,t){return e.x>=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function sn(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}class ln{call;options;el;constructor(e){this.options={...nn,...e};const t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return en.toString().replaceAll(tn,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,r){if(this.el=document.getElementById(this.options.id),!this.el){this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip");(document.fullscreenElement??document.body).appendChild(this.el)}if(null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:i,y:o}="mark"===this.options.anchor?function(e,t,n,r,i){const{position:o,offsetX:a,offsetY:s}=i,l=function(e,t,n){const r=n.isVoronoi?n.datum.bounds:n.bounds;let i=e.left+t[0]+r.x1,o=e.top+t[1]+r.y1,a=n;for(;a.mark.group;)a=a.mark.group,i+=a.x??0,o+=a.y??0;return{x1:i,x2:i+(r.x2-r.x1),y1:o,y2:o+(r.y2-r.y1)}}(e._el.getBoundingClientRect(),e._origin,n),c=on(l,r,a,s),f=Array.isArray(o)?o:[o];for(const e of f)if(an(c[e],r)&&!sn(t,c[e],r))return c[e];return rn(t,r,i)}(e,t,n,this.el.getBoundingClientRect(),this.options):rn(t,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${i}px`}}var cn='.vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n';function fn(e,...t){for(const n of t)dn(e,n);return e}function dn(t,n){for(const r of Object.keys(n))e.writeConfig(t,r,n[r],!0)}const pn="7.0.2",hn=i;let un=o;const gn="undefined"!=typeof window?window:void 0;void 0===un&&gn?.vl?.compile&&(un=gn.vl);const mn={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},En={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},vn={vega:"Vega","vega-lite":"Vega-Lite"},bn={vega:hn.version,"vega-lite":un?un.version:"not available"},yn={vega:e=>e,"vega-lite":(e,t)=>un.compile(e,{config:t}).spec},wn='\n<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">\n <circle r="2" cy="8" cx="2"></circle>\n <circle r="2" cy="8" cx="8"></circle>\n <circle r="2" cy="8" cx="14"></circle>\n</svg>',On="chart-wrapper";function An(e,t,n,r){const i=`<html><head>${t}</head><body><pre><code class="json">`,o=`</code></pre>${n}</body></html>`,a=window.open("");a.document.write(i+e+o),a.document.title=`${vn[r]} JSON Source`}function In(e){return!(!e||!("load"in e))}function Ln(e){return In(e)?e:hn.loader(e)}async function xn(t,n,r={}){let i,o;e.isString(n)?(o=Ln(r.loader),i=JSON.parse(await o.load(n))):i=n;const a=function(t){const n=t.usermeta?.embedOptions??{};return e.isString(n.defaultStyle)&&(n.defaultStyle=!1),n}(i),s=a.loader;o&&!s||(o=Ln(r.loader??s));const l=await $n(a,o),c=await $n(r,o),f={...fn(c,l),config:e.mergeConfig(c.config??{},l.config??{})};return await async function(t,n,r={},i){const o=r.theme?e.mergeConfig(Zt[r.theme],r.config??{}):r.config,a=e.isBoolean(r.actions)?r.actions:fn({},mn,r.actions??{}),s={...En,...r.i18n},l=r.renderer??"svg",c=r.logLevel??hn.Warn,f=r.downloadFileName??"visualization",d="string"==typeof t?document.querySelector(t):t;if(!d)throw new Error(`${t} does not exist`);if(!1!==r.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:n}=function(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}(d);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerHTML=void 0===r.defaultStyle||!0===r.defaultStyle?cn.toString():r.defaultStyle,n.appendChild(t)}}const p=function(e,t){if(e.$schema){const n=Ye(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${vn[n.library]}, but mode argument sets ${vn[t]??t}.`);const r=n.library;return Ne(bn[r],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${vn[r]} ${n.version}, but the current version of ${vn[r]} is v${bn[r]}.`),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}(n,r.mode);let h=yn[p](n,o);if("vega-lite"===p&&h.$schema){const e=Ye(h.$schema);Ne(bn.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${bn.vega}.`)}d.classList.add("vega-embed"),a&&d.classList.add("has-actions");d.innerHTML="";let u=d;if(a){const e=document.createElement("div");e.classList.add(On),d.appendChild(e),u=e}const g=r.patch;g&&(h=g instanceof Function?g(h):A(h,g,!0,!1).newDocument);r.formatLocale&&hn.formatLocale(r.formatLocale);r.timeFormatLocale&&hn.timeFormatLocale(r.timeFormatLocale);if(r.expressionFunctions)for(const e in r.expressionFunctions){const t=r.expressionFunctions[e];"fn"in t?hn.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&hn.expressionFunction(e,t)}const{ast:m}=r,E=hn.parse(h,"vega-lite"===p?{}:o,{ast:m}),v=new(r.viewClass||hn.View)(E,{loader:i,logLevel:c,renderer:l,...m?{expr:hn.expressionInterpreter??r.expr??He}:{}});if(v.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(u.classList.add("fit-x"),u.classList.remove("fit-y")):"fit-y"==n?(u.classList.remove("fit-x"),u.classList.add("fit-y")):"fit"==n?u.classList.add("fit-x","fit-y"):u.classList.remove("fit-x","fit-y")})),!1!==r.tooltip){const{loader:e,tooltip:t}=r,n=e&&!In(e)?e?.baseURL:void 0,i="function"==typeof t?t:new ln({baseURL:n,...!0===t?{}:t}).call;v.tooltip(i)}let b,{hover:y}=r;void 0===y&&(y="vega"===p);if(y){const{hoverSet:e,updateSet:t}="boolean"==typeof y?{}:y;v.hover(e,t)}r&&(null!=r.width&&v.width(r.width),null!=r.height&&v.height(r.height),null!=r.padding&&v.padding(r.padding));if(await v.initialize(u,r.bind).runAsync(),!1!==a){let t=d;if(!1!==r.defaultStyle||r.forceActionsMenu){const e=document.createElement("details");e.title=s.CLICK_TO_VIEW_ACTIONS,d.append(e),t=e;const n=document.createElement("summary");n.innerHTML=wn,e.append(n),b=t=>{e.contains(t.target)||e.removeAttribute("open")},document.addEventListener("click",b)}const i=document.createElement("div");if(t.append(i),i.classList.add("vega-actions"),!0===a||!1!==a.export)for(const t of["svg","png"])if(!0===a||!0===a.export||a.export[t]){const n=s[`${t.toUpperCase()}_ACTION`],o=document.createElement("a"),a=e.isObject(r.scaleFactor)?r.scaleFactor[t]:r.scaleFactor;o.text=n,o.href="#",o.target="_blank",o.download=`${f}.${t}`,o.addEventListener("mousedown",(async function(e){e.preventDefault();const n=await v.toImageURL(t,a);this.href=n})),i.append(o)}if(!0===a||!1!==a.source){const e=document.createElement("a");e.text=s.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){An(k(n),r.sourceHeader??"",r.sourceFooter??"",p),e.preventDefault()})),i.append(e)}if("vega-lite"===p&&(!0===a||!1!==a.compiled)){const e=document.createElement("a");e.text=s.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){An(k(h),r.sourceHeader??"",r.sourceFooter??"","vega"),e.preventDefault()})),i.append(e)}if(!0===a||!1!==a.editor){const e=r.editorUrl??"https://vega.github.io/editor/",t=document.createElement("a");t.text=s.EDITOR_ACTION,t.href="#",t.addEventListener("click",(function(t){!function(e,t,n){const r=e.open(t),{origin:i}=new URL(t);let o=40;e.addEventListener("message",(function t(n){n.source===r&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(r.postMessage(n,i),setTimeout(e,250),o-=1)}),250)}(window,e,{config:o,mode:g?"vega":p,renderer:l,spec:k(g?h:n)}),t.preventDefault()})),i.append(t)}}function w(){b&&document.removeEventListener("click",b),v.finalize()}return{view:v,spec:n,vgSpec:h,finalize:w,embedOptions:r}}(t,i,f,o)}async function $n(t,n){const r=e.isString(t.config)?JSON.parse(await n.load(t.config)):t.config??{},i=e.isString(t.patch)?JSON.parse(await n.load(t.patch)):t.patch;return{...t,...i?{patch:i}:{},...r?{config:r}:{}}}async function Nn(e,t={}){const n=document.createElement("div");n.classList.add("vega-embed-wrapper");const r=document.createElement("div");n.appendChild(r);const i=!0===t.actions||!1===t.actions?t.actions:{export:!0,source:!1,compiled:!0,editor:!0,...t.actions},o=await xn(r,e,{actions:i,...t});return n.value=o.view,n}const Rn=(...t)=>{return t.length>1&&(e.isString(t[0])&&!((n=t[0]).startsWith("http://")||n.startsWith("https://")||n.startsWith("//"))||t[0]instanceof HTMLElement||3===t.length)?xn(t[0],t[1],t[2]):Nn(t[0],t[1]);var n};return Rn.vegaLite=un,Rn.vl=un,Rn.container=Nn,Rn.embed=xn,Rn.vega=hn,Rn.default=xn,Rn.version=pn,Rn}));