claude-yes 1.10.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.
package/dist/index.js ADDED
@@ -0,0 +1,4949 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __toESM = (mod, isNodeMode, target) => {
8
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
9
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
+ for (let key of __getOwnPropNames(mod))
11
+ if (!__hasOwnProp.call(to, key))
12
+ __defProp(to, key, {
13
+ get: () => mod[key],
14
+ enumerable: true
15
+ });
16
+ return to;
17
+ };
18
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
20
+
21
+ // node_modules/unwind-array/src/index.js
22
+ var require_src = __commonJS((exports, module) => {
23
+ var unwind = (dataObject, options) => {
24
+ const unwindRecursive = (dataObject2, path2, currPath) => {
25
+ const pathArr = path2.split(".");
26
+ if (!currPath) {
27
+ currPath = pathArr[0];
28
+ }
29
+ const result = [];
30
+ let added = false;
31
+ const addObject = (objectTempUnwind, objectKey) => {
32
+ Object.keys(objectTempUnwind).forEach((objectTempUnwindKey) => {
33
+ const newObjectCopy = {};
34
+ Object.keys(dataObject2).forEach((dataObjectKey) => {
35
+ newObjectCopy[dataObjectKey] = dataObject2[dataObjectKey];
36
+ });
37
+ newObjectCopy[objectKey] = objectTempUnwind[objectTempUnwindKey];
38
+ added = true;
39
+ result.push(newObjectCopy);
40
+ });
41
+ };
42
+ Object.keys(dataObject2).forEach((objectKey) => {
43
+ if (currPath === objectKey) {
44
+ if (dataObject2[objectKey] instanceof Array) {
45
+ if (dataObject2[objectKey].length === 0 && options.preserveEmptyArray !== true) {
46
+ delete dataObject2[objectKey];
47
+ } else {
48
+ Object.keys(dataObject2[objectKey]).forEach((objectElementKey) => {
49
+ addObject(unwindRecursive(dataObject2[objectKey][objectElementKey], path2.replace(`${currPath}.`, "")), objectKey);
50
+ });
51
+ }
52
+ } else {
53
+ addObject(unwindRecursive(dataObject2[objectKey], path2.replace(`${currPath}.`, "")), objectKey);
54
+ }
55
+ }
56
+ });
57
+ if (!added) {
58
+ result.push(dataObject2);
59
+ }
60
+ return result;
61
+ };
62
+ return unwindRecursive(dataObject, options.path);
63
+ };
64
+ module.exports = { unwind };
65
+ });
66
+
67
+ // node_modules/phpdie/dist/index.js
68
+ var phpdie_default = DIE;
69
+ function DIE(reason, ...slots) {
70
+ throw errorFormat(reason, ...slots);
71
+ }
72
+ function errorFormat(reason, ...slots) {
73
+ if (typeof reason === "string") {
74
+ return reason.trim();
75
+ }
76
+ if (Array.isArray(reason)) {
77
+ return reason.map((e, i) => e + (slots[i] ?? "")).join("");
78
+ }
79
+ return reason;
80
+ }
81
+
82
+ // node_modules/polyfill-text-encoder-stream/dist/index.js
83
+ class PolyfillTextEncoderStream {
84
+ _encoder = new TextEncoder;
85
+ _reader = null;
86
+ ready = Promise.resolve();
87
+ closed = false;
88
+ readable = new ReadableStream({
89
+ start: (controller) => {
90
+ this._reader = controller;
91
+ }
92
+ });
93
+ writable = new WritableStream({
94
+ write: async (chunk) => {
95
+ if (typeof chunk !== "string") {
96
+ this._reader.enqueue(chunk);
97
+ return;
98
+ }
99
+ if (chunk != null && this._reader) {
100
+ const encoded = this._encoder.encode(chunk);
101
+ this._reader.enqueue(encoded);
102
+ }
103
+ },
104
+ close: () => {
105
+ this._reader?.close();
106
+ this.closed = true;
107
+ },
108
+ abort: (reason) => {
109
+ this._reader?.error(reason);
110
+ this.closed = true;
111
+ }
112
+ });
113
+ }
114
+
115
+ // node_modules/rambda/dist/rambda.js
116
+ var cloneList = (list) => Array.prototype.slice.call(list);
117
+ function curry(fn, args = []) {
118
+ return (..._args) => ((rest) => rest.length >= fn.length ? fn(...rest) : curry(fn, rest))([...args, ..._args]);
119
+ }
120
+ function adjustFn(index, replaceFn, list) {
121
+ const actualIndex = index < 0 ? list.length + index : index;
122
+ if (index >= list.length || actualIndex < 0)
123
+ return list;
124
+ const clone = cloneList(list);
125
+ clone[actualIndex] = replaceFn(clone[actualIndex]);
126
+ return clone;
127
+ }
128
+ var adjust = curry(adjustFn);
129
+ function always(x) {
130
+ return (_) => x;
131
+ }
132
+ var {
133
+ isArray
134
+ } = Array;
135
+ function assocFn(prop, newValue, obj) {
136
+ return Object.assign({}, obj, {
137
+ [prop]: newValue
138
+ });
139
+ }
140
+ var assoc = curry(assocFn);
141
+ function _isInteger(n) {
142
+ return n << 0 === n;
143
+ }
144
+ var isInteger = Number.isInteger || _isInteger;
145
+ var isIndexInteger = (index) => Number.isInteger(Number(index));
146
+ function createPath(path, delimiter = ".") {
147
+ return typeof path === "string" ? path.split(delimiter).map((x) => isInteger(x) ? Number(x) : x) : path;
148
+ }
149
+ function assocPathFn(path, newValue, input) {
150
+ const pathArrValue = createPath(path);
151
+ if (pathArrValue.length === 0)
152
+ return newValue;
153
+ const index = pathArrValue[0];
154
+ if (pathArrValue.length > 1) {
155
+ const condition = typeof input !== "object" || input === null || !input.hasOwnProperty(index);
156
+ const nextInput = condition ? isIndexInteger(pathArrValue[1]) ? [] : {} : input[index];
157
+ newValue = assocPathFn(Array.prototype.slice.call(pathArrValue, 1), newValue, nextInput);
158
+ }
159
+ if (isIndexInteger(index) && isArray(input)) {
160
+ const arr = cloneList(input);
161
+ arr[index] = newValue;
162
+ return arr;
163
+ }
164
+ return assocFn(index, newValue, input);
165
+ }
166
+ var assocPath = curry(assocPathFn);
167
+ function clampFn(min, max, input) {
168
+ if (min > max) {
169
+ throw new Error("min must not be greater than max in clamp(min, max, value)");
170
+ }
171
+ if (input >= min && input <= max)
172
+ return input;
173
+ if (input > max)
174
+ return max;
175
+ if (input < min)
176
+ return min;
177
+ }
178
+ var clamp = curry(clampFn);
179
+ function clone(input) {
180
+ const out = isArray(input) ? Array(input.length) : {};
181
+ if (input && input.getTime)
182
+ return new Date(input.getTime());
183
+ for (const key in input) {
184
+ const v = input[key];
185
+ out[key] = typeof v === "object" && v !== null ? v.getTime ? new Date(v.getTime()) : clone(v) : v;
186
+ }
187
+ return out;
188
+ }
189
+
190
+ class ReduceStopper {
191
+ constructor(value) {
192
+ this.value = value;
193
+ }
194
+ }
195
+ function reduceFn(reducer, acc, list) {
196
+ if (list == null) {
197
+ return acc;
198
+ }
199
+ if (!isArray(list)) {
200
+ throw new TypeError("reduce: list must be array or iterable");
201
+ }
202
+ let index = 0;
203
+ const len = list.length;
204
+ while (index < len) {
205
+ acc = reducer(acc, list[index], index, list);
206
+ if (acc instanceof ReduceStopper) {
207
+ return acc.value;
208
+ }
209
+ index++;
210
+ }
211
+ return acc;
212
+ }
213
+ var reduce = curry(reduceFn);
214
+ function isFalsy(input) {
215
+ return input === undefined || input === null || Number.isNaN(input) === true;
216
+ }
217
+ function defaultTo(defaultArgument, input) {
218
+ if (arguments.length === 1) {
219
+ return (_input) => defaultTo(defaultArgument, _input);
220
+ }
221
+ return isFalsy(input) ? defaultArgument : input;
222
+ }
223
+ function type(input) {
224
+ if (input === null) {
225
+ return "Null";
226
+ } else if (input === undefined) {
227
+ return "Undefined";
228
+ } else if (Number.isNaN(input)) {
229
+ return "NaN";
230
+ }
231
+ const typeResult = Object.prototype.toString.call(input).slice(8, -1);
232
+ return typeResult === "AsyncFunction" ? "Promise" : typeResult;
233
+ }
234
+ function _indexOf(valueToFind, list) {
235
+ if (!isArray(list))
236
+ throw new Error(`Cannot read property 'indexOf' of ${list}`);
237
+ const typeOfValue = type(valueToFind);
238
+ if (!["Array", "NaN", "Object", "RegExp"].includes(typeOfValue))
239
+ return list.indexOf(valueToFind);
240
+ let index = -1;
241
+ let foundIndex = -1;
242
+ const {
243
+ length
244
+ } = list;
245
+ while (++index < length && foundIndex === -1)
246
+ if (equals(list[index], valueToFind))
247
+ foundIndex = index;
248
+ return foundIndex;
249
+ }
250
+ function _arrayFromIterator(iter) {
251
+ const list = [];
252
+ let next;
253
+ while (!(next = iter.next()).done)
254
+ list.push(next.value);
255
+ return list;
256
+ }
257
+ function _compareSets(a, b) {
258
+ if (a.size !== b.size)
259
+ return false;
260
+ const aList = _arrayFromIterator(a.values());
261
+ const bList = _arrayFromIterator(b.values());
262
+ const filtered = aList.filter((aInstance) => _indexOf(aInstance, bList) === -1);
263
+ return filtered.length === 0;
264
+ }
265
+ function compareErrors(a, b) {
266
+ if (a.message !== b.message)
267
+ return false;
268
+ if (a.toString !== b.toString)
269
+ return false;
270
+ return a.toString() === b.toString();
271
+ }
272
+ function parseDate(maybeDate) {
273
+ if (!maybeDate.toDateString)
274
+ return [false];
275
+ return [true, maybeDate.getTime()];
276
+ }
277
+ function parseRegex(maybeRegex) {
278
+ if (maybeRegex.constructor !== RegExp)
279
+ return [false];
280
+ return [true, maybeRegex.toString()];
281
+ }
282
+ function equals(a, b) {
283
+ if (arguments.length === 1)
284
+ return (_b) => equals(a, _b);
285
+ if (Object.is(a, b))
286
+ return true;
287
+ const aType = type(a);
288
+ if (aType !== type(b))
289
+ return false;
290
+ if (aType === "Function")
291
+ return a.name === undefined ? false : a.name === b.name;
292
+ if (["NaN", "Null", "Undefined"].includes(aType))
293
+ return true;
294
+ if (["BigInt", "Number"].includes(aType)) {
295
+ if (Object.is(-0, a) !== Object.is(-0, b))
296
+ return false;
297
+ return a.toString() === b.toString();
298
+ }
299
+ if (["Boolean", "String"].includes(aType))
300
+ return a.toString() === b.toString();
301
+ if (aType === "Array") {
302
+ const aClone = Array.from(a);
303
+ const bClone = Array.from(b);
304
+ if (aClone.toString() !== bClone.toString())
305
+ return false;
306
+ let loopArrayFlag = true;
307
+ aClone.forEach((aCloneInstance, aCloneIndex) => {
308
+ if (loopArrayFlag) {
309
+ if (aCloneInstance !== bClone[aCloneIndex] && !equals(aCloneInstance, bClone[aCloneIndex]))
310
+ loopArrayFlag = false;
311
+ }
312
+ });
313
+ return loopArrayFlag;
314
+ }
315
+ const aRegex = parseRegex(a);
316
+ const bRegex = parseRegex(b);
317
+ if (aRegex[0])
318
+ return bRegex[0] ? aRegex[1] === bRegex[1] : false;
319
+ else if (bRegex[0])
320
+ return false;
321
+ const aDate = parseDate(a);
322
+ const bDate = parseDate(b);
323
+ if (aDate[0])
324
+ return bDate[0] ? aDate[1] === bDate[1] : false;
325
+ else if (bDate[0])
326
+ return false;
327
+ if (a instanceof Error) {
328
+ if (!(b instanceof Error))
329
+ return false;
330
+ return compareErrors(a, b);
331
+ }
332
+ if (aType === "Set")
333
+ return _compareSets(a, b);
334
+ if (aType === "Object") {
335
+ const aKeys = Object.keys(a);
336
+ if (aKeys.length !== Object.keys(b).length)
337
+ return false;
338
+ let loopObjectFlag = true;
339
+ aKeys.forEach((aKeyInstance) => {
340
+ if (loopObjectFlag) {
341
+ const aValue = a[aKeyInstance];
342
+ const bValue = b[aKeyInstance];
343
+ if (aValue !== bValue && !equals(aValue, bValue))
344
+ loopObjectFlag = false;
345
+ }
346
+ });
347
+ return loopObjectFlag;
348
+ }
349
+ return false;
350
+ }
351
+ function differenceWithFn(fn, a, b) {
352
+ const willReturn = [];
353
+ const [first, second] = a.length >= b.length ? [a, b] : [b, a];
354
+ first.forEach((item) => {
355
+ const hasItem = second.some((secondItem) => fn(item, secondItem));
356
+ if (!hasItem && _indexOf(item, willReturn) === -1) {
357
+ willReturn.push(item);
358
+ }
359
+ });
360
+ return willReturn;
361
+ }
362
+ var differenceWith = curry(differenceWithFn);
363
+ function _defineProperty(e, r, t) {
364
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
365
+ value: t,
366
+ enumerable: true,
367
+ configurable: true,
368
+ writable: true
369
+ }) : e[r] = t, e;
370
+ }
371
+ function ownKeys(e, r) {
372
+ var t = Object.keys(e);
373
+ if (Object.getOwnPropertySymbols) {
374
+ var o = Object.getOwnPropertySymbols(e);
375
+ r && (o = o.filter(function(r2) {
376
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
377
+ })), t.push.apply(t, o);
378
+ }
379
+ return t;
380
+ }
381
+ function _objectSpread2(e) {
382
+ for (var r = 1;r < arguments.length; r++) {
383
+ var t = arguments[r] != null ? arguments[r] : {};
384
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
385
+ _defineProperty(e, r2, t[r2]);
386
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
387
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
388
+ });
389
+ }
390
+ return e;
391
+ }
392
+ function _toPrimitive(t, r) {
393
+ if (typeof t != "object" || !t)
394
+ return t;
395
+ var e = t[Symbol.toPrimitive];
396
+ if (e !== undefined) {
397
+ var i = e.call(t, r || "default");
398
+ if (typeof i != "object")
399
+ return i;
400
+ throw new TypeError("@@toPrimitive must return a primitive value.");
401
+ }
402
+ return (r === "string" ? String : Number)(t);
403
+ }
404
+ function _toPropertyKey(t) {
405
+ var i = _toPrimitive(t, "string");
406
+ return typeof i == "symbol" ? i : i + "";
407
+ }
408
+ function pathFn(pathInput, obj) {
409
+ let willReturn = obj;
410
+ let counter = 0;
411
+ const pathArrValue = createPath(pathInput);
412
+ while (counter < pathArrValue.length) {
413
+ if (willReturn === null || willReturn === undefined) {
414
+ return;
415
+ }
416
+ if (willReturn[pathArrValue[counter]] === null)
417
+ return;
418
+ willReturn = willReturn[pathArrValue[counter]];
419
+ counter++;
420
+ }
421
+ return willReturn;
422
+ }
423
+ function path(pathInput, obj) {
424
+ if (arguments.length === 1)
425
+ return (_obj) => path(pathInput, _obj);
426
+ if (obj === null || obj === undefined) {
427
+ return;
428
+ }
429
+ return pathFn(pathInput, obj);
430
+ }
431
+ function updateFn(index, newValue, list) {
432
+ const clone2 = cloneList(list);
433
+ if (index === -1)
434
+ return clone2.fill(newValue, index);
435
+ return clone2.fill(newValue, index, index + 1);
436
+ }
437
+ var update = curry(updateFn);
438
+ function eqByFn(fn, a, b) {
439
+ return equals(fn(a), fn(b));
440
+ }
441
+ var eqBy = curry(eqByFn);
442
+ function propFn(searchProperty, obj) {
443
+ if (!obj)
444
+ return;
445
+ return obj[searchProperty];
446
+ }
447
+ function prop(searchProperty, obj) {
448
+ if (arguments.length === 1)
449
+ return (_obj) => prop(searchProperty, _obj);
450
+ return propFn(searchProperty, obj);
451
+ }
452
+ function eqPropsFn(property, objA, objB) {
453
+ return equals(prop(property, objA), prop(property, objB));
454
+ }
455
+ var eqProps = curry(eqPropsFn);
456
+ function has(prop2, obj) {
457
+ if (arguments.length === 1)
458
+ return (_obj) => has(prop2, _obj);
459
+ if (!obj)
460
+ return false;
461
+ return obj.hasOwnProperty(prop2);
462
+ }
463
+ function ifElseFn(condition, onTrue, onFalse) {
464
+ return (...input) => {
465
+ const conditionResult = typeof condition === "boolean" ? condition : condition(...input);
466
+ if (Boolean(conditionResult)) {
467
+ return onTrue(...input);
468
+ }
469
+ return onFalse(...input);
470
+ };
471
+ }
472
+ var ifElse = curry(ifElseFn);
473
+ function baseSlice(array, start, end) {
474
+ let index = -1;
475
+ let {
476
+ length
477
+ } = array;
478
+ end = end > length ? length : end;
479
+ if (end < 0) {
480
+ end += length;
481
+ }
482
+ length = start > end ? 0 : end - start >>> 0;
483
+ start >>>= 0;
484
+ const result = Array(length);
485
+ while (++index < length) {
486
+ result[index] = array[index + start];
487
+ }
488
+ return result;
489
+ }
490
+ function _includesWith(pred, x, list) {
491
+ let idx = 0;
492
+ const len = list.length;
493
+ while (idx < len) {
494
+ if (pred(x, list[idx]))
495
+ return true;
496
+ idx += 1;
497
+ }
498
+ return false;
499
+ }
500
+ function _filter(fn, list) {
501
+ let idx = 0;
502
+ const len = list.length;
503
+ const result = [];
504
+ while (idx < len) {
505
+ if (fn(list[idx]))
506
+ result[result.length] = list[idx];
507
+ idx += 1;
508
+ }
509
+ return result;
510
+ }
511
+ function innerJoinFn(pred, xs, ys) {
512
+ return _filter((x) => _includesWith(pred, x, ys), xs);
513
+ }
514
+ var innerJoin = curry(innerJoinFn);
515
+ function insertFn(indexToInsert, valueToInsert, array) {
516
+ return [...array.slice(0, indexToInsert), valueToInsert, ...array.slice(indexToInsert)];
517
+ }
518
+ var insert = curry(insertFn);
519
+ function insertAllFn(index, listToInsert, list) {
520
+ return [...list.slice(0, index), ...listToInsert, ...list.slice(index)];
521
+ }
522
+ var insertAll = curry(insertAllFn);
523
+ function is(targetPrototype, x) {
524
+ if (arguments.length === 1)
525
+ return (_x) => is(targetPrototype, _x);
526
+ return x != null && x.constructor === targetPrototype || x instanceof targetPrototype;
527
+ }
528
+ function maxByFn(compareFn, x, y) {
529
+ return compareFn(y) > compareFn(x) ? y : x;
530
+ }
531
+ var maxBy = curry(maxByFn);
532
+ function mergeWithFn(mergeFn, aInput, bInput) {
533
+ const a = aInput !== null && aInput !== undefined ? aInput : {};
534
+ const b = bInput !== null && bInput !== undefined ? bInput : {};
535
+ const willReturn = {};
536
+ Object.keys(a).forEach((key) => {
537
+ if (b[key] === undefined)
538
+ willReturn[key] = a[key];
539
+ else
540
+ willReturn[key] = mergeFn(a[key], b[key]);
541
+ });
542
+ Object.keys(b).forEach((key) => {
543
+ if (willReturn[key] !== undefined)
544
+ return;
545
+ if (a[key] === undefined)
546
+ willReturn[key] = b[key];
547
+ else
548
+ willReturn[key] = mergeFn(a[key], b[key]);
549
+ });
550
+ return willReturn;
551
+ }
552
+ var mergeWith = curry(mergeWithFn);
553
+ function minByFn(compareFn, x, y) {
554
+ return compareFn(y) < compareFn(x) ? y : x;
555
+ }
556
+ var minBy = curry(minByFn);
557
+ function isIterable(input) {
558
+ return Array.isArray(input) || type(input) === "Object";
559
+ }
560
+ function modifyFn(property, fn, iterable) {
561
+ if (!isIterable(iterable))
562
+ return iterable;
563
+ if (iterable[property] === undefined)
564
+ return iterable;
565
+ if (isArray(iterable)) {
566
+ return updateFn(property, fn(iterable[property]), iterable);
567
+ }
568
+ return _objectSpread2(_objectSpread2({}, iterable), {}, {
569
+ [property]: fn(iterable[property])
570
+ });
571
+ }
572
+ var modify = curry(modifyFn);
573
+ function modifyPathFn(pathInput, fn, object) {
574
+ const path$1 = createPath(pathInput);
575
+ if (path$1.length === 1) {
576
+ return _objectSpread2(_objectSpread2({}, object), {}, {
577
+ [path$1[0]]: fn(object[path$1[0]])
578
+ });
579
+ }
580
+ if (path(path$1, object) === undefined)
581
+ return object;
582
+ const val = modifyPath(Array.prototype.slice.call(path$1, 1), fn, object[path$1[0]]);
583
+ if (val === object[path$1[0]]) {
584
+ return object;
585
+ }
586
+ return assoc(path$1[0], val, object);
587
+ }
588
+ var modifyPath = curry(modifyPathFn);
589
+ function moveFn(fromIndex, toIndex, list) {
590
+ if (fromIndex < 0 || toIndex < 0) {
591
+ throw new Error("Rambda.move does not support negative indexes");
592
+ }
593
+ if (fromIndex > list.length - 1 || toIndex > list.length - 1)
594
+ return list;
595
+ const clone2 = cloneList(list);
596
+ clone2[fromIndex] = list[toIndex];
597
+ clone2[toIndex] = list[fromIndex];
598
+ return clone2;
599
+ }
600
+ var move = curry(moveFn);
601
+ function multiply(x, y) {
602
+ if (arguments.length === 1)
603
+ return (_y) => multiply(x, _y);
604
+ return x * y;
605
+ }
606
+ var Identity = (x) => ({
607
+ x,
608
+ map: (fn) => Identity(fn(x))
609
+ });
610
+ function overFn(lens, fn, object) {
611
+ return lens((x) => Identity(fn(x)))(object).x;
612
+ }
613
+ var over = curry(overFn);
614
+ function pathEqFn(pathToSearch, target, input) {
615
+ return equals(path(pathToSearch, input), target);
616
+ }
617
+ var pathEq = curry(pathEqFn);
618
+ function pathOrFn(defaultValue, pathInput, obj) {
619
+ return defaultTo(defaultValue, path(pathInput, obj));
620
+ }
621
+ var pathOr = curry(pathOrFn);
622
+ function pathSatisfiesFn(fn, pathInput, obj) {
623
+ if (pathInput.length === 0)
624
+ throw new Error("R.pathSatisfies received an empty path");
625
+ return Boolean(fn(path(pathInput, obj)));
626
+ }
627
+ var pathSatisfies = curry(pathSatisfiesFn);
628
+ var product = reduce(multiply, 1);
629
+ function propEqFn(valueToMatch, propToFind, obj) {
630
+ if (!obj)
631
+ return false;
632
+ return equals(valueToMatch, prop(propToFind, obj));
633
+ }
634
+ var propEq = curry(propEqFn);
635
+ function propIsFn(targetPrototype, property, obj) {
636
+ return is(targetPrototype, obj[property]);
637
+ }
638
+ var propIs = curry(propIsFn);
639
+ function propOrFn(defaultValue, property, obj) {
640
+ if (!obj)
641
+ return defaultValue;
642
+ return defaultTo(defaultValue, obj[property]);
643
+ }
644
+ var propOr = curry(propOrFn);
645
+ function propSatisfiesFn(predicate, property, obj) {
646
+ return predicate(prop(property, obj));
647
+ }
648
+ var propSatisfies = curry(propSatisfiesFn);
649
+ function reduceByFunction(valueFn, valueAcc, keyFn, acc, elt) {
650
+ const key = keyFn(elt);
651
+ const value = valueFn(has(key, acc) ? acc[key] : clone(valueAcc), elt);
652
+ acc[key] = value;
653
+ return acc;
654
+ }
655
+ function reduceByFn(valueFn, valueAcc, keyFn, list) {
656
+ return reduce((acc, elt) => reduceByFunction(valueFn, valueAcc, keyFn, acc, elt), {}, list);
657
+ }
658
+ var reduceBy = curry(reduceByFn);
659
+ function replaceFn(pattern, replacer, str) {
660
+ return str.replace(pattern, replacer);
661
+ }
662
+ var replace = curry(replaceFn);
663
+ function setFn(lens, replacer, x) {
664
+ return over(lens, always(replacer), x);
665
+ }
666
+ var set = curry(setFn);
667
+ function sliceFn(from, to, list) {
668
+ return list.slice(from, to);
669
+ }
670
+ var slice = curry(sliceFn);
671
+ function sortBy(sortFn, list) {
672
+ if (arguments.length === 1)
673
+ return (_list) => sortBy(sortFn, _list);
674
+ const clone2 = cloneList(list);
675
+ return clone2.sort((a, b) => {
676
+ const aSortResult = sortFn(a);
677
+ const bSortResult = sortFn(b);
678
+ if (aSortResult === bSortResult)
679
+ return 0;
680
+ return aSortResult < bSortResult ? -1 : 1;
681
+ });
682
+ }
683
+ function take(howMany, listOrString) {
684
+ if (arguments.length === 1)
685
+ return (_listOrString) => take(howMany, _listOrString);
686
+ if (howMany < 0)
687
+ return listOrString.slice();
688
+ if (typeof listOrString === "string")
689
+ return listOrString.slice(0, howMany);
690
+ return baseSlice(listOrString, 0, howMany);
691
+ }
692
+ function swapArrayOrString(indexA, indexB, iterable) {
693
+ const actualIndexA = indexA < 0 ? iterable.length + indexA : indexA;
694
+ const actualIndexB = indexB < 0 ? iterable.length + indexB : indexB;
695
+ if (actualIndexA === actualIndexB || Math.min(actualIndexA, actualIndexB) < 0 || Math.max(actualIndexA, actualIndexB) >= iterable.length)
696
+ return iterable;
697
+ if (typeof iterable === "string") {
698
+ return iterable.slice(0, actualIndexA) + iterable[actualIndexB] + iterable.slice(actualIndexA + 1, actualIndexB) + iterable[actualIndexA] + iterable.slice(actualIndexB + 1);
699
+ }
700
+ const clone2 = iterable.slice();
701
+ const temp = clone2[actualIndexA];
702
+ clone2[actualIndexA] = clone2[actualIndexB];
703
+ clone2[actualIndexB] = temp;
704
+ return clone2;
705
+ }
706
+ function swapFn(indexA, indexB, iterable) {
707
+ if (isArray(iterable) || typeof iterable === "string")
708
+ return swapArrayOrString(indexA, indexB, iterable);
709
+ const aVal = iterable[indexA];
710
+ const bVal = iterable[indexB];
711
+ if (aVal === undefined || bVal === undefined)
712
+ return iterable;
713
+ return _objectSpread2(_objectSpread2({}, iterable), {}, {
714
+ [indexA]: iterable[indexB],
715
+ [indexB]: iterable[indexA]
716
+ });
717
+ }
718
+ var swap = curry(swapFn);
719
+ function unlessFn(predicate, whenFalseFn, input) {
720
+ if (predicate(input))
721
+ return input;
722
+ return whenFalseFn(input);
723
+ }
724
+ var unless = curry(unlessFn);
725
+ function whenFn(predicate, whenTrueFn, input) {
726
+ if (!predicate(input))
727
+ return input;
728
+ return whenTrueFn(input);
729
+ }
730
+ var when = curry(whenFn);
731
+ function zipWithFn(fn, x, y) {
732
+ return take(x.length > y.length ? y.length : x.length, x).map((xInstance, i) => fn(xInstance, y[i]));
733
+ }
734
+ var zipWith = curry(zipWithFn);
735
+ var $equals = equals;
736
+ var $sortBy = sortBy;
737
+ // node_modules/web-streams-extensions/dist/esm/operators/map.js
738
+ function map(select) {
739
+ let reader = null;
740
+ async function flush(controller) {
741
+ try {
742
+ while (controller.desiredSize > 0 && reader != null) {
743
+ let next = await reader.read();
744
+ if (next.done) {
745
+ controller.close();
746
+ reader = null;
747
+ } else {
748
+ let mapped = await select(next.value);
749
+ if (mapped !== undefined)
750
+ controller.enqueue(mapped);
751
+ }
752
+ }
753
+ } catch (err) {
754
+ controller.error(err);
755
+ }
756
+ }
757
+ return function(src, opts) {
758
+ return new ReadableStream({
759
+ start(controller) {
760
+ reader = src.getReader();
761
+ return flush(controller);
762
+ },
763
+ pull(controller) {
764
+ return flush(controller);
765
+ },
766
+ cancel(reason) {
767
+ if (reader) {
768
+ reader.cancel(reason);
769
+ reader.releaseLock();
770
+ reader = null;
771
+ }
772
+ }
773
+ }, opts);
774
+ };
775
+ }
776
+ // node_modules/web-streams-extensions/dist/esm/_readable-like.js
777
+ function isReadableLike(obj) {
778
+ return obj["readable"] != null;
779
+ }
780
+
781
+ // node_modules/web-streams-extensions/dist/esm/from.js
782
+ function from(src) {
783
+ let it;
784
+ async function flush(controller) {
785
+ try {
786
+ while (controller.desiredSize > 0 && it != null) {
787
+ let next = await it.next();
788
+ if (next.done) {
789
+ it = null;
790
+ controller.close();
791
+ } else {
792
+ controller.enqueue(next.value);
793
+ }
794
+ }
795
+ } catch (err) {
796
+ controller.error(err);
797
+ }
798
+ }
799
+ if (isReadableLike(src)) {
800
+ return src.readable;
801
+ }
802
+ return new ReadableStream({
803
+ async start(controller) {
804
+ let iterable;
805
+ if (typeof src == "function") {
806
+ src = src();
807
+ }
808
+ if (Symbol.asyncIterator && src[Symbol.asyncIterator])
809
+ iterable = src[Symbol.asyncIterator].bind(src);
810
+ else if (src[Symbol.iterator])
811
+ iterable = src[Symbol.iterator].bind(src);
812
+ else {
813
+ let value = await Promise.resolve(src);
814
+ controller.enqueue(value);
815
+ controller.close();
816
+ return;
817
+ }
818
+ it = iterable();
819
+ return flush(controller);
820
+ },
821
+ async pull(controller) {
822
+ return flush(controller);
823
+ },
824
+ async cancel(reason) {
825
+ if (reason && it && it.throw) {
826
+ it.throw(reason);
827
+ } else if (it && it.return) {
828
+ await it.return();
829
+ }
830
+ it = null;
831
+ }
832
+ });
833
+ }
834
+
835
+ // node_modules/web-streams-extensions/dist/esm/operators/through.js
836
+ function through(dst) {
837
+ return function(src) {
838
+ return src.pipeThrough(dst);
839
+ };
840
+ }
841
+
842
+ // node_modules/web-streams-extensions/dist/esm/pipe.js
843
+ function pipe(src, ...ops) {
844
+ if (isReadableLike(src)) {
845
+ src = src.readable;
846
+ }
847
+ return ops.map((x) => isTransform(x) ? through(x) : x).reduce((p, c) => {
848
+ return c(p, { highWaterMark: 1 });
849
+ }, src);
850
+ }
851
+ function isTransform(x) {
852
+ return x["readable"] != null && x["writable"] != null;
853
+ }
854
+
855
+ // node_modules/web-streams-extensions/dist/esm/utils/signal.js
856
+ class Gate {
857
+ _count;
858
+ _queue = [];
859
+ constructor(_count) {
860
+ this._count = _count;
861
+ }
862
+ async wait() {
863
+ if (this._count > 0) {
864
+ --this._count;
865
+ return Promise.resolve();
866
+ }
867
+ return new Promise((r) => {
868
+ let cb = () => {
869
+ this._queue.splice(this._queue.indexOf(cb), 1);
870
+ --this._count;
871
+ r();
872
+ };
873
+ this._queue.push(cb);
874
+ });
875
+ }
876
+ increment() {
877
+ ++this._count;
878
+ this.clearQueue();
879
+ }
880
+ setCount(count) {
881
+ this._count = count;
882
+ this.clearQueue();
883
+ }
884
+ clearQueue() {
885
+ while (this._count > 0 && this._queue.length > 0) {
886
+ this._queue.shift()();
887
+ }
888
+ }
889
+ }
890
+
891
+ class BlockingQueue {
892
+ _pushers = [];
893
+ _pullers = [];
894
+ constructor() {}
895
+ async push(value) {
896
+ return new Promise((r) => {
897
+ this._pushers.unshift(() => {
898
+ r();
899
+ return value;
900
+ });
901
+ this.dequeue();
902
+ });
903
+ }
904
+ async pull() {
905
+ return new Promise((r) => {
906
+ this._pullers.unshift((value) => {
907
+ r(value);
908
+ });
909
+ this.dequeue();
910
+ });
911
+ }
912
+ dequeue() {
913
+ while (this._pullers.length > 0 && this._pushers.length > 0) {
914
+ let puller = this._pullers.pop();
915
+ let pusher = this._pushers.pop();
916
+ puller(pusher());
917
+ }
918
+ }
919
+ }
920
+
921
+ // node_modules/web-streams-extensions/dist/esm/operators/schedule.js
922
+ function schedule(scheduler) {
923
+ let reader = null;
924
+ async function flush(controller) {
925
+ try {
926
+ while (controller.desiredSize > 0 && reader != null) {
927
+ let next = await reader.read();
928
+ if (next.done) {
929
+ controller.close();
930
+ reader = null;
931
+ } else {
932
+ await scheduler.nextTick();
933
+ controller.enqueue(next.value);
934
+ }
935
+ }
936
+ } catch (err) {
937
+ controller.error(err);
938
+ }
939
+ }
940
+ return function(src, opts) {
941
+ return new ReadableStream({
942
+ start(controller) {
943
+ reader = src.getReader();
944
+ return flush(controller);
945
+ },
946
+ pull(controller) {
947
+ return flush(controller);
948
+ },
949
+ cancel(reason) {
950
+ if (reader) {
951
+ reader.cancel(reason);
952
+ reader.releaseLock();
953
+ reader = null;
954
+ }
955
+ }
956
+ }, opts);
957
+ };
958
+ }
959
+
960
+ // node_modules/web-streams-extensions/dist/esm/operators/on.js
961
+ function on(callbacks) {
962
+ let reader = null;
963
+ async function flush(controller) {
964
+ try {
965
+ while (controller.desiredSize > 0 && reader != null) {
966
+ let next = await reader.read();
967
+ if (next.done) {
968
+ controller.close();
969
+ reader = null;
970
+ if (callbacks.complete)
971
+ callbacks.complete();
972
+ } else {
973
+ controller.enqueue(next.value);
974
+ }
975
+ }
976
+ } catch (err) {
977
+ controller.error(err);
978
+ if (callbacks.error)
979
+ callbacks.error(err);
980
+ }
981
+ }
982
+ return function(src, opts) {
983
+ return new ReadableStream({
984
+ start(controller) {
985
+ reader = src.getReader();
986
+ if (callbacks.start)
987
+ callbacks.start();
988
+ return flush(controller);
989
+ },
990
+ pull(controller) {
991
+ return flush(controller);
992
+ },
993
+ cancel(reason) {
994
+ if (reader) {
995
+ reader.cancel(reason);
996
+ reader.releaseLock();
997
+ reader = null;
998
+ if (callbacks.complete)
999
+ callbacks.complete(reason);
1000
+ }
1001
+ }
1002
+ }, opts);
1003
+ };
1004
+ }
1005
+
1006
+ // node_modules/web-streams-extensions/dist/esm/to-promise.js
1007
+ async function toPromise(src) {
1008
+ let res = undefined;
1009
+ if (isReadableLike(src)) {
1010
+ src = src.readable;
1011
+ }
1012
+ let reader = src.getReader();
1013
+ let done = false;
1014
+ while (done == false) {
1015
+ let next = await reader.read();
1016
+ done = next.done;
1017
+ if (!done)
1018
+ res = next.value;
1019
+ }
1020
+ return res;
1021
+ }
1022
+
1023
+ // node_modules/web-streams-extensions/dist/esm/operators/merge.js
1024
+ function merge(concurrent = Infinity) {
1025
+ if (concurrent == 0)
1026
+ throw Error("zero is an invalid concurrency limit");
1027
+ return function(src) {
1028
+ let outerGate = new Gate(concurrent);
1029
+ let innerQueue = new BlockingQueue;
1030
+ let subscription;
1031
+ let errored = null;
1032
+ return new ReadableStream({
1033
+ start(outerController) {
1034
+ let reading = [];
1035
+ let readingDone = false;
1036
+ toPromise(pipe(src, schedule({
1037
+ nextTick: async () => {
1038
+ await outerGate.wait();
1039
+ }
1040
+ }), map((innerStream) => {
1041
+ if (!(innerStream instanceof ReadableStream)) {
1042
+ innerStream = from(innerStream);
1043
+ }
1044
+ reading.push(innerStream);
1045
+ pipe(innerStream, map(async (value) => {
1046
+ await innerQueue.push({ done: false, value });
1047
+ }), on({
1048
+ error(err) {
1049
+ outerController.error(err);
1050
+ },
1051
+ complete() {
1052
+ outerGate.increment();
1053
+ reading.splice(reading.indexOf(innerStream), 1);
1054
+ if (reading.length == 0 && readingDone) {
1055
+ innerQueue.push({ done: true });
1056
+ }
1057
+ }
1058
+ }));
1059
+ }), on({
1060
+ error(err) {
1061
+ outerController.error(err);
1062
+ errored = err;
1063
+ },
1064
+ complete() {
1065
+ readingDone = true;
1066
+ }
1067
+ }))).catch((err) => {
1068
+ outerController.error(err);
1069
+ });
1070
+ },
1071
+ async pull(controller) {
1072
+ while (controller.desiredSize > 0) {
1073
+ let next = await innerQueue.pull();
1074
+ if (errored) {
1075
+ controller.error(errored);
1076
+ }
1077
+ if (next.done) {
1078
+ controller.close();
1079
+ } else {
1080
+ controller.enqueue(next.value);
1081
+ }
1082
+ }
1083
+ },
1084
+ cancel(reason) {
1085
+ if (subscription) {
1086
+ subscription.unsubscribe();
1087
+ subscription = null;
1088
+ }
1089
+ }
1090
+ });
1091
+ };
1092
+ }
1093
+ // node_modules/web-streams-extensions/dist/esm/to-array.js
1094
+ async function toArray(src) {
1095
+ let res = [];
1096
+ if (isReadableLike(src)) {
1097
+ src = src.readable;
1098
+ }
1099
+ let reader = src.getReader();
1100
+ try {
1101
+ let done = false;
1102
+ while (done == false) {
1103
+ let next = await reader.read();
1104
+ done = next.done;
1105
+ if (!done)
1106
+ res.push(next.value);
1107
+ }
1108
+ } finally {
1109
+ reader.releaseLock();
1110
+ }
1111
+ return res;
1112
+ }
1113
+ // node_modules/web-streams-extensions/dist/esm/_subscribable.js
1114
+ class Subscribable {
1115
+ closed = false;
1116
+ subscribers = [];
1117
+ subscribe(cb) {
1118
+ let self = this;
1119
+ self.subscribers.push(cb);
1120
+ let _closed = false;
1121
+ return {
1122
+ get closed() {
1123
+ return _closed || self.closed;
1124
+ },
1125
+ unsubscribe() {
1126
+ let index = self.subscribers.findIndex((x) => x === cb);
1127
+ if (index >= 0) {
1128
+ self.subscribers.splice(index, 1);
1129
+ }
1130
+ _closed = true;
1131
+ }
1132
+ };
1133
+ }
1134
+ next(value) {
1135
+ return Math.min(...this.subscribers.map((x) => x.next(value)));
1136
+ }
1137
+ complete() {
1138
+ for (let sub of this.subscribers) {
1139
+ sub.complete();
1140
+ }
1141
+ this.subscribers = [];
1142
+ this.closed = true;
1143
+ }
1144
+ error(err) {
1145
+ for (let sub of this.subscribers) {
1146
+ sub.error(err);
1147
+ }
1148
+ this.subscribers = [];
1149
+ this.closed = true;
1150
+ }
1151
+ }
1152
+
1153
+ // node_modules/web-streams-extensions/dist/esm/subject.js
1154
+ class Subject {
1155
+ _subscribable = new Subscribable;
1156
+ _closingResolve;
1157
+ _closing = new Promise((r) => this._closingResolve = r);
1158
+ get closed() {
1159
+ return this._subscribable.closed;
1160
+ }
1161
+ get readable() {
1162
+ let self = this;
1163
+ let subscription;
1164
+ let cancelled = false;
1165
+ return new ReadableStream({
1166
+ async start(controller) {
1167
+ subscription = self.subscribe({
1168
+ next: (value) => {
1169
+ if (cancelled)
1170
+ return;
1171
+ controller.enqueue(value);
1172
+ return controller.desiredSize;
1173
+ },
1174
+ complete: () => {
1175
+ controller.close();
1176
+ },
1177
+ error: (err) => {
1178
+ controller.error(err);
1179
+ }
1180
+ });
1181
+ },
1182
+ cancel() {
1183
+ cancelled = true;
1184
+ if (subscription) {
1185
+ subscription.unsubscribe();
1186
+ }
1187
+ }
1188
+ });
1189
+ }
1190
+ get writable() {
1191
+ const queuingStrategy = new CountQueuingStrategy({ highWaterMark: 1 });
1192
+ const self = this;
1193
+ let stream = new WritableStream({
1194
+ write(chunk, controller) {
1195
+ if (self.closed && controller.signal.aborted == false) {
1196
+ controller.error();
1197
+ return;
1198
+ }
1199
+ if (controller.signal.aborted) {
1200
+ self._error(controller.signal.reason);
1201
+ return;
1202
+ }
1203
+ self._next(chunk);
1204
+ },
1205
+ close() {
1206
+ self._complete();
1207
+ },
1208
+ abort(reason) {
1209
+ self._error(reason);
1210
+ }
1211
+ }, queuingStrategy);
1212
+ this._closing.then((_) => {
1213
+ if (stream.locked == false) {
1214
+ stream.close();
1215
+ }
1216
+ });
1217
+ return stream;
1218
+ }
1219
+ subscribe(cb) {
1220
+ let subscription = this._subscribable.subscribe(cb);
1221
+ return subscription;
1222
+ }
1223
+ _next(value) {
1224
+ return this._subscribable.next(value);
1225
+ }
1226
+ _complete() {
1227
+ this._subscribable.complete();
1228
+ }
1229
+ _error(err) {
1230
+ this._subscribable.error(err);
1231
+ }
1232
+ async next(value) {
1233
+ return this._next(value);
1234
+ }
1235
+ async complete() {
1236
+ this._closingResolve(undefined);
1237
+ return this._complete();
1238
+ }
1239
+ async error(err) {
1240
+ this._closingResolve(undefined);
1241
+ return this._error(err);
1242
+ }
1243
+ }
1244
+ // node_modules/string-replace-async/index.js
1245
+ function replaceAsync(string, searchValue, replacer) {
1246
+ try {
1247
+ if (typeof replacer === "function") {
1248
+ var values = [];
1249
+ String.prototype.replace.call(string, searchValue, function() {
1250
+ values.push(replacer.apply(undefined, arguments));
1251
+ return "";
1252
+ });
1253
+ return Promise.all(values).then(function(resolvedValues) {
1254
+ return String.prototype.replace.call(string, searchValue, function() {
1255
+ return resolvedValues.shift();
1256
+ });
1257
+ });
1258
+ } else {
1259
+ return Promise.resolve(String.prototype.replace.call(string, searchValue, replacer));
1260
+ }
1261
+ } catch (error) {
1262
+ return Promise.reject(error);
1263
+ }
1264
+ }
1265
+
1266
+ // node_modules/sflow/dist/index.js
1267
+ var import_unwind_array = __toESM(require_src(), 1);
1268
+ // node_modules/d3-dispatch/src/dispatch.js
1269
+ var noop = { value: () => {} };
1270
+ function dispatch() {
1271
+ for (var i = 0, n = arguments.length, _ = {}, t;i < n; ++i) {
1272
+ if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t))
1273
+ throw new Error("illegal type: " + t);
1274
+ _[t] = [];
1275
+ }
1276
+ return new Dispatch(_);
1277
+ }
1278
+ function Dispatch(_) {
1279
+ this._ = _;
1280
+ }
1281
+ function parseTypenames(typenames, types) {
1282
+ return typenames.trim().split(/^|\s+/).map(function(t) {
1283
+ var name = "", i = t.indexOf(".");
1284
+ if (i >= 0)
1285
+ name = t.slice(i + 1), t = t.slice(0, i);
1286
+ if (t && !types.hasOwnProperty(t))
1287
+ throw new Error("unknown type: " + t);
1288
+ return { type: t, name };
1289
+ });
1290
+ }
1291
+ Dispatch.prototype = dispatch.prototype = {
1292
+ constructor: Dispatch,
1293
+ on: function(typename, callback) {
1294
+ var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length;
1295
+ if (arguments.length < 2) {
1296
+ while (++i < n)
1297
+ if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name)))
1298
+ return t;
1299
+ return;
1300
+ }
1301
+ if (callback != null && typeof callback !== "function")
1302
+ throw new Error("invalid callback: " + callback);
1303
+ while (++i < n) {
1304
+ if (t = (typename = T[i]).type)
1305
+ _[t] = set2(_[t], typename.name, callback);
1306
+ else if (callback == null)
1307
+ for (t in _)
1308
+ _[t] = set2(_[t], typename.name, null);
1309
+ }
1310
+ return this;
1311
+ },
1312
+ copy: function() {
1313
+ var copy = {}, _ = this._;
1314
+ for (var t in _)
1315
+ copy[t] = _[t].slice();
1316
+ return new Dispatch(copy);
1317
+ },
1318
+ call: function(type2, that) {
1319
+ if ((n = arguments.length - 2) > 0)
1320
+ for (var args = new Array(n), i = 0, n, t;i < n; ++i)
1321
+ args[i] = arguments[i + 2];
1322
+ if (!this._.hasOwnProperty(type2))
1323
+ throw new Error("unknown type: " + type2);
1324
+ for (t = this._[type2], i = 0, n = t.length;i < n; ++i)
1325
+ t[i].value.apply(that, args);
1326
+ },
1327
+ apply: function(type2, that, args) {
1328
+ if (!this._.hasOwnProperty(type2))
1329
+ throw new Error("unknown type: " + type2);
1330
+ for (var t = this._[type2], i = 0, n = t.length;i < n; ++i)
1331
+ t[i].value.apply(that, args);
1332
+ }
1333
+ };
1334
+ function get(type2, name) {
1335
+ for (var i = 0, n = type2.length, c;i < n; ++i) {
1336
+ if ((c = type2[i]).name === name) {
1337
+ return c.value;
1338
+ }
1339
+ }
1340
+ }
1341
+ function set2(type2, name, callback) {
1342
+ for (var i = 0, n = type2.length;i < n; ++i) {
1343
+ if (type2[i].name === name) {
1344
+ type2[i] = noop, type2 = type2.slice(0, i).concat(type2.slice(i + 1));
1345
+ break;
1346
+ }
1347
+ }
1348
+ if (callback != null)
1349
+ type2.push({ name, value: callback });
1350
+ return type2;
1351
+ }
1352
+ var dispatch_default = dispatch;
1353
+ // node_modules/d3-selection/src/namespaces.js
1354
+ var xhtml = "http://www.w3.org/1999/xhtml";
1355
+ var namespaces_default = {
1356
+ svg: "http://www.w3.org/2000/svg",
1357
+ xhtml,
1358
+ xlink: "http://www.w3.org/1999/xlink",
1359
+ xml: "http://www.w3.org/XML/1998/namespace",
1360
+ xmlns: "http://www.w3.org/2000/xmlns/"
1361
+ };
1362
+
1363
+ // node_modules/d3-selection/src/namespace.js
1364
+ function namespace_default(name) {
1365
+ var prefix = name += "", i = prefix.indexOf(":");
1366
+ if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns")
1367
+ name = name.slice(i + 1);
1368
+ return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
1369
+ }
1370
+
1371
+ // node_modules/d3-selection/src/creator.js
1372
+ function creatorInherit(name) {
1373
+ return function() {
1374
+ var document2 = this.ownerDocument, uri = this.namespaceURI;
1375
+ return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
1376
+ };
1377
+ }
1378
+ function creatorFixed(fullname) {
1379
+ return function() {
1380
+ return this.ownerDocument.createElementNS(fullname.space, fullname.local);
1381
+ };
1382
+ }
1383
+ function creator_default(name) {
1384
+ var fullname = namespace_default(name);
1385
+ return (fullname.local ? creatorFixed : creatorInherit)(fullname);
1386
+ }
1387
+
1388
+ // node_modules/d3-selection/src/selector.js
1389
+ function none() {}
1390
+ function selector_default(selector) {
1391
+ return selector == null ? none : function() {
1392
+ return this.querySelector(selector);
1393
+ };
1394
+ }
1395
+
1396
+ // node_modules/d3-selection/src/selection/select.js
1397
+ function select_default(select) {
1398
+ if (typeof select !== "function")
1399
+ select = selector_default(select);
1400
+ for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0;j < m; ++j) {
1401
+ for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0;i < n; ++i) {
1402
+ if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
1403
+ if ("__data__" in node)
1404
+ subnode.__data__ = node.__data__;
1405
+ subgroup[i] = subnode;
1406
+ }
1407
+ }
1408
+ }
1409
+ return new Selection(subgroups, this._parents);
1410
+ }
1411
+
1412
+ // node_modules/d3-selection/src/array.js
1413
+ function array(x) {
1414
+ return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
1415
+ }
1416
+
1417
+ // node_modules/d3-selection/src/selectorAll.js
1418
+ function empty() {
1419
+ return [];
1420
+ }
1421
+ function selectorAll_default(selector) {
1422
+ return selector == null ? empty : function() {
1423
+ return this.querySelectorAll(selector);
1424
+ };
1425
+ }
1426
+
1427
+ // node_modules/d3-selection/src/selection/selectAll.js
1428
+ function arrayAll(select) {
1429
+ return function() {
1430
+ return array(select.apply(this, arguments));
1431
+ };
1432
+ }
1433
+ function selectAll_default(select) {
1434
+ if (typeof select === "function")
1435
+ select = arrayAll(select);
1436
+ else
1437
+ select = selectorAll_default(select);
1438
+ for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0;j < m; ++j) {
1439
+ for (var group = groups[j], n = group.length, node, i = 0;i < n; ++i) {
1440
+ if (node = group[i]) {
1441
+ subgroups.push(select.call(node, node.__data__, i, group));
1442
+ parents.push(node);
1443
+ }
1444
+ }
1445
+ }
1446
+ return new Selection(subgroups, parents);
1447
+ }
1448
+
1449
+ // node_modules/d3-selection/src/matcher.js
1450
+ function matcher_default(selector) {
1451
+ return function() {
1452
+ return this.matches(selector);
1453
+ };
1454
+ }
1455
+ function childMatcher(selector) {
1456
+ return function(node) {
1457
+ return node.matches(selector);
1458
+ };
1459
+ }
1460
+
1461
+ // node_modules/d3-selection/src/selection/selectChild.js
1462
+ var find = Array.prototype.find;
1463
+ function childFind(match) {
1464
+ return function() {
1465
+ return find.call(this.children, match);
1466
+ };
1467
+ }
1468
+ function childFirst() {
1469
+ return this.firstElementChild;
1470
+ }
1471
+ function selectChild_default(match) {
1472
+ return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
1473
+ }
1474
+
1475
+ // node_modules/d3-selection/src/selection/selectChildren.js
1476
+ var filter2 = Array.prototype.filter;
1477
+ function children() {
1478
+ return Array.from(this.children);
1479
+ }
1480
+ function childrenFilter(match) {
1481
+ return function() {
1482
+ return filter2.call(this.children, match);
1483
+ };
1484
+ }
1485
+ function selectChildren_default(match) {
1486
+ return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
1487
+ }
1488
+
1489
+ // node_modules/d3-selection/src/selection/filter.js
1490
+ function filter_default(match) {
1491
+ if (typeof match !== "function")
1492
+ match = matcher_default(match);
1493
+ for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0;j < m; ++j) {
1494
+ for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0;i < n; ++i) {
1495
+ if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
1496
+ subgroup.push(node);
1497
+ }
1498
+ }
1499
+ }
1500
+ return new Selection(subgroups, this._parents);
1501
+ }
1502
+
1503
+ // node_modules/d3-selection/src/selection/sparse.js
1504
+ function sparse_default(update2) {
1505
+ return new Array(update2.length);
1506
+ }
1507
+
1508
+ // node_modules/d3-selection/src/selection/enter.js
1509
+ function enter_default() {
1510
+ return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
1511
+ }
1512
+ function EnterNode(parent, datum) {
1513
+ this.ownerDocument = parent.ownerDocument;
1514
+ this.namespaceURI = parent.namespaceURI;
1515
+ this._next = null;
1516
+ this._parent = parent;
1517
+ this.__data__ = datum;
1518
+ }
1519
+ EnterNode.prototype = {
1520
+ constructor: EnterNode,
1521
+ appendChild: function(child) {
1522
+ return this._parent.insertBefore(child, this._next);
1523
+ },
1524
+ insertBefore: function(child, next) {
1525
+ return this._parent.insertBefore(child, next);
1526
+ },
1527
+ querySelector: function(selector) {
1528
+ return this._parent.querySelector(selector);
1529
+ },
1530
+ querySelectorAll: function(selector) {
1531
+ return this._parent.querySelectorAll(selector);
1532
+ }
1533
+ };
1534
+
1535
+ // node_modules/d3-selection/src/constant.js
1536
+ function constant_default(x) {
1537
+ return function() {
1538
+ return x;
1539
+ };
1540
+ }
1541
+
1542
+ // node_modules/d3-selection/src/selection/data.js
1543
+ function bindIndex(parent, group, enter, update2, exit, data) {
1544
+ var i = 0, node, groupLength = group.length, dataLength = data.length;
1545
+ for (;i < dataLength; ++i) {
1546
+ if (node = group[i]) {
1547
+ node.__data__ = data[i];
1548
+ update2[i] = node;
1549
+ } else {
1550
+ enter[i] = new EnterNode(parent, data[i]);
1551
+ }
1552
+ }
1553
+ for (;i < groupLength; ++i) {
1554
+ if (node = group[i]) {
1555
+ exit[i] = node;
1556
+ }
1557
+ }
1558
+ }
1559
+ function bindKey(parent, group, enter, update2, exit, data, key) {
1560
+ var i, node, nodeByKeyValue = new Map, groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
1561
+ for (i = 0;i < groupLength; ++i) {
1562
+ if (node = group[i]) {
1563
+ keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + "";
1564
+ if (nodeByKeyValue.has(keyValue)) {
1565
+ exit[i] = node;
1566
+ } else {
1567
+ nodeByKeyValue.set(keyValue, node);
1568
+ }
1569
+ }
1570
+ }
1571
+ for (i = 0;i < dataLength; ++i) {
1572
+ keyValue = key.call(parent, data[i], i, data) + "";
1573
+ if (node = nodeByKeyValue.get(keyValue)) {
1574
+ update2[i] = node;
1575
+ node.__data__ = data[i];
1576
+ nodeByKeyValue.delete(keyValue);
1577
+ } else {
1578
+ enter[i] = new EnterNode(parent, data[i]);
1579
+ }
1580
+ }
1581
+ for (i = 0;i < groupLength; ++i) {
1582
+ if ((node = group[i]) && nodeByKeyValue.get(keyValues[i]) === node) {
1583
+ exit[i] = node;
1584
+ }
1585
+ }
1586
+ }
1587
+ function datum(node) {
1588
+ return node.__data__;
1589
+ }
1590
+ function data_default(value, key) {
1591
+ if (!arguments.length)
1592
+ return Array.from(this, datum);
1593
+ var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
1594
+ if (typeof value !== "function")
1595
+ value = constant_default(value);
1596
+ for (var m = groups.length, update2 = new Array(m), enter = new Array(m), exit = new Array(m), j = 0;j < m; ++j) {
1597
+ var parent = parents[j], group = groups[j], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update2[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength);
1598
+ bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
1599
+ for (var i0 = 0, i1 = 0, previous, next;i0 < dataLength; ++i0) {
1600
+ if (previous = enterGroup[i0]) {
1601
+ if (i0 >= i1)
1602
+ i1 = i0 + 1;
1603
+ while (!(next = updateGroup[i1]) && ++i1 < dataLength)
1604
+ ;
1605
+ previous._next = next || null;
1606
+ }
1607
+ }
1608
+ }
1609
+ update2 = new Selection(update2, parents);
1610
+ update2._enter = enter;
1611
+ update2._exit = exit;
1612
+ return update2;
1613
+ }
1614
+ function arraylike(data) {
1615
+ return typeof data === "object" && "length" in data ? data : Array.from(data);
1616
+ }
1617
+
1618
+ // node_modules/d3-selection/src/selection/exit.js
1619
+ function exit_default() {
1620
+ return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
1621
+ }
1622
+
1623
+ // node_modules/d3-selection/src/selection/join.js
1624
+ function join_default(onenter, onupdate, onexit) {
1625
+ var enter = this.enter(), update2 = this, exit = this.exit();
1626
+ if (typeof onenter === "function") {
1627
+ enter = onenter(enter);
1628
+ if (enter)
1629
+ enter = enter.selection();
1630
+ } else {
1631
+ enter = enter.append(onenter + "");
1632
+ }
1633
+ if (onupdate != null) {
1634
+ update2 = onupdate(update2);
1635
+ if (update2)
1636
+ update2 = update2.selection();
1637
+ }
1638
+ if (onexit == null)
1639
+ exit.remove();
1640
+ else
1641
+ onexit(exit);
1642
+ return enter && update2 ? enter.merge(update2).order() : update2;
1643
+ }
1644
+
1645
+ // node_modules/d3-selection/src/selection/merge.js
1646
+ function merge_default(context) {
1647
+ var selection = context.selection ? context.selection() : context;
1648
+ for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0;j < m; ++j) {
1649
+ for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge3 = merges[j] = new Array(n), node, i = 0;i < n; ++i) {
1650
+ if (node = group0[i] || group1[i]) {
1651
+ merge3[i] = node;
1652
+ }
1653
+ }
1654
+ }
1655
+ for (;j < m0; ++j) {
1656
+ merges[j] = groups0[j];
1657
+ }
1658
+ return new Selection(merges, this._parents);
1659
+ }
1660
+
1661
+ // node_modules/d3-selection/src/selection/order.js
1662
+ function order_default() {
1663
+ for (var groups = this._groups, j = -1, m = groups.length;++j < m; ) {
1664
+ for (var group = groups[j], i = group.length - 1, next = group[i], node;--i >= 0; ) {
1665
+ if (node = group[i]) {
1666
+ if (next && node.compareDocumentPosition(next) ^ 4)
1667
+ next.parentNode.insertBefore(node, next);
1668
+ next = node;
1669
+ }
1670
+ }
1671
+ }
1672
+ return this;
1673
+ }
1674
+
1675
+ // node_modules/d3-selection/src/selection/sort.js
1676
+ function sort_default(compare) {
1677
+ if (!compare)
1678
+ compare = ascending;
1679
+ function compareNode(a, b) {
1680
+ return a && b ? compare(a.__data__, b.__data__) : !a - !b;
1681
+ }
1682
+ for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0;j < m; ++j) {
1683
+ for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0;i < n; ++i) {
1684
+ if (node = group[i]) {
1685
+ sortgroup[i] = node;
1686
+ }
1687
+ }
1688
+ sortgroup.sort(compareNode);
1689
+ }
1690
+ return new Selection(sortgroups, this._parents).order();
1691
+ }
1692
+ function ascending(a, b) {
1693
+ return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
1694
+ }
1695
+
1696
+ // node_modules/d3-selection/src/selection/call.js
1697
+ function call_default() {
1698
+ var callback = arguments[0];
1699
+ arguments[0] = this;
1700
+ callback.apply(null, arguments);
1701
+ return this;
1702
+ }
1703
+
1704
+ // node_modules/d3-selection/src/selection/nodes.js
1705
+ function nodes_default() {
1706
+ return Array.from(this);
1707
+ }
1708
+
1709
+ // node_modules/d3-selection/src/selection/node.js
1710
+ function node_default() {
1711
+ for (var groups = this._groups, j = 0, m = groups.length;j < m; ++j) {
1712
+ for (var group = groups[j], i = 0, n = group.length;i < n; ++i) {
1713
+ var node = group[i];
1714
+ if (node)
1715
+ return node;
1716
+ }
1717
+ }
1718
+ return null;
1719
+ }
1720
+
1721
+ // node_modules/d3-selection/src/selection/size.js
1722
+ function size_default() {
1723
+ let size = 0;
1724
+ for (const node of this)
1725
+ ++size;
1726
+ return size;
1727
+ }
1728
+
1729
+ // node_modules/d3-selection/src/selection/empty.js
1730
+ function empty_default() {
1731
+ return !this.node();
1732
+ }
1733
+
1734
+ // node_modules/d3-selection/src/selection/each.js
1735
+ function each_default(callback) {
1736
+ for (var groups = this._groups, j = 0, m = groups.length;j < m; ++j) {
1737
+ for (var group = groups[j], i = 0, n = group.length, node;i < n; ++i) {
1738
+ if (node = group[i])
1739
+ callback.call(node, node.__data__, i, group);
1740
+ }
1741
+ }
1742
+ return this;
1743
+ }
1744
+
1745
+ // node_modules/d3-selection/src/selection/attr.js
1746
+ function attrRemove(name) {
1747
+ return function() {
1748
+ this.removeAttribute(name);
1749
+ };
1750
+ }
1751
+ function attrRemoveNS(fullname) {
1752
+ return function() {
1753
+ this.removeAttributeNS(fullname.space, fullname.local);
1754
+ };
1755
+ }
1756
+ function attrConstant(name, value) {
1757
+ return function() {
1758
+ this.setAttribute(name, value);
1759
+ };
1760
+ }
1761
+ function attrConstantNS(fullname, value) {
1762
+ return function() {
1763
+ this.setAttributeNS(fullname.space, fullname.local, value);
1764
+ };
1765
+ }
1766
+ function attrFunction(name, value) {
1767
+ return function() {
1768
+ var v = value.apply(this, arguments);
1769
+ if (v == null)
1770
+ this.removeAttribute(name);
1771
+ else
1772
+ this.setAttribute(name, v);
1773
+ };
1774
+ }
1775
+ function attrFunctionNS(fullname, value) {
1776
+ return function() {
1777
+ var v = value.apply(this, arguments);
1778
+ if (v == null)
1779
+ this.removeAttributeNS(fullname.space, fullname.local);
1780
+ else
1781
+ this.setAttributeNS(fullname.space, fullname.local, v);
1782
+ };
1783
+ }
1784
+ function attr_default(name, value) {
1785
+ var fullname = namespace_default(name);
1786
+ if (arguments.length < 2) {
1787
+ var node = this.node();
1788
+ return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
1789
+ }
1790
+ return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
1791
+ }
1792
+
1793
+ // node_modules/d3-selection/src/window.js
1794
+ function window_default(node) {
1795
+ return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
1796
+ }
1797
+
1798
+ // node_modules/d3-selection/src/selection/style.js
1799
+ function styleRemove(name) {
1800
+ return function() {
1801
+ this.style.removeProperty(name);
1802
+ };
1803
+ }
1804
+ function styleConstant(name, value, priority) {
1805
+ return function() {
1806
+ this.style.setProperty(name, value, priority);
1807
+ };
1808
+ }
1809
+ function styleFunction(name, value, priority) {
1810
+ return function() {
1811
+ var v = value.apply(this, arguments);
1812
+ if (v == null)
1813
+ this.style.removeProperty(name);
1814
+ else
1815
+ this.style.setProperty(name, v, priority);
1816
+ };
1817
+ }
1818
+ function style_default(name, value, priority) {
1819
+ return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
1820
+ }
1821
+ function styleValue(node, name) {
1822
+ return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
1823
+ }
1824
+
1825
+ // node_modules/d3-selection/src/selection/property.js
1826
+ function propertyRemove(name) {
1827
+ return function() {
1828
+ delete this[name];
1829
+ };
1830
+ }
1831
+ function propertyConstant(name, value) {
1832
+ return function() {
1833
+ this[name] = value;
1834
+ };
1835
+ }
1836
+ function propertyFunction(name, value) {
1837
+ return function() {
1838
+ var v = value.apply(this, arguments);
1839
+ if (v == null)
1840
+ delete this[name];
1841
+ else
1842
+ this[name] = v;
1843
+ };
1844
+ }
1845
+ function property_default(name, value) {
1846
+ return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
1847
+ }
1848
+
1849
+ // node_modules/d3-selection/src/selection/classed.js
1850
+ function classArray(string) {
1851
+ return string.trim().split(/^|\s+/);
1852
+ }
1853
+ function classList(node) {
1854
+ return node.classList || new ClassList(node);
1855
+ }
1856
+ function ClassList(node) {
1857
+ this._node = node;
1858
+ this._names = classArray(node.getAttribute("class") || "");
1859
+ }
1860
+ ClassList.prototype = {
1861
+ add: function(name) {
1862
+ var i = this._names.indexOf(name);
1863
+ if (i < 0) {
1864
+ this._names.push(name);
1865
+ this._node.setAttribute("class", this._names.join(" "));
1866
+ }
1867
+ },
1868
+ remove: function(name) {
1869
+ var i = this._names.indexOf(name);
1870
+ if (i >= 0) {
1871
+ this._names.splice(i, 1);
1872
+ this._node.setAttribute("class", this._names.join(" "));
1873
+ }
1874
+ },
1875
+ contains: function(name) {
1876
+ return this._names.indexOf(name) >= 0;
1877
+ }
1878
+ };
1879
+ function classedAdd(node, names) {
1880
+ var list = classList(node), i = -1, n = names.length;
1881
+ while (++i < n)
1882
+ list.add(names[i]);
1883
+ }
1884
+ function classedRemove(node, names) {
1885
+ var list = classList(node), i = -1, n = names.length;
1886
+ while (++i < n)
1887
+ list.remove(names[i]);
1888
+ }
1889
+ function classedTrue(names) {
1890
+ return function() {
1891
+ classedAdd(this, names);
1892
+ };
1893
+ }
1894
+ function classedFalse(names) {
1895
+ return function() {
1896
+ classedRemove(this, names);
1897
+ };
1898
+ }
1899
+ function classedFunction(names, value) {
1900
+ return function() {
1901
+ (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
1902
+ };
1903
+ }
1904
+ function classed_default(name, value) {
1905
+ var names = classArray(name + "");
1906
+ if (arguments.length < 2) {
1907
+ var list = classList(this.node()), i = -1, n = names.length;
1908
+ while (++i < n)
1909
+ if (!list.contains(names[i]))
1910
+ return false;
1911
+ return true;
1912
+ }
1913
+ return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
1914
+ }
1915
+
1916
+ // node_modules/d3-selection/src/selection/text.js
1917
+ function textRemove() {
1918
+ this.textContent = "";
1919
+ }
1920
+ function textConstant(value) {
1921
+ return function() {
1922
+ this.textContent = value;
1923
+ };
1924
+ }
1925
+ function textFunction(value) {
1926
+ return function() {
1927
+ var v = value.apply(this, arguments);
1928
+ this.textContent = v == null ? "" : v;
1929
+ };
1930
+ }
1931
+ function text_default(value) {
1932
+ return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
1933
+ }
1934
+
1935
+ // node_modules/d3-selection/src/selection/html.js
1936
+ function htmlRemove() {
1937
+ this.innerHTML = "";
1938
+ }
1939
+ function htmlConstant(value) {
1940
+ return function() {
1941
+ this.innerHTML = value;
1942
+ };
1943
+ }
1944
+ function htmlFunction(value) {
1945
+ return function() {
1946
+ var v = value.apply(this, arguments);
1947
+ this.innerHTML = v == null ? "" : v;
1948
+ };
1949
+ }
1950
+ function html_default(value) {
1951
+ return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
1952
+ }
1953
+
1954
+ // node_modules/d3-selection/src/selection/raise.js
1955
+ function raise() {
1956
+ if (this.nextSibling)
1957
+ this.parentNode.appendChild(this);
1958
+ }
1959
+ function raise_default() {
1960
+ return this.each(raise);
1961
+ }
1962
+
1963
+ // node_modules/d3-selection/src/selection/lower.js
1964
+ function lower() {
1965
+ if (this.previousSibling)
1966
+ this.parentNode.insertBefore(this, this.parentNode.firstChild);
1967
+ }
1968
+ function lower_default() {
1969
+ return this.each(lower);
1970
+ }
1971
+
1972
+ // node_modules/d3-selection/src/selection/append.js
1973
+ function append_default(name) {
1974
+ var create = typeof name === "function" ? name : creator_default(name);
1975
+ return this.select(function() {
1976
+ return this.appendChild(create.apply(this, arguments));
1977
+ });
1978
+ }
1979
+
1980
+ // node_modules/d3-selection/src/selection/insert.js
1981
+ function constantNull() {
1982
+ return null;
1983
+ }
1984
+ function insert_default(name, before) {
1985
+ var create = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
1986
+ return this.select(function() {
1987
+ return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
1988
+ });
1989
+ }
1990
+
1991
+ // node_modules/d3-selection/src/selection/remove.js
1992
+ function remove() {
1993
+ var parent = this.parentNode;
1994
+ if (parent)
1995
+ parent.removeChild(this);
1996
+ }
1997
+ function remove_default() {
1998
+ return this.each(remove);
1999
+ }
2000
+
2001
+ // node_modules/d3-selection/src/selection/clone.js
2002
+ function selection_cloneShallow() {
2003
+ var clone2 = this.cloneNode(false), parent = this.parentNode;
2004
+ return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
2005
+ }
2006
+ function selection_cloneDeep() {
2007
+ var clone2 = this.cloneNode(true), parent = this.parentNode;
2008
+ return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
2009
+ }
2010
+ function clone_default(deep) {
2011
+ return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
2012
+ }
2013
+
2014
+ // node_modules/d3-selection/src/selection/datum.js
2015
+ function datum_default(value) {
2016
+ return arguments.length ? this.property("__data__", value) : this.node().__data__;
2017
+ }
2018
+
2019
+ // node_modules/d3-selection/src/selection/on.js
2020
+ function contextListener(listener) {
2021
+ return function(event) {
2022
+ listener.call(this, event, this.__data__);
2023
+ };
2024
+ }
2025
+ function parseTypenames2(typenames) {
2026
+ return typenames.trim().split(/^|\s+/).map(function(t) {
2027
+ var name = "", i = t.indexOf(".");
2028
+ if (i >= 0)
2029
+ name = t.slice(i + 1), t = t.slice(0, i);
2030
+ return { type: t, name };
2031
+ });
2032
+ }
2033
+ function onRemove(typename) {
2034
+ return function() {
2035
+ var on3 = this.__on;
2036
+ if (!on3)
2037
+ return;
2038
+ for (var j = 0, i = -1, m = on3.length, o;j < m; ++j) {
2039
+ if (o = on3[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
2040
+ this.removeEventListener(o.type, o.listener, o.options);
2041
+ } else {
2042
+ on3[++i] = o;
2043
+ }
2044
+ }
2045
+ if (++i)
2046
+ on3.length = i;
2047
+ else
2048
+ delete this.__on;
2049
+ };
2050
+ }
2051
+ function onAdd(typename, value, options) {
2052
+ return function() {
2053
+ var on3 = this.__on, o, listener = contextListener(value);
2054
+ if (on3)
2055
+ for (var j = 0, m = on3.length;j < m; ++j) {
2056
+ if ((o = on3[j]).type === typename.type && o.name === typename.name) {
2057
+ this.removeEventListener(o.type, o.listener, o.options);
2058
+ this.addEventListener(o.type, o.listener = listener, o.options = options);
2059
+ o.value = value;
2060
+ return;
2061
+ }
2062
+ }
2063
+ this.addEventListener(typename.type, listener, options);
2064
+ o = { type: typename.type, name: typename.name, value, listener, options };
2065
+ if (!on3)
2066
+ this.__on = [o];
2067
+ else
2068
+ on3.push(o);
2069
+ };
2070
+ }
2071
+ function on_default(typename, value, options) {
2072
+ var typenames = parseTypenames2(typename + ""), i, n = typenames.length, t;
2073
+ if (arguments.length < 2) {
2074
+ var on3 = this.node().__on;
2075
+ if (on3)
2076
+ for (var j = 0, m = on3.length, o;j < m; ++j) {
2077
+ for (i = 0, o = on3[j];i < n; ++i) {
2078
+ if ((t = typenames[i]).type === o.type && t.name === o.name) {
2079
+ return o.value;
2080
+ }
2081
+ }
2082
+ }
2083
+ return;
2084
+ }
2085
+ on3 = value ? onAdd : onRemove;
2086
+ for (i = 0;i < n; ++i)
2087
+ this.each(on3(typenames[i], value, options));
2088
+ return this;
2089
+ }
2090
+
2091
+ // node_modules/d3-selection/src/selection/dispatch.js
2092
+ function dispatchEvent(node, type2, params) {
2093
+ var window2 = window_default(node), event = window2.CustomEvent;
2094
+ if (typeof event === "function") {
2095
+ event = new event(type2, params);
2096
+ } else {
2097
+ event = window2.document.createEvent("Event");
2098
+ if (params)
2099
+ event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
2100
+ else
2101
+ event.initEvent(type2, false, false);
2102
+ }
2103
+ node.dispatchEvent(event);
2104
+ }
2105
+ function dispatchConstant(type2, params) {
2106
+ return function() {
2107
+ return dispatchEvent(this, type2, params);
2108
+ };
2109
+ }
2110
+ function dispatchFunction(type2, params) {
2111
+ return function() {
2112
+ return dispatchEvent(this, type2, params.apply(this, arguments));
2113
+ };
2114
+ }
2115
+ function dispatch_default2(type2, params) {
2116
+ return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
2117
+ }
2118
+
2119
+ // node_modules/d3-selection/src/selection/iterator.js
2120
+ function* iterator_default() {
2121
+ for (var groups = this._groups, j = 0, m = groups.length;j < m; ++j) {
2122
+ for (var group = groups[j], i = 0, n = group.length, node;i < n; ++i) {
2123
+ if (node = group[i])
2124
+ yield node;
2125
+ }
2126
+ }
2127
+ }
2128
+
2129
+ // node_modules/d3-selection/src/selection/index.js
2130
+ var root = [null];
2131
+ function Selection(groups, parents) {
2132
+ this._groups = groups;
2133
+ this._parents = parents;
2134
+ }
2135
+ function selection() {
2136
+ return new Selection([[document.documentElement]], root);
2137
+ }
2138
+ function selection_selection() {
2139
+ return this;
2140
+ }
2141
+ Selection.prototype = selection.prototype = {
2142
+ constructor: Selection,
2143
+ select: select_default,
2144
+ selectAll: selectAll_default,
2145
+ selectChild: selectChild_default,
2146
+ selectChildren: selectChildren_default,
2147
+ filter: filter_default,
2148
+ data: data_default,
2149
+ enter: enter_default,
2150
+ exit: exit_default,
2151
+ join: join_default,
2152
+ merge: merge_default,
2153
+ selection: selection_selection,
2154
+ order: order_default,
2155
+ sort: sort_default,
2156
+ call: call_default,
2157
+ nodes: nodes_default,
2158
+ node: node_default,
2159
+ size: size_default,
2160
+ empty: empty_default,
2161
+ each: each_default,
2162
+ attr: attr_default,
2163
+ style: style_default,
2164
+ property: property_default,
2165
+ classed: classed_default,
2166
+ text: text_default,
2167
+ html: html_default,
2168
+ raise: raise_default,
2169
+ lower: lower_default,
2170
+ append: append_default,
2171
+ insert: insert_default,
2172
+ remove: remove_default,
2173
+ clone: clone_default,
2174
+ datum: datum_default,
2175
+ on: on_default,
2176
+ dispatch: dispatch_default2,
2177
+ [Symbol.iterator]: iterator_default
2178
+ };
2179
+ var selection_default = selection;
2180
+ // node_modules/d3-color/src/define.js
2181
+ function define_default(constructor, factory, prototype) {
2182
+ constructor.prototype = factory.prototype = prototype;
2183
+ prototype.constructor = constructor;
2184
+ }
2185
+ function extend(parent, definition) {
2186
+ var prototype = Object.create(parent.prototype);
2187
+ for (var key in definition)
2188
+ prototype[key] = definition[key];
2189
+ return prototype;
2190
+ }
2191
+
2192
+ // node_modules/d3-color/src/color.js
2193
+ function Color() {}
2194
+ var darker = 0.7;
2195
+ var brighter = 1 / darker;
2196
+ var reI = "\\s*([+-]?\\d+)\\s*";
2197
+ var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
2198
+ var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
2199
+ var reHex = /^#([0-9a-f]{3,8})$/;
2200
+ var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
2201
+ var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
2202
+ var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
2203
+ var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
2204
+ var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
2205
+ var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
2206
+ var named = {
2207
+ aliceblue: 15792383,
2208
+ antiquewhite: 16444375,
2209
+ aqua: 65535,
2210
+ aquamarine: 8388564,
2211
+ azure: 15794175,
2212
+ beige: 16119260,
2213
+ bisque: 16770244,
2214
+ black: 0,
2215
+ blanchedalmond: 16772045,
2216
+ blue: 255,
2217
+ blueviolet: 9055202,
2218
+ brown: 10824234,
2219
+ burlywood: 14596231,
2220
+ cadetblue: 6266528,
2221
+ chartreuse: 8388352,
2222
+ chocolate: 13789470,
2223
+ coral: 16744272,
2224
+ cornflowerblue: 6591981,
2225
+ cornsilk: 16775388,
2226
+ crimson: 14423100,
2227
+ cyan: 65535,
2228
+ darkblue: 139,
2229
+ darkcyan: 35723,
2230
+ darkgoldenrod: 12092939,
2231
+ darkgray: 11119017,
2232
+ darkgreen: 25600,
2233
+ darkgrey: 11119017,
2234
+ darkkhaki: 12433259,
2235
+ darkmagenta: 9109643,
2236
+ darkolivegreen: 5597999,
2237
+ darkorange: 16747520,
2238
+ darkorchid: 10040012,
2239
+ darkred: 9109504,
2240
+ darksalmon: 15308410,
2241
+ darkseagreen: 9419919,
2242
+ darkslateblue: 4734347,
2243
+ darkslategray: 3100495,
2244
+ darkslategrey: 3100495,
2245
+ darkturquoise: 52945,
2246
+ darkviolet: 9699539,
2247
+ deeppink: 16716947,
2248
+ deepskyblue: 49151,
2249
+ dimgray: 6908265,
2250
+ dimgrey: 6908265,
2251
+ dodgerblue: 2003199,
2252
+ firebrick: 11674146,
2253
+ floralwhite: 16775920,
2254
+ forestgreen: 2263842,
2255
+ fuchsia: 16711935,
2256
+ gainsboro: 14474460,
2257
+ ghostwhite: 16316671,
2258
+ gold: 16766720,
2259
+ goldenrod: 14329120,
2260
+ gray: 8421504,
2261
+ green: 32768,
2262
+ greenyellow: 11403055,
2263
+ grey: 8421504,
2264
+ honeydew: 15794160,
2265
+ hotpink: 16738740,
2266
+ indianred: 13458524,
2267
+ indigo: 4915330,
2268
+ ivory: 16777200,
2269
+ khaki: 15787660,
2270
+ lavender: 15132410,
2271
+ lavenderblush: 16773365,
2272
+ lawngreen: 8190976,
2273
+ lemonchiffon: 16775885,
2274
+ lightblue: 11393254,
2275
+ lightcoral: 15761536,
2276
+ lightcyan: 14745599,
2277
+ lightgoldenrodyellow: 16448210,
2278
+ lightgray: 13882323,
2279
+ lightgreen: 9498256,
2280
+ lightgrey: 13882323,
2281
+ lightpink: 16758465,
2282
+ lightsalmon: 16752762,
2283
+ lightseagreen: 2142890,
2284
+ lightskyblue: 8900346,
2285
+ lightslategray: 7833753,
2286
+ lightslategrey: 7833753,
2287
+ lightsteelblue: 11584734,
2288
+ lightyellow: 16777184,
2289
+ lime: 65280,
2290
+ limegreen: 3329330,
2291
+ linen: 16445670,
2292
+ magenta: 16711935,
2293
+ maroon: 8388608,
2294
+ mediumaquamarine: 6737322,
2295
+ mediumblue: 205,
2296
+ mediumorchid: 12211667,
2297
+ mediumpurple: 9662683,
2298
+ mediumseagreen: 3978097,
2299
+ mediumslateblue: 8087790,
2300
+ mediumspringgreen: 64154,
2301
+ mediumturquoise: 4772300,
2302
+ mediumvioletred: 13047173,
2303
+ midnightblue: 1644912,
2304
+ mintcream: 16121850,
2305
+ mistyrose: 16770273,
2306
+ moccasin: 16770229,
2307
+ navajowhite: 16768685,
2308
+ navy: 128,
2309
+ oldlace: 16643558,
2310
+ olive: 8421376,
2311
+ olivedrab: 7048739,
2312
+ orange: 16753920,
2313
+ orangered: 16729344,
2314
+ orchid: 14315734,
2315
+ palegoldenrod: 15657130,
2316
+ palegreen: 10025880,
2317
+ paleturquoise: 11529966,
2318
+ palevioletred: 14381203,
2319
+ papayawhip: 16773077,
2320
+ peachpuff: 16767673,
2321
+ peru: 13468991,
2322
+ pink: 16761035,
2323
+ plum: 14524637,
2324
+ powderblue: 11591910,
2325
+ purple: 8388736,
2326
+ rebeccapurple: 6697881,
2327
+ red: 16711680,
2328
+ rosybrown: 12357519,
2329
+ royalblue: 4286945,
2330
+ saddlebrown: 9127187,
2331
+ salmon: 16416882,
2332
+ sandybrown: 16032864,
2333
+ seagreen: 3050327,
2334
+ seashell: 16774638,
2335
+ sienna: 10506797,
2336
+ silver: 12632256,
2337
+ skyblue: 8900331,
2338
+ slateblue: 6970061,
2339
+ slategray: 7372944,
2340
+ slategrey: 7372944,
2341
+ snow: 16775930,
2342
+ springgreen: 65407,
2343
+ steelblue: 4620980,
2344
+ tan: 13808780,
2345
+ teal: 32896,
2346
+ thistle: 14204888,
2347
+ tomato: 16737095,
2348
+ turquoise: 4251856,
2349
+ violet: 15631086,
2350
+ wheat: 16113331,
2351
+ white: 16777215,
2352
+ whitesmoke: 16119285,
2353
+ yellow: 16776960,
2354
+ yellowgreen: 10145074
2355
+ };
2356
+ define_default(Color, color, {
2357
+ copy(channels) {
2358
+ return Object.assign(new this.constructor, this, channels);
2359
+ },
2360
+ displayable() {
2361
+ return this.rgb().displayable();
2362
+ },
2363
+ hex: color_formatHex,
2364
+ formatHex: color_formatHex,
2365
+ formatHex8: color_formatHex8,
2366
+ formatHsl: color_formatHsl,
2367
+ formatRgb: color_formatRgb,
2368
+ toString: color_formatRgb
2369
+ });
2370
+ function color_formatHex() {
2371
+ return this.rgb().formatHex();
2372
+ }
2373
+ function color_formatHex8() {
2374
+ return this.rgb().formatHex8();
2375
+ }
2376
+ function color_formatHsl() {
2377
+ return hslConvert(this).formatHsl();
2378
+ }
2379
+ function color_formatRgb() {
2380
+ return this.rgb().formatRgb();
2381
+ }
2382
+ function color(format) {
2383
+ var m, l;
2384
+ format = (format + "").trim().toLowerCase();
2385
+ return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
2386
+ }
2387
+ function rgbn(n) {
2388
+ return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
2389
+ }
2390
+ function rgba(r, g, b, a) {
2391
+ if (a <= 0)
2392
+ r = g = b = NaN;
2393
+ return new Rgb(r, g, b, a);
2394
+ }
2395
+ function rgbConvert(o) {
2396
+ if (!(o instanceof Color))
2397
+ o = color(o);
2398
+ if (!o)
2399
+ return new Rgb;
2400
+ o = o.rgb();
2401
+ return new Rgb(o.r, o.g, o.b, o.opacity);
2402
+ }
2403
+ function rgb(r, g, b, opacity) {
2404
+ return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
2405
+ }
2406
+ function Rgb(r, g, b, opacity) {
2407
+ this.r = +r;
2408
+ this.g = +g;
2409
+ this.b = +b;
2410
+ this.opacity = +opacity;
2411
+ }
2412
+ define_default(Rgb, rgb, extend(Color, {
2413
+ brighter(k) {
2414
+ k = k == null ? brighter : Math.pow(brighter, k);
2415
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
2416
+ },
2417
+ darker(k) {
2418
+ k = k == null ? darker : Math.pow(darker, k);
2419
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
2420
+ },
2421
+ rgb() {
2422
+ return this;
2423
+ },
2424
+ clamp() {
2425
+ return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
2426
+ },
2427
+ displayable() {
2428
+ return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
2429
+ },
2430
+ hex: rgb_formatHex,
2431
+ formatHex: rgb_formatHex,
2432
+ formatHex8: rgb_formatHex8,
2433
+ formatRgb: rgb_formatRgb,
2434
+ toString: rgb_formatRgb
2435
+ }));
2436
+ function rgb_formatHex() {
2437
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
2438
+ }
2439
+ function rgb_formatHex8() {
2440
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
2441
+ }
2442
+ function rgb_formatRgb() {
2443
+ const a = clampa(this.opacity);
2444
+ return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
2445
+ }
2446
+ function clampa(opacity) {
2447
+ return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
2448
+ }
2449
+ function clampi(value) {
2450
+ return Math.max(0, Math.min(255, Math.round(value) || 0));
2451
+ }
2452
+ function hex(value) {
2453
+ value = clampi(value);
2454
+ return (value < 16 ? "0" : "") + value.toString(16);
2455
+ }
2456
+ function hsla(h, s, l, a) {
2457
+ if (a <= 0)
2458
+ h = s = l = NaN;
2459
+ else if (l <= 0 || l >= 1)
2460
+ h = s = NaN;
2461
+ else if (s <= 0)
2462
+ h = NaN;
2463
+ return new Hsl(h, s, l, a);
2464
+ }
2465
+ function hslConvert(o) {
2466
+ if (o instanceof Hsl)
2467
+ return new Hsl(o.h, o.s, o.l, o.opacity);
2468
+ if (!(o instanceof Color))
2469
+ o = color(o);
2470
+ if (!o)
2471
+ return new Hsl;
2472
+ if (o instanceof Hsl)
2473
+ return o;
2474
+ o = o.rgb();
2475
+ var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2;
2476
+ if (s) {
2477
+ if (r === max)
2478
+ h = (g - b) / s + (g < b) * 6;
2479
+ else if (g === max)
2480
+ h = (b - r) / s + 2;
2481
+ else
2482
+ h = (r - g) / s + 4;
2483
+ s /= l < 0.5 ? max + min : 2 - max - min;
2484
+ h *= 60;
2485
+ } else {
2486
+ s = l > 0 && l < 1 ? 0 : h;
2487
+ }
2488
+ return new Hsl(h, s, l, o.opacity);
2489
+ }
2490
+ function hsl(h, s, l, opacity) {
2491
+ return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
2492
+ }
2493
+ function Hsl(h, s, l, opacity) {
2494
+ this.h = +h;
2495
+ this.s = +s;
2496
+ this.l = +l;
2497
+ this.opacity = +opacity;
2498
+ }
2499
+ define_default(Hsl, hsl, extend(Color, {
2500
+ brighter(k) {
2501
+ k = k == null ? brighter : Math.pow(brighter, k);
2502
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
2503
+ },
2504
+ darker(k) {
2505
+ k = k == null ? darker : Math.pow(darker, k);
2506
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
2507
+ },
2508
+ rgb() {
2509
+ var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
2510
+ return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
2511
+ },
2512
+ clamp() {
2513
+ return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
2514
+ },
2515
+ displayable() {
2516
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
2517
+ },
2518
+ formatHsl() {
2519
+ const a = clampa(this.opacity);
2520
+ return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
2521
+ }
2522
+ }));
2523
+ function clamph(value) {
2524
+ value = (value || 0) % 360;
2525
+ return value < 0 ? value + 360 : value;
2526
+ }
2527
+ function clampt(value) {
2528
+ return Math.max(0, Math.min(1, value || 0));
2529
+ }
2530
+ function hsl2rgb(h, m1, m2) {
2531
+ return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
2532
+ }
2533
+ // node_modules/d3-interpolate/src/basis.js
2534
+ function basis(t1, v0, v1, v2, v3) {
2535
+ var t2 = t1 * t1, t3 = t2 * t1;
2536
+ return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
2537
+ }
2538
+ function basis_default(values) {
2539
+ var n = values.length - 1;
2540
+ return function(t) {
2541
+ var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
2542
+ return basis((t - i / n) * n, v0, v1, v2, v3);
2543
+ };
2544
+ }
2545
+
2546
+ // node_modules/d3-interpolate/src/basisClosed.js
2547
+ function basisClosed_default(values) {
2548
+ var n = values.length;
2549
+ return function(t) {
2550
+ var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n];
2551
+ return basis((t - i / n) * n, v0, v1, v2, v3);
2552
+ };
2553
+ }
2554
+
2555
+ // node_modules/d3-interpolate/src/constant.js
2556
+ var constant_default2 = (x) => () => x;
2557
+
2558
+ // node_modules/d3-interpolate/src/color.js
2559
+ function linear(a, d) {
2560
+ return function(t) {
2561
+ return a + t * d;
2562
+ };
2563
+ }
2564
+ function exponential(a, b, y) {
2565
+ return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
2566
+ return Math.pow(a + t * b, y);
2567
+ };
2568
+ }
2569
+ function gamma(y) {
2570
+ return (y = +y) === 1 ? nogamma : function(a, b) {
2571
+ return b - a ? exponential(a, b, y) : constant_default2(isNaN(a) ? b : a);
2572
+ };
2573
+ }
2574
+ function nogamma(a, b) {
2575
+ var d = b - a;
2576
+ return d ? linear(a, d) : constant_default2(isNaN(a) ? b : a);
2577
+ }
2578
+
2579
+ // node_modules/d3-interpolate/src/rgb.js
2580
+ var rgb_default = function rgbGamma(y) {
2581
+ var color2 = gamma(y);
2582
+ function rgb2(start, end) {
2583
+ var r = color2((start = rgb(start)).r, (end = rgb(end)).r), g = color2(start.g, end.g), b = color2(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);
2584
+ return function(t) {
2585
+ start.r = r(t);
2586
+ start.g = g(t);
2587
+ start.b = b(t);
2588
+ start.opacity = opacity(t);
2589
+ return start + "";
2590
+ };
2591
+ }
2592
+ rgb2.gamma = rgbGamma;
2593
+ return rgb2;
2594
+ }(1);
2595
+ function rgbSpline(spline) {
2596
+ return function(colors) {
2597
+ var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color2;
2598
+ for (i = 0;i < n; ++i) {
2599
+ color2 = rgb(colors[i]);
2600
+ r[i] = color2.r || 0;
2601
+ g[i] = color2.g || 0;
2602
+ b[i] = color2.b || 0;
2603
+ }
2604
+ r = spline(r);
2605
+ g = spline(g);
2606
+ b = spline(b);
2607
+ color2.opacity = 1;
2608
+ return function(t) {
2609
+ color2.r = r(t);
2610
+ color2.g = g(t);
2611
+ color2.b = b(t);
2612
+ return color2 + "";
2613
+ };
2614
+ };
2615
+ }
2616
+ var rgbBasis = rgbSpline(basis_default);
2617
+ var rgbBasisClosed = rgbSpline(basisClosed_default);
2618
+
2619
+ // node_modules/d3-interpolate/src/number.js
2620
+ function number_default(a, b) {
2621
+ return a = +a, b = +b, function(t) {
2622
+ return a * (1 - t) + b * t;
2623
+ };
2624
+ }
2625
+
2626
+ // node_modules/d3-interpolate/src/string.js
2627
+ var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
2628
+ var reB = new RegExp(reA.source, "g");
2629
+ function zero(b) {
2630
+ return function() {
2631
+ return b;
2632
+ };
2633
+ }
2634
+ function one(b) {
2635
+ return function(t) {
2636
+ return b(t) + "";
2637
+ };
2638
+ }
2639
+ function string_default(a, b) {
2640
+ var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];
2641
+ a = a + "", b = b + "";
2642
+ while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
2643
+ if ((bs = bm.index) > bi) {
2644
+ bs = b.slice(bi, bs);
2645
+ if (s[i])
2646
+ s[i] += bs;
2647
+ else
2648
+ s[++i] = bs;
2649
+ }
2650
+ if ((am = am[0]) === (bm = bm[0])) {
2651
+ if (s[i])
2652
+ s[i] += bm;
2653
+ else
2654
+ s[++i] = bm;
2655
+ } else {
2656
+ s[++i] = null;
2657
+ q.push({ i, x: number_default(am, bm) });
2658
+ }
2659
+ bi = reB.lastIndex;
2660
+ }
2661
+ if (bi < b.length) {
2662
+ bs = b.slice(bi);
2663
+ if (s[i])
2664
+ s[i] += bs;
2665
+ else
2666
+ s[++i] = bs;
2667
+ }
2668
+ return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) {
2669
+ for (var i2 = 0, o;i2 < b; ++i2)
2670
+ s[(o = q[i2]).i] = o.x(t);
2671
+ return s.join("");
2672
+ });
2673
+ }
2674
+ // node_modules/d3-interpolate/src/transform/decompose.js
2675
+ var degrees = 180 / Math.PI;
2676
+ var identity = {
2677
+ translateX: 0,
2678
+ translateY: 0,
2679
+ rotate: 0,
2680
+ skewX: 0,
2681
+ scaleX: 1,
2682
+ scaleY: 1
2683
+ };
2684
+ function decompose_default(a, b, c, d, e, f) {
2685
+ var scaleX, scaleY, skewX;
2686
+ if (scaleX = Math.sqrt(a * a + b * b))
2687
+ a /= scaleX, b /= scaleX;
2688
+ if (skewX = a * c + b * d)
2689
+ c -= a * skewX, d -= b * skewX;
2690
+ if (scaleY = Math.sqrt(c * c + d * d))
2691
+ c /= scaleY, d /= scaleY, skewX /= scaleY;
2692
+ if (a * d < b * c)
2693
+ a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
2694
+ return {
2695
+ translateX: e,
2696
+ translateY: f,
2697
+ rotate: Math.atan2(b, a) * degrees,
2698
+ skewX: Math.atan(skewX) * degrees,
2699
+ scaleX,
2700
+ scaleY
2701
+ };
2702
+ }
2703
+
2704
+ // node_modules/d3-interpolate/src/transform/parse.js
2705
+ var svgNode;
2706
+ function parseCss(value) {
2707
+ const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
2708
+ return m.isIdentity ? identity : decompose_default(m.a, m.b, m.c, m.d, m.e, m.f);
2709
+ }
2710
+ function parseSvg(value) {
2711
+ if (value == null)
2712
+ return identity;
2713
+ if (!svgNode)
2714
+ svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
2715
+ svgNode.setAttribute("transform", value);
2716
+ if (!(value = svgNode.transform.baseVal.consolidate()))
2717
+ return identity;
2718
+ value = value.matrix;
2719
+ return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
2720
+ }
2721
+
2722
+ // node_modules/d3-interpolate/src/transform/index.js
2723
+ function interpolateTransform(parse, pxComma, pxParen, degParen) {
2724
+ function pop(s) {
2725
+ return s.length ? s.pop() + " " : "";
2726
+ }
2727
+ function translate(xa, ya, xb, yb, s, q) {
2728
+ if (xa !== xb || ya !== yb) {
2729
+ var i = s.push("translate(", null, pxComma, null, pxParen);
2730
+ q.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });
2731
+ } else if (xb || yb) {
2732
+ s.push("translate(" + xb + pxComma + yb + pxParen);
2733
+ }
2734
+ }
2735
+ function rotate(a, b, s, q) {
2736
+ if (a !== b) {
2737
+ if (a - b > 180)
2738
+ b += 360;
2739
+ else if (b - a > 180)
2740
+ a += 360;
2741
+ q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number_default(a, b) });
2742
+ } else if (b) {
2743
+ s.push(pop(s) + "rotate(" + b + degParen);
2744
+ }
2745
+ }
2746
+ function skewX(a, b, s, q) {
2747
+ if (a !== b) {
2748
+ q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number_default(a, b) });
2749
+ } else if (b) {
2750
+ s.push(pop(s) + "skewX(" + b + degParen);
2751
+ }
2752
+ }
2753
+ function scale(xa, ya, xb, yb, s, q) {
2754
+ if (xa !== xb || ya !== yb) {
2755
+ var i = s.push(pop(s) + "scale(", null, ",", null, ")");
2756
+ q.push({ i: i - 4, x: number_default(xa, xb) }, { i: i - 2, x: number_default(ya, yb) });
2757
+ } else if (xb !== 1 || yb !== 1) {
2758
+ s.push(pop(s) + "scale(" + xb + "," + yb + ")");
2759
+ }
2760
+ }
2761
+ return function(a, b) {
2762
+ var s = [], q = [];
2763
+ a = parse(a), b = parse(b);
2764
+ translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
2765
+ rotate(a.rotate, b.rotate, s, q);
2766
+ skewX(a.skewX, b.skewX, s, q);
2767
+ scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
2768
+ a = b = null;
2769
+ return function(t) {
2770
+ var i = -1, n = q.length, o;
2771
+ while (++i < n)
2772
+ s[(o = q[i]).i] = o.x(t);
2773
+ return s.join("");
2774
+ };
2775
+ };
2776
+ }
2777
+ var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
2778
+ var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
2779
+ // node_modules/d3-timer/src/timer.js
2780
+ var frame = 0;
2781
+ var timeout2 = 0;
2782
+ var interval = 0;
2783
+ var pokeDelay = 1000;
2784
+ var taskHead;
2785
+ var taskTail;
2786
+ var clockLast = 0;
2787
+ var clockNow = 0;
2788
+ var clockSkew = 0;
2789
+ var clock = typeof performance === "object" && performance.now ? performance : Date;
2790
+ var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) {
2791
+ setTimeout(f, 17);
2792
+ };
2793
+ function now() {
2794
+ return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
2795
+ }
2796
+ function clearNow() {
2797
+ clockNow = 0;
2798
+ }
2799
+ function Timer() {
2800
+ this._call = this._time = this._next = null;
2801
+ }
2802
+ Timer.prototype = timer.prototype = {
2803
+ constructor: Timer,
2804
+ restart: function(callback, delay, time) {
2805
+ if (typeof callback !== "function")
2806
+ throw new TypeError("callback is not a function");
2807
+ time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
2808
+ if (!this._next && taskTail !== this) {
2809
+ if (taskTail)
2810
+ taskTail._next = this;
2811
+ else
2812
+ taskHead = this;
2813
+ taskTail = this;
2814
+ }
2815
+ this._call = callback;
2816
+ this._time = time;
2817
+ sleep();
2818
+ },
2819
+ stop: function() {
2820
+ if (this._call) {
2821
+ this._call = null;
2822
+ this._time = Infinity;
2823
+ sleep();
2824
+ }
2825
+ }
2826
+ };
2827
+ function timer(callback, delay, time) {
2828
+ var t = new Timer;
2829
+ t.restart(callback, delay, time);
2830
+ return t;
2831
+ }
2832
+ function timerFlush() {
2833
+ now();
2834
+ ++frame;
2835
+ var t = taskHead, e;
2836
+ while (t) {
2837
+ if ((e = clockNow - t._time) >= 0)
2838
+ t._call.call(undefined, e);
2839
+ t = t._next;
2840
+ }
2841
+ --frame;
2842
+ }
2843
+ function wake() {
2844
+ clockNow = (clockLast = clock.now()) + clockSkew;
2845
+ frame = timeout2 = 0;
2846
+ try {
2847
+ timerFlush();
2848
+ } finally {
2849
+ frame = 0;
2850
+ nap();
2851
+ clockNow = 0;
2852
+ }
2853
+ }
2854
+ function poke() {
2855
+ var now2 = clock.now(), delay = now2 - clockLast;
2856
+ if (delay > pokeDelay)
2857
+ clockSkew -= delay, clockLast = now2;
2858
+ }
2859
+ function nap() {
2860
+ var t0, t1 = taskHead, t2, time = Infinity;
2861
+ while (t1) {
2862
+ if (t1._call) {
2863
+ if (time > t1._time)
2864
+ time = t1._time;
2865
+ t0 = t1, t1 = t1._next;
2866
+ } else {
2867
+ t2 = t1._next, t1._next = null;
2868
+ t1 = t0 ? t0._next = t2 : taskHead = t2;
2869
+ }
2870
+ }
2871
+ taskTail = t0;
2872
+ sleep(time);
2873
+ }
2874
+ function sleep(time) {
2875
+ if (frame)
2876
+ return;
2877
+ if (timeout2)
2878
+ timeout2 = clearTimeout(timeout2);
2879
+ var delay = time - clockNow;
2880
+ if (delay > 24) {
2881
+ if (time < Infinity)
2882
+ timeout2 = setTimeout(wake, time - clock.now() - clockSkew);
2883
+ if (interval)
2884
+ interval = clearInterval(interval);
2885
+ } else {
2886
+ if (!interval)
2887
+ clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
2888
+ frame = 1, setFrame(wake);
2889
+ }
2890
+ }
2891
+ // node_modules/d3-timer/src/timeout.js
2892
+ function timeout_default(callback, delay, time) {
2893
+ var t = new Timer;
2894
+ delay = delay == null ? 0 : +delay;
2895
+ t.restart((elapsed) => {
2896
+ t.stop();
2897
+ callback(elapsed + delay);
2898
+ }, delay, time);
2899
+ return t;
2900
+ }
2901
+ // node_modules/d3-transition/src/transition/schedule.js
2902
+ var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
2903
+ var emptyTween = [];
2904
+ var CREATED = 0;
2905
+ var SCHEDULED = 1;
2906
+ var STARTING = 2;
2907
+ var STARTED = 3;
2908
+ var RUNNING = 4;
2909
+ var ENDING = 5;
2910
+ var ENDED = 6;
2911
+ function schedule_default(node, name, id, index, group, timing) {
2912
+ var schedules = node.__transition;
2913
+ if (!schedules)
2914
+ node.__transition = {};
2915
+ else if (id in schedules)
2916
+ return;
2917
+ create(node, id, {
2918
+ name,
2919
+ index,
2920
+ group,
2921
+ on: emptyOn,
2922
+ tween: emptyTween,
2923
+ time: timing.time,
2924
+ delay: timing.delay,
2925
+ duration: timing.duration,
2926
+ ease: timing.ease,
2927
+ timer: null,
2928
+ state: CREATED
2929
+ });
2930
+ }
2931
+ function init(node, id) {
2932
+ var schedule4 = get2(node, id);
2933
+ if (schedule4.state > CREATED)
2934
+ throw new Error("too late; already scheduled");
2935
+ return schedule4;
2936
+ }
2937
+ function set3(node, id) {
2938
+ var schedule4 = get2(node, id);
2939
+ if (schedule4.state > STARTED)
2940
+ throw new Error("too late; already running");
2941
+ return schedule4;
2942
+ }
2943
+ function get2(node, id) {
2944
+ var schedule4 = node.__transition;
2945
+ if (!schedule4 || !(schedule4 = schedule4[id]))
2946
+ throw new Error("transition not found");
2947
+ return schedule4;
2948
+ }
2949
+ function create(node, id, self) {
2950
+ var schedules = node.__transition, tween;
2951
+ schedules[id] = self;
2952
+ self.timer = timer(schedule4, 0, self.time);
2953
+ function schedule4(elapsed) {
2954
+ self.state = SCHEDULED;
2955
+ self.timer.restart(start, self.delay, self.time);
2956
+ if (self.delay <= elapsed)
2957
+ start(elapsed - self.delay);
2958
+ }
2959
+ function start(elapsed) {
2960
+ var i, j, n, o;
2961
+ if (self.state !== SCHEDULED)
2962
+ return stop();
2963
+ for (i in schedules) {
2964
+ o = schedules[i];
2965
+ if (o.name !== self.name)
2966
+ continue;
2967
+ if (o.state === STARTED)
2968
+ return timeout_default(start);
2969
+ if (o.state === RUNNING) {
2970
+ o.state = ENDED;
2971
+ o.timer.stop();
2972
+ o.on.call("interrupt", node, node.__data__, o.index, o.group);
2973
+ delete schedules[i];
2974
+ } else if (+i < id) {
2975
+ o.state = ENDED;
2976
+ o.timer.stop();
2977
+ o.on.call("cancel", node, node.__data__, o.index, o.group);
2978
+ delete schedules[i];
2979
+ }
2980
+ }
2981
+ timeout_default(function() {
2982
+ if (self.state === STARTED) {
2983
+ self.state = RUNNING;
2984
+ self.timer.restart(tick, self.delay, self.time);
2985
+ tick(elapsed);
2986
+ }
2987
+ });
2988
+ self.state = STARTING;
2989
+ self.on.call("start", node, node.__data__, self.index, self.group);
2990
+ if (self.state !== STARTING)
2991
+ return;
2992
+ self.state = STARTED;
2993
+ tween = new Array(n = self.tween.length);
2994
+ for (i = 0, j = -1;i < n; ++i) {
2995
+ if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
2996
+ tween[++j] = o;
2997
+ }
2998
+ }
2999
+ tween.length = j + 1;
3000
+ }
3001
+ function tick(elapsed) {
3002
+ var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1), i = -1, n = tween.length;
3003
+ while (++i < n) {
3004
+ tween[i].call(node, t);
3005
+ }
3006
+ if (self.state === ENDING) {
3007
+ self.on.call("end", node, node.__data__, self.index, self.group);
3008
+ stop();
3009
+ }
3010
+ }
3011
+ function stop() {
3012
+ self.state = ENDED;
3013
+ self.timer.stop();
3014
+ delete schedules[id];
3015
+ for (var i in schedules)
3016
+ return;
3017
+ delete node.__transition;
3018
+ }
3019
+ }
3020
+
3021
+ // node_modules/d3-transition/src/interrupt.js
3022
+ function interrupt_default(node, name) {
3023
+ var schedules = node.__transition, schedule4, active, empty2 = true, i;
3024
+ if (!schedules)
3025
+ return;
3026
+ name = name == null ? null : name + "";
3027
+ for (i in schedules) {
3028
+ if ((schedule4 = schedules[i]).name !== name) {
3029
+ empty2 = false;
3030
+ continue;
3031
+ }
3032
+ active = schedule4.state > STARTING && schedule4.state < ENDING;
3033
+ schedule4.state = ENDED;
3034
+ schedule4.timer.stop();
3035
+ schedule4.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule4.index, schedule4.group);
3036
+ delete schedules[i];
3037
+ }
3038
+ if (empty2)
3039
+ delete node.__transition;
3040
+ }
3041
+
3042
+ // node_modules/d3-transition/src/selection/interrupt.js
3043
+ function interrupt_default2(name) {
3044
+ return this.each(function() {
3045
+ interrupt_default(this, name);
3046
+ });
3047
+ }
3048
+
3049
+ // node_modules/d3-transition/src/transition/tween.js
3050
+ function tweenRemove(id, name) {
3051
+ var tween0, tween1;
3052
+ return function() {
3053
+ var schedule4 = set3(this, id), tween = schedule4.tween;
3054
+ if (tween !== tween0) {
3055
+ tween1 = tween0 = tween;
3056
+ for (var i = 0, n = tween1.length;i < n; ++i) {
3057
+ if (tween1[i].name === name) {
3058
+ tween1 = tween1.slice();
3059
+ tween1.splice(i, 1);
3060
+ break;
3061
+ }
3062
+ }
3063
+ }
3064
+ schedule4.tween = tween1;
3065
+ };
3066
+ }
3067
+ function tweenFunction(id, name, value) {
3068
+ var tween0, tween1;
3069
+ if (typeof value !== "function")
3070
+ throw new Error;
3071
+ return function() {
3072
+ var schedule4 = set3(this, id), tween = schedule4.tween;
3073
+ if (tween !== tween0) {
3074
+ tween1 = (tween0 = tween).slice();
3075
+ for (var t = { name, value }, i = 0, n = tween1.length;i < n; ++i) {
3076
+ if (tween1[i].name === name) {
3077
+ tween1[i] = t;
3078
+ break;
3079
+ }
3080
+ }
3081
+ if (i === n)
3082
+ tween1.push(t);
3083
+ }
3084
+ schedule4.tween = tween1;
3085
+ };
3086
+ }
3087
+ function tween_default(name, value) {
3088
+ var id = this._id;
3089
+ name += "";
3090
+ if (arguments.length < 2) {
3091
+ var tween = get2(this.node(), id).tween;
3092
+ for (var i = 0, n = tween.length, t;i < n; ++i) {
3093
+ if ((t = tween[i]).name === name) {
3094
+ return t.value;
3095
+ }
3096
+ }
3097
+ return null;
3098
+ }
3099
+ return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
3100
+ }
3101
+ function tweenValue(transition, name, value) {
3102
+ var id = transition._id;
3103
+ transition.each(function() {
3104
+ var schedule4 = set3(this, id);
3105
+ (schedule4.value || (schedule4.value = {}))[name] = value.apply(this, arguments);
3106
+ });
3107
+ return function(node) {
3108
+ return get2(node, id).value[name];
3109
+ };
3110
+ }
3111
+
3112
+ // node_modules/d3-transition/src/transition/interpolate.js
3113
+ function interpolate_default(a, b) {
3114
+ var c;
3115
+ return (typeof b === "number" ? number_default : b instanceof color ? rgb_default : (c = color(b)) ? (b = c, rgb_default) : string_default)(a, b);
3116
+ }
3117
+
3118
+ // node_modules/d3-transition/src/transition/attr.js
3119
+ function attrRemove2(name) {
3120
+ return function() {
3121
+ this.removeAttribute(name);
3122
+ };
3123
+ }
3124
+ function attrRemoveNS2(fullname) {
3125
+ return function() {
3126
+ this.removeAttributeNS(fullname.space, fullname.local);
3127
+ };
3128
+ }
3129
+ function attrConstant2(name, interpolate, value1) {
3130
+ var string00, string1 = value1 + "", interpolate0;
3131
+ return function() {
3132
+ var string0 = this.getAttribute(name);
3133
+ return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
3134
+ };
3135
+ }
3136
+ function attrConstantNS2(fullname, interpolate, value1) {
3137
+ var string00, string1 = value1 + "", interpolate0;
3138
+ return function() {
3139
+ var string0 = this.getAttributeNS(fullname.space, fullname.local);
3140
+ return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
3141
+ };
3142
+ }
3143
+ function attrFunction2(name, interpolate, value) {
3144
+ var string00, string10, interpolate0;
3145
+ return function() {
3146
+ var string0, value1 = value(this), string1;
3147
+ if (value1 == null)
3148
+ return void this.removeAttribute(name);
3149
+ string0 = this.getAttribute(name);
3150
+ string1 = value1 + "";
3151
+ return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
3152
+ };
3153
+ }
3154
+ function attrFunctionNS2(fullname, interpolate, value) {
3155
+ var string00, string10, interpolate0;
3156
+ return function() {
3157
+ var string0, value1 = value(this), string1;
3158
+ if (value1 == null)
3159
+ return void this.removeAttributeNS(fullname.space, fullname.local);
3160
+ string0 = this.getAttributeNS(fullname.space, fullname.local);
3161
+ string1 = value1 + "";
3162
+ return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
3163
+ };
3164
+ }
3165
+ function attr_default2(name, value) {
3166
+ var fullname = namespace_default(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
3167
+ return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i, value));
3168
+ }
3169
+
3170
+ // node_modules/d3-transition/src/transition/attrTween.js
3171
+ function attrInterpolate(name, i) {
3172
+ return function(t) {
3173
+ this.setAttribute(name, i.call(this, t));
3174
+ };
3175
+ }
3176
+ function attrInterpolateNS(fullname, i) {
3177
+ return function(t) {
3178
+ this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
3179
+ };
3180
+ }
3181
+ function attrTweenNS(fullname, value) {
3182
+ var t0, i0;
3183
+ function tween() {
3184
+ var i = value.apply(this, arguments);
3185
+ if (i !== i0)
3186
+ t0 = (i0 = i) && attrInterpolateNS(fullname, i);
3187
+ return t0;
3188
+ }
3189
+ tween._value = value;
3190
+ return tween;
3191
+ }
3192
+ function attrTween(name, value) {
3193
+ var t0, i0;
3194
+ function tween() {
3195
+ var i = value.apply(this, arguments);
3196
+ if (i !== i0)
3197
+ t0 = (i0 = i) && attrInterpolate(name, i);
3198
+ return t0;
3199
+ }
3200
+ tween._value = value;
3201
+ return tween;
3202
+ }
3203
+ function attrTween_default(name, value) {
3204
+ var key = "attr." + name;
3205
+ if (arguments.length < 2)
3206
+ return (key = this.tween(key)) && key._value;
3207
+ if (value == null)
3208
+ return this.tween(key, null);
3209
+ if (typeof value !== "function")
3210
+ throw new Error;
3211
+ var fullname = namespace_default(name);
3212
+ return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
3213
+ }
3214
+
3215
+ // node_modules/d3-transition/src/transition/delay.js
3216
+ function delayFunction(id, value) {
3217
+ return function() {
3218
+ init(this, id).delay = +value.apply(this, arguments);
3219
+ };
3220
+ }
3221
+ function delayConstant(id, value) {
3222
+ return value = +value, function() {
3223
+ init(this, id).delay = value;
3224
+ };
3225
+ }
3226
+ function delay_default(value) {
3227
+ var id = this._id;
3228
+ return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get2(this.node(), id).delay;
3229
+ }
3230
+
3231
+ // node_modules/d3-transition/src/transition/duration.js
3232
+ function durationFunction(id, value) {
3233
+ return function() {
3234
+ set3(this, id).duration = +value.apply(this, arguments);
3235
+ };
3236
+ }
3237
+ function durationConstant(id, value) {
3238
+ return value = +value, function() {
3239
+ set3(this, id).duration = value;
3240
+ };
3241
+ }
3242
+ function duration_default(value) {
3243
+ var id = this._id;
3244
+ return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get2(this.node(), id).duration;
3245
+ }
3246
+
3247
+ // node_modules/d3-transition/src/transition/ease.js
3248
+ function easeConstant(id, value) {
3249
+ if (typeof value !== "function")
3250
+ throw new Error;
3251
+ return function() {
3252
+ set3(this, id).ease = value;
3253
+ };
3254
+ }
3255
+ function ease_default(value) {
3256
+ var id = this._id;
3257
+ return arguments.length ? this.each(easeConstant(id, value)) : get2(this.node(), id).ease;
3258
+ }
3259
+
3260
+ // node_modules/d3-transition/src/transition/easeVarying.js
3261
+ function easeVarying(id, value) {
3262
+ return function() {
3263
+ var v = value.apply(this, arguments);
3264
+ if (typeof v !== "function")
3265
+ throw new Error;
3266
+ set3(this, id).ease = v;
3267
+ };
3268
+ }
3269
+ function easeVarying_default(value) {
3270
+ if (typeof value !== "function")
3271
+ throw new Error;
3272
+ return this.each(easeVarying(this._id, value));
3273
+ }
3274
+
3275
+ // node_modules/d3-transition/src/transition/filter.js
3276
+ function filter_default2(match) {
3277
+ if (typeof match !== "function")
3278
+ match = matcher_default(match);
3279
+ for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0;j < m; ++j) {
3280
+ for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0;i < n; ++i) {
3281
+ if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
3282
+ subgroup.push(node);
3283
+ }
3284
+ }
3285
+ }
3286
+ return new Transition(subgroups, this._parents, this._name, this._id);
3287
+ }
3288
+
3289
+ // node_modules/d3-transition/src/transition/merge.js
3290
+ function merge_default2(transition) {
3291
+ if (transition._id !== this._id)
3292
+ throw new Error;
3293
+ for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0;j < m; ++j) {
3294
+ for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge3 = merges[j] = new Array(n), node, i = 0;i < n; ++i) {
3295
+ if (node = group0[i] || group1[i]) {
3296
+ merge3[i] = node;
3297
+ }
3298
+ }
3299
+ }
3300
+ for (;j < m0; ++j) {
3301
+ merges[j] = groups0[j];
3302
+ }
3303
+ return new Transition(merges, this._parents, this._name, this._id);
3304
+ }
3305
+
3306
+ // node_modules/d3-transition/src/transition/on.js
3307
+ function start(name) {
3308
+ return (name + "").trim().split(/^|\s+/).every(function(t) {
3309
+ var i = t.indexOf(".");
3310
+ if (i >= 0)
3311
+ t = t.slice(0, i);
3312
+ return !t || t === "start";
3313
+ });
3314
+ }
3315
+ function onFunction(id, name, listener) {
3316
+ var on0, on1, sit = start(name) ? init : set3;
3317
+ return function() {
3318
+ var schedule4 = sit(this, id), on3 = schedule4.on;
3319
+ if (on3 !== on0)
3320
+ (on1 = (on0 = on3).copy()).on(name, listener);
3321
+ schedule4.on = on1;
3322
+ };
3323
+ }
3324
+ function on_default2(name, listener) {
3325
+ var id = this._id;
3326
+ return arguments.length < 2 ? get2(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener));
3327
+ }
3328
+
3329
+ // node_modules/d3-transition/src/transition/remove.js
3330
+ function removeFunction(id) {
3331
+ return function() {
3332
+ var parent = this.parentNode;
3333
+ for (var i in this.__transition)
3334
+ if (+i !== id)
3335
+ return;
3336
+ if (parent)
3337
+ parent.removeChild(this);
3338
+ };
3339
+ }
3340
+ function remove_default2() {
3341
+ return this.on("end.remove", removeFunction(this._id));
3342
+ }
3343
+
3344
+ // node_modules/d3-transition/src/transition/select.js
3345
+ function select_default2(select) {
3346
+ var name = this._name, id = this._id;
3347
+ if (typeof select !== "function")
3348
+ select = selector_default(select);
3349
+ for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0;j < m; ++j) {
3350
+ for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0;i < n; ++i) {
3351
+ if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
3352
+ if ("__data__" in node)
3353
+ subnode.__data__ = node.__data__;
3354
+ subgroup[i] = subnode;
3355
+ schedule_default(subgroup[i], name, id, i, subgroup, get2(node, id));
3356
+ }
3357
+ }
3358
+ }
3359
+ return new Transition(subgroups, this._parents, name, id);
3360
+ }
3361
+
3362
+ // node_modules/d3-transition/src/transition/selectAll.js
3363
+ function selectAll_default2(select) {
3364
+ var name = this._name, id = this._id;
3365
+ if (typeof select !== "function")
3366
+ select = selectorAll_default(select);
3367
+ for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0;j < m; ++j) {
3368
+ for (var group = groups[j], n = group.length, node, i = 0;i < n; ++i) {
3369
+ if (node = group[i]) {
3370
+ for (var children2 = select.call(node, node.__data__, i, group), child, inherit = get2(node, id), k = 0, l = children2.length;k < l; ++k) {
3371
+ if (child = children2[k]) {
3372
+ schedule_default(child, name, id, k, children2, inherit);
3373
+ }
3374
+ }
3375
+ subgroups.push(children2);
3376
+ parents.push(node);
3377
+ }
3378
+ }
3379
+ }
3380
+ return new Transition(subgroups, parents, name, id);
3381
+ }
3382
+
3383
+ // node_modules/d3-transition/src/transition/selection.js
3384
+ var Selection2 = selection_default.prototype.constructor;
3385
+ function selection_default2() {
3386
+ return new Selection2(this._groups, this._parents);
3387
+ }
3388
+
3389
+ // node_modules/d3-transition/src/transition/style.js
3390
+ function styleNull(name, interpolate) {
3391
+ var string00, string10, interpolate0;
3392
+ return function() {
3393
+ var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
3394
+ return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
3395
+ };
3396
+ }
3397
+ function styleRemove2(name) {
3398
+ return function() {
3399
+ this.style.removeProperty(name);
3400
+ };
3401
+ }
3402
+ function styleConstant2(name, interpolate, value1) {
3403
+ var string00, string1 = value1 + "", interpolate0;
3404
+ return function() {
3405
+ var string0 = styleValue(this, name);
3406
+ return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
3407
+ };
3408
+ }
3409
+ function styleFunction2(name, interpolate, value) {
3410
+ var string00, string10, interpolate0;
3411
+ return function() {
3412
+ var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
3413
+ if (value1 == null)
3414
+ string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
3415
+ return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
3416
+ };
3417
+ }
3418
+ function styleMaybeRemove(id, name) {
3419
+ var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
3420
+ return function() {
3421
+ var schedule4 = set3(this, id), on3 = schedule4.on, listener = schedule4.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : undefined;
3422
+ if (on3 !== on0 || listener0 !== listener)
3423
+ (on1 = (on0 = on3).copy()).on(event, listener0 = listener);
3424
+ schedule4.on = on1;
3425
+ };
3426
+ }
3427
+ function style_default2(name, value, priority) {
3428
+ var i = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
3429
+ return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i, value), priority).on("end.style." + name, null);
3430
+ }
3431
+
3432
+ // node_modules/d3-transition/src/transition/styleTween.js
3433
+ function styleInterpolate(name, i, priority) {
3434
+ return function(t) {
3435
+ this.style.setProperty(name, i.call(this, t), priority);
3436
+ };
3437
+ }
3438
+ function styleTween(name, value, priority) {
3439
+ var t, i0;
3440
+ function tween() {
3441
+ var i = value.apply(this, arguments);
3442
+ if (i !== i0)
3443
+ t = (i0 = i) && styleInterpolate(name, i, priority);
3444
+ return t;
3445
+ }
3446
+ tween._value = value;
3447
+ return tween;
3448
+ }
3449
+ function styleTween_default(name, value, priority) {
3450
+ var key = "style." + (name += "");
3451
+ if (arguments.length < 2)
3452
+ return (key = this.tween(key)) && key._value;
3453
+ if (value == null)
3454
+ return this.tween(key, null);
3455
+ if (typeof value !== "function")
3456
+ throw new Error;
3457
+ return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
3458
+ }
3459
+
3460
+ // node_modules/d3-transition/src/transition/text.js
3461
+ function textConstant2(value) {
3462
+ return function() {
3463
+ this.textContent = value;
3464
+ };
3465
+ }
3466
+ function textFunction2(value) {
3467
+ return function() {
3468
+ var value1 = value(this);
3469
+ this.textContent = value1 == null ? "" : value1;
3470
+ };
3471
+ }
3472
+ function text_default2(value) {
3473
+ return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
3474
+ }
3475
+
3476
+ // node_modules/d3-transition/src/transition/textTween.js
3477
+ function textInterpolate(i) {
3478
+ return function(t) {
3479
+ this.textContent = i.call(this, t);
3480
+ };
3481
+ }
3482
+ function textTween(value) {
3483
+ var t0, i0;
3484
+ function tween() {
3485
+ var i = value.apply(this, arguments);
3486
+ if (i !== i0)
3487
+ t0 = (i0 = i) && textInterpolate(i);
3488
+ return t0;
3489
+ }
3490
+ tween._value = value;
3491
+ return tween;
3492
+ }
3493
+ function textTween_default(value) {
3494
+ var key = "text";
3495
+ if (arguments.length < 1)
3496
+ return (key = this.tween(key)) && key._value;
3497
+ if (value == null)
3498
+ return this.tween(key, null);
3499
+ if (typeof value !== "function")
3500
+ throw new Error;
3501
+ return this.tween(key, textTween(value));
3502
+ }
3503
+
3504
+ // node_modules/d3-transition/src/transition/transition.js
3505
+ function transition_default() {
3506
+ var name = this._name, id0 = this._id, id1 = newId();
3507
+ for (var groups = this._groups, m = groups.length, j = 0;j < m; ++j) {
3508
+ for (var group = groups[j], n = group.length, node, i = 0;i < n; ++i) {
3509
+ if (node = group[i]) {
3510
+ var inherit = get2(node, id0);
3511
+ schedule_default(node, name, id1, i, group, {
3512
+ time: inherit.time + inherit.delay + inherit.duration,
3513
+ delay: 0,
3514
+ duration: inherit.duration,
3515
+ ease: inherit.ease
3516
+ });
3517
+ }
3518
+ }
3519
+ }
3520
+ return new Transition(groups, this._parents, name, id1);
3521
+ }
3522
+
3523
+ // node_modules/d3-transition/src/transition/end.js
3524
+ function end_default() {
3525
+ var on0, on1, that = this, id = that._id, size = that.size();
3526
+ return new Promise(function(resolve, reject) {
3527
+ var cancel = { value: reject }, end = { value: function() {
3528
+ if (--size === 0)
3529
+ resolve();
3530
+ } };
3531
+ that.each(function() {
3532
+ var schedule4 = set3(this, id), on3 = schedule4.on;
3533
+ if (on3 !== on0) {
3534
+ on1 = (on0 = on3).copy();
3535
+ on1._.cancel.push(cancel);
3536
+ on1._.interrupt.push(cancel);
3537
+ on1._.end.push(end);
3538
+ }
3539
+ schedule4.on = on1;
3540
+ });
3541
+ if (size === 0)
3542
+ resolve();
3543
+ });
3544
+ }
3545
+
3546
+ // node_modules/d3-transition/src/transition/index.js
3547
+ var id = 0;
3548
+ function Transition(groups, parents, name, id2) {
3549
+ this._groups = groups;
3550
+ this._parents = parents;
3551
+ this._name = name;
3552
+ this._id = id2;
3553
+ }
3554
+ function transition(name) {
3555
+ return selection_default().transition(name);
3556
+ }
3557
+ function newId() {
3558
+ return ++id;
3559
+ }
3560
+ var selection_prototype = selection_default.prototype;
3561
+ Transition.prototype = transition.prototype = {
3562
+ constructor: Transition,
3563
+ select: select_default2,
3564
+ selectAll: selectAll_default2,
3565
+ selectChild: selection_prototype.selectChild,
3566
+ selectChildren: selection_prototype.selectChildren,
3567
+ filter: filter_default2,
3568
+ merge: merge_default2,
3569
+ selection: selection_default2,
3570
+ transition: transition_default,
3571
+ call: selection_prototype.call,
3572
+ nodes: selection_prototype.nodes,
3573
+ node: selection_prototype.node,
3574
+ size: selection_prototype.size,
3575
+ empty: selection_prototype.empty,
3576
+ each: selection_prototype.each,
3577
+ on: on_default2,
3578
+ attr: attr_default2,
3579
+ attrTween: attrTween_default,
3580
+ style: style_default2,
3581
+ styleTween: styleTween_default,
3582
+ text: text_default2,
3583
+ textTween: textTween_default,
3584
+ remove: remove_default2,
3585
+ tween: tween_default,
3586
+ delay: delay_default,
3587
+ duration: duration_default,
3588
+ ease: ease_default,
3589
+ easeVarying: easeVarying_default,
3590
+ end: end_default,
3591
+ [Symbol.iterator]: selection_prototype[Symbol.iterator]
3592
+ };
3593
+
3594
+ // node_modules/d3-ease/src/cubic.js
3595
+ function cubicInOut(t) {
3596
+ return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
3597
+ }
3598
+ // node_modules/d3-transition/src/selection/transition.js
3599
+ var defaultTiming = {
3600
+ time: null,
3601
+ delay: 0,
3602
+ duration: 250,
3603
+ ease: cubicInOut
3604
+ };
3605
+ function inherit(node, id2) {
3606
+ var timing;
3607
+ while (!(timing = node.__transition) || !(timing = timing[id2])) {
3608
+ if (!(node = node.parentNode)) {
3609
+ throw new Error(`transition ${id2} not found`);
3610
+ }
3611
+ }
3612
+ return timing;
3613
+ }
3614
+ function transition_default2(name) {
3615
+ var id2, timing;
3616
+ if (name instanceof Transition) {
3617
+ id2 = name._id, name = name._name;
3618
+ } else {
3619
+ id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
3620
+ }
3621
+ for (var groups = this._groups, m = groups.length, j = 0;j < m; ++j) {
3622
+ for (var group = groups[j], n = group.length, node, i = 0;i < n; ++i) {
3623
+ if (node = group[i]) {
3624
+ schedule_default(node, name, id2, i, group, timing || inherit(node, id2));
3625
+ }
3626
+ }
3627
+ }
3628
+ return new Transition(groups, this._parents, name, id2);
3629
+ }
3630
+
3631
+ // node_modules/d3-transition/src/selection/index.js
3632
+ selection_default.prototype.interrupt = interrupt_default2;
3633
+ selection_default.prototype.transition = transition_default2;
3634
+
3635
+ // node_modules/d3-brush/src/brush.js
3636
+ function number1(e) {
3637
+ return [+e[0], +e[1]];
3638
+ }
3639
+ function number2(e) {
3640
+ return [number1(e[0]), number1(e[1])];
3641
+ }
3642
+ var X = {
3643
+ name: "x",
3644
+ handles: ["w", "e"].map(type2),
3645
+ input: function(x, e) {
3646
+ return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]];
3647
+ },
3648
+ output: function(xy) {
3649
+ return xy && [xy[0][0], xy[1][0]];
3650
+ }
3651
+ };
3652
+ var Y = {
3653
+ name: "y",
3654
+ handles: ["n", "s"].map(type2),
3655
+ input: function(y, e) {
3656
+ return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]];
3657
+ },
3658
+ output: function(xy) {
3659
+ return xy && [xy[0][1], xy[1][1]];
3660
+ }
3661
+ };
3662
+ var XY = {
3663
+ name: "xy",
3664
+ handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type2),
3665
+ input: function(xy) {
3666
+ return xy == null ? null : number2(xy);
3667
+ },
3668
+ output: function(xy) {
3669
+ return xy;
3670
+ }
3671
+ };
3672
+ function type2(t) {
3673
+ return { type: t };
3674
+ }
3675
+ // node_modules/d3-dsv/src/dsv.js
3676
+ var EOL = {};
3677
+ var EOF = {};
3678
+ var QUOTE = 34;
3679
+ var NEWLINE = 10;
3680
+ var RETURN = 13;
3681
+ function objectConverter(columns) {
3682
+ return new Function("d", "return {" + columns.map(function(name, i) {
3683
+ return JSON.stringify(name) + ": d[" + i + '] || ""';
3684
+ }).join(",") + "}");
3685
+ }
3686
+ function customConverter(columns, f) {
3687
+ var object = objectConverter(columns);
3688
+ return function(row, i) {
3689
+ return f(object(row), i, columns);
3690
+ };
3691
+ }
3692
+ function inferColumns(rows) {
3693
+ var columnSet = Object.create(null), columns = [];
3694
+ rows.forEach(function(row) {
3695
+ for (var column in row) {
3696
+ if (!(column in columnSet)) {
3697
+ columns.push(columnSet[column] = column);
3698
+ }
3699
+ }
3700
+ });
3701
+ return columns;
3702
+ }
3703
+ function pad(value, width) {
3704
+ var s = value + "", length = s.length;
3705
+ return length < width ? new Array(width - length + 1).join(0) + s : s;
3706
+ }
3707
+ function formatYear(year) {
3708
+ return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4);
3709
+ }
3710
+ function formatDate(date) {
3711
+ var hours = date.getUTCHours(), minutes = date.getUTCMinutes(), seconds = date.getUTCSeconds(), milliseconds = date.getUTCMilliseconds();
3712
+ return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : "");
3713
+ }
3714
+ function dsv_default(delimiter) {
3715
+ var reFormat = new RegExp('["' + delimiter + `
3716
+ \r]`), DELIMITER = delimiter.charCodeAt(0);
3717
+ function parse(text, f) {
3718
+ var convert, columns, rows = parseRows(text, function(row, i) {
3719
+ if (convert)
3720
+ return convert(row, i - 1);
3721
+ columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
3722
+ });
3723
+ rows.columns = columns || [];
3724
+ return rows;
3725
+ }
3726
+ function parseRows(text, f) {
3727
+ var rows = [], N = text.length, I = 0, n = 0, t, eof = N <= 0, eol = false;
3728
+ if (text.charCodeAt(N - 1) === NEWLINE)
3729
+ --N;
3730
+ if (text.charCodeAt(N - 1) === RETURN)
3731
+ --N;
3732
+ function token() {
3733
+ if (eof)
3734
+ return EOF;
3735
+ if (eol)
3736
+ return eol = false, EOL;
3737
+ var i, j = I, c;
3738
+ if (text.charCodeAt(j) === QUOTE) {
3739
+ while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE)
3740
+ ;
3741
+ if ((i = I) >= N)
3742
+ eof = true;
3743
+ else if ((c = text.charCodeAt(I++)) === NEWLINE)
3744
+ eol = true;
3745
+ else if (c === RETURN) {
3746
+ eol = true;
3747
+ if (text.charCodeAt(I) === NEWLINE)
3748
+ ++I;
3749
+ }
3750
+ return text.slice(j + 1, i - 1).replace(/""/g, '"');
3751
+ }
3752
+ while (I < N) {
3753
+ if ((c = text.charCodeAt(i = I++)) === NEWLINE)
3754
+ eol = true;
3755
+ else if (c === RETURN) {
3756
+ eol = true;
3757
+ if (text.charCodeAt(I) === NEWLINE)
3758
+ ++I;
3759
+ } else if (c !== DELIMITER)
3760
+ continue;
3761
+ return text.slice(j, i);
3762
+ }
3763
+ return eof = true, text.slice(j, N);
3764
+ }
3765
+ while ((t = token()) !== EOF) {
3766
+ var row = [];
3767
+ while (t !== EOL && t !== EOF)
3768
+ row.push(t), t = token();
3769
+ if (f && (row = f(row, n++)) == null)
3770
+ continue;
3771
+ rows.push(row);
3772
+ }
3773
+ return rows;
3774
+ }
3775
+ function preformatBody(rows, columns) {
3776
+ return rows.map(function(row) {
3777
+ return columns.map(function(column) {
3778
+ return formatValue(row[column]);
3779
+ }).join(delimiter);
3780
+ });
3781
+ }
3782
+ function format(rows, columns) {
3783
+ if (columns == null)
3784
+ columns = inferColumns(rows);
3785
+ return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join(`
3786
+ `);
3787
+ }
3788
+ function formatBody(rows, columns) {
3789
+ if (columns == null)
3790
+ columns = inferColumns(rows);
3791
+ return preformatBody(rows, columns).join(`
3792
+ `);
3793
+ }
3794
+ function formatRows(rows) {
3795
+ return rows.map(formatRow).join(`
3796
+ `);
3797
+ }
3798
+ function formatRow(row) {
3799
+ return row.map(formatValue).join(delimiter);
3800
+ }
3801
+ function formatValue(value) {
3802
+ return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? '"' + value.replace(/"/g, '""') + '"' : value;
3803
+ }
3804
+ return {
3805
+ parse,
3806
+ parseRows,
3807
+ format,
3808
+ formatBody,
3809
+ formatRows,
3810
+ formatRow,
3811
+ formatValue
3812
+ };
3813
+ }
3814
+
3815
+ // node_modules/d3-dsv/src/csv.js
3816
+ var csv = dsv_default(",");
3817
+ var csvParse = csv.parse;
3818
+ var csvParseRows = csv.parseRows;
3819
+ var csvFormat = csv.format;
3820
+ var csvFormatBody = csv.formatBody;
3821
+ var csvFormatRows = csv.formatRows;
3822
+ var csvFormatRow = csv.formatRow;
3823
+ var csvFormatValue = csv.formatValue;
3824
+ // node_modules/d3-dsv/src/tsv.js
3825
+ var tsv = dsv_default("\t");
3826
+ var tsvParse = tsv.parse;
3827
+ var tsvParseRows = tsv.parseRows;
3828
+ var tsvFormat = tsv.format;
3829
+ var tsvFormatBody = tsv.formatBody;
3830
+ var tsvFormatRows = tsv.formatRows;
3831
+ var tsvFormatRow = tsv.formatRow;
3832
+ var tsvFormatValue = tsv.formatValue;
3833
+ // node_modules/d3-zoom/src/transform.js
3834
+ function Transform(k, x, y) {
3835
+ this.k = k;
3836
+ this.x = x;
3837
+ this.y = y;
3838
+ }
3839
+ Transform.prototype = {
3840
+ constructor: Transform,
3841
+ scale: function(k) {
3842
+ return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
3843
+ },
3844
+ translate: function(x, y) {
3845
+ return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
3846
+ },
3847
+ apply: function(point) {
3848
+ return [point[0] * this.k + this.x, point[1] * this.k + this.y];
3849
+ },
3850
+ applyX: function(x) {
3851
+ return x * this.k + this.x;
3852
+ },
3853
+ applyY: function(y) {
3854
+ return y * this.k + this.y;
3855
+ },
3856
+ invert: function(location) {
3857
+ return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
3858
+ },
3859
+ invertX: function(x) {
3860
+ return (x - this.x) / this.k;
3861
+ },
3862
+ invertY: function(y) {
3863
+ return (y - this.y) / this.k;
3864
+ },
3865
+ rescaleX: function(x) {
3866
+ return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
3867
+ },
3868
+ rescaleY: function(y) {
3869
+ return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
3870
+ },
3871
+ toString: function() {
3872
+ return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
3873
+ }
3874
+ };
3875
+ var identity2 = new Transform(1, 0, 0);
3876
+ transform.prototype = Transform.prototype;
3877
+ function transform(node) {
3878
+ while (!node.__zoom)
3879
+ if (!(node = node.parentNode))
3880
+ return identity2;
3881
+ return node.__zoom;
3882
+ }
3883
+ // node_modules/polyfill-text-decoder-stream/dist/index.js
3884
+ class PolyfillTextDecoderStream extends TransformStream {
3885
+ encoding;
3886
+ fatal;
3887
+ ignoreBOM;
3888
+ constructor(encoding = "utf-8", {
3889
+ fatal = false,
3890
+ ignoreBOM = false
3891
+ } = {}) {
3892
+ const decoder = new TextDecoder(encoding, { fatal, ignoreBOM });
3893
+ super({
3894
+ transform(chunk, controller) {
3895
+ if (typeof chunk === "string") {
3896
+ controller.enqueue(chunk);
3897
+ return;
3898
+ }
3899
+ const decoded = decoder.decode(chunk);
3900
+ if (decoded.length > 0) {
3901
+ controller.enqueue(decoded);
3902
+ }
3903
+ },
3904
+ flush(controller) {
3905
+ const output = decoder.decode();
3906
+ if (output.length > 0) {
3907
+ controller.enqueue(output);
3908
+ }
3909
+ }
3910
+ });
3911
+ this.encoding = encoding;
3912
+ this.fatal = fatal;
3913
+ this.ignoreBOM = ignoreBOM;
3914
+ }
3915
+ }
3916
+
3917
+ // node_modules/sflow/dist/index.js
3918
+ var asyncMaps = (fn, options = {}) => {
3919
+ let i = 0;
3920
+ let tasks = new Map;
3921
+ return new TransformStream({
3922
+ transform: async (chunk, ctrl) => {
3923
+ const id2 = i++;
3924
+ tasks.set(id2, async function() {
3925
+ return fn(chunk, id2);
3926
+ }().then((data) => ({ id: id2, data })));
3927
+ if (tasks.size >= (options.concurrency ?? Infinity)) {
3928
+ const { id: id22, data } = await Promise.race(tasks.values());
3929
+ tasks.delete(id22);
3930
+ ctrl.enqueue(data);
3931
+ }
3932
+ },
3933
+ flush: async (ctrl) => {
3934
+ while (tasks.size) {
3935
+ const { id: id2, data } = await Promise.race(tasks.values());
3936
+ tasks.delete(id2);
3937
+ ctrl.enqueue(data);
3938
+ }
3939
+ }
3940
+ });
3941
+ };
3942
+ var never = () => new Promise(() => null);
3943
+ function cacheLists(store, _options) {
3944
+ const { key = new Error().stack ?? phpdie_default("missing cache key") } = typeof _options === "string" ? { key: _options } : _options ?? {};
3945
+ const chunks = [];
3946
+ const cacheHitPromise = store.has?.(key) || store.get(key);
3947
+ let hitflag = false;
3948
+ return new TransformStream({
3949
+ start: async (ctrl) => {
3950
+ if (!await cacheHitPromise)
3951
+ return;
3952
+ const cached = await store.get(key);
3953
+ if (!cached)
3954
+ return;
3955
+ cached.map((c) => ctrl.enqueue(c));
3956
+ hitflag = true;
3957
+ },
3958
+ transform: async (chunk, ctrl) => {
3959
+ if (await cacheHitPromise || hitflag) {
3960
+ ctrl.terminate();
3961
+ return never();
3962
+ }
3963
+ chunks.push(chunk);
3964
+ ctrl.enqueue(chunk);
3965
+ },
3966
+ flush: async () => await store.set(key, chunks)
3967
+ });
3968
+ }
3969
+ function cacheSkips(store, _options) {
3970
+ const {
3971
+ key = new Error().stack ?? phpdie_default("missing cache key"),
3972
+ windowSize = 1
3973
+ } = typeof _options === "string" ? { key: _options } : _options ?? {};
3974
+ const chunks = [];
3975
+ const cachePromise = store.get(key);
3976
+ return new TransformStream({
3977
+ transform: async (chunk, ctrl) => {
3978
+ const cache = await cachePromise;
3979
+ const chunked = JSON.stringify(chunk);
3980
+ const inf404 = (idx) => idx == null || idx < 0 ? Infinity : idx;
3981
+ const hitCache = (item) => JSON.stringify(item) === chunked;
3982
+ const cachedContents = cache?.slice(inf404(cache.findIndex(hitCache)));
3983
+ if (cachedContents?.length) {
3984
+ await store.set(key, [...chunks, ...cachedContents].slice(0, windowSize));
3985
+ ctrl.terminate();
3986
+ return await never();
3987
+ }
3988
+ chunks.push(chunk);
3989
+ ctrl.enqueue(chunk);
3990
+ },
3991
+ flush: async () => {
3992
+ await store.set(key, chunks.slice(0, windowSize));
3993
+ }
3994
+ });
3995
+ }
3996
+ function cacheTails(store, _options) {
3997
+ const { key = new Error().stack ?? phpdie_default("missing cache key") } = typeof _options === "string" ? { key: _options } : _options ?? {};
3998
+ const chunks = [];
3999
+ const cachePromise = Promise.withResolvers();
4000
+ const t = new TransformStream;
4001
+ const w = t.writable.getWriter();
4002
+ const writable = new WritableStream({
4003
+ start: async () => cachePromise.resolve(await store.get(key)),
4004
+ write: async (chunk, ctrl) => {
4005
+ const cache = await cachePromise.promise;
4006
+ if (cache && $equals(chunk, cache[0])) {
4007
+ await store.set(key, [...chunks, ...cache]);
4008
+ for await (const item of cache)
4009
+ await w.write(item);
4010
+ await w.close();
4011
+ ctrl.error(new Error("cached"));
4012
+ return await never();
4013
+ }
4014
+ chunks.push(chunk);
4015
+ await w.write(chunk);
4016
+ },
4017
+ close: async () => {
4018
+ await store.set(key, [...chunks]);
4019
+ await w.close();
4020
+ },
4021
+ abort: () => w.abort()
4022
+ });
4023
+ return { writable, readable: t.readable };
4024
+ }
4025
+ function chunkBys(compareFn) {
4026
+ let chunks = [];
4027
+ let lastOrder;
4028
+ return new TransformStream({
4029
+ transform: async (chunk, ctrl) => {
4030
+ const order = await compareFn(chunk);
4031
+ if (lastOrder && lastOrder !== order)
4032
+ ctrl.enqueue(chunks.splice(0, Infinity));
4033
+ chunks.push(chunk);
4034
+ lastOrder = order;
4035
+ },
4036
+ flush: async (ctrl) => void (chunks.length && ctrl.enqueue(chunks))
4037
+ });
4038
+ }
4039
+ function chunkIfs(predicate, { inclusive = false } = {}) {
4040
+ let chunks = [];
4041
+ let i = 0;
4042
+ return new TransformStream({
4043
+ transform: async (chunk, ctrl) => {
4044
+ const cond = await predicate(chunk, i++, chunks);
4045
+ if (!inclusive && !cond)
4046
+ chunks.length && ctrl.enqueue(chunks.splice(0, Infinity));
4047
+ chunks.push(chunk);
4048
+ if (!cond)
4049
+ ctrl.enqueue(chunks.splice(0, Infinity));
4050
+ },
4051
+ flush: async (ctrl) => void (chunks.length && ctrl.enqueue(chunks))
4052
+ });
4053
+ }
4054
+ function chunkIntervals(interval2 = 0) {
4055
+ let chunks = [];
4056
+ let id2 = null;
4057
+ return new TransformStream({
4058
+ start: (ctrl) => {
4059
+ id2 = setInterval(() => ctrl.enqueue(chunks.splice(0, Infinity)), interval2);
4060
+ },
4061
+ transform: async (chunk) => {
4062
+ chunks.push(chunk);
4063
+ },
4064
+ flush: async (ctrl) => {
4065
+ if (chunks.length)
4066
+ ctrl.enqueue(chunks.splice(0, Infinity));
4067
+ id2 !== null && clearInterval(id2);
4068
+ }
4069
+ });
4070
+ }
4071
+ function chunks(n = Infinity) {
4072
+ let chunks2 = [];
4073
+ if (n <= 0)
4074
+ throw new Error("Buffer size must be greater than 0");
4075
+ return new TransformStream({
4076
+ transform: async (chunk, ctrl) => {
4077
+ chunks2.push(chunk);
4078
+ if (chunks2.length >= n)
4079
+ ctrl.enqueue(chunks2.splice(0, Infinity));
4080
+ },
4081
+ flush: async (ctrl) => void (chunks2.length && ctrl.enqueue(chunks2))
4082
+ });
4083
+ }
4084
+ var toStream = (src) => src instanceof ReadableStream ? src : from(src ?? []);
4085
+ function maps(fn) {
4086
+ let i = 0;
4087
+ return new TransformStream({
4088
+ transform: async (chunk, ctrl) => {
4089
+ const ret = fn(chunk, i++);
4090
+ const val = ret instanceof Promise ? await ret : ret;
4091
+ ctrl.enqueue(val);
4092
+ }
4093
+ });
4094
+ }
4095
+ function nils() {
4096
+ return new WritableStream;
4097
+ }
4098
+ var concats = (srcs) => {
4099
+ if (!srcs)
4100
+ return new TransformStream;
4101
+ const upstream = new TransformStream;
4102
+ return {
4103
+ writable: upstream.writable,
4104
+ readable: concatStream([upstream.readable, concatStream(srcs)])
4105
+ };
4106
+ };
4107
+ var concatStream = (srcs) => {
4108
+ if (!srcs)
4109
+ return new ReadableStream({ start: (c) => c.close() });
4110
+ const t = new TransformStream;
4111
+ const w = t.writable.getWriter();
4112
+ toStream(srcs).pipeThrough(maps(toStream)).pipeThrough(maps(async (s) => {
4113
+ const r = s.getReader();
4114
+ while (true) {
4115
+ const { value, done } = await r.read();
4116
+ if (done)
4117
+ break;
4118
+ await w.write(value);
4119
+ }
4120
+ })).pipeTo(nils()).then(() => w.close()).catch((reason) => w.abort(reason));
4121
+ return t.readable;
4122
+ };
4123
+ var confluences = ({
4124
+ order = "breadth"
4125
+ } = {}) => {
4126
+ const baseError = new Error;
4127
+ if (order !== "breadth")
4128
+ phpdie_default("not implemented");
4129
+ const { writable, readable: sources } = new TransformStream;
4130
+ const srcsQueue = [];
4131
+ const readable = new ReadableStream({
4132
+ async pull(ctrl) {
4133
+ while (true) {
4134
+ const src = await async function() {
4135
+ const r2 = sources.getReader();
4136
+ const { done: done2, value: src2 } = await r2.read();
4137
+ r2.releaseLock();
4138
+ if (done2)
4139
+ return srcsQueue.shift();
4140
+ return src2;
4141
+ }();
4142
+ if (!src)
4143
+ return ctrl.close();
4144
+ const r = src.getReader();
4145
+ const { done, value } = await r.read();
4146
+ r.releaseLock();
4147
+ if (done)
4148
+ continue;
4149
+ srcsQueue.push(src);
4150
+ ctrl.enqueue(value);
4151
+ return;
4152
+ }
4153
+ }
4154
+ });
4155
+ return { writable, readable };
4156
+ };
4157
+ function convolves(n) {
4158
+ const buffer2 = [];
4159
+ return new TransformStream({
4160
+ transform(chunk, controller) {
4161
+ buffer2.push(chunk);
4162
+ if (buffer2.length > n)
4163
+ buffer2.shift();
4164
+ if (buffer2.length === n)
4165
+ controller.enqueue([...buffer2]);
4166
+ },
4167
+ flush(controller) {
4168
+ while (buffer2.length > 1) {
4169
+ buffer2.shift();
4170
+ if (buffer2.length === n)
4171
+ controller.enqueue([...buffer2]);
4172
+ }
4173
+ }
4174
+ });
4175
+ }
4176
+ function debounces(t) {
4177
+ let id2 = null;
4178
+ return new TransformStream({
4179
+ transform: async (chunk, ctrl) => {
4180
+ if (id2)
4181
+ clearTimeout(id2);
4182
+ id2 = setTimeout(() => {
4183
+ ctrl.enqueue(chunk);
4184
+ id2 = null;
4185
+ }, t);
4186
+ },
4187
+ flush: async () => {
4188
+ while (id2)
4189
+ await new Promise((r) => setTimeout(r, t / 2));
4190
+ }
4191
+ });
4192
+ }
4193
+ var filters = (fn) => {
4194
+ let i = 0;
4195
+ return new TransformStream({
4196
+ transform: async (chunk, ctrl) => {
4197
+ if (fn) {
4198
+ const shouldEnqueue = await fn(chunk, i++);
4199
+ if (shouldEnqueue)
4200
+ ctrl.enqueue(chunk);
4201
+ } else {
4202
+ const isNull = chunk === undefined || chunk === null;
4203
+ if (!isNull)
4204
+ ctrl.enqueue(chunk);
4205
+ }
4206
+ }
4207
+ });
4208
+ };
4209
+ function flatMaps(fn) {
4210
+ let i = 0;
4211
+ return new TransformStream({
4212
+ transform: async (chunk, ctrl) => {
4213
+ const ret = fn(chunk, i++);
4214
+ const val = ret instanceof Promise ? await ret : ret;
4215
+ val.map((e) => ctrl.enqueue(e));
4216
+ }
4217
+ });
4218
+ }
4219
+ function flats() {
4220
+ const emptyError = new Error("Flatten for empty array [] in stream is not supported yet, To fix this error, you can add a .filter(array=>array.length) stage before flat");
4221
+ return new TransformStream({
4222
+ transform: async (a, ctrl) => {
4223
+ a.length || phpdie_default(emptyError);
4224
+ a.map((e) => ctrl.enqueue(e));
4225
+ }
4226
+ });
4227
+ }
4228
+ function forEachs(fn) {
4229
+ let i = 0;
4230
+ return new TransformStream({
4231
+ transform: async (chunk, ctrl) => {
4232
+ const ret = fn(chunk, i++);
4233
+ ret instanceof Promise && await ret;
4234
+ ctrl.enqueue(chunk);
4235
+ }
4236
+ });
4237
+ }
4238
+ function heads(n = 1) {
4239
+ return new TransformStream({
4240
+ transform: async (chunk, ctrl) => {
4241
+ return n-- > 0 ? ctrl.enqueue(chunk) : await never();
4242
+ }
4243
+ });
4244
+ }
4245
+ function limits(n, { terminate = true } = {}) {
4246
+ return new TransformStream({
4247
+ transform: async (chunk, ctrl) => {
4248
+ ctrl.enqueue(chunk);
4249
+ if (--n === 0) {
4250
+ terminate && ctrl.terminate();
4251
+ return never();
4252
+ }
4253
+ },
4254
+ flush: () => {}
4255
+ }, { highWaterMark: 1 }, { highWaterMark: 0 });
4256
+ }
4257
+ var throughs = (arg) => {
4258
+ if (!arg)
4259
+ return new TransformStream;
4260
+ if (typeof arg !== "function")
4261
+ return throughs((s) => s.pipeThrough(arg));
4262
+ const fn = arg;
4263
+ const { writable, readable } = new TransformStream;
4264
+ return { writable, readable: fn(readable) };
4265
+ };
4266
+ var lines = ({ EOL: EOL2 = "KEEP" } = {}) => {
4267
+ const CRLFMap = {
4268
+ KEEP: "$1",
4269
+ LF: `
4270
+ `,
4271
+ CRLF: `\r
4272
+ `,
4273
+ NONE: ""
4274
+ };
4275
+ return throughs((r) => r.pipeThrough(flatMaps((s) => s.split(/(?<=\n)/g))).pipeThrough(chunkIfs((ch) => ch.indexOf(`
4276
+ `) === -1, { inclusive: true })).pipeThrough(maps((chunks2) => chunks2.join("").replace(/(\r?\n?)$/, CRLFMap[EOL2]))));
4277
+ };
4278
+ function unpromises(promise) {
4279
+ const tr = new TransformStream;
4280
+ (async function() {
4281
+ const s = await promise;
4282
+ await s.pipeTo(tr.writable);
4283
+ })().catch((error) => {
4284
+ tr.readable.cancel(error).catch(() => {
4285
+ throw error;
4286
+ });
4287
+ }).then();
4288
+ return tr.readable;
4289
+ }
4290
+ function bys(arg) {
4291
+ if (!arg)
4292
+ return new TransformStream;
4293
+ if (typeof arg !== "function")
4294
+ return bys((s) => s.pipeThrough(arg));
4295
+ const fn = arg;
4296
+ const { writable, readable } = new TransformStream;
4297
+ return { writable, readable: unpromises(fn(readable)) };
4298
+ }
4299
+ function peeks(fn) {
4300
+ let i = 0;
4301
+ return new TransformStream({
4302
+ transform: async (chunk, ctrl) => {
4303
+ ctrl.enqueue(chunk);
4304
+ const ret = fn(chunk, i++);
4305
+ const val = ret instanceof Promise ? await ret : ret;
4306
+ }
4307
+ });
4308
+ }
4309
+ function logs(mapFn = (s, i) => s) {
4310
+ return bys(peeks(async (e, i) => {
4311
+ const ret = mapFn(e, i);
4312
+ const val = ret instanceof Promise ? await ret : ret;
4313
+ console.log(typeof val === "string" ? val.replace(/\n$/, "") : val);
4314
+ }));
4315
+ }
4316
+ function mapAddFields(key, fn) {
4317
+ let i = 0;
4318
+ return new TransformStream({
4319
+ transform: async (chunk, ctrl) => ctrl.enqueue({ ...chunk, [key]: await fn(chunk, i++) })
4320
+ });
4321
+ }
4322
+ var wseMerges = merge;
4323
+ var parallels = (...srcs) => wseMerges()(from(srcs));
4324
+ var merges = (...srcs) => {
4325
+ if (!srcs.length)
4326
+ return new TransformStream;
4327
+ const upstream = new TransformStream;
4328
+ return {
4329
+ writable: upstream.writable,
4330
+ readable: parallels(upstream.readable, ...srcs.map(toStream))
4331
+ };
4332
+ };
4333
+ async function* streamAsyncIterator() {
4334
+ const reader = this.getReader();
4335
+ try {
4336
+ while (true) {
4337
+ const { done, value } = await reader.read();
4338
+ if (done)
4339
+ return;
4340
+ yield value;
4341
+ }
4342
+ } finally {
4343
+ reader.releaseLock();
4344
+ }
4345
+ }
4346
+ var mergeStream = (...srcs) => {
4347
+ if (!srcs.length)
4348
+ return new ReadableStream({ start: (c) => c.close() });
4349
+ if (srcs.length === 1)
4350
+ return toStream(srcs[0]);
4351
+ const t = new TransformStream;
4352
+ const w = t.writable.getWriter();
4353
+ const streams = srcs.map(toStream);
4354
+ Promise.all(streams.map(async (s) => {
4355
+ for await (const chunk of Object.assign(s, {
4356
+ [Symbol.asyncIterator]: streamAsyncIterator
4357
+ }))
4358
+ await w.write(chunk);
4359
+ })).then(async () => w.close()).catch((error) => {
4360
+ console.error(error);
4361
+ return Promise.all([
4362
+ t.writable.abort(error),
4363
+ ...streams.map((e) => e.cancel(error))
4364
+ ]);
4365
+ });
4366
+ return t.readable;
4367
+ };
4368
+ var emptyStream = () => new ReadableStream({ start: (c) => c.close() });
4369
+ function mergeStreamsBy(transform2, sources) {
4370
+ if (!sources)
4371
+ return (srcs) => mergeStreamsBy(transform2, srcs);
4372
+ if (!sources.length)
4373
+ return emptyStream();
4374
+ const streams = sources.map((s) => toStream(s));
4375
+ const readers = streams.map((stream) => stream.getReader());
4376
+ let slots = streams.map(() => null);
4377
+ return new ReadableStream({
4378
+ pull: async (ctrl) => {
4379
+ const results = await Promise.all(readers.map(async (reader, i) => slots[i] ??= await reader.read()));
4380
+ slots = await transform2([...slots], ctrl);
4381
+ if (slots.length !== streams.length)
4382
+ phpdie_default("slot length mismatch");
4383
+ }
4384
+ });
4385
+ }
4386
+ function mergeStreamsByAscend(ordFn, sources) {
4387
+ if (!sources)
4388
+ return (sources2) => mergeStreamsByAscend(ordFn, sources2);
4389
+ let lastEmit = null;
4390
+ return mergeStreamsBy(async (slots, ctrl) => {
4391
+ const cands = slots.filter((e) => e?.done === false).map((e) => e.value);
4392
+ if (!cands.length) {
4393
+ ctrl.close();
4394
+ return [];
4395
+ }
4396
+ const peak = $sortBy(ordFn, cands)[0];
4397
+ const index = slots.findIndex((e) => e?.done === false && e?.value === peak);
4398
+ if (lastEmit && lastEmit.value !== $sortBy(ordFn, [lastEmit.value, peak])[0] && ordFn(lastEmit.value) !== ordFn(peak))
4399
+ phpdie_default(new Error("MergeStreamError: one of sources is not ordered by ascending", {
4400
+ cause: {
4401
+ prevOrd: ordFn(lastEmit.value),
4402
+ currOrd: ordFn(peak),
4403
+ prev: lastEmit.value,
4404
+ curr: peak
4405
+ }
4406
+ }));
4407
+ lastEmit = { value: peak };
4408
+ ctrl.enqueue(peak);
4409
+ return slots.toSpliced(index, 1, null);
4410
+ }, sources);
4411
+ }
4412
+ function mergeStreamsByDescend(ordFn, sources) {
4413
+ if (!sources)
4414
+ return (srcs) => mergeStreamsByDescend(ordFn, srcs);
4415
+ let lastEmit = null;
4416
+ return mergeStreamsBy(async (slots, ctrl) => {
4417
+ const cands = slots.filter((e) => e?.done === false).map((e) => e.value);
4418
+ if (!cands.length) {
4419
+ ctrl.close();
4420
+ return [];
4421
+ }
4422
+ const peak = $sortBy(ordFn, cands).toReversed()[0];
4423
+ const index = slots.findIndex((e) => e?.done === false && e?.value === peak);
4424
+ if (lastEmit && lastEmit.value !== $sortBy(ordFn, [lastEmit.value, peak]).toReversed()[0] && ordFn(lastEmit.value) !== ordFn(peak))
4425
+ phpdie_default(new Error("MergeStreamError: one of sources is not ordered by descending", {
4426
+ cause: {
4427
+ prevOrd: ordFn(lastEmit.value),
4428
+ currOrd: ordFn(peak),
4429
+ prev: lastEmit.value,
4430
+ curr: peak
4431
+ }
4432
+ }));
4433
+ lastEmit = { value: peak };
4434
+ ctrl.enqueue(peak);
4435
+ return slots.toSpliced(index, 1, null);
4436
+ }, sources);
4437
+ }
4438
+ var pMaps = (fn, options = {}) => {
4439
+ let i = 0;
4440
+ let promises = [];
4441
+ return new TransformStream({
4442
+ transform: async (chunk, ctrl) => {
4443
+ promises.push(fn(chunk, i++));
4444
+ if (promises.length >= (options.concurrency ?? Infinity))
4445
+ ctrl.enqueue(await promises.shift());
4446
+ },
4447
+ flush: async (ctrl) => {
4448
+ while (promises.length)
4449
+ ctrl.enqueue(await promises.shift());
4450
+ }
4451
+ });
4452
+ };
4453
+ var portals = (arg) => {
4454
+ if (!arg)
4455
+ return new TransformStream;
4456
+ if (typeof arg !== "function")
4457
+ return throughs((s) => s.pipeThrough(arg));
4458
+ const fn = arg;
4459
+ const { writable, readable } = new TransformStream;
4460
+ return { writable, readable: fn(readable) };
4461
+ };
4462
+ var reduceEmits = (fn, _state) => {
4463
+ let i = 0;
4464
+ return new TransformStream({
4465
+ transform: async (chunk, ctrl) => {
4466
+ const { next, emit } = await fn(_state, chunk, i++);
4467
+ _state = next;
4468
+ ctrl.enqueue(emit);
4469
+ }
4470
+ });
4471
+ };
4472
+ var reduces = (fn, state) => {
4473
+ let i = 0;
4474
+ return new TransformStream({
4475
+ transform: async (chunk, ctrl) => {
4476
+ const ret = fn(state, chunk, i++);
4477
+ const val = ret instanceof Promise ? await ret : ret;
4478
+ state = await val;
4479
+ ctrl.enqueue(state);
4480
+ }
4481
+ });
4482
+ };
4483
+ function riffles(sep) {
4484
+ let last2;
4485
+ return new TransformStream({
4486
+ transform: (chunk, ctrl) => {
4487
+ if (last2 !== undefined) {
4488
+ ctrl.enqueue(last2);
4489
+ ctrl.enqueue(sep);
4490
+ }
4491
+ last2 = chunk;
4492
+ },
4493
+ flush: (ctrl) => ctrl.enqueue(last2)
4494
+ });
4495
+ }
4496
+ function skips(n = 1) {
4497
+ return new TransformStream({
4498
+ transform: async (chunk, ctrl) => {
4499
+ if (n <= 0)
4500
+ ctrl.enqueue(chunk);
4501
+ else
4502
+ n--;
4503
+ }
4504
+ });
4505
+ }
4506
+ function slices(start2 = 0, end = Infinity) {
4507
+ const count = end - start2;
4508
+ const { readable, writable } = new TransformStream;
4509
+ return {
4510
+ writable,
4511
+ readable: readable.pipeThrough(skips(start2)).pipeThrough(limits(count))
4512
+ };
4513
+ }
4514
+ var matchs = (matcher) => {
4515
+ return new TransformStream({
4516
+ transform: (chunk, ctrl) => ctrl.enqueue(chunk.match(matcher))
4517
+ });
4518
+ };
4519
+ var matchAlls = (matcher) => {
4520
+ return new TransformStream({
4521
+ transform: (chunk, ctrl) => ctrl.enqueue(chunk.matchAll(matcher))
4522
+ });
4523
+ };
4524
+ var replaces = (searchValue, replacement) => {
4525
+ return maps((s) => typeof replacement === "string" ? s.replace(searchValue, replacement) : replaceAsync(s, searchValue, replacement));
4526
+ };
4527
+ var replaceAlls = (searchValue, replacement) => {
4528
+ return maps((s) => typeof replacement === "string" ? s.replaceAll(searchValue, replacement) : replaceAsync(s, searchValue, replacement));
4529
+ };
4530
+ function tails(n = 1) {
4531
+ let chunks2 = [];
4532
+ return new TransformStream({
4533
+ transform: (chunk) => {
4534
+ chunks2.push(chunk);
4535
+ if (chunks2.length > n)
4536
+ chunks2.shift();
4537
+ },
4538
+ flush: (ctrl) => {
4539
+ chunks2.map((e) => ctrl.enqueue(e));
4540
+ }
4541
+ });
4542
+ }
4543
+ var tees = (arg) => {
4544
+ if (!arg)
4545
+ return new TransformStream;
4546
+ if (arg instanceof WritableStream)
4547
+ return tees((s) => s.pipeTo(arg));
4548
+ const fn = arg;
4549
+ const { writable, readable } = new TransformStream;
4550
+ const [a, b] = readable.tee();
4551
+ fn(a);
4552
+ return { writable, readable: b };
4553
+ };
4554
+ function terminates(signal) {
4555
+ return throughs((r) => r.pipeThrough(new TransformStream, { signal }));
4556
+ }
4557
+ function throttles(interval2, { drop = false, keepLast = true } = {}) {
4558
+ let timerId = null;
4559
+ let cdPromise = Promise.withResolvers();
4560
+ let lasts = [];
4561
+ return new TransformStream({
4562
+ transform: async (chunk, ctrl) => {
4563
+ if (timerId) {
4564
+ if (keepLast)
4565
+ lasts = [chunk];
4566
+ if (drop)
4567
+ return;
4568
+ await cdPromise.promise;
4569
+ }
4570
+ lasts = [];
4571
+ ctrl.enqueue(chunk);
4572
+ [cdPromise, timerId] = [
4573
+ Promise.withResolvers(),
4574
+ setTimeout(() => {
4575
+ timerId = null;
4576
+ cdPromise.resolve();
4577
+ }, interval2)
4578
+ ];
4579
+ },
4580
+ flush: async (ctrl) => {
4581
+ while (timerId)
4582
+ await new Promise((r) => setTimeout(r, interval2 / 2));
4583
+ lasts.map((e) => ctrl.enqueue(e));
4584
+ }
4585
+ });
4586
+ }
4587
+ var uniqs = () => {
4588
+ const set4 = new Set;
4589
+ return throughs((s) => s.pipeThrough(filters((x) => {
4590
+ if (set4.has(x))
4591
+ return false;
4592
+ set4.add(x);
4593
+ return true;
4594
+ })));
4595
+ };
4596
+ var uniqBys = (keyFn) => {
4597
+ const set4 = new Set;
4598
+ return throughs((s) => s.pipeThrough(filters(async (x) => {
4599
+ const key = await keyFn(x);
4600
+ if (set4.has(key))
4601
+ return false;
4602
+ set4.add(key);
4603
+ return true;
4604
+ })));
4605
+ };
4606
+ function unwinds(key) {
4607
+ return flatMaps((e) => import_unwind_array.unwind(e, { path: key }));
4608
+ }
4609
+ function csvFormats(header) {
4610
+ const _header = typeof header === "string" ? header.split(",") : header;
4611
+ return new TransformStream({
4612
+ start: (ctrl) => ctrl.enqueue(_header.join(",") + `
4613
+ `),
4614
+ transform: (chunk, ctrl) => ctrl.enqueue(csvFormatBody([chunk], _header) + `
4615
+ `)
4616
+ });
4617
+ }
4618
+ function csvParses(header) {
4619
+ const _header = typeof header === "string" ? header.split(",") : header;
4620
+ let i = 0;
4621
+ return throughs((r) => r.pipeThrough(lines({ EOL: "LF" })).pipeThrough(skips(1)).pipeThrough(maps((line) => csvParse(_header + `
4622
+ ` + line)[0])));
4623
+ }
4624
+ function tsvFormats(header) {
4625
+ const sep = "\t";
4626
+ const _header = typeof header === "string" ? header.split(sep) : header;
4627
+ return new TransformStream({
4628
+ start: (ctrl) => ctrl.enqueue(_header.join(sep) + `
4629
+ `),
4630
+ transform: (chunk, ctrl) => ctrl.enqueue(tsvFormatBody([chunk], _header) + `
4631
+ `)
4632
+ });
4633
+ }
4634
+ function tsvParses(header) {
4635
+ const _header = typeof header === "string" ? header.split("\t") : header;
4636
+ let i = 0;
4637
+ return throughs((r) => r.pipeThrough(lines({ EOL: "LF" })).pipeThrough(skips(1)).pipeThrough(maps((line) => tsvParse(_header + `
4638
+ ` + line)[0])));
4639
+ }
4640
+ function sflow(...srcs) {
4641
+ let r = srcs.length === 1 ? toStream(srcs[0]) : concatStream(srcs);
4642
+ return Object.assign(r, {
4643
+ _type: null,
4644
+ get readable() {
4645
+ return r;
4646
+ },
4647
+ portal: (...args) => sflow(r.pipeThrough(portals(...args))),
4648
+ through: (...args) => sflow(r.pipeThrough(_throughs(...args))),
4649
+ by: (...args) => sflow(r.pipeThrough(_throughs(...args))),
4650
+ byLazy: (t) => _byLazy(r, t),
4651
+ mapAddField: (...args) => sflow(r.pipeThrough(mapAddFields(...args))),
4652
+ cacheSkip: (...args) => sflow(r).byLazy(cacheSkips(...args)),
4653
+ cacheList: (...args) => sflow(r).byLazy(cacheLists(...args)),
4654
+ cacheTail: (...args) => sflow(r).byLazy(cacheTails(...args)),
4655
+ chunkBy: (...args) => sflow(r.pipeThrough(chunkBys(...args))),
4656
+ chunkIf: (...args) => sflow(r.pipeThrough(chunkIfs(...args))),
4657
+ buffer: (...args) => sflow(r.pipeThrough(chunks(...args))),
4658
+ chunk: (...args) => sflow(r.pipeThrough(chunks(...args))),
4659
+ convolve: (...args) => sflow(r.pipeThrough(convolves(...args))),
4660
+ abort: (...args) => sflow(r.pipeThrough(terminates(...args))),
4661
+ chunkInterval: (...args) => sflow(r.pipeThrough(chunkIntervals(...args))),
4662
+ interval: (...args) => sflow(r.pipeThrough(chunkIntervals(...args))),
4663
+ debounce: (...args) => sflow(r.pipeThrough(debounces(...args))),
4664
+ filter: (...args) => sflow(r.pipeThrough(filters(...args))),
4665
+ flatMap: (...args) => sflow(r.pipeThrough(flatMaps(...args))),
4666
+ flat: (...args) => sflow(r).byLazy(flats(...args)),
4667
+ join: (...args) => sflow(r.pipeThrough(riffles(...args))),
4668
+ match: (...args) => sflow(r.pipeThrough(matchs(...args))),
4669
+ matchAll: (...args) => sflow(r.pipeThrough(matchAlls(...args))),
4670
+ replace: (...args) => sflow(r.pipeThrough(replaces(...args))),
4671
+ replaceAll: (...args) => sflow(r.pipeThrough(replaceAlls(...args))),
4672
+ merge: (...args) => sflow(r.pipeThrough(merges(...args))),
4673
+ concat: (srcs2) => sflow(r.pipeThrough(concats(srcs2))),
4674
+ confluence: (...args) => sflow(r.pipeThrough(confluences(...args))),
4675
+ confluenceByZip: () => sflow(r).by(confluences()),
4676
+ confluenceByConcat: () => sflow(r).by((srcs2) => concatStream(srcs2)),
4677
+ confluenceByParallel: () => sflow(r).by((srcs2) => sflow(srcs2).toArray().then((srcs3) => mergeStream(...srcs3))).confluence(),
4678
+ confluenceByAscend: (ordFn) => sflow(r).chunk().map((srcs2) => mergeStreamsByAscend(ordFn, srcs2)).confluence(),
4679
+ confluenceByDescend: (ordFn) => sflow(r).chunk().map((srcs2) => mergeStreamsByDescend(ordFn, srcs2)).confluence(),
4680
+ limit: (...args) => sflow(r).byLazy(limits(...args)),
4681
+ head: (...args) => sflow(r.pipeThrough(heads(...args))),
4682
+ map: (...args) => sflow(r.pipeThrough(maps(...args))),
4683
+ log: (...args) => sflow(r.pipeThrough(logs(...args))),
4684
+ uniq: (...args) => sflow(r.pipeThrough(uniqs(...args))),
4685
+ uniqBy: (...args) => sflow(r.pipeThrough(uniqBys(...args))),
4686
+ unwind: (...args) => sflow(r.pipeThrough(unwinds(...args))),
4687
+ asyncMap: (...args) => sflow(r.pipeThrough(asyncMaps(...args))),
4688
+ pMap: (...args) => sflow(r.pipeThrough(pMaps(...args))),
4689
+ peek: (...args) => sflow(r.pipeThrough(peeks(...args))),
4690
+ riffle: (...args) => sflow(r.pipeThrough(riffles(...args))),
4691
+ forEach: (...args) => sflow(r.pipeThrough(forEachs(...args))),
4692
+ reduce: (...args) => sflow(r.pipeThrough(reduces(...args))),
4693
+ reduceEmit: (...args) => sflow(r.pipeThrough(reduceEmits(...args))),
4694
+ skip: (...args) => sflow(r.pipeThrough(skips(...args))),
4695
+ slice: (...args) => sflow(r.pipeThrough(slices(...args))),
4696
+ tail: (...args) => sflow(r.pipeThrough(tails(...args))),
4697
+ tees: (...args) => sflow(r.pipeThrough(_tees(...args))),
4698
+ forkTo: (...args) => sflow(r.pipeThrough(_tees(...args))),
4699
+ fork: () => {
4700
+ let b;
4701
+ [r, b] = r.tee();
4702
+ return sflow(b);
4703
+ },
4704
+ throttle: (...args) => sflow(r.pipeThrough(throttles(...args))),
4705
+ csvFormat: (...args) => sflow(r.pipeThrough(csvFormats(...args))),
4706
+ tsvFormat: (...args) => sflow(r.pipeThrough(tsvFormats(...args))),
4707
+ csvParse: (...args) => sflow(r.pipeThrough(csvParses(...args))),
4708
+ tsvParse: (...args) => sflow(r.pipeThrough(tsvParses(...args))),
4709
+ preventAbort: () => sflow(r.pipeThrough(throughs(), { preventAbort: true })),
4710
+ preventClose: () => sflow(r.pipeThrough(throughs(), { preventClose: true })),
4711
+ preventCancel: () => sflow(r.pipeThrough(throughs(), { preventCancel: true })),
4712
+ onStart: (start2) => sflow(r).by(new TransformStream({ start: start2 })),
4713
+ onTransform: (transform2) => sflow(r).by(new TransformStream({ transform: transform2 })),
4714
+ onFlush: (flush) => sflow(r).by(new TransformStream({ flush })),
4715
+ done: () => r.pipeTo(nils()),
4716
+ end: (dst = nils()) => r.pipeTo(dst),
4717
+ to: (dst = nils()) => r.pipeTo(dst),
4718
+ run: () => r.pipeTo(nils()),
4719
+ toEnd: () => r.pipeTo(nils()),
4720
+ toNil: () => r.pipeTo(nils()),
4721
+ toArray: () => toArray(r),
4722
+ toCount: async () => {
4723
+ let i = 0;
4724
+ const d = r.getReader();
4725
+ while (!(await d.read()).done)
4726
+ i++;
4727
+ return i;
4728
+ },
4729
+ toFirst: () => toPromise(sflow(r).limit(1, { terminate: true })),
4730
+ toLast: () => toPromise(sflow(r).tail(1)),
4731
+ toExactlyOne: async () => {
4732
+ const a = await toArray(r);
4733
+ a.length !== 1 || phpdie_default(`Expect exactly 1 Item, but got ${a.length}`);
4734
+ return a[0];
4735
+ },
4736
+ toOne: async () => {
4737
+ const a = await toArray(r);
4738
+ if (a.length > 1)
4739
+ phpdie_default(`Expect only 1 Item, but got ${a.length}`);
4740
+ return a[0];
4741
+ },
4742
+ toAtLeastOne: async () => {
4743
+ const a = await toArray(r);
4744
+ if (a.length > 1)
4745
+ phpdie_default(`Expect only 1 Item, but got ${a.length}`);
4746
+ if (a.length < 1)
4747
+ phpdie_default(`Expect at least 1 Item, but got ${a.length}`);
4748
+ return a[0];
4749
+ },
4750
+ toLog: (...args) => sflow(r.pipeThrough(logs(...args))).done(),
4751
+ lines: (...args) => sflow(r.pipeThrough(lines(...args))),
4752
+ toResponse: (init2) => new Response(r, init2),
4753
+ text: (init2) => new Response(r.pipeThrough(new PolyfillTextEncoderStream), init2).text(),
4754
+ json: (init2) => new Response(r.pipeThrough(new PolyfillTextEncoderStream), init2).json(),
4755
+ blob: (init2) => new Response(sflow(r), init2).blob(),
4756
+ arrayBuffer: (init2) => new Response(r, init2).arrayBuffer(),
4757
+ [Symbol.asyncIterator]: streamAsyncIterator
4758
+ });
4759
+ }
4760
+ var _tees = (arg) => {
4761
+ if (!arg)
4762
+ return new TransformStream;
4763
+ if (arg instanceof WritableStream)
4764
+ return tees((s) => s.pipeTo(arg));
4765
+ const fn = arg;
4766
+ const { writable, readable } = new TransformStream;
4767
+ const [a, b] = readable.tee();
4768
+ fn(sflow(a));
4769
+ return { writable, readable: b };
4770
+ };
4771
+ var _throughs = (arg) => {
4772
+ if (!arg)
4773
+ return new TransformStream;
4774
+ if (typeof arg !== "function")
4775
+ return throughs((s) => s.pipeThrough(arg));
4776
+ const fn = arg;
4777
+ const { writable, readable } = new TransformStream;
4778
+ return { writable, readable: sflow(fn(sflow(readable))) };
4779
+ };
4780
+ function _byLazy(r, t) {
4781
+ const reader = r.getReader();
4782
+ const tw = t.writable.getWriter();
4783
+ const tr = t.readable.getReader();
4784
+ return sflow(new ReadableStream({
4785
+ start: async (ctrl) => {
4786
+ (async function() {
4787
+ while (true) {
4788
+ const { done, value } = await tr.read();
4789
+ if (done)
4790
+ return ctrl.close();
4791
+ ctrl.enqueue(value);
4792
+ }
4793
+ })();
4794
+ },
4795
+ pull: async (ctrl) => {
4796
+ const { done, value } = await reader.read();
4797
+ if (done)
4798
+ return tw.close();
4799
+ await tw.write(value);
4800
+ },
4801
+ cancel: async (r2) => {
4802
+ reader.cancel(r2);
4803
+ tr.cancel(r2);
4804
+ }
4805
+ }, { highWaterMark: 0 }));
4806
+ }
4807
+ var src_default = sflow;
4808
+
4809
+ // node_modules/from-node-stream/dist/index.js
4810
+ function fromReadable(i) {
4811
+ return new ReadableStream({
4812
+ start: (c) => {
4813
+ i.on("data", (data) => c.enqueue(data));
4814
+ i.on("close", () => c.close());
4815
+ i.on("error", (err) => c.error(err));
4816
+ },
4817
+ cancel: (reason) => (i.destroy?.(reason), undefined)
4818
+ });
4819
+ }
4820
+ function fromWritable(i) {
4821
+ return new WritableStream({
4822
+ start: (c) => (i.on("error", (err) => c.error(err)), undefined),
4823
+ abort: (reason) => (i.destroy?.(reason), undefined),
4824
+ write: (data, c) => (i.write(data), undefined),
4825
+ close: () => (i.end(), undefined)
4826
+ });
4827
+ }
4828
+
4829
+ // index.ts
4830
+ import * as pty from "node-pty";
4831
+
4832
+ // createIdleWatcher.ts
4833
+ function createIdleWatcher(onIdle, idleTimeout) {
4834
+ let lastActiveTime = new Date;
4835
+ let idleTimeoutId = null;
4836
+ return {
4837
+ ping: () => {
4838
+ if (idleTimeoutId) {
4839
+ clearTimeout(idleTimeoutId);
4840
+ }
4841
+ idleTimeoutId = setTimeout(() => {
4842
+ clearTimeout(idleTimeoutId);
4843
+ onIdle();
4844
+ }, idleTimeout);
4845
+ lastActiveTime = new Date;
4846
+ },
4847
+ getLastActiveTime: () => lastActiveTime
4848
+ };
4849
+ }
4850
+
4851
+ // removeControlCharacters.ts
4852
+ function removeControlCharacters(str) {
4853
+ return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
4854
+ }
4855
+
4856
+ // utils.ts
4857
+ function sleepms(ms) {
4858
+ return new Promise((resolve) => setTimeout(resolve, ms));
4859
+ }
4860
+
4861
+ // index.ts
4862
+ if (__require.main == __require.module)
4863
+ await main();
4864
+ async function main() {}
4865
+ async function claudeYes({ continueOnCrash, exitOnIdle, claudeArgs = [] } = {}) {
4866
+ const defaultTimeout = 5000;
4867
+ const idleTimeout = typeof exitOnIdle === "number" ? exitOnIdle : defaultTimeout;
4868
+ console.log("⭐ Starting claude, automatically responding to yes/no prompts...");
4869
+ console.log("⚠️ Important Security Warning: Only run this on trusted repositories. This tool automatically responds to prompts and can execute commands without user confirmation. Be aware of potential prompt injection attacks where malicious code or instructions could be embedded in files or user inputs to manipulate the automated responses.");
4870
+ process.stdin.setRawMode?.(true);
4871
+ const prefix = "";
4872
+ const PREFIXLENGTH = prefix.length;
4873
+ const shellOutputStream = new TransformStream;
4874
+ const outputWriter = shellOutputStream.writable.getWriter();
4875
+ let shell = pty.spawn("claude", claudeArgs, {
4876
+ cols: process.stdout.columns - PREFIXLENGTH,
4877
+ rows: process.stdout.rows,
4878
+ cwd: process.cwd(),
4879
+ env: process.env
4880
+ });
4881
+ async function onData(data) {
4882
+ await outputWriter.write(data);
4883
+ }
4884
+ shell.onData(onData);
4885
+ shell.onExit(function onExit({ exitCode }) {
4886
+ if (continueOnCrash) {
4887
+ if (exitCode !== 0) {
4888
+ console.log("Claude crashed, restarting...");
4889
+ shell = pty.spawn("claude", ["continue", "--continue"], {
4890
+ cols: process.stdout.columns - PREFIXLENGTH,
4891
+ rows: process.stdout.rows,
4892
+ cwd: process.cwd(),
4893
+ env: process.env
4894
+ });
4895
+ shell.onData(onData);
4896
+ shell.onExit(onExit);
4897
+ }
4898
+ }
4899
+ process.exit(exitCode);
4900
+ });
4901
+ const exitClaudeCode = async () => {
4902
+ await src_default(["\r", "/exit", "\r"]).forEach(async (e) => {
4903
+ await sleepms(200);
4904
+ shell.write(e);
4905
+ }).run();
4906
+ let exited = false;
4907
+ await Promise.race([
4908
+ new Promise((resolve) => shell.onExit(() => {
4909
+ resolve();
4910
+ exited = true;
4911
+ })),
4912
+ new Promise((resolve) => setTimeout(() => {
4913
+ if (exited)
4914
+ return;
4915
+ shell.kill();
4916
+ resolve();
4917
+ }, 5000))
4918
+ ]);
4919
+ };
4920
+ process.stdout.on("resize", () => {
4921
+ const { columns, rows } = process.stdout;
4922
+ shell.resize(columns - PREFIXLENGTH, rows);
4923
+ });
4924
+ const shellStdio = {
4925
+ writable: new WritableStream({ write: (data) => shell.write(data), close: () => {} }),
4926
+ readable: shellOutputStream.readable
4927
+ };
4928
+ const idleWatcher = createIdleWatcher(async () => {
4929
+ if (exitOnIdle) {
4930
+ console.log("Claude is idle, exiting...");
4931
+ await exitClaudeCode();
4932
+ }
4933
+ }, idleTimeout);
4934
+ await src_default(fromReadable(process.stdin)).map((buffer2) => buffer2.toString()).by(shellStdio).forkTo((e) => e.map((e2) => removeControlCharacters(e2)).map((e2) => e2.replaceAll("\r", "")).forEach(async (e2) => {
4935
+ if (e2.match(/❯ 1. Yes/)) {
4936
+ await sleepms(200);
4937
+ shell.write("\r");
4938
+ }
4939
+ }).forEach(async (e2) => {
4940
+ if (e2.match(/❯ 1. Dark mode✔|Press Enter to continue…/)) {
4941
+ await sleepms(200);
4942
+ shell.write("\r");
4943
+ }
4944
+ }).run()).replaceAll(/.*(?:\r\n?|\r?\n)/g, (line) => prefix + line).forEach(() => idleWatcher.ping()).map((e) => !process.stdout.isTTY ? removeControlCharacters(e) : e).to(fromWritable(process.stdout));
4945
+ }
4946
+ export {
4947
+ removeControlCharacters,
4948
+ claudeYes as default
4949
+ };