@kokimoki/app 1.4.6 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,6 @@
1
+ import require$$1 from 'path';
2
+ import require$$2 from 'fs';
3
+
1
4
  const defaultFieldOptions = {};
2
5
  class Field {
3
6
  options;
@@ -151,6 +154,8 @@ class FormArray extends Field {
151
154
  class Form extends FormGroup {
152
155
  }
153
156
 
157
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
158
+
154
159
  function getDefaultExportFromCjs (x) {
155
160
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
156
161
  }
@@ -634,7 +639,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
634
639
  var eventsExports = events.exports;
635
640
  var EventEmitter$1 = /*@__PURE__*/getDefaultExportFromCjs(eventsExports);
636
641
 
637
- const KOKIMOKI_APP_VERSION = "1.4.6";
642
+ const KOKIMOKI_APP_VERSION = "1.5.0";
638
643
 
639
644
  /**
640
645
  * Utility module to work with key-value stores.
@@ -1045,7 +1050,7 @@ const keys$1 = Object.keys;
1045
1050
  * @param {{[k:string]:V}} obj
1046
1051
  * @param {function(V,string):any} f
1047
1052
  */
1048
- const forEach = (obj, f) => {
1053
+ const forEach$2 = (obj, f) => {
1049
1054
  for (const key in obj) {
1050
1055
  f(obj[key], key);
1051
1056
  }
@@ -8973,7 +8978,7 @@ class YXmlElement extends YXmlFragment {
8973
8978
  */
8974
8979
  const el = new YXmlElement(this.nodeName);
8975
8980
  const attrs = this.getAttributes();
8976
- forEach(attrs, (value, key) => {
8981
+ forEach$2(attrs, (value, key) => {
8977
8982
  if (typeof value === 'string') {
8978
8983
  el.setAttribute(key, value);
8979
8984
  }
@@ -12223,6 +12228,2335 @@ class KokimokiReqRes {
12223
12228
  }
12224
12229
  }
12225
12230
 
12231
+ var farmhash_modern = {exports: {}};
12232
+
12233
+ var util = {};
12234
+
12235
+ var types = {};
12236
+
12237
+ /* eslint complexity: [2, 18], max-statements: [2, 33] */
12238
+ var shams$1 = function hasSymbols() {
12239
+ if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
12240
+ if (typeof Symbol.iterator === 'symbol') { return true; }
12241
+
12242
+ var obj = {};
12243
+ var sym = Symbol('test');
12244
+ var symObj = Object(sym);
12245
+ if (typeof sym === 'string') { return false; }
12246
+
12247
+ if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
12248
+ if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
12249
+
12250
+ // temp disabled per https://github.com/ljharb/object.assign/issues/17
12251
+ // if (sym instanceof Symbol) { return false; }
12252
+ // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
12253
+ // if (!(symObj instanceof Symbol)) { return false; }
12254
+
12255
+ // if (typeof Symbol.prototype.toString !== 'function') { return false; }
12256
+ // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
12257
+
12258
+ var symVal = 42;
12259
+ obj[sym] = symVal;
12260
+ for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
12261
+ if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
12262
+
12263
+ if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
12264
+
12265
+ var syms = Object.getOwnPropertySymbols(obj);
12266
+ if (syms.length !== 1 || syms[0] !== sym) { return false; }
12267
+
12268
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
12269
+
12270
+ if (typeof Object.getOwnPropertyDescriptor === 'function') {
12271
+ var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
12272
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
12273
+ }
12274
+
12275
+ return true;
12276
+ };
12277
+
12278
+ var hasSymbols$2 = shams$1;
12279
+
12280
+ var shams = function hasToStringTagShams() {
12281
+ return hasSymbols$2() && !!Symbol.toStringTag;
12282
+ };
12283
+
12284
+ var origSymbol = typeof Symbol !== 'undefined' && Symbol;
12285
+ var hasSymbolSham = shams$1;
12286
+
12287
+ var hasSymbols$1 = function hasNativeSymbols() {
12288
+ if (typeof origSymbol !== 'function') { return false; }
12289
+ if (typeof Symbol !== 'function') { return false; }
12290
+ if (typeof origSymbol('foo') !== 'symbol') { return false; }
12291
+ if (typeof Symbol('bar') !== 'symbol') { return false; }
12292
+
12293
+ return hasSymbolSham();
12294
+ };
12295
+
12296
+ var test = {
12297
+ foo: {}
12298
+ };
12299
+
12300
+ var $Object = Object;
12301
+
12302
+ var hasProto$1 = function hasProto() {
12303
+ return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
12304
+ };
12305
+
12306
+ /* eslint no-invalid-this: 1 */
12307
+
12308
+ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
12309
+ var slice = Array.prototype.slice;
12310
+ var toStr$3 = Object.prototype.toString;
12311
+ var funcType = '[object Function]';
12312
+
12313
+ var implementation$1 = function bind(that) {
12314
+ var target = this;
12315
+ if (typeof target !== 'function' || toStr$3.call(target) !== funcType) {
12316
+ throw new TypeError(ERROR_MESSAGE + target);
12317
+ }
12318
+ var args = slice.call(arguments, 1);
12319
+
12320
+ var bound;
12321
+ var binder = function () {
12322
+ if (this instanceof bound) {
12323
+ var result = target.apply(
12324
+ this,
12325
+ args.concat(slice.call(arguments))
12326
+ );
12327
+ if (Object(result) === result) {
12328
+ return result;
12329
+ }
12330
+ return this;
12331
+ } else {
12332
+ return target.apply(
12333
+ that,
12334
+ args.concat(slice.call(arguments))
12335
+ );
12336
+ }
12337
+ };
12338
+
12339
+ var boundLength = Math.max(0, target.length - args.length);
12340
+ var boundArgs = [];
12341
+ for (var i = 0; i < boundLength; i++) {
12342
+ boundArgs.push('$' + i);
12343
+ }
12344
+
12345
+ bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
12346
+
12347
+ if (target.prototype) {
12348
+ var Empty = function Empty() {};
12349
+ Empty.prototype = target.prototype;
12350
+ bound.prototype = new Empty();
12351
+ Empty.prototype = null;
12352
+ }
12353
+
12354
+ return bound;
12355
+ };
12356
+
12357
+ var implementation = implementation$1;
12358
+
12359
+ var functionBind = Function.prototype.bind || implementation;
12360
+
12361
+ var bind$1 = functionBind;
12362
+
12363
+ var src = bind$1.call(Function.call, Object.prototype.hasOwnProperty);
12364
+
12365
+ var undefined$1;
12366
+
12367
+ var $SyntaxError = SyntaxError;
12368
+ var $Function = Function;
12369
+ var $TypeError = TypeError;
12370
+
12371
+ // eslint-disable-next-line consistent-return
12372
+ var getEvalledConstructor = function (expressionSyntax) {
12373
+ try {
12374
+ return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
12375
+ } catch (e) {}
12376
+ };
12377
+
12378
+ var $gOPD$1 = Object.getOwnPropertyDescriptor;
12379
+ if ($gOPD$1) {
12380
+ try {
12381
+ $gOPD$1({}, '');
12382
+ } catch (e) {
12383
+ $gOPD$1 = null; // this is IE 8, which has a broken gOPD
12384
+ }
12385
+ }
12386
+
12387
+ var throwTypeError = function () {
12388
+ throw new $TypeError();
12389
+ };
12390
+ var ThrowTypeError = $gOPD$1
12391
+ ? (function () {
12392
+ try {
12393
+ // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
12394
+ arguments.callee; // IE 8 does not throw here
12395
+ return throwTypeError;
12396
+ } catch (calleeThrows) {
12397
+ try {
12398
+ // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
12399
+ return $gOPD$1(arguments, 'callee').get;
12400
+ } catch (gOPDthrows) {
12401
+ return throwTypeError;
12402
+ }
12403
+ }
12404
+ }())
12405
+ : throwTypeError;
12406
+
12407
+ var hasSymbols = hasSymbols$1();
12408
+ var hasProto = hasProto$1();
12409
+
12410
+ var getProto$1 = Object.getPrototypeOf || (
12411
+ hasProto
12412
+ ? function (x) { return x.__proto__; } // eslint-disable-line no-proto
12413
+ : null
12414
+ );
12415
+
12416
+ var needsEval = {};
12417
+
12418
+ var TypedArray = typeof Uint8Array === 'undefined' || !getProto$1 ? undefined$1 : getProto$1(Uint8Array);
12419
+
12420
+ var INTRINSICS = {
12421
+ '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
12422
+ '%Array%': Array,
12423
+ '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
12424
+ '%ArrayIteratorPrototype%': hasSymbols && getProto$1 ? getProto$1([][Symbol.iterator]()) : undefined$1,
12425
+ '%AsyncFromSyncIteratorPrototype%': undefined$1,
12426
+ '%AsyncFunction%': needsEval,
12427
+ '%AsyncGenerator%': needsEval,
12428
+ '%AsyncGeneratorFunction%': needsEval,
12429
+ '%AsyncIteratorPrototype%': needsEval,
12430
+ '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
12431
+ '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
12432
+ '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
12433
+ '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
12434
+ '%Boolean%': Boolean,
12435
+ '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
12436
+ '%Date%': Date,
12437
+ '%decodeURI%': decodeURI,
12438
+ '%decodeURIComponent%': decodeURIComponent,
12439
+ '%encodeURI%': encodeURI,
12440
+ '%encodeURIComponent%': encodeURIComponent,
12441
+ '%Error%': Error,
12442
+ '%eval%': eval, // eslint-disable-line no-eval
12443
+ '%EvalError%': EvalError,
12444
+ '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
12445
+ '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
12446
+ '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
12447
+ '%Function%': $Function,
12448
+ '%GeneratorFunction%': needsEval,
12449
+ '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
12450
+ '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
12451
+ '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
12452
+ '%isFinite%': isFinite,
12453
+ '%isNaN%': isNaN,
12454
+ '%IteratorPrototype%': hasSymbols && getProto$1 ? getProto$1(getProto$1([][Symbol.iterator]())) : undefined$1,
12455
+ '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
12456
+ '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
12457
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto$1 ? undefined$1 : getProto$1(new Map()[Symbol.iterator]()),
12458
+ '%Math%': Math,
12459
+ '%Number%': Number,
12460
+ '%Object%': Object,
12461
+ '%parseFloat%': parseFloat,
12462
+ '%parseInt%': parseInt,
12463
+ '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
12464
+ '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
12465
+ '%RangeError%': RangeError,
12466
+ '%ReferenceError%': ReferenceError,
12467
+ '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
12468
+ '%RegExp%': RegExp,
12469
+ '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
12470
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto$1 ? undefined$1 : getProto$1(new Set()[Symbol.iterator]()),
12471
+ '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
12472
+ '%String%': String,
12473
+ '%StringIteratorPrototype%': hasSymbols && getProto$1 ? getProto$1(''[Symbol.iterator]()) : undefined$1,
12474
+ '%Symbol%': hasSymbols ? Symbol : undefined$1,
12475
+ '%SyntaxError%': $SyntaxError,
12476
+ '%ThrowTypeError%': ThrowTypeError,
12477
+ '%TypedArray%': TypedArray,
12478
+ '%TypeError%': $TypeError,
12479
+ '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
12480
+ '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
12481
+ '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
12482
+ '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
12483
+ '%URIError%': URIError,
12484
+ '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
12485
+ '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
12486
+ '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
12487
+ };
12488
+
12489
+ if (getProto$1) {
12490
+ try {
12491
+ null.error; // eslint-disable-line no-unused-expressions
12492
+ } catch (e) {
12493
+ // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
12494
+ var errorProto = getProto$1(getProto$1(e));
12495
+ INTRINSICS['%Error.prototype%'] = errorProto;
12496
+ }
12497
+ }
12498
+
12499
+ var doEval = function doEval(name) {
12500
+ var value;
12501
+ if (name === '%AsyncFunction%') {
12502
+ value = getEvalledConstructor('async function () {}');
12503
+ } else if (name === '%GeneratorFunction%') {
12504
+ value = getEvalledConstructor('function* () {}');
12505
+ } else if (name === '%AsyncGeneratorFunction%') {
12506
+ value = getEvalledConstructor('async function* () {}');
12507
+ } else if (name === '%AsyncGenerator%') {
12508
+ var fn = doEval('%AsyncGeneratorFunction%');
12509
+ if (fn) {
12510
+ value = fn.prototype;
12511
+ }
12512
+ } else if (name === '%AsyncIteratorPrototype%') {
12513
+ var gen = doEval('%AsyncGenerator%');
12514
+ if (gen && getProto$1) {
12515
+ value = getProto$1(gen.prototype);
12516
+ }
12517
+ }
12518
+
12519
+ INTRINSICS[name] = value;
12520
+
12521
+ return value;
12522
+ };
12523
+
12524
+ var LEGACY_ALIASES = {
12525
+ '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
12526
+ '%ArrayPrototype%': ['Array', 'prototype'],
12527
+ '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
12528
+ '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
12529
+ '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
12530
+ '%ArrayProto_values%': ['Array', 'prototype', 'values'],
12531
+ '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
12532
+ '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
12533
+ '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
12534
+ '%BooleanPrototype%': ['Boolean', 'prototype'],
12535
+ '%DataViewPrototype%': ['DataView', 'prototype'],
12536
+ '%DatePrototype%': ['Date', 'prototype'],
12537
+ '%ErrorPrototype%': ['Error', 'prototype'],
12538
+ '%EvalErrorPrototype%': ['EvalError', 'prototype'],
12539
+ '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
12540
+ '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
12541
+ '%FunctionPrototype%': ['Function', 'prototype'],
12542
+ '%Generator%': ['GeneratorFunction', 'prototype'],
12543
+ '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
12544
+ '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
12545
+ '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
12546
+ '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
12547
+ '%JSONParse%': ['JSON', 'parse'],
12548
+ '%JSONStringify%': ['JSON', 'stringify'],
12549
+ '%MapPrototype%': ['Map', 'prototype'],
12550
+ '%NumberPrototype%': ['Number', 'prototype'],
12551
+ '%ObjectPrototype%': ['Object', 'prototype'],
12552
+ '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
12553
+ '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
12554
+ '%PromisePrototype%': ['Promise', 'prototype'],
12555
+ '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
12556
+ '%Promise_all%': ['Promise', 'all'],
12557
+ '%Promise_reject%': ['Promise', 'reject'],
12558
+ '%Promise_resolve%': ['Promise', 'resolve'],
12559
+ '%RangeErrorPrototype%': ['RangeError', 'prototype'],
12560
+ '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
12561
+ '%RegExpPrototype%': ['RegExp', 'prototype'],
12562
+ '%SetPrototype%': ['Set', 'prototype'],
12563
+ '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
12564
+ '%StringPrototype%': ['String', 'prototype'],
12565
+ '%SymbolPrototype%': ['Symbol', 'prototype'],
12566
+ '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
12567
+ '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
12568
+ '%TypeErrorPrototype%': ['TypeError', 'prototype'],
12569
+ '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
12570
+ '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
12571
+ '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
12572
+ '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
12573
+ '%URIErrorPrototype%': ['URIError', 'prototype'],
12574
+ '%WeakMapPrototype%': ['WeakMap', 'prototype'],
12575
+ '%WeakSetPrototype%': ['WeakSet', 'prototype']
12576
+ };
12577
+
12578
+ var bind = functionBind;
12579
+ var hasOwn = src;
12580
+ var $concat = bind.call(Function.call, Array.prototype.concat);
12581
+ var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
12582
+ var $replace = bind.call(Function.call, String.prototype.replace);
12583
+ var $strSlice = bind.call(Function.call, String.prototype.slice);
12584
+ var $exec = bind.call(Function.call, RegExp.prototype.exec);
12585
+
12586
+ /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
12587
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
12588
+ var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
12589
+ var stringToPath = function stringToPath(string) {
12590
+ var first = $strSlice(string, 0, 1);
12591
+ var last = $strSlice(string, -1);
12592
+ if (first === '%' && last !== '%') {
12593
+ throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
12594
+ } else if (last === '%' && first !== '%') {
12595
+ throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
12596
+ }
12597
+ var result = [];
12598
+ $replace(string, rePropName, function (match, number, quote, subString) {
12599
+ result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
12600
+ });
12601
+ return result;
12602
+ };
12603
+ /* end adaptation */
12604
+
12605
+ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
12606
+ var intrinsicName = name;
12607
+ var alias;
12608
+ if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
12609
+ alias = LEGACY_ALIASES[intrinsicName];
12610
+ intrinsicName = '%' + alias[0] + '%';
12611
+ }
12612
+
12613
+ if (hasOwn(INTRINSICS, intrinsicName)) {
12614
+ var value = INTRINSICS[intrinsicName];
12615
+ if (value === needsEval) {
12616
+ value = doEval(intrinsicName);
12617
+ }
12618
+ if (typeof value === 'undefined' && !allowMissing) {
12619
+ throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
12620
+ }
12621
+
12622
+ return {
12623
+ alias: alias,
12624
+ name: intrinsicName,
12625
+ value: value
12626
+ };
12627
+ }
12628
+
12629
+ throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
12630
+ };
12631
+
12632
+ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
12633
+ if (typeof name !== 'string' || name.length === 0) {
12634
+ throw new $TypeError('intrinsic name must be a non-empty string');
12635
+ }
12636
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
12637
+ throw new $TypeError('"allowMissing" argument must be a boolean');
12638
+ }
12639
+
12640
+ if ($exec(/^%?[^%]*%?$/, name) === null) {
12641
+ throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
12642
+ }
12643
+ var parts = stringToPath(name);
12644
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
12645
+
12646
+ var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
12647
+ var intrinsicRealName = intrinsic.name;
12648
+ var value = intrinsic.value;
12649
+ var skipFurtherCaching = false;
12650
+
12651
+ var alias = intrinsic.alias;
12652
+ if (alias) {
12653
+ intrinsicBaseName = alias[0];
12654
+ $spliceApply(parts, $concat([0, 1], alias));
12655
+ }
12656
+
12657
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
12658
+ var part = parts[i];
12659
+ var first = $strSlice(part, 0, 1);
12660
+ var last = $strSlice(part, -1);
12661
+ if (
12662
+ (
12663
+ (first === '"' || first === "'" || first === '`')
12664
+ || (last === '"' || last === "'" || last === '`')
12665
+ )
12666
+ && first !== last
12667
+ ) {
12668
+ throw new $SyntaxError('property names with quotes must have matching quotes');
12669
+ }
12670
+ if (part === 'constructor' || !isOwn) {
12671
+ skipFurtherCaching = true;
12672
+ }
12673
+
12674
+ intrinsicBaseName += '.' + part;
12675
+ intrinsicRealName = '%' + intrinsicBaseName + '%';
12676
+
12677
+ if (hasOwn(INTRINSICS, intrinsicRealName)) {
12678
+ value = INTRINSICS[intrinsicRealName];
12679
+ } else if (value != null) {
12680
+ if (!(part in value)) {
12681
+ if (!allowMissing) {
12682
+ throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
12683
+ }
12684
+ return void undefined$1;
12685
+ }
12686
+ if ($gOPD$1 && (i + 1) >= parts.length) {
12687
+ var desc = $gOPD$1(value, part);
12688
+ isOwn = !!desc;
12689
+
12690
+ // By convention, when a data property is converted to an accessor
12691
+ // property to emulate a data property that does not suffer from
12692
+ // the override mistake, that accessor's getter is marked with
12693
+ // an `originalValue` property. Here, when we detect this, we
12694
+ // uphold the illusion by pretending to see that original data
12695
+ // property, i.e., returning the value rather than the getter
12696
+ // itself.
12697
+ if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
12698
+ value = desc.get;
12699
+ } else {
12700
+ value = value[part];
12701
+ }
12702
+ } else {
12703
+ isOwn = hasOwn(value, part);
12704
+ value = value[part];
12705
+ }
12706
+
12707
+ if (isOwn && !skipFurtherCaching) {
12708
+ INTRINSICS[intrinsicRealName] = value;
12709
+ }
12710
+ }
12711
+ }
12712
+ return value;
12713
+ };
12714
+
12715
+ var callBind$2 = {exports: {}};
12716
+
12717
+ (function (module) {
12718
+
12719
+ var bind = functionBind;
12720
+ var GetIntrinsic = getIntrinsic;
12721
+
12722
+ var $apply = GetIntrinsic('%Function.prototype.apply%');
12723
+ var $call = GetIntrinsic('%Function.prototype.call%');
12724
+ var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
12725
+
12726
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
12727
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
12728
+ var $max = GetIntrinsic('%Math.max%');
12729
+
12730
+ if ($defineProperty) {
12731
+ try {
12732
+ $defineProperty({}, 'a', { value: 1 });
12733
+ } catch (e) {
12734
+ // IE 8 has a broken defineProperty
12735
+ $defineProperty = null;
12736
+ }
12737
+ }
12738
+
12739
+ module.exports = function callBind(originalFunction) {
12740
+ var func = $reflectApply(bind, $call, arguments);
12741
+ if ($gOPD && $defineProperty) {
12742
+ var desc = $gOPD(func, 'length');
12743
+ if (desc.configurable) {
12744
+ // original length, plus the receiver, minus any additional arguments (after the receiver)
12745
+ $defineProperty(
12746
+ func,
12747
+ 'length',
12748
+ { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
12749
+ );
12750
+ }
12751
+ }
12752
+ return func;
12753
+ };
12754
+
12755
+ var applyBind = function applyBind() {
12756
+ return $reflectApply(bind, $apply, arguments);
12757
+ };
12758
+
12759
+ if ($defineProperty) {
12760
+ $defineProperty(module.exports, 'apply', { value: applyBind });
12761
+ } else {
12762
+ module.exports.apply = applyBind;
12763
+ }
12764
+ } (callBind$2));
12765
+
12766
+ var callBindExports = callBind$2.exports;
12767
+
12768
+ var GetIntrinsic$1 = getIntrinsic;
12769
+
12770
+ var callBind$1 = callBindExports;
12771
+
12772
+ var $indexOf$1 = callBind$1(GetIntrinsic$1('String.prototype.indexOf'));
12773
+
12774
+ var callBound$2 = function callBoundIntrinsic(name, allowMissing) {
12775
+ var intrinsic = GetIntrinsic$1(name, !!allowMissing);
12776
+ if (typeof intrinsic === 'function' && $indexOf$1(name, '.prototype.') > -1) {
12777
+ return callBind$1(intrinsic);
12778
+ }
12779
+ return intrinsic;
12780
+ };
12781
+
12782
+ var hasToStringTag$3 = shams();
12783
+ var callBound$1 = callBound$2;
12784
+
12785
+ var $toString$1 = callBound$1('Object.prototype.toString');
12786
+
12787
+ var isStandardArguments = function isArguments(value) {
12788
+ if (hasToStringTag$3 && value && typeof value === 'object' && Symbol.toStringTag in value) {
12789
+ return false;
12790
+ }
12791
+ return $toString$1(value) === '[object Arguments]';
12792
+ };
12793
+
12794
+ var isLegacyArguments = function isArguments(value) {
12795
+ if (isStandardArguments(value)) {
12796
+ return true;
12797
+ }
12798
+ return value !== null &&
12799
+ typeof value === 'object' &&
12800
+ typeof value.length === 'number' &&
12801
+ value.length >= 0 &&
12802
+ $toString$1(value) !== '[object Array]' &&
12803
+ $toString$1(value.callee) === '[object Function]';
12804
+ };
12805
+
12806
+ var supportsStandardArguments = (function () {
12807
+ return isStandardArguments(arguments);
12808
+ }());
12809
+
12810
+ isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
12811
+
12812
+ var isArguments = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
12813
+
12814
+ var toStr$2 = Object.prototype.toString;
12815
+ var fnToStr$1 = Function.prototype.toString;
12816
+ var isFnRegex = /^\s*(?:function)?\*/;
12817
+ var hasToStringTag$2 = shams();
12818
+ var getProto = Object.getPrototypeOf;
12819
+ var getGeneratorFunc = function () { // eslint-disable-line consistent-return
12820
+ if (!hasToStringTag$2) {
12821
+ return false;
12822
+ }
12823
+ try {
12824
+ return Function('return function*() {}')();
12825
+ } catch (e) {
12826
+ }
12827
+ };
12828
+ var GeneratorFunction;
12829
+
12830
+ var isGeneratorFunction = function isGeneratorFunction(fn) {
12831
+ if (typeof fn !== 'function') {
12832
+ return false;
12833
+ }
12834
+ if (isFnRegex.test(fnToStr$1.call(fn))) {
12835
+ return true;
12836
+ }
12837
+ if (!hasToStringTag$2) {
12838
+ var str = toStr$2.call(fn);
12839
+ return str === '[object GeneratorFunction]';
12840
+ }
12841
+ if (!getProto) {
12842
+ return false;
12843
+ }
12844
+ if (typeof GeneratorFunction === 'undefined') {
12845
+ var generatorFunc = getGeneratorFunc();
12846
+ GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;
12847
+ }
12848
+ return getProto(fn) === GeneratorFunction;
12849
+ };
12850
+
12851
+ var fnToStr = Function.prototype.toString;
12852
+ var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
12853
+ var badArrayLike;
12854
+ var isCallableMarker;
12855
+ if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
12856
+ try {
12857
+ badArrayLike = Object.defineProperty({}, 'length', {
12858
+ get: function () {
12859
+ throw isCallableMarker;
12860
+ }
12861
+ });
12862
+ isCallableMarker = {};
12863
+ // eslint-disable-next-line no-throw-literal
12864
+ reflectApply(function () { throw 42; }, null, badArrayLike);
12865
+ } catch (_) {
12866
+ if (_ !== isCallableMarker) {
12867
+ reflectApply = null;
12868
+ }
12869
+ }
12870
+ } else {
12871
+ reflectApply = null;
12872
+ }
12873
+
12874
+ var constructorRegex = /^\s*class\b/;
12875
+ var isES6ClassFn = function isES6ClassFunction(value) {
12876
+ try {
12877
+ var fnStr = fnToStr.call(value);
12878
+ return constructorRegex.test(fnStr);
12879
+ } catch (e) {
12880
+ return false; // not a function
12881
+ }
12882
+ };
12883
+
12884
+ var tryFunctionObject = function tryFunctionToStr(value) {
12885
+ try {
12886
+ if (isES6ClassFn(value)) { return false; }
12887
+ fnToStr.call(value);
12888
+ return true;
12889
+ } catch (e) {
12890
+ return false;
12891
+ }
12892
+ };
12893
+ var toStr$1 = Object.prototype.toString;
12894
+ var objectClass = '[object Object]';
12895
+ var fnClass = '[object Function]';
12896
+ var genClass = '[object GeneratorFunction]';
12897
+ var ddaClass = '[object HTMLAllCollection]'; // IE 11
12898
+ var ddaClass2 = '[object HTML document.all class]';
12899
+ var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
12900
+ var hasToStringTag$1 = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
12901
+
12902
+ var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
12903
+
12904
+ var isDDA = function isDocumentDotAll() { return false; };
12905
+ if (typeof document === 'object') {
12906
+ // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
12907
+ var all = document.all;
12908
+ if (toStr$1.call(all) === toStr$1.call(document.all)) {
12909
+ isDDA = function isDocumentDotAll(value) {
12910
+ /* globals document: false */
12911
+ // in IE 6-8, typeof document.all is "object" and it's truthy
12912
+ if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
12913
+ try {
12914
+ var str = toStr$1.call(value);
12915
+ return (
12916
+ str === ddaClass
12917
+ || str === ddaClass2
12918
+ || str === ddaClass3 // opera 12.16
12919
+ || str === objectClass // IE 6-8
12920
+ ) && value('') == null; // eslint-disable-line eqeqeq
12921
+ } catch (e) { /**/ }
12922
+ }
12923
+ return false;
12924
+ };
12925
+ }
12926
+ }
12927
+
12928
+ var isCallable$1 = reflectApply
12929
+ ? function isCallable(value) {
12930
+ if (isDDA(value)) { return true; }
12931
+ if (!value) { return false; }
12932
+ if (typeof value !== 'function' && typeof value !== 'object') { return false; }
12933
+ try {
12934
+ reflectApply(value, null, badArrayLike);
12935
+ } catch (e) {
12936
+ if (e !== isCallableMarker) { return false; }
12937
+ }
12938
+ return !isES6ClassFn(value) && tryFunctionObject(value);
12939
+ }
12940
+ : function isCallable(value) {
12941
+ if (isDDA(value)) { return true; }
12942
+ if (!value) { return false; }
12943
+ if (typeof value !== 'function' && typeof value !== 'object') { return false; }
12944
+ if (hasToStringTag$1) { return tryFunctionObject(value); }
12945
+ if (isES6ClassFn(value)) { return false; }
12946
+ var strClass = toStr$1.call(value);
12947
+ if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; }
12948
+ return tryFunctionObject(value);
12949
+ };
12950
+
12951
+ var isCallable = isCallable$1;
12952
+
12953
+ var toStr = Object.prototype.toString;
12954
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
12955
+
12956
+ var forEachArray = function forEachArray(array, iterator, receiver) {
12957
+ for (var i = 0, len = array.length; i < len; i++) {
12958
+ if (hasOwnProperty.call(array, i)) {
12959
+ if (receiver == null) {
12960
+ iterator(array[i], i, array);
12961
+ } else {
12962
+ iterator.call(receiver, array[i], i, array);
12963
+ }
12964
+ }
12965
+ }
12966
+ };
12967
+
12968
+ var forEachString = function forEachString(string, iterator, receiver) {
12969
+ for (var i = 0, len = string.length; i < len; i++) {
12970
+ // no such thing as a sparse string.
12971
+ if (receiver == null) {
12972
+ iterator(string.charAt(i), i, string);
12973
+ } else {
12974
+ iterator.call(receiver, string.charAt(i), i, string);
12975
+ }
12976
+ }
12977
+ };
12978
+
12979
+ var forEachObject = function forEachObject(object, iterator, receiver) {
12980
+ for (var k in object) {
12981
+ if (hasOwnProperty.call(object, k)) {
12982
+ if (receiver == null) {
12983
+ iterator(object[k], k, object);
12984
+ } else {
12985
+ iterator.call(receiver, object[k], k, object);
12986
+ }
12987
+ }
12988
+ }
12989
+ };
12990
+
12991
+ var forEach$1 = function forEach(list, iterator, thisArg) {
12992
+ if (!isCallable(iterator)) {
12993
+ throw new TypeError('iterator must be a function');
12994
+ }
12995
+
12996
+ var receiver;
12997
+ if (arguments.length >= 3) {
12998
+ receiver = thisArg;
12999
+ }
13000
+
13001
+ if (toStr.call(list) === '[object Array]') {
13002
+ forEachArray(list, iterator, receiver);
13003
+ } else if (typeof list === 'string') {
13004
+ forEachString(list, iterator, receiver);
13005
+ } else {
13006
+ forEachObject(list, iterator, receiver);
13007
+ }
13008
+ };
13009
+
13010
+ var forEach_1 = forEach$1;
13011
+
13012
+ var possibleNames = [
13013
+ 'BigInt64Array',
13014
+ 'BigUint64Array',
13015
+ 'Float32Array',
13016
+ 'Float64Array',
13017
+ 'Int16Array',
13018
+ 'Int32Array',
13019
+ 'Int8Array',
13020
+ 'Uint16Array',
13021
+ 'Uint32Array',
13022
+ 'Uint8Array',
13023
+ 'Uint8ClampedArray'
13024
+ ];
13025
+
13026
+ var g$1 = typeof globalThis === 'undefined' ? commonjsGlobal : globalThis;
13027
+
13028
+ var availableTypedArrays$1 = function availableTypedArrays() {
13029
+ var out = [];
13030
+ for (var i = 0; i < possibleNames.length; i++) {
13031
+ if (typeof g$1[possibleNames[i]] === 'function') {
13032
+ out[out.length] = possibleNames[i];
13033
+ }
13034
+ }
13035
+ return out;
13036
+ };
13037
+
13038
+ var GetIntrinsic = getIntrinsic;
13039
+
13040
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
13041
+
13042
+ if ($gOPD) {
13043
+ try {
13044
+ $gOPD([], 'length');
13045
+ } catch (e) {
13046
+ // IE 8 has a broken gOPD
13047
+ $gOPD = null;
13048
+ }
13049
+ }
13050
+
13051
+ var gopd = $gOPD;
13052
+
13053
+ var forEach = forEach_1;
13054
+ var availableTypedArrays = availableTypedArrays$1;
13055
+ var callBind = callBindExports;
13056
+ var callBound = callBound$2;
13057
+ var gOPD = gopd;
13058
+
13059
+ var $toString = callBound('Object.prototype.toString');
13060
+ var hasToStringTag = shams();
13061
+
13062
+ var g = typeof globalThis === 'undefined' ? commonjsGlobal : globalThis;
13063
+ var typedArrays = availableTypedArrays();
13064
+
13065
+ var $slice = callBound('String.prototype.slice');
13066
+ var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
13067
+
13068
+ var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
13069
+ for (var i = 0; i < array.length; i += 1) {
13070
+ if (array[i] === value) {
13071
+ return i;
13072
+ }
13073
+ }
13074
+ return -1;
13075
+ };
13076
+ var cache = { __proto__: null };
13077
+ if (hasToStringTag && gOPD && getPrototypeOf) {
13078
+ forEach(typedArrays, function (typedArray) {
13079
+ var arr = new g[typedArray]();
13080
+ if (Symbol.toStringTag in arr) {
13081
+ var proto = getPrototypeOf(arr);
13082
+ var descriptor = gOPD(proto, Symbol.toStringTag);
13083
+ if (!descriptor) {
13084
+ var superProto = getPrototypeOf(proto);
13085
+ descriptor = gOPD(superProto, Symbol.toStringTag);
13086
+ }
13087
+ cache['$' + typedArray] = callBind(descriptor.get);
13088
+ }
13089
+ });
13090
+ } else {
13091
+ forEach(typedArrays, function (typedArray) {
13092
+ var arr = new g[typedArray]();
13093
+ cache['$' + typedArray] = callBind(arr.slice);
13094
+ });
13095
+ }
13096
+
13097
+ var tryTypedArrays = function tryAllTypedArrays(value) {
13098
+ var found = false;
13099
+ forEach(cache, function (getter, typedArray) {
13100
+ if (!found) {
13101
+ try {
13102
+ if ('$' + getter(value) === typedArray) {
13103
+ found = $slice(typedArray, 1);
13104
+ }
13105
+ } catch (e) { /**/ }
13106
+ }
13107
+ });
13108
+ return found;
13109
+ };
13110
+
13111
+ var trySlices = function tryAllSlices(value) {
13112
+ var found = false;
13113
+ forEach(cache, function (getter, name) {
13114
+ if (!found) {
13115
+ try {
13116
+ getter(value);
13117
+ found = $slice(name, 1);
13118
+ } catch (e) { /**/ }
13119
+ }
13120
+ });
13121
+ return found;
13122
+ };
13123
+
13124
+ var whichTypedArray$1 = function whichTypedArray(value) {
13125
+ if (!value || typeof value !== 'object') { return false; }
13126
+ if (!hasToStringTag) {
13127
+ var tag = $slice($toString(value), 8, -1);
13128
+ if ($indexOf(typedArrays, tag) > -1) {
13129
+ return tag;
13130
+ }
13131
+ if (tag !== 'Object') {
13132
+ return false;
13133
+ }
13134
+ // node < 0.6 hits here on real Typed Arrays
13135
+ return trySlices(value);
13136
+ }
13137
+ if (!gOPD) { return null; } // unknown engine
13138
+ return tryTypedArrays(value);
13139
+ };
13140
+
13141
+ var whichTypedArray = whichTypedArray$1;
13142
+
13143
+ var isTypedArray = function isTypedArray(value) {
13144
+ return !!whichTypedArray(value);
13145
+ };
13146
+
13147
+ (function (exports) {
13148
+
13149
+ var isArgumentsObject = isArguments;
13150
+ var isGeneratorFunction$1 = isGeneratorFunction;
13151
+ var whichTypedArray = whichTypedArray$1;
13152
+ var isTypedArray$1 = isTypedArray;
13153
+
13154
+ function uncurryThis(f) {
13155
+ return f.call.bind(f);
13156
+ }
13157
+
13158
+ var BigIntSupported = typeof BigInt !== 'undefined';
13159
+ var SymbolSupported = typeof Symbol !== 'undefined';
13160
+
13161
+ var ObjectToString = uncurryThis(Object.prototype.toString);
13162
+
13163
+ var numberValue = uncurryThis(Number.prototype.valueOf);
13164
+ var stringValue = uncurryThis(String.prototype.valueOf);
13165
+ var booleanValue = uncurryThis(Boolean.prototype.valueOf);
13166
+
13167
+ if (BigIntSupported) {
13168
+ var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
13169
+ }
13170
+
13171
+ if (SymbolSupported) {
13172
+ var symbolValue = uncurryThis(Symbol.prototype.valueOf);
13173
+ }
13174
+
13175
+ function checkBoxedPrimitive(value, prototypeValueOf) {
13176
+ if (typeof value !== 'object') {
13177
+ return false;
13178
+ }
13179
+ try {
13180
+ prototypeValueOf(value);
13181
+ return true;
13182
+ } catch(e) {
13183
+ return false;
13184
+ }
13185
+ }
13186
+
13187
+ exports.isArgumentsObject = isArgumentsObject;
13188
+ exports.isGeneratorFunction = isGeneratorFunction$1;
13189
+ exports.isTypedArray = isTypedArray$1;
13190
+
13191
+ // Taken from here and modified for better browser support
13192
+ // https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
13193
+ function isPromise(input) {
13194
+ return (
13195
+ (
13196
+ typeof Promise !== 'undefined' &&
13197
+ input instanceof Promise
13198
+ ) ||
13199
+ (
13200
+ input !== null &&
13201
+ typeof input === 'object' &&
13202
+ typeof input.then === 'function' &&
13203
+ typeof input.catch === 'function'
13204
+ )
13205
+ );
13206
+ }
13207
+ exports.isPromise = isPromise;
13208
+
13209
+ function isArrayBufferView(value) {
13210
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
13211
+ return ArrayBuffer.isView(value);
13212
+ }
13213
+
13214
+ return (
13215
+ isTypedArray$1(value) ||
13216
+ isDataView(value)
13217
+ );
13218
+ }
13219
+ exports.isArrayBufferView = isArrayBufferView;
13220
+
13221
+
13222
+ function isUint8Array(value) {
13223
+ return whichTypedArray(value) === 'Uint8Array';
13224
+ }
13225
+ exports.isUint8Array = isUint8Array;
13226
+
13227
+ function isUint8ClampedArray(value) {
13228
+ return whichTypedArray(value) === 'Uint8ClampedArray';
13229
+ }
13230
+ exports.isUint8ClampedArray = isUint8ClampedArray;
13231
+
13232
+ function isUint16Array(value) {
13233
+ return whichTypedArray(value) === 'Uint16Array';
13234
+ }
13235
+ exports.isUint16Array = isUint16Array;
13236
+
13237
+ function isUint32Array(value) {
13238
+ return whichTypedArray(value) === 'Uint32Array';
13239
+ }
13240
+ exports.isUint32Array = isUint32Array;
13241
+
13242
+ function isInt8Array(value) {
13243
+ return whichTypedArray(value) === 'Int8Array';
13244
+ }
13245
+ exports.isInt8Array = isInt8Array;
13246
+
13247
+ function isInt16Array(value) {
13248
+ return whichTypedArray(value) === 'Int16Array';
13249
+ }
13250
+ exports.isInt16Array = isInt16Array;
13251
+
13252
+ function isInt32Array(value) {
13253
+ return whichTypedArray(value) === 'Int32Array';
13254
+ }
13255
+ exports.isInt32Array = isInt32Array;
13256
+
13257
+ function isFloat32Array(value) {
13258
+ return whichTypedArray(value) === 'Float32Array';
13259
+ }
13260
+ exports.isFloat32Array = isFloat32Array;
13261
+
13262
+ function isFloat64Array(value) {
13263
+ return whichTypedArray(value) === 'Float64Array';
13264
+ }
13265
+ exports.isFloat64Array = isFloat64Array;
13266
+
13267
+ function isBigInt64Array(value) {
13268
+ return whichTypedArray(value) === 'BigInt64Array';
13269
+ }
13270
+ exports.isBigInt64Array = isBigInt64Array;
13271
+
13272
+ function isBigUint64Array(value) {
13273
+ return whichTypedArray(value) === 'BigUint64Array';
13274
+ }
13275
+ exports.isBigUint64Array = isBigUint64Array;
13276
+
13277
+ function isMapToString(value) {
13278
+ return ObjectToString(value) === '[object Map]';
13279
+ }
13280
+ isMapToString.working = (
13281
+ typeof Map !== 'undefined' &&
13282
+ isMapToString(new Map())
13283
+ );
13284
+
13285
+ function isMap(value) {
13286
+ if (typeof Map === 'undefined') {
13287
+ return false;
13288
+ }
13289
+
13290
+ return isMapToString.working
13291
+ ? isMapToString(value)
13292
+ : value instanceof Map;
13293
+ }
13294
+ exports.isMap = isMap;
13295
+
13296
+ function isSetToString(value) {
13297
+ return ObjectToString(value) === '[object Set]';
13298
+ }
13299
+ isSetToString.working = (
13300
+ typeof Set !== 'undefined' &&
13301
+ isSetToString(new Set())
13302
+ );
13303
+ function isSet(value) {
13304
+ if (typeof Set === 'undefined') {
13305
+ return false;
13306
+ }
13307
+
13308
+ return isSetToString.working
13309
+ ? isSetToString(value)
13310
+ : value instanceof Set;
13311
+ }
13312
+ exports.isSet = isSet;
13313
+
13314
+ function isWeakMapToString(value) {
13315
+ return ObjectToString(value) === '[object WeakMap]';
13316
+ }
13317
+ isWeakMapToString.working = (
13318
+ typeof WeakMap !== 'undefined' &&
13319
+ isWeakMapToString(new WeakMap())
13320
+ );
13321
+ function isWeakMap(value) {
13322
+ if (typeof WeakMap === 'undefined') {
13323
+ return false;
13324
+ }
13325
+
13326
+ return isWeakMapToString.working
13327
+ ? isWeakMapToString(value)
13328
+ : value instanceof WeakMap;
13329
+ }
13330
+ exports.isWeakMap = isWeakMap;
13331
+
13332
+ function isWeakSetToString(value) {
13333
+ return ObjectToString(value) === '[object WeakSet]';
13334
+ }
13335
+ isWeakSetToString.working = (
13336
+ typeof WeakSet !== 'undefined' &&
13337
+ isWeakSetToString(new WeakSet())
13338
+ );
13339
+ function isWeakSet(value) {
13340
+ return isWeakSetToString(value);
13341
+ }
13342
+ exports.isWeakSet = isWeakSet;
13343
+
13344
+ function isArrayBufferToString(value) {
13345
+ return ObjectToString(value) === '[object ArrayBuffer]';
13346
+ }
13347
+ isArrayBufferToString.working = (
13348
+ typeof ArrayBuffer !== 'undefined' &&
13349
+ isArrayBufferToString(new ArrayBuffer())
13350
+ );
13351
+ function isArrayBuffer(value) {
13352
+ if (typeof ArrayBuffer === 'undefined') {
13353
+ return false;
13354
+ }
13355
+
13356
+ return isArrayBufferToString.working
13357
+ ? isArrayBufferToString(value)
13358
+ : value instanceof ArrayBuffer;
13359
+ }
13360
+ exports.isArrayBuffer = isArrayBuffer;
13361
+
13362
+ function isDataViewToString(value) {
13363
+ return ObjectToString(value) === '[object DataView]';
13364
+ }
13365
+ isDataViewToString.working = (
13366
+ typeof ArrayBuffer !== 'undefined' &&
13367
+ typeof DataView !== 'undefined' &&
13368
+ isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
13369
+ );
13370
+ function isDataView(value) {
13371
+ if (typeof DataView === 'undefined') {
13372
+ return false;
13373
+ }
13374
+
13375
+ return isDataViewToString.working
13376
+ ? isDataViewToString(value)
13377
+ : value instanceof DataView;
13378
+ }
13379
+ exports.isDataView = isDataView;
13380
+
13381
+ // Store a copy of SharedArrayBuffer in case it's deleted elsewhere
13382
+ var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
13383
+ function isSharedArrayBufferToString(value) {
13384
+ return ObjectToString(value) === '[object SharedArrayBuffer]';
13385
+ }
13386
+ function isSharedArrayBuffer(value) {
13387
+ if (typeof SharedArrayBufferCopy === 'undefined') {
13388
+ return false;
13389
+ }
13390
+
13391
+ if (typeof isSharedArrayBufferToString.working === 'undefined') {
13392
+ isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
13393
+ }
13394
+
13395
+ return isSharedArrayBufferToString.working
13396
+ ? isSharedArrayBufferToString(value)
13397
+ : value instanceof SharedArrayBufferCopy;
13398
+ }
13399
+ exports.isSharedArrayBuffer = isSharedArrayBuffer;
13400
+
13401
+ function isAsyncFunction(value) {
13402
+ return ObjectToString(value) === '[object AsyncFunction]';
13403
+ }
13404
+ exports.isAsyncFunction = isAsyncFunction;
13405
+
13406
+ function isMapIterator(value) {
13407
+ return ObjectToString(value) === '[object Map Iterator]';
13408
+ }
13409
+ exports.isMapIterator = isMapIterator;
13410
+
13411
+ function isSetIterator(value) {
13412
+ return ObjectToString(value) === '[object Set Iterator]';
13413
+ }
13414
+ exports.isSetIterator = isSetIterator;
13415
+
13416
+ function isGeneratorObject(value) {
13417
+ return ObjectToString(value) === '[object Generator]';
13418
+ }
13419
+ exports.isGeneratorObject = isGeneratorObject;
13420
+
13421
+ function isWebAssemblyCompiledModule(value) {
13422
+ return ObjectToString(value) === '[object WebAssembly.Module]';
13423
+ }
13424
+ exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
13425
+
13426
+ function isNumberObject(value) {
13427
+ return checkBoxedPrimitive(value, numberValue);
13428
+ }
13429
+ exports.isNumberObject = isNumberObject;
13430
+
13431
+ function isStringObject(value) {
13432
+ return checkBoxedPrimitive(value, stringValue);
13433
+ }
13434
+ exports.isStringObject = isStringObject;
13435
+
13436
+ function isBooleanObject(value) {
13437
+ return checkBoxedPrimitive(value, booleanValue);
13438
+ }
13439
+ exports.isBooleanObject = isBooleanObject;
13440
+
13441
+ function isBigIntObject(value) {
13442
+ return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
13443
+ }
13444
+ exports.isBigIntObject = isBigIntObject;
13445
+
13446
+ function isSymbolObject(value) {
13447
+ return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
13448
+ }
13449
+ exports.isSymbolObject = isSymbolObject;
13450
+
13451
+ function isBoxedPrimitive(value) {
13452
+ return (
13453
+ isNumberObject(value) ||
13454
+ isStringObject(value) ||
13455
+ isBooleanObject(value) ||
13456
+ isBigIntObject(value) ||
13457
+ isSymbolObject(value)
13458
+ );
13459
+ }
13460
+ exports.isBoxedPrimitive = isBoxedPrimitive;
13461
+
13462
+ function isAnyArrayBuffer(value) {
13463
+ return typeof Uint8Array !== 'undefined' && (
13464
+ isArrayBuffer(value) ||
13465
+ isSharedArrayBuffer(value)
13466
+ );
13467
+ }
13468
+ exports.isAnyArrayBuffer = isAnyArrayBuffer;
13469
+
13470
+ ['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {
13471
+ Object.defineProperty(exports, method, {
13472
+ enumerable: false,
13473
+ value: function() {
13474
+ throw new Error(method + ' is not supported in userland');
13475
+ }
13476
+ });
13477
+ });
13478
+ } (types));
13479
+
13480
+ var isBuffer = function isBuffer(arg) {
13481
+ return arg instanceof Buffer;
13482
+ };
13483
+
13484
+ var inherits = {exports: {}};
13485
+
13486
+ var inherits_browser = {exports: {}};
13487
+
13488
+ var hasRequiredInherits_browser;
13489
+
13490
+ function requireInherits_browser () {
13491
+ if (hasRequiredInherits_browser) return inherits_browser.exports;
13492
+ hasRequiredInherits_browser = 1;
13493
+ if (typeof Object.create === 'function') {
13494
+ // implementation from standard node.js 'util' module
13495
+ inherits_browser.exports = function inherits(ctor, superCtor) {
13496
+ if (superCtor) {
13497
+ ctor.super_ = superCtor;
13498
+ ctor.prototype = Object.create(superCtor.prototype, {
13499
+ constructor: {
13500
+ value: ctor,
13501
+ enumerable: false,
13502
+ writable: true,
13503
+ configurable: true
13504
+ }
13505
+ });
13506
+ }
13507
+ };
13508
+ } else {
13509
+ // old school shim for old browsers
13510
+ inherits_browser.exports = function inherits(ctor, superCtor) {
13511
+ if (superCtor) {
13512
+ ctor.super_ = superCtor;
13513
+ var TempCtor = function () {};
13514
+ TempCtor.prototype = superCtor.prototype;
13515
+ ctor.prototype = new TempCtor();
13516
+ ctor.prototype.constructor = ctor;
13517
+ }
13518
+ };
13519
+ }
13520
+ return inherits_browser.exports;
13521
+ }
13522
+
13523
+ var hasRequiredInherits;
13524
+
13525
+ function requireInherits () {
13526
+ if (hasRequiredInherits) return inherits.exports;
13527
+ hasRequiredInherits = 1;
13528
+ try {
13529
+ var util = requireUtil();
13530
+ /* istanbul ignore next */
13531
+ if (typeof util.inherits !== 'function') throw '';
13532
+ inherits.exports = util.inherits;
13533
+ } catch (e) {
13534
+ /* istanbul ignore next */
13535
+ inherits.exports = requireInherits_browser();
13536
+ }
13537
+ return inherits.exports;
13538
+ }
13539
+
13540
+ var hasRequiredUtil;
13541
+
13542
+ function requireUtil () {
13543
+ if (hasRequiredUtil) return util;
13544
+ hasRequiredUtil = 1;
13545
+ (function (exports) {
13546
+ // Copyright Joyent, Inc. and other Node contributors.
13547
+ //
13548
+ // Permission is hereby granted, free of charge, to any person obtaining a
13549
+ // copy of this software and associated documentation files (the
13550
+ // "Software"), to deal in the Software without restriction, including
13551
+ // without limitation the rights to use, copy, modify, merge, publish,
13552
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
13553
+ // persons to whom the Software is furnished to do so, subject to the
13554
+ // following conditions:
13555
+ //
13556
+ // The above copyright notice and this permission notice shall be included
13557
+ // in all copies or substantial portions of the Software.
13558
+ //
13559
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13560
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
13561
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
13562
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
13563
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
13564
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
13565
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
13566
+
13567
+ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
13568
+ function getOwnPropertyDescriptors(obj) {
13569
+ var keys = Object.keys(obj);
13570
+ var descriptors = {};
13571
+ for (var i = 0; i < keys.length; i++) {
13572
+ descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
13573
+ }
13574
+ return descriptors;
13575
+ };
13576
+
13577
+ var formatRegExp = /%[sdj%]/g;
13578
+ exports.format = function(f) {
13579
+ if (!isString(f)) {
13580
+ var objects = [];
13581
+ for (var i = 0; i < arguments.length; i++) {
13582
+ objects.push(inspect(arguments[i]));
13583
+ }
13584
+ return objects.join(' ');
13585
+ }
13586
+
13587
+ var i = 1;
13588
+ var args = arguments;
13589
+ var len = args.length;
13590
+ var str = String(f).replace(formatRegExp, function(x) {
13591
+ if (x === '%%') return '%';
13592
+ if (i >= len) return x;
13593
+ switch (x) {
13594
+ case '%s': return String(args[i++]);
13595
+ case '%d': return Number(args[i++]);
13596
+ case '%j':
13597
+ try {
13598
+ return JSON.stringify(args[i++]);
13599
+ } catch (_) {
13600
+ return '[Circular]';
13601
+ }
13602
+ default:
13603
+ return x;
13604
+ }
13605
+ });
13606
+ for (var x = args[i]; i < len; x = args[++i]) {
13607
+ if (isNull(x) || !isObject(x)) {
13608
+ str += ' ' + x;
13609
+ } else {
13610
+ str += ' ' + inspect(x);
13611
+ }
13612
+ }
13613
+ return str;
13614
+ };
13615
+
13616
+
13617
+ // Mark that a method should not be used.
13618
+ // Returns a modified function which warns once by default.
13619
+ // If --no-deprecation is set, then it is a no-op.
13620
+ exports.deprecate = function(fn, msg) {
13621
+ if (typeof process !== 'undefined' && process.noDeprecation === true) {
13622
+ return fn;
13623
+ }
13624
+
13625
+ // Allow for deprecating things in the process of starting up.
13626
+ if (typeof process === 'undefined') {
13627
+ return function() {
13628
+ return exports.deprecate(fn, msg).apply(this, arguments);
13629
+ };
13630
+ }
13631
+
13632
+ var warned = false;
13633
+ function deprecated() {
13634
+ if (!warned) {
13635
+ if (process.throwDeprecation) {
13636
+ throw new Error(msg);
13637
+ } else if (process.traceDeprecation) {
13638
+ console.trace(msg);
13639
+ } else {
13640
+ console.error(msg);
13641
+ }
13642
+ warned = true;
13643
+ }
13644
+ return fn.apply(this, arguments);
13645
+ }
13646
+
13647
+ return deprecated;
13648
+ };
13649
+
13650
+
13651
+ var debugs = {};
13652
+ var debugEnvRegex = /^$/;
13653
+
13654
+ if (process.env.NODE_DEBUG) {
13655
+ var debugEnv = process.env.NODE_DEBUG;
13656
+ debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
13657
+ .replace(/\*/g, '.*')
13658
+ .replace(/,/g, '$|^')
13659
+ .toUpperCase();
13660
+ debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
13661
+ }
13662
+ exports.debuglog = function(set) {
13663
+ set = set.toUpperCase();
13664
+ if (!debugs[set]) {
13665
+ if (debugEnvRegex.test(set)) {
13666
+ var pid = process.pid;
13667
+ debugs[set] = function() {
13668
+ var msg = exports.format.apply(exports, arguments);
13669
+ console.error('%s %d: %s', set, pid, msg);
13670
+ };
13671
+ } else {
13672
+ debugs[set] = function() {};
13673
+ }
13674
+ }
13675
+ return debugs[set];
13676
+ };
13677
+
13678
+
13679
+ /**
13680
+ * Echos the value of a value. Trys to print the value out
13681
+ * in the best way possible given the different types.
13682
+ *
13683
+ * @param {Object} obj The object to print out.
13684
+ * @param {Object} opts Optional options object that alters the output.
13685
+ */
13686
+ /* legacy: obj, showHidden, depth, colors*/
13687
+ function inspect(obj, opts) {
13688
+ // default options
13689
+ var ctx = {
13690
+ seen: [],
13691
+ stylize: stylizeNoColor
13692
+ };
13693
+ // legacy...
13694
+ if (arguments.length >= 3) ctx.depth = arguments[2];
13695
+ if (arguments.length >= 4) ctx.colors = arguments[3];
13696
+ if (isBoolean(opts)) {
13697
+ // legacy...
13698
+ ctx.showHidden = opts;
13699
+ } else if (opts) {
13700
+ // got an "options" object
13701
+ exports._extend(ctx, opts);
13702
+ }
13703
+ // set default options
13704
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
13705
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
13706
+ if (isUndefined(ctx.colors)) ctx.colors = false;
13707
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
13708
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
13709
+ return formatValue(ctx, obj, ctx.depth);
13710
+ }
13711
+ exports.inspect = inspect;
13712
+
13713
+
13714
+ // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
13715
+ inspect.colors = {
13716
+ 'bold' : [1, 22],
13717
+ 'italic' : [3, 23],
13718
+ 'underline' : [4, 24],
13719
+ 'inverse' : [7, 27],
13720
+ 'white' : [37, 39],
13721
+ 'grey' : [90, 39],
13722
+ 'black' : [30, 39],
13723
+ 'blue' : [34, 39],
13724
+ 'cyan' : [36, 39],
13725
+ 'green' : [32, 39],
13726
+ 'magenta' : [35, 39],
13727
+ 'red' : [31, 39],
13728
+ 'yellow' : [33, 39]
13729
+ };
13730
+
13731
+ // Don't use 'blue' not visible on cmd.exe
13732
+ inspect.styles = {
13733
+ 'special': 'cyan',
13734
+ 'number': 'yellow',
13735
+ 'boolean': 'yellow',
13736
+ 'undefined': 'grey',
13737
+ 'null': 'bold',
13738
+ 'string': 'green',
13739
+ 'date': 'magenta',
13740
+ // "name": intentionally not styling
13741
+ 'regexp': 'red'
13742
+ };
13743
+
13744
+
13745
+ function stylizeWithColor(str, styleType) {
13746
+ var style = inspect.styles[styleType];
13747
+
13748
+ if (style) {
13749
+ return '\u001b[' + inspect.colors[style][0] + 'm' + str +
13750
+ '\u001b[' + inspect.colors[style][1] + 'm';
13751
+ } else {
13752
+ return str;
13753
+ }
13754
+ }
13755
+
13756
+
13757
+ function stylizeNoColor(str, styleType) {
13758
+ return str;
13759
+ }
13760
+
13761
+
13762
+ function arrayToHash(array) {
13763
+ var hash = {};
13764
+
13765
+ array.forEach(function(val, idx) {
13766
+ hash[val] = true;
13767
+ });
13768
+
13769
+ return hash;
13770
+ }
13771
+
13772
+
13773
+ function formatValue(ctx, value, recurseTimes) {
13774
+ // Provide a hook for user-specified inspect functions.
13775
+ // Check that value is an object with an inspect function on it
13776
+ if (ctx.customInspect &&
13777
+ value &&
13778
+ isFunction(value.inspect) &&
13779
+ // Filter out the util module, it's inspect function is special
13780
+ value.inspect !== exports.inspect &&
13781
+ // Also filter out any prototype objects using the circular check.
13782
+ !(value.constructor && value.constructor.prototype === value)) {
13783
+ var ret = value.inspect(recurseTimes, ctx);
13784
+ if (!isString(ret)) {
13785
+ ret = formatValue(ctx, ret, recurseTimes);
13786
+ }
13787
+ return ret;
13788
+ }
13789
+
13790
+ // Primitive types cannot have properties
13791
+ var primitive = formatPrimitive(ctx, value);
13792
+ if (primitive) {
13793
+ return primitive;
13794
+ }
13795
+
13796
+ // Look up the keys of the object.
13797
+ var keys = Object.keys(value);
13798
+ var visibleKeys = arrayToHash(keys);
13799
+
13800
+ if (ctx.showHidden) {
13801
+ keys = Object.getOwnPropertyNames(value);
13802
+ }
13803
+
13804
+ // IE doesn't make error fields non-enumerable
13805
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
13806
+ if (isError(value)
13807
+ && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
13808
+ return formatError(value);
13809
+ }
13810
+
13811
+ // Some type of object without properties can be shortcutted.
13812
+ if (keys.length === 0) {
13813
+ if (isFunction(value)) {
13814
+ var name = value.name ? ': ' + value.name : '';
13815
+ return ctx.stylize('[Function' + name + ']', 'special');
13816
+ }
13817
+ if (isRegExp(value)) {
13818
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
13819
+ }
13820
+ if (isDate(value)) {
13821
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
13822
+ }
13823
+ if (isError(value)) {
13824
+ return formatError(value);
13825
+ }
13826
+ }
13827
+
13828
+ var base = '', array = false, braces = ['{', '}'];
13829
+
13830
+ // Make Array say that they are Array
13831
+ if (isArray(value)) {
13832
+ array = true;
13833
+ braces = ['[', ']'];
13834
+ }
13835
+
13836
+ // Make functions say that they are functions
13837
+ if (isFunction(value)) {
13838
+ var n = value.name ? ': ' + value.name : '';
13839
+ base = ' [Function' + n + ']';
13840
+ }
13841
+
13842
+ // Make RegExps say that they are RegExps
13843
+ if (isRegExp(value)) {
13844
+ base = ' ' + RegExp.prototype.toString.call(value);
13845
+ }
13846
+
13847
+ // Make dates with properties first say the date
13848
+ if (isDate(value)) {
13849
+ base = ' ' + Date.prototype.toUTCString.call(value);
13850
+ }
13851
+
13852
+ // Make error with message first say the error
13853
+ if (isError(value)) {
13854
+ base = ' ' + formatError(value);
13855
+ }
13856
+
13857
+ if (keys.length === 0 && (!array || value.length == 0)) {
13858
+ return braces[0] + base + braces[1];
13859
+ }
13860
+
13861
+ if (recurseTimes < 0) {
13862
+ if (isRegExp(value)) {
13863
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
13864
+ } else {
13865
+ return ctx.stylize('[Object]', 'special');
13866
+ }
13867
+ }
13868
+
13869
+ ctx.seen.push(value);
13870
+
13871
+ var output;
13872
+ if (array) {
13873
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
13874
+ } else {
13875
+ output = keys.map(function(key) {
13876
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
13877
+ });
13878
+ }
13879
+
13880
+ ctx.seen.pop();
13881
+
13882
+ return reduceToSingleString(output, base, braces);
13883
+ }
13884
+
13885
+
13886
+ function formatPrimitive(ctx, value) {
13887
+ if (isUndefined(value))
13888
+ return ctx.stylize('undefined', 'undefined');
13889
+ if (isString(value)) {
13890
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
13891
+ .replace(/'/g, "\\'")
13892
+ .replace(/\\"/g, '"') + '\'';
13893
+ return ctx.stylize(simple, 'string');
13894
+ }
13895
+ if (isNumber(value))
13896
+ return ctx.stylize('' + value, 'number');
13897
+ if (isBoolean(value))
13898
+ return ctx.stylize('' + value, 'boolean');
13899
+ // For some reason typeof null is "object", so special case here.
13900
+ if (isNull(value))
13901
+ return ctx.stylize('null', 'null');
13902
+ }
13903
+
13904
+
13905
+ function formatError(value) {
13906
+ return '[' + Error.prototype.toString.call(value) + ']';
13907
+ }
13908
+
13909
+
13910
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
13911
+ var output = [];
13912
+ for (var i = 0, l = value.length; i < l; ++i) {
13913
+ if (hasOwnProperty(value, String(i))) {
13914
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
13915
+ String(i), true));
13916
+ } else {
13917
+ output.push('');
13918
+ }
13919
+ }
13920
+ keys.forEach(function(key) {
13921
+ if (!key.match(/^\d+$/)) {
13922
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
13923
+ key, true));
13924
+ }
13925
+ });
13926
+ return output;
13927
+ }
13928
+
13929
+
13930
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
13931
+ var name, str, desc;
13932
+ desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
13933
+ if (desc.get) {
13934
+ if (desc.set) {
13935
+ str = ctx.stylize('[Getter/Setter]', 'special');
13936
+ } else {
13937
+ str = ctx.stylize('[Getter]', 'special');
13938
+ }
13939
+ } else {
13940
+ if (desc.set) {
13941
+ str = ctx.stylize('[Setter]', 'special');
13942
+ }
13943
+ }
13944
+ if (!hasOwnProperty(visibleKeys, key)) {
13945
+ name = '[' + key + ']';
13946
+ }
13947
+ if (!str) {
13948
+ if (ctx.seen.indexOf(desc.value) < 0) {
13949
+ if (isNull(recurseTimes)) {
13950
+ str = formatValue(ctx, desc.value, null);
13951
+ } else {
13952
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
13953
+ }
13954
+ if (str.indexOf('\n') > -1) {
13955
+ if (array) {
13956
+ str = str.split('\n').map(function(line) {
13957
+ return ' ' + line;
13958
+ }).join('\n').slice(2);
13959
+ } else {
13960
+ str = '\n' + str.split('\n').map(function(line) {
13961
+ return ' ' + line;
13962
+ }).join('\n');
13963
+ }
13964
+ }
13965
+ } else {
13966
+ str = ctx.stylize('[Circular]', 'special');
13967
+ }
13968
+ }
13969
+ if (isUndefined(name)) {
13970
+ if (array && key.match(/^\d+$/)) {
13971
+ return str;
13972
+ }
13973
+ name = JSON.stringify('' + key);
13974
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
13975
+ name = name.slice(1, -1);
13976
+ name = ctx.stylize(name, 'name');
13977
+ } else {
13978
+ name = name.replace(/'/g, "\\'")
13979
+ .replace(/\\"/g, '"')
13980
+ .replace(/(^"|"$)/g, "'");
13981
+ name = ctx.stylize(name, 'string');
13982
+ }
13983
+ }
13984
+
13985
+ return name + ': ' + str;
13986
+ }
13987
+
13988
+
13989
+ function reduceToSingleString(output, base, braces) {
13990
+ var length = output.reduce(function(prev, cur) {
13991
+ if (cur.indexOf('\n') >= 0) ;
13992
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
13993
+ }, 0);
13994
+
13995
+ if (length > 60) {
13996
+ return braces[0] +
13997
+ (base === '' ? '' : base + '\n ') +
13998
+ ' ' +
13999
+ output.join(',\n ') +
14000
+ ' ' +
14001
+ braces[1];
14002
+ }
14003
+
14004
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
14005
+ }
14006
+
14007
+
14008
+ // NOTE: These type checking functions intentionally don't use `instanceof`
14009
+ // because it is fragile and can be easily faked with `Object.create()`.
14010
+ exports.types = types;
14011
+
14012
+ function isArray(ar) {
14013
+ return Array.isArray(ar);
14014
+ }
14015
+ exports.isArray = isArray;
14016
+
14017
+ function isBoolean(arg) {
14018
+ return typeof arg === 'boolean';
14019
+ }
14020
+ exports.isBoolean = isBoolean;
14021
+
14022
+ function isNull(arg) {
14023
+ return arg === null;
14024
+ }
14025
+ exports.isNull = isNull;
14026
+
14027
+ function isNullOrUndefined(arg) {
14028
+ return arg == null;
14029
+ }
14030
+ exports.isNullOrUndefined = isNullOrUndefined;
14031
+
14032
+ function isNumber(arg) {
14033
+ return typeof arg === 'number';
14034
+ }
14035
+ exports.isNumber = isNumber;
14036
+
14037
+ function isString(arg) {
14038
+ return typeof arg === 'string';
14039
+ }
14040
+ exports.isString = isString;
14041
+
14042
+ function isSymbol(arg) {
14043
+ return typeof arg === 'symbol';
14044
+ }
14045
+ exports.isSymbol = isSymbol;
14046
+
14047
+ function isUndefined(arg) {
14048
+ return arg === void 0;
14049
+ }
14050
+ exports.isUndefined = isUndefined;
14051
+
14052
+ function isRegExp(re) {
14053
+ return isObject(re) && objectToString(re) === '[object RegExp]';
14054
+ }
14055
+ exports.isRegExp = isRegExp;
14056
+ exports.types.isRegExp = isRegExp;
14057
+
14058
+ function isObject(arg) {
14059
+ return typeof arg === 'object' && arg !== null;
14060
+ }
14061
+ exports.isObject = isObject;
14062
+
14063
+ function isDate(d) {
14064
+ return isObject(d) && objectToString(d) === '[object Date]';
14065
+ }
14066
+ exports.isDate = isDate;
14067
+ exports.types.isDate = isDate;
14068
+
14069
+ function isError(e) {
14070
+ return isObject(e) &&
14071
+ (objectToString(e) === '[object Error]' || e instanceof Error);
14072
+ }
14073
+ exports.isError = isError;
14074
+ exports.types.isNativeError = isError;
14075
+
14076
+ function isFunction(arg) {
14077
+ return typeof arg === 'function';
14078
+ }
14079
+ exports.isFunction = isFunction;
14080
+
14081
+ function isPrimitive(arg) {
14082
+ return arg === null ||
14083
+ typeof arg === 'boolean' ||
14084
+ typeof arg === 'number' ||
14085
+ typeof arg === 'string' ||
14086
+ typeof arg === 'symbol' || // ES6 symbol
14087
+ typeof arg === 'undefined';
14088
+ }
14089
+ exports.isPrimitive = isPrimitive;
14090
+
14091
+ exports.isBuffer = isBuffer;
14092
+
14093
+ function objectToString(o) {
14094
+ return Object.prototype.toString.call(o);
14095
+ }
14096
+
14097
+
14098
+ function pad(n) {
14099
+ return n < 10 ? '0' + n.toString(10) : n.toString(10);
14100
+ }
14101
+
14102
+
14103
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
14104
+ 'Oct', 'Nov', 'Dec'];
14105
+
14106
+ // 26 Feb 16:19:34
14107
+ function timestamp() {
14108
+ var d = new Date();
14109
+ var time = [pad(d.getHours()),
14110
+ pad(d.getMinutes()),
14111
+ pad(d.getSeconds())].join(':');
14112
+ return [d.getDate(), months[d.getMonth()], time].join(' ');
14113
+ }
14114
+
14115
+
14116
+ // log is just a thin wrapper to console.log that prepends a timestamp
14117
+ exports.log = function() {
14118
+ console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
14119
+ };
14120
+
14121
+
14122
+ /**
14123
+ * Inherit the prototype methods from one constructor into another.
14124
+ *
14125
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
14126
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
14127
+ * during bootstrapping this function needs to be rewritten using some native
14128
+ * functions as prototype setup using normal JavaScript does not work as
14129
+ * expected during bootstrapping (see mirror.js in r114903).
14130
+ *
14131
+ * @param {function} ctor Constructor function which needs to inherit the
14132
+ * prototype.
14133
+ * @param {function} superCtor Constructor function to inherit prototype from.
14134
+ */
14135
+ exports.inherits = requireInherits();
14136
+
14137
+ exports._extend = function(origin, add) {
14138
+ // Don't do anything if add isn't an object
14139
+ if (!add || !isObject(add)) return origin;
14140
+
14141
+ var keys = Object.keys(add);
14142
+ var i = keys.length;
14143
+ while (i--) {
14144
+ origin[keys[i]] = add[keys[i]];
14145
+ }
14146
+ return origin;
14147
+ };
14148
+
14149
+ function hasOwnProperty(obj, prop) {
14150
+ return Object.prototype.hasOwnProperty.call(obj, prop);
14151
+ }
14152
+
14153
+ var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
14154
+
14155
+ exports.promisify = function promisify(original) {
14156
+ if (typeof original !== 'function')
14157
+ throw new TypeError('The "original" argument must be of type Function');
14158
+
14159
+ if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
14160
+ var fn = original[kCustomPromisifiedSymbol];
14161
+ if (typeof fn !== 'function') {
14162
+ throw new TypeError('The "util.promisify.custom" argument must be of type Function');
14163
+ }
14164
+ Object.defineProperty(fn, kCustomPromisifiedSymbol, {
14165
+ value: fn, enumerable: false, writable: false, configurable: true
14166
+ });
14167
+ return fn;
14168
+ }
14169
+
14170
+ function fn() {
14171
+ var promiseResolve, promiseReject;
14172
+ var promise = new Promise(function (resolve, reject) {
14173
+ promiseResolve = resolve;
14174
+ promiseReject = reject;
14175
+ });
14176
+
14177
+ var args = [];
14178
+ for (var i = 0; i < arguments.length; i++) {
14179
+ args.push(arguments[i]);
14180
+ }
14181
+ args.push(function (err, value) {
14182
+ if (err) {
14183
+ promiseReject(err);
14184
+ } else {
14185
+ promiseResolve(value);
14186
+ }
14187
+ });
14188
+
14189
+ try {
14190
+ original.apply(this, args);
14191
+ } catch (err) {
14192
+ promiseReject(err);
14193
+ }
14194
+
14195
+ return promise;
14196
+ }
14197
+
14198
+ Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
14199
+
14200
+ if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
14201
+ value: fn, enumerable: false, writable: false, configurable: true
14202
+ });
14203
+ return Object.defineProperties(
14204
+ fn,
14205
+ getOwnPropertyDescriptors(original)
14206
+ );
14207
+ };
14208
+
14209
+ exports.promisify.custom = kCustomPromisifiedSymbol;
14210
+
14211
+ function callbackifyOnRejected(reason, cb) {
14212
+ // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
14213
+ // Because `null` is a special error value in callbacks which means "no error
14214
+ // occurred", we error-wrap so the callback consumer can distinguish between
14215
+ // "the promise rejected with null" or "the promise fulfilled with undefined".
14216
+ if (!reason) {
14217
+ var newReason = new Error('Promise was rejected with a falsy value');
14218
+ newReason.reason = reason;
14219
+ reason = newReason;
14220
+ }
14221
+ return cb(reason);
14222
+ }
14223
+
14224
+ function callbackify(original) {
14225
+ if (typeof original !== 'function') {
14226
+ throw new TypeError('The "original" argument must be of type Function');
14227
+ }
14228
+
14229
+ // We DO NOT return the promise as it gives the user a false sense that
14230
+ // the promise is actually somehow related to the callback's execution
14231
+ // and that the callback throwing will reject the promise.
14232
+ function callbackified() {
14233
+ var args = [];
14234
+ for (var i = 0; i < arguments.length; i++) {
14235
+ args.push(arguments[i]);
14236
+ }
14237
+
14238
+ var maybeCb = args.pop();
14239
+ if (typeof maybeCb !== 'function') {
14240
+ throw new TypeError('The last argument must be of type Function');
14241
+ }
14242
+ var self = this;
14243
+ var cb = function() {
14244
+ return maybeCb.apply(self, arguments);
14245
+ };
14246
+ // In true node style we process the callback on `nextTick` with all the
14247
+ // implications (stack, `uncaughtException`, `async_hooks`)
14248
+ original.apply(this, args)
14249
+ .then(function(ret) { process.nextTick(cb.bind(null, null, ret)); },
14250
+ function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); });
14251
+ }
14252
+
14253
+ Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
14254
+ Object.defineProperties(callbackified,
14255
+ getOwnPropertyDescriptors(original));
14256
+ return callbackified;
14257
+ }
14258
+ exports.callbackify = callbackify;
14259
+ } (util));
14260
+ return util;
14261
+ }
14262
+
14263
+ (function (module) {
14264
+ let imports = {};
14265
+ imports['__wbindgen_placeholder__'] = module.exports;
14266
+ let wasm;
14267
+ const { TextDecoder, TextEncoder } = requireUtil();
14268
+
14269
+ const heap = new Array(128).fill(undefined);
14270
+
14271
+ heap.push(undefined, null, true, false);
14272
+
14273
+ function getObject(idx) { return heap[idx]; }
14274
+
14275
+ let heap_next = heap.length;
14276
+
14277
+ function dropObject(idx) {
14278
+ if (idx < 132) return;
14279
+ heap[idx] = heap_next;
14280
+ heap_next = idx;
14281
+ }
14282
+
14283
+ function takeObject(idx) {
14284
+ const ret = getObject(idx);
14285
+ dropObject(idx);
14286
+ return ret;
14287
+ }
14288
+
14289
+ let cachedUint8Memory0 = null;
14290
+
14291
+ function getUint8Memory0() {
14292
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
14293
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
14294
+ }
14295
+ return cachedUint8Memory0;
14296
+ }
14297
+
14298
+ let WASM_VECTOR_LEN = 0;
14299
+
14300
+ function passArray8ToWasm0(arg, malloc) {
14301
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
14302
+ getUint8Memory0().set(arg, ptr / 1);
14303
+ WASM_VECTOR_LEN = arg.length;
14304
+ return ptr;
14305
+ }
14306
+ /**
14307
+ * @param {Uint8Array} input
14308
+ * @returns {number}
14309
+ */
14310
+ module.exports.fingerprint32 = function(input) {
14311
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
14312
+ const len0 = WASM_VECTOR_LEN;
14313
+ const ret = wasm.fingerprint32(ptr0, len0);
14314
+ return ret >>> 0;
14315
+ };
14316
+
14317
+ /**
14318
+ * @param {Uint8Array} input
14319
+ * @returns {bigint}
14320
+ */
14321
+ module.exports.fingerprint64 = function(input) {
14322
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
14323
+ const len0 = WASM_VECTOR_LEN;
14324
+ const ret = wasm.bigquery_fingerprint(ptr0, len0);
14325
+ return BigInt.asUintN(64, ret);
14326
+ };
14327
+
14328
+ /**
14329
+ * @param {Uint8Array} input
14330
+ * @returns {bigint}
14331
+ */
14332
+ module.exports.bigquery_fingerprint = function(input) {
14333
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
14334
+ const len0 = WASM_VECTOR_LEN;
14335
+ const ret = wasm.bigquery_fingerprint(ptr0, len0);
14336
+ return ret;
14337
+ };
14338
+
14339
+ /**
14340
+ * @param {Uint8Array} input
14341
+ * @returns {number}
14342
+ */
14343
+ module.exports.hash32 = function(input) {
14344
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
14345
+ const len0 = WASM_VECTOR_LEN;
14346
+ const ret = wasm.hash32(ptr0, len0);
14347
+ return ret >>> 0;
14348
+ };
14349
+
14350
+ /**
14351
+ * @param {Uint8Array} input
14352
+ * @param {number} seed
14353
+ * @returns {number}
14354
+ */
14355
+ module.exports.hash32_with_seed = function(input, seed) {
14356
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
14357
+ const len0 = WASM_VECTOR_LEN;
14358
+ const ret = wasm.hash32_with_seed(ptr0, len0, seed);
14359
+ return ret >>> 0;
14360
+ };
14361
+
14362
+ /**
14363
+ * @param {Uint8Array} input
14364
+ * @returns {bigint}
14365
+ */
14366
+ module.exports.hash64 = function(input) {
14367
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
14368
+ const len0 = WASM_VECTOR_LEN;
14369
+ const ret = wasm.hash64(ptr0, len0);
14370
+ return BigInt.asUintN(64, ret);
14371
+ };
14372
+
14373
+ /**
14374
+ * @param {Uint8Array} input
14375
+ * @param {bigint} seed
14376
+ * @returns {bigint}
14377
+ */
14378
+ module.exports.hash64_with_seed = function(input, seed) {
14379
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
14380
+ const len0 = WASM_VECTOR_LEN;
14381
+ const ret = wasm.hash64_with_seed(ptr0, len0, seed);
14382
+ return BigInt.asUintN(64, ret);
14383
+ };
14384
+
14385
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
14386
+
14387
+ cachedTextDecoder.decode();
14388
+
14389
+ function getStringFromWasm0(ptr, len) {
14390
+ ptr = ptr >>> 0;
14391
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
14392
+ }
14393
+
14394
+ function addHeapObject(obj) {
14395
+ if (heap_next === heap.length) heap.push(heap.length + 1);
14396
+ const idx = heap_next;
14397
+ heap_next = heap[idx];
14398
+
14399
+ heap[idx] = obj;
14400
+ return idx;
14401
+ }
14402
+
14403
+ let cachedTextEncoder = new TextEncoder('utf-8');
14404
+
14405
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
14406
+ ? function (arg, view) {
14407
+ return cachedTextEncoder.encodeInto(arg, view);
14408
+ }
14409
+ : function (arg, view) {
14410
+ const buf = cachedTextEncoder.encode(arg);
14411
+ view.set(buf);
14412
+ return {
14413
+ read: arg.length,
14414
+ written: buf.length
14415
+ };
14416
+ });
14417
+
14418
+ function passStringToWasm0(arg, malloc, realloc) {
14419
+
14420
+ if (realloc === undefined) {
14421
+ const buf = cachedTextEncoder.encode(arg);
14422
+ const ptr = malloc(buf.length, 1) >>> 0;
14423
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
14424
+ WASM_VECTOR_LEN = buf.length;
14425
+ return ptr;
14426
+ }
14427
+
14428
+ let len = arg.length;
14429
+ let ptr = malloc(len, 1) >>> 0;
14430
+
14431
+ const mem = getUint8Memory0();
14432
+
14433
+ let offset = 0;
14434
+
14435
+ for (; offset < len; offset++) {
14436
+ const code = arg.charCodeAt(offset);
14437
+ if (code > 0x7F) break;
14438
+ mem[ptr + offset] = code;
14439
+ }
14440
+
14441
+ if (offset !== len) {
14442
+ if (offset !== 0) {
14443
+ arg = arg.slice(offset);
14444
+ }
14445
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
14446
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
14447
+ const ret = encodeString(arg, view);
14448
+
14449
+ offset += ret.written;
14450
+ }
14451
+
14452
+ WASM_VECTOR_LEN = offset;
14453
+ return ptr;
14454
+ }
14455
+
14456
+ let cachedInt32Memory0 = null;
14457
+
14458
+ function getInt32Memory0() {
14459
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
14460
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
14461
+ }
14462
+ return cachedInt32Memory0;
14463
+ }
14464
+
14465
+ module.exports.__wbg_new_abda76e883ba8a5f = function() {
14466
+ const ret = new Error();
14467
+ return addHeapObject(ret);
14468
+ };
14469
+
14470
+ module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
14471
+ const ret = getObject(arg1).stack;
14472
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
14473
+ const len1 = WASM_VECTOR_LEN;
14474
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
14475
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
14476
+ };
14477
+
14478
+ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
14479
+ let deferred0_0;
14480
+ let deferred0_1;
14481
+ try {
14482
+ deferred0_0 = arg0;
14483
+ deferred0_1 = arg1;
14484
+ console.error(getStringFromWasm0(arg0, arg1));
14485
+ } finally {
14486
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
14487
+ }
14488
+ };
14489
+
14490
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
14491
+ takeObject(arg0);
14492
+ };
14493
+
14494
+ const path = require$$1.join(__dirname, 'farmhash_modern_bg.wasm');
14495
+ const bytes = require$$2.readFileSync(path);
14496
+
14497
+ const wasmModule = new WebAssembly.Module(bytes);
14498
+ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
14499
+ wasm = wasmInstance.exports;
14500
+ module.exports.__wasm = wasm;
14501
+ } (farmhash_modern));
14502
+
14503
+ var farmhash_modernExports = farmhash_modern.exports;
14504
+
14505
+ function asBuffer(input) {
14506
+ if (typeof input === 'string') {
14507
+ return new TextEncoder().encode(input);
14508
+ }
14509
+ if (input instanceof Uint8Array) {
14510
+ return input;
14511
+ }
14512
+ throw new Error('Expected input to be a string or Uint8Array');
14513
+ }
14514
+ /**
14515
+ * Create a new farmhash based u32 for a string or an array of bytes.
14516
+ * Fingerprint value should be portable and stable across library versions
14517
+ * and platforms.
14518
+ */
14519
+ function fingerprint32(input) {
14520
+ return farmhash_modernExports.fingerprint32(asBuffer(input));
14521
+ }
14522
+
14523
+ class KokimokiLocalStore extends KokimokiStore {
14524
+ localRoomName;
14525
+ _stateKey;
14526
+ get stateKey() {
14527
+ if (!this._stateKey) {
14528
+ throw new Error("Not initialized");
14529
+ }
14530
+ return this._stateKey;
14531
+ }
14532
+ constructor(localRoomName, schema) {
14533
+ super(`/l/${localRoomName}`, schema, RoomSubscriptionMode.ReadWrite);
14534
+ this.localRoomName = localRoomName;
14535
+ // Synchronize doc changes to local storage
14536
+ // TODO: maybe do not serialize full state every time
14537
+ this.doc.on("update", () => {
14538
+ const value = encodeStateAsUpdate(this.doc);
14539
+ const valueString = String.fromCharCode(...value);
14540
+ const valueBase64 = btoa(valueString);
14541
+ localStorage.setItem(this.stateKey, valueBase64);
14542
+ });
14543
+ }
14544
+ getInitialUpdate(appId, clientId) {
14545
+ this._stateKey = `${appId}/${clientId}/${this.localRoomName}`;
14546
+ // get initial update from local storage
14547
+ let initialUpdate = undefined;
14548
+ const state = localStorage.getItem(this.stateKey);
14549
+ if (state) {
14550
+ const valueString = atob(state);
14551
+ initialUpdate = Uint8Array.from(valueString, (c) => c.charCodeAt(0));
14552
+ }
14553
+ return {
14554
+ roomHash: fingerprint32(this.roomName),
14555
+ initialUpdate,
14556
+ };
14557
+ }
14558
+ }
14559
+
12226
14560
  class KokimokiClient extends EventEmitter$1 {
12227
14561
  host;
12228
14562
  appId;
@@ -12248,6 +14582,7 @@ class KokimokiClient extends EventEmitter$1 {
12248
14582
  _reconnectTimeout = 0;
12249
14583
  _pingInterval;
12250
14584
  _clientTokenKey = "KM_TOKEN";
14585
+ _editorContext;
12251
14586
  constructor(host, appId, code = "") {
12252
14587
  super();
12253
14588
  this.host = host;
@@ -12270,6 +14605,7 @@ class KokimokiClient extends EventEmitter$1 {
12270
14605
  if (window.parent && window.self !== window.parent) {
12271
14606
  window.addEventListener("message", (e) => {
12272
14607
  console.log(`[KM TOOLS] ${e.data}`);
14608
+ this._editorContext = e.data;
12273
14609
  if (e.data === "km:clearStorage") {
12274
14610
  localStorage.removeItem(this._clientTokenKey);
12275
14611
  window.location.reload();
@@ -12325,6 +14661,9 @@ class KokimokiClient extends EventEmitter$1 {
12325
14661
  }
12326
14662
  return this._ws;
12327
14663
  }
14664
+ get isEditor() {
14665
+ return !!this._editorContext;
14666
+ }
12328
14667
  async connect() {
12329
14668
  if (this._connectPromise) {
12330
14669
  return await this._connectPromise;
@@ -12658,7 +14997,13 @@ class KokimokiClient extends EventEmitter$1 {
12658
14997
  }
12659
14998
  // Send subscription request if connected to server
12660
14999
  if (!subscription.joined) {
12661
- const res = await this.sendSubscribeReq(store.roomName, store.mode);
15000
+ let res;
15001
+ if (store instanceof KokimokiLocalStore) {
15002
+ res = store.getInitialUpdate(this.appId, this.id);
15003
+ }
15004
+ else {
15005
+ res = await this.sendSubscribeReq(store.roomName, store.mode);
15006
+ }
12662
15007
  this._subscriptionsByHash.set(res.roomHash, subscription);
12663
15008
  await subscription.applyInitialResponse(res.roomHash, res.initialUpdate);
12664
15009
  // Trigger onJoin event
@@ -12678,55 +15023,76 @@ class KokimokiClient extends EventEmitter$1 {
12678
15023
  }
12679
15024
  }
12680
15025
  async transact(handler) {
12681
- if (!this._connected) {
12682
- throw new Error("Client not connected");
12683
- }
15026
+ // if (!this._connected) {
15027
+ // throw new Error("Client not connected");
15028
+ // }
12684
15029
  const transaction = new KokimokiTransaction(this);
12685
15030
  await handler(transaction);
12686
15031
  const { updates, consumedMessages } = await transaction.getUpdates();
12687
15032
  if (!updates.length) {
12688
15033
  return;
12689
15034
  }
12690
- // Construct buffer
12691
- const writer = new WsMessageWriter();
15035
+ // Construct buffers
15036
+ const remoteUpdateWriter = new WsMessageWriter();
15037
+ const localUpdateWriter = new WsMessageWriter();
12692
15038
  // Write message type
12693
- writer.writeInt32(WsMessageType.Transaction);
15039
+ remoteUpdateWriter.writeInt32(WsMessageType.Transaction);
12694
15040
  // Update and write transaction ID
12695
15041
  const transactionId = ++this._messageId;
12696
- writer.writeInt32(transactionId);
12697
- // Write room hashes where messages were consumed
12698
- writer.writeInt32(consumedMessages.size);
15042
+ remoteUpdateWriter.writeInt32(transactionId);
15043
+ localUpdateWriter.writeInt32(transactionId);
15044
+ // Write room hashes where messages were consumed (remote only)
15045
+ remoteUpdateWriter.writeInt32(consumedMessages.size);
12699
15046
  for (const roomName of consumedMessages) {
12700
15047
  const subscription = this._subscriptionsByName.get(roomName);
12701
15048
  if (!subscription) {
12702
15049
  throw new Error(`Cannot consume message in "${roomName}" because it hasn't been joined`);
12703
15050
  }
12704
- writer.writeUint32(subscription.roomHash);
15051
+ remoteUpdateWriter.writeUint32(subscription.roomHash);
12705
15052
  }
12706
15053
  // Write updates
15054
+ let localUpdates = 0, remoteUpdates = 0;
12707
15055
  for (const { roomName, update } of updates) {
12708
15056
  const subscription = this._subscriptionsByName.get(roomName);
12709
15057
  if (!subscription) {
12710
15058
  throw new Error(`Cannot send update to "${roomName}" because it hasn't been joined`);
12711
15059
  }
12712
- writer.writeUint32(subscription.roomHash);
12713
- writer.writeUint8Array(update);
12714
- }
12715
- const buffer = writer.getBuffer();
12716
- // Wait for server to apply transaction
12717
- await new Promise((resolve, reject) => {
12718
- this._transactionPromises.set(transactionId, { resolve, reject });
12719
- // Send update to server
12720
- try {
12721
- this.ws.send(buffer);
15060
+ if (subscription.store instanceof KokimokiLocalStore) {
15061
+ localUpdates++;
15062
+ localUpdateWriter.writeUint32(subscription.roomHash);
15063
+ localUpdateWriter.writeUint8Array(update);
12722
15064
  }
12723
- catch (e) {
12724
- // Not connected
12725
- console.log("Failed to send update to server:", e);
12726
- // TODO: merge updates or something
12727
- throw e;
15065
+ else {
15066
+ remoteUpdates++;
15067
+ remoteUpdateWriter.writeUint32(subscription.roomHash);
15068
+ remoteUpdateWriter.writeUint8Array(update);
12728
15069
  }
12729
- });
15070
+ }
15071
+ // Wait for server to apply transaction
15072
+ if (remoteUpdates) {
15073
+ const remoteBuffer = remoteUpdateWriter.getBuffer();
15074
+ await new Promise((resolve, reject) => {
15075
+ this._transactionPromises.set(transactionId, { resolve, reject });
15076
+ // Send update to server
15077
+ try {
15078
+ this.ws.send(remoteBuffer);
15079
+ }
15080
+ catch (e) {
15081
+ // Not connected
15082
+ console.log("Failed to send update to server:", e);
15083
+ // Delete transaction promise
15084
+ this._transactionPromises.delete(transactionId);
15085
+ // TODO: merge updates or something
15086
+ reject(e);
15087
+ }
15088
+ });
15089
+ }
15090
+ // Apply local updates
15091
+ if (localUpdates) {
15092
+ const localBuffer = localUpdateWriter.getBuffer();
15093
+ const reader = new WsMessageReader(localBuffer);
15094
+ this.handleRoomUpdateMessage(reader);
15095
+ }
12730
15096
  }
12731
15097
  async close() {
12732
15098
  this._autoReconnect = false;
@@ -12756,6 +15122,14 @@ class KokimokiClient extends EventEmitter$1 {
12756
15122
  }
12757
15123
  return store;
12758
15124
  }
15125
+ // local store
15126
+ localStore(name, schema) {
15127
+ const store = new KokimokiLocalStore(name, schema);
15128
+ this.join(store)
15129
+ .then(() => { })
15130
+ .catch(() => { });
15131
+ return store;
15132
+ }
12759
15133
  // queue
12760
15134
  queue(name, schema, mode, autoJoin = true) {
12761
15135
  const queue = new KokimokiQueue(name, schema, mode);