@cadenza.io/core 3.18.1 → 3.19.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 CHANGED
@@ -293,975 +293,6 @@ function debounce(func, wait, options) {
293
293
  }
294
294
  var debounce_default = debounce;
295
295
 
296
- // node_modules/lodash-es/isArray.js
297
- var isArray = Array.isArray;
298
- var isArray_default = isArray;
299
-
300
- // node_modules/lodash-es/identity.js
301
- function identity(value) {
302
- return value;
303
- }
304
- var identity_default = identity;
305
-
306
- // node_modules/lodash-es/isFunction.js
307
- var asyncTag = "[object AsyncFunction]";
308
- var funcTag = "[object Function]";
309
- var genTag = "[object GeneratorFunction]";
310
- var proxyTag = "[object Proxy]";
311
- function isFunction(value) {
312
- if (!isObject_default(value)) {
313
- return false;
314
- }
315
- var tag = baseGetTag_default(value);
316
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
317
- }
318
- var isFunction_default = isFunction;
319
-
320
- // node_modules/lodash-es/_coreJsData.js
321
- var coreJsData = root_default["__core-js_shared__"];
322
- var coreJsData_default = coreJsData;
323
-
324
- // node_modules/lodash-es/_isMasked.js
325
- var maskSrcKey = (function() {
326
- var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
327
- return uid ? "Symbol(src)_1." + uid : "";
328
- })();
329
- function isMasked(func) {
330
- return !!maskSrcKey && maskSrcKey in func;
331
- }
332
- var isMasked_default = isMasked;
333
-
334
- // node_modules/lodash-es/_toSource.js
335
- var funcProto = Function.prototype;
336
- var funcToString = funcProto.toString;
337
- function toSource(func) {
338
- if (func != null) {
339
- try {
340
- return funcToString.call(func);
341
- } catch (e) {
342
- }
343
- try {
344
- return func + "";
345
- } catch (e) {
346
- }
347
- }
348
- return "";
349
- }
350
- var toSource_default = toSource;
351
-
352
- // node_modules/lodash-es/_baseIsNative.js
353
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
354
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
355
- var funcProto2 = Function.prototype;
356
- var objectProto3 = Object.prototype;
357
- var funcToString2 = funcProto2.toString;
358
- var hasOwnProperty2 = objectProto3.hasOwnProperty;
359
- var reIsNative = RegExp(
360
- "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
361
- );
362
- function baseIsNative(value) {
363
- if (!isObject_default(value) || isMasked_default(value)) {
364
- return false;
365
- }
366
- var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
367
- return pattern.test(toSource_default(value));
368
- }
369
- var baseIsNative_default = baseIsNative;
370
-
371
- // node_modules/lodash-es/_getValue.js
372
- function getValue(object, key) {
373
- return object == null ? void 0 : object[key];
374
- }
375
- var getValue_default = getValue;
376
-
377
- // node_modules/lodash-es/_getNative.js
378
- function getNative(object, key) {
379
- var value = getValue_default(object, key);
380
- return baseIsNative_default(value) ? value : void 0;
381
- }
382
- var getNative_default = getNative;
383
-
384
- // node_modules/lodash-es/_baseCreate.js
385
- var objectCreate = Object.create;
386
- var baseCreate = /* @__PURE__ */ (function() {
387
- function object() {
388
- }
389
- return function(proto) {
390
- if (!isObject_default(proto)) {
391
- return {};
392
- }
393
- if (objectCreate) {
394
- return objectCreate(proto);
395
- }
396
- object.prototype = proto;
397
- var result = new object();
398
- object.prototype = void 0;
399
- return result;
400
- };
401
- })();
402
- var baseCreate_default = baseCreate;
403
-
404
- // node_modules/lodash-es/_apply.js
405
- function apply(func, thisArg, args) {
406
- switch (args.length) {
407
- case 0:
408
- return func.call(thisArg);
409
- case 1:
410
- return func.call(thisArg, args[0]);
411
- case 2:
412
- return func.call(thisArg, args[0], args[1]);
413
- case 3:
414
- return func.call(thisArg, args[0], args[1], args[2]);
415
- }
416
- return func.apply(thisArg, args);
417
- }
418
- var apply_default = apply;
419
-
420
- // node_modules/lodash-es/_copyArray.js
421
- function copyArray(source, array) {
422
- var index = -1, length = source.length;
423
- array || (array = Array(length));
424
- while (++index < length) {
425
- array[index] = source[index];
426
- }
427
- return array;
428
- }
429
- var copyArray_default = copyArray;
430
-
431
- // node_modules/lodash-es/_shortOut.js
432
- var HOT_COUNT = 800;
433
- var HOT_SPAN = 16;
434
- var nativeNow = Date.now;
435
- function shortOut(func) {
436
- var count = 0, lastCalled = 0;
437
- return function() {
438
- var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
439
- lastCalled = stamp;
440
- if (remaining > 0) {
441
- if (++count >= HOT_COUNT) {
442
- return arguments[0];
443
- }
444
- } else {
445
- count = 0;
446
- }
447
- return func.apply(void 0, arguments);
448
- };
449
- }
450
- var shortOut_default = shortOut;
451
-
452
- // node_modules/lodash-es/constant.js
453
- function constant(value) {
454
- return function() {
455
- return value;
456
- };
457
- }
458
- var constant_default = constant;
459
-
460
- // node_modules/lodash-es/_defineProperty.js
461
- var defineProperty = (function() {
462
- try {
463
- var func = getNative_default(Object, "defineProperty");
464
- func({}, "", {});
465
- return func;
466
- } catch (e) {
467
- }
468
- })();
469
- var defineProperty_default = defineProperty;
470
-
471
- // node_modules/lodash-es/_baseSetToString.js
472
- var baseSetToString = !defineProperty_default ? identity_default : function(func, string) {
473
- return defineProperty_default(func, "toString", {
474
- "configurable": true,
475
- "enumerable": false,
476
- "value": constant_default(string),
477
- "writable": true
478
- });
479
- };
480
- var baseSetToString_default = baseSetToString;
481
-
482
- // node_modules/lodash-es/_setToString.js
483
- var setToString = shortOut_default(baseSetToString_default);
484
- var setToString_default = setToString;
485
-
486
- // node_modules/lodash-es/_isIndex.js
487
- var MAX_SAFE_INTEGER = 9007199254740991;
488
- var reIsUint = /^(?:0|[1-9]\d*)$/;
489
- function isIndex(value, length) {
490
- var type = typeof value;
491
- length = length == null ? MAX_SAFE_INTEGER : length;
492
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
493
- }
494
- var isIndex_default = isIndex;
495
-
496
- // node_modules/lodash-es/_baseAssignValue.js
497
- function baseAssignValue(object, key, value) {
498
- if (key == "__proto__" && defineProperty_default) {
499
- defineProperty_default(object, key, {
500
- "configurable": true,
501
- "enumerable": true,
502
- "value": value,
503
- "writable": true
504
- });
505
- } else {
506
- object[key] = value;
507
- }
508
- }
509
- var baseAssignValue_default = baseAssignValue;
510
-
511
- // node_modules/lodash-es/eq.js
512
- function eq(value, other) {
513
- return value === other || value !== value && other !== other;
514
- }
515
- var eq_default = eq;
516
-
517
- // node_modules/lodash-es/_assignValue.js
518
- var objectProto4 = Object.prototype;
519
- var hasOwnProperty3 = objectProto4.hasOwnProperty;
520
- function assignValue(object, key, value) {
521
- var objValue = object[key];
522
- if (!(hasOwnProperty3.call(object, key) && eq_default(objValue, value)) || value === void 0 && !(key in object)) {
523
- baseAssignValue_default(object, key, value);
524
- }
525
- }
526
- var assignValue_default = assignValue;
527
-
528
- // node_modules/lodash-es/_copyObject.js
529
- function copyObject(source, props, object, customizer) {
530
- var isNew = !object;
531
- object || (object = {});
532
- var index = -1, length = props.length;
533
- while (++index < length) {
534
- var key = props[index];
535
- var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
536
- if (newValue === void 0) {
537
- newValue = source[key];
538
- }
539
- if (isNew) {
540
- baseAssignValue_default(object, key, newValue);
541
- } else {
542
- assignValue_default(object, key, newValue);
543
- }
544
- }
545
- return object;
546
- }
547
- var copyObject_default = copyObject;
548
-
549
- // node_modules/lodash-es/_overRest.js
550
- var nativeMax2 = Math.max;
551
- function overRest(func, start, transform) {
552
- start = nativeMax2(start === void 0 ? func.length - 1 : start, 0);
553
- return function() {
554
- var args = arguments, index = -1, length = nativeMax2(args.length - start, 0), array = Array(length);
555
- while (++index < length) {
556
- array[index] = args[start + index];
557
- }
558
- index = -1;
559
- var otherArgs = Array(start + 1);
560
- while (++index < start) {
561
- otherArgs[index] = args[index];
562
- }
563
- otherArgs[start] = transform(array);
564
- return apply_default(func, this, otherArgs);
565
- };
566
- }
567
- var overRest_default = overRest;
568
-
569
- // node_modules/lodash-es/_baseRest.js
570
- function baseRest(func, start) {
571
- return setToString_default(overRest_default(func, start, identity_default), func + "");
572
- }
573
- var baseRest_default = baseRest;
574
-
575
- // node_modules/lodash-es/isLength.js
576
- var MAX_SAFE_INTEGER2 = 9007199254740991;
577
- function isLength(value) {
578
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
579
- }
580
- var isLength_default = isLength;
581
-
582
- // node_modules/lodash-es/isArrayLike.js
583
- function isArrayLike(value) {
584
- return value != null && isLength_default(value.length) && !isFunction_default(value);
585
- }
586
- var isArrayLike_default = isArrayLike;
587
-
588
- // node_modules/lodash-es/_isIterateeCall.js
589
- function isIterateeCall(value, index, object) {
590
- if (!isObject_default(object)) {
591
- return false;
592
- }
593
- var type = typeof index;
594
- if (type == "number" ? isArrayLike_default(object) && isIndex_default(index, object.length) : type == "string" && index in object) {
595
- return eq_default(object[index], value);
596
- }
597
- return false;
598
- }
599
- var isIterateeCall_default = isIterateeCall;
600
-
601
- // node_modules/lodash-es/_createAssigner.js
602
- function createAssigner(assigner) {
603
- return baseRest_default(function(object, sources) {
604
- var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
605
- customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
606
- if (guard && isIterateeCall_default(sources[0], sources[1], guard)) {
607
- customizer = length < 3 ? void 0 : customizer;
608
- length = 1;
609
- }
610
- object = Object(object);
611
- while (++index < length) {
612
- var source = sources[index];
613
- if (source) {
614
- assigner(object, source, index, customizer);
615
- }
616
- }
617
- return object;
618
- });
619
- }
620
- var createAssigner_default = createAssigner;
621
-
622
- // node_modules/lodash-es/_isPrototype.js
623
- var objectProto5 = Object.prototype;
624
- function isPrototype(value) {
625
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5;
626
- return value === proto;
627
- }
628
- var isPrototype_default = isPrototype;
629
-
630
- // node_modules/lodash-es/_baseTimes.js
631
- function baseTimes(n, iteratee) {
632
- var index = -1, result = Array(n);
633
- while (++index < n) {
634
- result[index] = iteratee(index);
635
- }
636
- return result;
637
- }
638
- var baseTimes_default = baseTimes;
639
-
640
- // node_modules/lodash-es/_baseIsArguments.js
641
- var argsTag = "[object Arguments]";
642
- function baseIsArguments(value) {
643
- return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
644
- }
645
- var baseIsArguments_default = baseIsArguments;
646
-
647
- // node_modules/lodash-es/isArguments.js
648
- var objectProto6 = Object.prototype;
649
- var hasOwnProperty4 = objectProto6.hasOwnProperty;
650
- var propertyIsEnumerable = objectProto6.propertyIsEnumerable;
651
- var isArguments = baseIsArguments_default(/* @__PURE__ */ (function() {
652
- return arguments;
653
- })()) ? baseIsArguments_default : function(value) {
654
- return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
655
- };
656
- var isArguments_default = isArguments;
657
-
658
- // node_modules/lodash-es/stubFalse.js
659
- function stubFalse() {
660
- return false;
661
- }
662
- var stubFalse_default = stubFalse;
663
-
664
- // node_modules/lodash-es/isBuffer.js
665
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
666
- var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
667
- var moduleExports = freeModule && freeModule.exports === freeExports;
668
- var Buffer2 = moduleExports ? root_default.Buffer : void 0;
669
- var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
670
- var isBuffer = nativeIsBuffer || stubFalse_default;
671
- var isBuffer_default = isBuffer;
672
-
673
- // node_modules/lodash-es/_baseIsTypedArray.js
674
- var argsTag2 = "[object Arguments]";
675
- var arrayTag = "[object Array]";
676
- var boolTag = "[object Boolean]";
677
- var dateTag = "[object Date]";
678
- var errorTag = "[object Error]";
679
- var funcTag2 = "[object Function]";
680
- var mapTag = "[object Map]";
681
- var numberTag = "[object Number]";
682
- var objectTag = "[object Object]";
683
- var regexpTag = "[object RegExp]";
684
- var setTag = "[object Set]";
685
- var stringTag = "[object String]";
686
- var weakMapTag = "[object WeakMap]";
687
- var arrayBufferTag = "[object ArrayBuffer]";
688
- var dataViewTag = "[object DataView]";
689
- var float32Tag = "[object Float32Array]";
690
- var float64Tag = "[object Float64Array]";
691
- var int8Tag = "[object Int8Array]";
692
- var int16Tag = "[object Int16Array]";
693
- var int32Tag = "[object Int32Array]";
694
- var uint8Tag = "[object Uint8Array]";
695
- var uint8ClampedTag = "[object Uint8ClampedArray]";
696
- var uint16Tag = "[object Uint16Array]";
697
- var uint32Tag = "[object Uint32Array]";
698
- var typedArrayTags = {};
699
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
700
- typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
701
- function baseIsTypedArray(value) {
702
- return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
703
- }
704
- var baseIsTypedArray_default = baseIsTypedArray;
705
-
706
- // node_modules/lodash-es/_baseUnary.js
707
- function baseUnary(func) {
708
- return function(value) {
709
- return func(value);
710
- };
711
- }
712
- var baseUnary_default = baseUnary;
713
-
714
- // node_modules/lodash-es/_nodeUtil.js
715
- var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
716
- var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
717
- var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
718
- var freeProcess = moduleExports2 && freeGlobal_default.process;
719
- var nodeUtil = (function() {
720
- try {
721
- var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
722
- if (types) {
723
- return types;
724
- }
725
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
726
- } catch (e) {
727
- }
728
- })();
729
- var nodeUtil_default = nodeUtil;
730
-
731
- // node_modules/lodash-es/isTypedArray.js
732
- var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
733
- var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
734
- var isTypedArray_default = isTypedArray;
735
-
736
- // node_modules/lodash-es/_arrayLikeKeys.js
737
- var objectProto7 = Object.prototype;
738
- var hasOwnProperty5 = objectProto7.hasOwnProperty;
739
- function arrayLikeKeys(value, inherited) {
740
- var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length;
741
- for (var key in value) {
742
- if ((inherited || hasOwnProperty5.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
743
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
744
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
745
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
746
- isIndex_default(key, length)))) {
747
- result.push(key);
748
- }
749
- }
750
- return result;
751
- }
752
- var arrayLikeKeys_default = arrayLikeKeys;
753
-
754
- // node_modules/lodash-es/_overArg.js
755
- function overArg(func, transform) {
756
- return function(arg) {
757
- return func(transform(arg));
758
- };
759
- }
760
- var overArg_default = overArg;
761
-
762
- // node_modules/lodash-es/_nativeKeysIn.js
763
- function nativeKeysIn(object) {
764
- var result = [];
765
- if (object != null) {
766
- for (var key in Object(object)) {
767
- result.push(key);
768
- }
769
- }
770
- return result;
771
- }
772
- var nativeKeysIn_default = nativeKeysIn;
773
-
774
- // node_modules/lodash-es/_baseKeysIn.js
775
- var objectProto8 = Object.prototype;
776
- var hasOwnProperty6 = objectProto8.hasOwnProperty;
777
- function baseKeysIn(object) {
778
- if (!isObject_default(object)) {
779
- return nativeKeysIn_default(object);
780
- }
781
- var isProto = isPrototype_default(object), result = [];
782
- for (var key in object) {
783
- if (!(key == "constructor" && (isProto || !hasOwnProperty6.call(object, key)))) {
784
- result.push(key);
785
- }
786
- }
787
- return result;
788
- }
789
- var baseKeysIn_default = baseKeysIn;
790
-
791
- // node_modules/lodash-es/keysIn.js
792
- function keysIn(object) {
793
- return isArrayLike_default(object) ? arrayLikeKeys_default(object, true) : baseKeysIn_default(object);
794
- }
795
- var keysIn_default = keysIn;
796
-
797
- // node_modules/lodash-es/_nativeCreate.js
798
- var nativeCreate = getNative_default(Object, "create");
799
- var nativeCreate_default = nativeCreate;
800
-
801
- // node_modules/lodash-es/_hashClear.js
802
- function hashClear() {
803
- this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
804
- this.size = 0;
805
- }
806
- var hashClear_default = hashClear;
807
-
808
- // node_modules/lodash-es/_hashDelete.js
809
- function hashDelete(key) {
810
- var result = this.has(key) && delete this.__data__[key];
811
- this.size -= result ? 1 : 0;
812
- return result;
813
- }
814
- var hashDelete_default = hashDelete;
815
-
816
- // node_modules/lodash-es/_hashGet.js
817
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
818
- var objectProto9 = Object.prototype;
819
- var hasOwnProperty7 = objectProto9.hasOwnProperty;
820
- function hashGet(key) {
821
- var data = this.__data__;
822
- if (nativeCreate_default) {
823
- var result = data[key];
824
- return result === HASH_UNDEFINED ? void 0 : result;
825
- }
826
- return hasOwnProperty7.call(data, key) ? data[key] : void 0;
827
- }
828
- var hashGet_default = hashGet;
829
-
830
- // node_modules/lodash-es/_hashHas.js
831
- var objectProto10 = Object.prototype;
832
- var hasOwnProperty8 = objectProto10.hasOwnProperty;
833
- function hashHas(key) {
834
- var data = this.__data__;
835
- return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty8.call(data, key);
836
- }
837
- var hashHas_default = hashHas;
838
-
839
- // node_modules/lodash-es/_hashSet.js
840
- var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
841
- function hashSet(key, value) {
842
- var data = this.__data__;
843
- this.size += this.has(key) ? 0 : 1;
844
- data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
845
- return this;
846
- }
847
- var hashSet_default = hashSet;
848
-
849
- // node_modules/lodash-es/_Hash.js
850
- function Hash(entries) {
851
- var index = -1, length = entries == null ? 0 : entries.length;
852
- this.clear();
853
- while (++index < length) {
854
- var entry = entries[index];
855
- this.set(entry[0], entry[1]);
856
- }
857
- }
858
- Hash.prototype.clear = hashClear_default;
859
- Hash.prototype["delete"] = hashDelete_default;
860
- Hash.prototype.get = hashGet_default;
861
- Hash.prototype.has = hashHas_default;
862
- Hash.prototype.set = hashSet_default;
863
- var Hash_default = Hash;
864
-
865
- // node_modules/lodash-es/_listCacheClear.js
866
- function listCacheClear() {
867
- this.__data__ = [];
868
- this.size = 0;
869
- }
870
- var listCacheClear_default = listCacheClear;
871
-
872
- // node_modules/lodash-es/_assocIndexOf.js
873
- function assocIndexOf(array, key) {
874
- var length = array.length;
875
- while (length--) {
876
- if (eq_default(array[length][0], key)) {
877
- return length;
878
- }
879
- }
880
- return -1;
881
- }
882
- var assocIndexOf_default = assocIndexOf;
883
-
884
- // node_modules/lodash-es/_listCacheDelete.js
885
- var arrayProto = Array.prototype;
886
- var splice = arrayProto.splice;
887
- function listCacheDelete(key) {
888
- var data = this.__data__, index = assocIndexOf_default(data, key);
889
- if (index < 0) {
890
- return false;
891
- }
892
- var lastIndex = data.length - 1;
893
- if (index == lastIndex) {
894
- data.pop();
895
- } else {
896
- splice.call(data, index, 1);
897
- }
898
- --this.size;
899
- return true;
900
- }
901
- var listCacheDelete_default = listCacheDelete;
902
-
903
- // node_modules/lodash-es/_listCacheGet.js
904
- function listCacheGet(key) {
905
- var data = this.__data__, index = assocIndexOf_default(data, key);
906
- return index < 0 ? void 0 : data[index][1];
907
- }
908
- var listCacheGet_default = listCacheGet;
909
-
910
- // node_modules/lodash-es/_listCacheHas.js
911
- function listCacheHas(key) {
912
- return assocIndexOf_default(this.__data__, key) > -1;
913
- }
914
- var listCacheHas_default = listCacheHas;
915
-
916
- // node_modules/lodash-es/_listCacheSet.js
917
- function listCacheSet(key, value) {
918
- var data = this.__data__, index = assocIndexOf_default(data, key);
919
- if (index < 0) {
920
- ++this.size;
921
- data.push([key, value]);
922
- } else {
923
- data[index][1] = value;
924
- }
925
- return this;
926
- }
927
- var listCacheSet_default = listCacheSet;
928
-
929
- // node_modules/lodash-es/_ListCache.js
930
- function ListCache(entries) {
931
- var index = -1, length = entries == null ? 0 : entries.length;
932
- this.clear();
933
- while (++index < length) {
934
- var entry = entries[index];
935
- this.set(entry[0], entry[1]);
936
- }
937
- }
938
- ListCache.prototype.clear = listCacheClear_default;
939
- ListCache.prototype["delete"] = listCacheDelete_default;
940
- ListCache.prototype.get = listCacheGet_default;
941
- ListCache.prototype.has = listCacheHas_default;
942
- ListCache.prototype.set = listCacheSet_default;
943
- var ListCache_default = ListCache;
944
-
945
- // node_modules/lodash-es/_Map.js
946
- var Map2 = getNative_default(root_default, "Map");
947
- var Map_default = Map2;
948
-
949
- // node_modules/lodash-es/_mapCacheClear.js
950
- function mapCacheClear() {
951
- this.size = 0;
952
- this.__data__ = {
953
- "hash": new Hash_default(),
954
- "map": new (Map_default || ListCache_default)(),
955
- "string": new Hash_default()
956
- };
957
- }
958
- var mapCacheClear_default = mapCacheClear;
959
-
960
- // node_modules/lodash-es/_isKeyable.js
961
- function isKeyable(value) {
962
- var type = typeof value;
963
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
964
- }
965
- var isKeyable_default = isKeyable;
966
-
967
- // node_modules/lodash-es/_getMapData.js
968
- function getMapData(map, key) {
969
- var data = map.__data__;
970
- return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
971
- }
972
- var getMapData_default = getMapData;
973
-
974
- // node_modules/lodash-es/_mapCacheDelete.js
975
- function mapCacheDelete(key) {
976
- var result = getMapData_default(this, key)["delete"](key);
977
- this.size -= result ? 1 : 0;
978
- return result;
979
- }
980
- var mapCacheDelete_default = mapCacheDelete;
981
-
982
- // node_modules/lodash-es/_mapCacheGet.js
983
- function mapCacheGet(key) {
984
- return getMapData_default(this, key).get(key);
985
- }
986
- var mapCacheGet_default = mapCacheGet;
987
-
988
- // node_modules/lodash-es/_mapCacheHas.js
989
- function mapCacheHas(key) {
990
- return getMapData_default(this, key).has(key);
991
- }
992
- var mapCacheHas_default = mapCacheHas;
993
-
994
- // node_modules/lodash-es/_mapCacheSet.js
995
- function mapCacheSet(key, value) {
996
- var data = getMapData_default(this, key), size = data.size;
997
- data.set(key, value);
998
- this.size += data.size == size ? 0 : 1;
999
- return this;
1000
- }
1001
- var mapCacheSet_default = mapCacheSet;
1002
-
1003
- // node_modules/lodash-es/_MapCache.js
1004
- function MapCache(entries) {
1005
- var index = -1, length = entries == null ? 0 : entries.length;
1006
- this.clear();
1007
- while (++index < length) {
1008
- var entry = entries[index];
1009
- this.set(entry[0], entry[1]);
1010
- }
1011
- }
1012
- MapCache.prototype.clear = mapCacheClear_default;
1013
- MapCache.prototype["delete"] = mapCacheDelete_default;
1014
- MapCache.prototype.get = mapCacheGet_default;
1015
- MapCache.prototype.has = mapCacheHas_default;
1016
- MapCache.prototype.set = mapCacheSet_default;
1017
- var MapCache_default = MapCache;
1018
-
1019
- // node_modules/lodash-es/_getPrototype.js
1020
- var getPrototype = overArg_default(Object.getPrototypeOf, Object);
1021
- var getPrototype_default = getPrototype;
1022
-
1023
- // node_modules/lodash-es/isPlainObject.js
1024
- var objectTag2 = "[object Object]";
1025
- var funcProto3 = Function.prototype;
1026
- var objectProto11 = Object.prototype;
1027
- var funcToString3 = funcProto3.toString;
1028
- var hasOwnProperty9 = objectProto11.hasOwnProperty;
1029
- var objectCtorString = funcToString3.call(Object);
1030
- function isPlainObject(value) {
1031
- if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag2) {
1032
- return false;
1033
- }
1034
- var proto = getPrototype_default(value);
1035
- if (proto === null) {
1036
- return true;
1037
- }
1038
- var Ctor = hasOwnProperty9.call(proto, "constructor") && proto.constructor;
1039
- return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
1040
- }
1041
- var isPlainObject_default = isPlainObject;
1042
-
1043
- // node_modules/lodash-es/_stackClear.js
1044
- function stackClear() {
1045
- this.__data__ = new ListCache_default();
1046
- this.size = 0;
1047
- }
1048
- var stackClear_default = stackClear;
1049
-
1050
- // node_modules/lodash-es/_stackDelete.js
1051
- function stackDelete(key) {
1052
- var data = this.__data__, result = data["delete"](key);
1053
- this.size = data.size;
1054
- return result;
1055
- }
1056
- var stackDelete_default = stackDelete;
1057
-
1058
- // node_modules/lodash-es/_stackGet.js
1059
- function stackGet(key) {
1060
- return this.__data__.get(key);
1061
- }
1062
- var stackGet_default = stackGet;
1063
-
1064
- // node_modules/lodash-es/_stackHas.js
1065
- function stackHas(key) {
1066
- return this.__data__.has(key);
1067
- }
1068
- var stackHas_default = stackHas;
1069
-
1070
- // node_modules/lodash-es/_stackSet.js
1071
- var LARGE_ARRAY_SIZE = 200;
1072
- function stackSet(key, value) {
1073
- var data = this.__data__;
1074
- if (data instanceof ListCache_default) {
1075
- var pairs = data.__data__;
1076
- if (!Map_default || pairs.length < LARGE_ARRAY_SIZE - 1) {
1077
- pairs.push([key, value]);
1078
- this.size = ++data.size;
1079
- return this;
1080
- }
1081
- data = this.__data__ = new MapCache_default(pairs);
1082
- }
1083
- data.set(key, value);
1084
- this.size = data.size;
1085
- return this;
1086
- }
1087
- var stackSet_default = stackSet;
1088
-
1089
- // node_modules/lodash-es/_Stack.js
1090
- function Stack(entries) {
1091
- var data = this.__data__ = new ListCache_default(entries);
1092
- this.size = data.size;
1093
- }
1094
- Stack.prototype.clear = stackClear_default;
1095
- Stack.prototype["delete"] = stackDelete_default;
1096
- Stack.prototype.get = stackGet_default;
1097
- Stack.prototype.has = stackHas_default;
1098
- Stack.prototype.set = stackSet_default;
1099
- var Stack_default = Stack;
1100
-
1101
- // node_modules/lodash-es/_cloneBuffer.js
1102
- var freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports;
1103
- var freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module;
1104
- var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
1105
- var Buffer3 = moduleExports3 ? root_default.Buffer : void 0;
1106
- var allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : void 0;
1107
- function cloneBuffer(buffer, isDeep) {
1108
- if (isDeep) {
1109
- return buffer.slice();
1110
- }
1111
- var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
1112
- buffer.copy(result);
1113
- return result;
1114
- }
1115
- var cloneBuffer_default = cloneBuffer;
1116
-
1117
- // node_modules/lodash-es/_Uint8Array.js
1118
- var Uint8Array2 = root_default.Uint8Array;
1119
- var Uint8Array_default = Uint8Array2;
1120
-
1121
- // node_modules/lodash-es/_cloneArrayBuffer.js
1122
- function cloneArrayBuffer(arrayBuffer) {
1123
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
1124
- new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer));
1125
- return result;
1126
- }
1127
- var cloneArrayBuffer_default = cloneArrayBuffer;
1128
-
1129
- // node_modules/lodash-es/_cloneTypedArray.js
1130
- function cloneTypedArray(typedArray, isDeep) {
1131
- var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer;
1132
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
1133
- }
1134
- var cloneTypedArray_default = cloneTypedArray;
1135
-
1136
- // node_modules/lodash-es/_initCloneObject.js
1137
- function initCloneObject(object) {
1138
- return typeof object.constructor == "function" && !isPrototype_default(object) ? baseCreate_default(getPrototype_default(object)) : {};
1139
- }
1140
- var initCloneObject_default = initCloneObject;
1141
-
1142
- // node_modules/lodash-es/_createBaseFor.js
1143
- function createBaseFor(fromRight) {
1144
- return function(object, iteratee, keysFunc) {
1145
- var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
1146
- while (length--) {
1147
- var key = props[fromRight ? length : ++index];
1148
- if (iteratee(iterable[key], key, iterable) === false) {
1149
- break;
1150
- }
1151
- }
1152
- return object;
1153
- };
1154
- }
1155
- var createBaseFor_default = createBaseFor;
1156
-
1157
- // node_modules/lodash-es/_baseFor.js
1158
- var baseFor = createBaseFor_default();
1159
- var baseFor_default = baseFor;
1160
-
1161
- // node_modules/lodash-es/_assignMergeValue.js
1162
- function assignMergeValue(object, key, value) {
1163
- if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) {
1164
- baseAssignValue_default(object, key, value);
1165
- }
1166
- }
1167
- var assignMergeValue_default = assignMergeValue;
1168
-
1169
- // node_modules/lodash-es/isArrayLikeObject.js
1170
- function isArrayLikeObject(value) {
1171
- return isObjectLike_default(value) && isArrayLike_default(value);
1172
- }
1173
- var isArrayLikeObject_default = isArrayLikeObject;
1174
-
1175
- // node_modules/lodash-es/_safeGet.js
1176
- function safeGet(object, key) {
1177
- if (key === "constructor" && typeof object[key] === "function") {
1178
- return;
1179
- }
1180
- if (key == "__proto__") {
1181
- return;
1182
- }
1183
- return object[key];
1184
- }
1185
- var safeGet_default = safeGet;
1186
-
1187
- // node_modules/lodash-es/toPlainObject.js
1188
- function toPlainObject(value) {
1189
- return copyObject_default(value, keysIn_default(value));
1190
- }
1191
- var toPlainObject_default = toPlainObject;
1192
-
1193
- // node_modules/lodash-es/_baseMergeDeep.js
1194
- function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
1195
- var objValue = safeGet_default(object, key), srcValue = safeGet_default(source, key), stacked = stack.get(srcValue);
1196
- if (stacked) {
1197
- assignMergeValue_default(object, key, stacked);
1198
- return;
1199
- }
1200
- var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
1201
- var isCommon = newValue === void 0;
1202
- if (isCommon) {
1203
- var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue);
1204
- newValue = srcValue;
1205
- if (isArr || isBuff || isTyped) {
1206
- if (isArray_default(objValue)) {
1207
- newValue = objValue;
1208
- } else if (isArrayLikeObject_default(objValue)) {
1209
- newValue = copyArray_default(objValue);
1210
- } else if (isBuff) {
1211
- isCommon = false;
1212
- newValue = cloneBuffer_default(srcValue, true);
1213
- } else if (isTyped) {
1214
- isCommon = false;
1215
- newValue = cloneTypedArray_default(srcValue, true);
1216
- } else {
1217
- newValue = [];
1218
- }
1219
- } else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) {
1220
- newValue = objValue;
1221
- if (isArguments_default(objValue)) {
1222
- newValue = toPlainObject_default(objValue);
1223
- } else if (!isObject_default(objValue) || isFunction_default(objValue)) {
1224
- newValue = initCloneObject_default(srcValue);
1225
- }
1226
- } else {
1227
- isCommon = false;
1228
- }
1229
- }
1230
- if (isCommon) {
1231
- stack.set(srcValue, newValue);
1232
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
1233
- stack["delete"](srcValue);
1234
- }
1235
- assignMergeValue_default(object, key, newValue);
1236
- }
1237
- var baseMergeDeep_default = baseMergeDeep;
1238
-
1239
- // node_modules/lodash-es/_baseMerge.js
1240
- function baseMerge(object, source, srcIndex, customizer, stack) {
1241
- if (object === source) {
1242
- return;
1243
- }
1244
- baseFor_default(source, function(srcValue, key) {
1245
- stack || (stack = new Stack_default());
1246
- if (isObject_default(srcValue)) {
1247
- baseMergeDeep_default(object, source, key, srcIndex, baseMerge, customizer, stack);
1248
- } else {
1249
- var newValue = customizer ? customizer(safeGet_default(object, key), srcValue, key + "", object, source, stack) : void 0;
1250
- if (newValue === void 0) {
1251
- newValue = srcValue;
1252
- }
1253
- assignMergeValue_default(object, key, newValue);
1254
- }
1255
- }, keysIn_default);
1256
- }
1257
- var baseMerge_default = baseMerge;
1258
-
1259
- // node_modules/lodash-es/merge.js
1260
- var merge = createAssigner_default(function(object, source, srcIndex) {
1261
- baseMerge_default(object, source, srcIndex);
1262
- });
1263
- var merge_default = merge;
1264
-
1265
296
  // src/utils/promise.ts
1266
297
  function sleep(ms) {
1267
298
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -1272,15 +303,30 @@ var SignalBroker = class _SignalBroker {
1272
303
  constructor() {
1273
304
  this.debug = false;
1274
305
  this.verbose = false;
1275
- this.debouncedEmitters = /* @__PURE__ */ new Map();
1276
- this.squashedEmitters = /* @__PURE__ */ new Map();
1277
- this.squashedContexts = /* @__PURE__ */ new Map();
1278
306
  this.throttleEmitters = /* @__PURE__ */ new Map();
1279
307
  this.throttleQueues = /* @__PURE__ */ new Map();
1280
308
  // TODO: Signals should be a class with a the observers, registered flag and other data.
1281
309
  this.signalObservers = /* @__PURE__ */ new Map();
1282
310
  this.emittedSignalsRegistry = /* @__PURE__ */ new Set();
311
+ // ── Flush Strategy Management ───────────────────────────────────────
312
+ this.flushStrategies = /* @__PURE__ */ new Map();
313
+ this.strategyData = /* @__PURE__ */ new Map();
314
+ this.strategyTimers = /* @__PURE__ */ new Map();
315
+ this.isStrategyFlushing = /* @__PURE__ */ new Map();
316
+ this.defaultStrategyName = "default";
317
+ // ── Squash (Multi-strategy) ─────────────────────────────────────────
318
+ this.MAX_FLUSH_DURATION_MS = 120;
319
+ // ── Schedule (Bucketed) ─────────────────────────────────────────────
320
+ this.scheduledBuckets = /* @__PURE__ */ new Map();
321
+ this.scheduleTimer = null;
322
+ // ── Debounce (with cap) ─────────────────────────────────────────────
323
+ this.debouncedEmitters = /* @__PURE__ */ new Map();
324
+ this.MAX_DEBOUNCERS = 5e3;
1283
325
  this.addSignal("meta.signal_broker.added");
326
+ this.setFlushStrategy(this.defaultStrategyName, {
327
+ intervalMs: 350,
328
+ maxBatchSize: 80
329
+ });
1284
330
  }
1285
331
  static get instance() {
1286
332
  if (!this.instance_) {
@@ -1367,57 +413,224 @@ var SignalBroker = class _SignalBroker {
1367
413
  }
1368
414
  ).doOn("meta.signal.registered");
1369
415
  }
1370
- /**
1371
- * Observes a signal with a routine/task.
1372
- * @param signal The signal (e.g., 'domain.action', 'domain.*' for wildcards).
1373
- * @param routineOrTask The observer.
1374
- * @edge Duplicates ignored; supports wildcards for broad listening.
1375
- */
1376
- observe(signal, routineOrTask) {
1377
- this.addSignal(signal);
1378
- this.signalObservers.get(signal).tasks.add(routineOrTask);
416
+ setFlushStrategy(name, config) {
417
+ if (config.intervalMs < 50) {
418
+ throw new Error("intervalMs must be >= 50ms for performance reasons");
419
+ }
420
+ this.flushStrategies.set(name, {
421
+ intervalMs: config.intervalMs,
422
+ maxBatchSize: config.maxBatchSize ?? 80
423
+ });
424
+ if (!this.strategyData.has(name)) {
425
+ this.strategyData.set(name, /* @__PURE__ */ new Map());
426
+ this.strategyTimers.set(name, null);
427
+ this.isStrategyFlushing.set(name, false);
428
+ }
1379
429
  }
1380
- registerEmittedSignal(signal) {
1381
- this.emittedSignalsRegistry.add(signal);
430
+ updateFlushStrategy(name, config) {
431
+ if (!this.flushStrategies.get(name)) {
432
+ return this.setFlushStrategy(name, config);
433
+ }
434
+ this.flushStrategies.set(name, config);
1382
435
  }
1383
- /**
1384
- * Unsubscribes a routine/task from a signal.
1385
- * @param signal The signal.
1386
- * @param routineOrTask The observer.
1387
- * @edge Removes all instances if duplicate; deletes if empty.
1388
- */
1389
- unsubscribe(signal, routineOrTask) {
1390
- const obs = this.signalObservers.get(signal);
1391
- if (obs) {
1392
- obs.tasks.delete(routineOrTask);
1393
- if (obs.tasks.size === 0) {
1394
- this.signalObservers.delete(signal);
436
+ removeFlushStrategy(name) {
437
+ if (name === this.defaultStrategyName) {
438
+ throw new Error("Cannot remove default strategy");
439
+ }
440
+ const timer = this.strategyTimers.get(name);
441
+ if (timer) clearTimeout(timer);
442
+ this.strategyTimers.delete(name);
443
+ this.strategyData.delete(name);
444
+ this.isStrategyFlushing.delete(name);
445
+ this.flushStrategies.delete(name);
446
+ }
447
+ getFlushStrategies() {
448
+ return Object.fromEntries(this.flushStrategies);
449
+ }
450
+ squash(signal, context, options = { squash: true }) {
451
+ if (!options.squash) {
452
+ this.emit(signal, context, options);
453
+ return;
454
+ }
455
+ const strategyName = options.flushStrategy ?? this.defaultStrategyName;
456
+ const strategy = this.flushStrategies.get(strategyName);
457
+ if (!strategy) {
458
+ console.warn(
459
+ `Unknown flush strategy '${strategyName}', falling back to default`
460
+ );
461
+ return this.squash(signal, context, {
462
+ ...options,
463
+ flushStrategy: this.defaultStrategyName
464
+ });
465
+ }
466
+ const squashId = options.squashId ?? signal;
467
+ let groups = this.strategyData.get(strategyName);
468
+ let data = groups.get(squashId);
469
+ if (!data) {
470
+ data = { signal, contexts: [] };
471
+ groups.set(squashId, data);
472
+ }
473
+ data.contexts.push(context);
474
+ if (data.contexts.length >= strategy.maxBatchSize) {
475
+ this.flushGroup(strategyName, squashId, options);
476
+ return;
477
+ }
478
+ if (!this.strategyTimers.get(strategyName) && !this.isStrategyFlushing.get(strategyName)) {
479
+ this.strategyTimers.set(
480
+ strategyName,
481
+ setTimeout(() => this.flushStrategy(strategyName), strategy.intervalMs)
482
+ );
483
+ }
484
+ }
485
+ flushGroup(strategyName, squashId, options) {
486
+ const groups = this.strategyData.get(strategyName);
487
+ if (!groups) return;
488
+ const data = groups.get(squashId);
489
+ if (!data || data.contexts.length === 0) return;
490
+ const start = performance.now();
491
+ const merged = options.mergeFunction ? options.mergeFunction(data.contexts[0], ...data.contexts.slice(1)) : Object.assign({}, ...data.contexts);
492
+ groups.delete(squashId);
493
+ this.emit(data.signal, merged, { ...options, squash: false });
494
+ const duration = performance.now() - start;
495
+ if (duration > this.MAX_FLUSH_DURATION_MS) {
496
+ console.warn(
497
+ `Squash flush for ${data.signal} in group ${squashId} took ${duration.toFixed(1)}ms`
498
+ );
499
+ }
500
+ }
501
+ flushStrategy(strategyName) {
502
+ this.strategyTimers.set(strategyName, null);
503
+ this.isStrategyFlushing.set(strategyName, true);
504
+ const groups = this.strategyData.get(strategyName);
505
+ if (!groups || groups.size === 0) {
506
+ this.isStrategyFlushing.set(strategyName, false);
507
+ return;
508
+ }
509
+ const keys = Array.from(groups.keys());
510
+ for (const squashId of keys) {
511
+ if (groups.has(squashId)) {
512
+ this.flushGroup(strategyName, squashId, {});
1395
513
  }
1396
514
  }
515
+ this.isStrategyFlushing.set(strategyName, false);
516
+ if (groups.size > 0) {
517
+ const strategy = this.flushStrategies.get(strategyName);
518
+ this.strategyTimers.set(
519
+ strategyName,
520
+ setTimeout(() => this.flushStrategy(strategyName), strategy.intervalMs)
521
+ );
522
+ }
523
+ }
524
+ clearSquashState() {
525
+ for (const [name, timer] of this.strategyTimers.entries()) {
526
+ if (timer) clearTimeout(timer);
527
+ }
528
+ this.strategyTimers.clear();
529
+ this.strategyData.clear();
530
+ this.isStrategyFlushing.clear();
1397
531
  }
1398
- /**
1399
- * Schedules a signal to be emitted after a specified delay or at an exact date and time.
1400
- *
1401
- * @param {string} signal - The name of the signal to be emitted.
1402
- * @param {AnyObject} context - The context to be passed along with the signal.
1403
- * @param options
1404
- * @return {AbortController} An AbortController instance that can be used to cancel the scheduled signal emission.
1405
- */
1406
532
  schedule(signal, context, options = { delayMs: 6e4 }) {
1407
- let delay = options.delayMs;
1408
- if (options.exactDateTime != null) {
533
+ let delay = options.delayMs ?? 0;
534
+ if (options.exactDateTime) {
1409
535
  delay = options.exactDateTime.getTime() - Date.now();
1410
536
  }
1411
- delay = Math.max(0, delay ?? 0);
537
+ delay = Math.max(0, delay);
538
+ const bucketKey = Math.ceil(delay / 100) * 100;
539
+ let bucket = this.scheduledBuckets.get(bucketKey);
540
+ if (!bucket) {
541
+ bucket = [];
542
+ this.scheduledBuckets.set(bucketKey, bucket);
543
+ }
544
+ bucket.push({ signal, context });
1412
545
  const controller = new AbortController();
1413
- const { signal: signalController } = controller;
1414
- const tick = () => this.emit(signal, context);
1415
- const timerId = setTimeout(() => {
1416
- if (!signalController.aborted) tick();
1417
- }, delay);
1418
- signalController.addEventListener("abort", () => clearTimeout(timerId));
546
+ if (!this.scheduleTimer) {
547
+ this.scheduleTimer = setTimeout(() => this.flushScheduled(), 50);
548
+ }
1419
549
  return controller;
1420
550
  }
551
+ flushScheduled() {
552
+ this.scheduleTimer = null;
553
+ const now2 = Date.now();
554
+ const toProcess = [];
555
+ for (const [bucketKey, items] of this.scheduledBuckets.entries()) {
556
+ const bucketTime = bucketKey;
557
+ if (now2 >= bucketTime - 150) {
558
+ toProcess.push([bucketKey, items]);
559
+ }
560
+ }
561
+ for (const [key, items] of toProcess) {
562
+ this.scheduledBuckets.delete(key);
563
+ for (const item of items) {
564
+ this.emit(item.signal, item.context);
565
+ }
566
+ }
567
+ if (this.scheduledBuckets.size > 0) {
568
+ this.scheduleTimer = setTimeout(() => this.flushScheduled(), 50);
569
+ }
570
+ }
571
+ debounce(signal, context, options = { delayMs: 500 }) {
572
+ if (this.debouncedEmitters.size > this.MAX_DEBOUNCERS) {
573
+ console.warn("Max debouncers reached - evicting oldest");
574
+ const oldestKey = this.debouncedEmitters.keys().next().value;
575
+ if (oldestKey) {
576
+ const entry2 = this.debouncedEmitters.get(oldestKey);
577
+ entry2.debouncedFn.flush();
578
+ this.debouncedEmitters.delete(oldestKey);
579
+ }
580
+ }
581
+ const delay = options.delayMs ?? 300;
582
+ const key = signal;
583
+ let entry = this.debouncedEmitters.get(key);
584
+ if (!entry) {
585
+ const debouncedFn = debounce_default(
586
+ (ctx) => {
587
+ this.emit(signal, ctx);
588
+ entry.idleTimeout = setTimeout(() => {
589
+ this.debouncedEmitters.delete(key);
590
+ }, delay * 4);
591
+ },
592
+ delay,
593
+ { leading: false, trailing: true }
594
+ );
595
+ entry = { debouncedFn, idleTimeout: null };
596
+ this.debouncedEmitters.set(key, entry);
597
+ }
598
+ if (entry.idleTimeout) {
599
+ clearTimeout(entry.idleTimeout);
600
+ entry.idleTimeout = null;
601
+ }
602
+ entry.debouncedFn(context);
603
+ }
604
+ // ── Existing throttle, interval, etc. remain unchanged ──────────────
605
+ throttle(signal, context, options = { delayMs: 1e3 }) {
606
+ let { groupId, delayMs = 300 } = options;
607
+ if (!groupId) {
608
+ groupId = signal;
609
+ }
610
+ if (!this.throttleQueues.has(groupId)) {
611
+ this.throttleQueues.set(groupId, []);
612
+ }
613
+ const queue = this.throttleQueues.get(groupId);
614
+ queue.push([signal, context]);
615
+ if (!this.throttleEmitters.has(groupId)) {
616
+ this.throttleEmitters.set(groupId, async () => {
617
+ while (queue.length > 0) {
618
+ let batchSize = options.throttleBatch ?? 1;
619
+ if (batchSize > queue.length) {
620
+ batchSize = queue.length;
621
+ }
622
+ for (let i = 0; i < batchSize; i++) {
623
+ const [nextSignal, nextContext] = queue.shift();
624
+ this.emit(nextSignal, nextContext);
625
+ }
626
+ await sleep(delayMs);
627
+ }
628
+ this.throttleEmitters.delete(groupId);
629
+ this.throttleQueues.delete(groupId);
630
+ });
631
+ this.throttleEmitters.get(groupId)();
632
+ }
633
+ }
1421
634
  /**
1422
635
  * Emits `signal` repeatedly with a fixed interval.
1423
636
  *
@@ -1464,90 +677,6 @@ var SignalBroker = class _SignalBroker {
1464
677
  }
1465
678
  };
1466
679
  }
1467
- debounce(signal, context, options = { delayMs: 500 }) {
1468
- let debouncedEmitter = this.debouncedEmitters.get(signal);
1469
- if (!debouncedEmitter) {
1470
- this.debouncedEmitters.set(
1471
- signal,
1472
- debounce_default((ctx) => {
1473
- this.emit(signal, ctx);
1474
- }, options.delayMs ?? 300)
1475
- );
1476
- debouncedEmitter = this.debouncedEmitters.get(signal);
1477
- }
1478
- debouncedEmitter(context);
1479
- }
1480
- throttle(signal, context, options = { delayMs: 1e3 }) {
1481
- let { groupId, delayMs = 300 } = options;
1482
- if (!groupId) {
1483
- groupId = signal;
1484
- }
1485
- if (!this.throttleQueues.has(groupId)) {
1486
- this.throttleQueues.set(groupId, []);
1487
- }
1488
- const queue = this.throttleQueues.get(groupId);
1489
- queue.push([signal, context]);
1490
- if (!this.throttleEmitters.has(groupId)) {
1491
- this.throttleEmitters.set(groupId, async () => {
1492
- while (queue.length > 0) {
1493
- let batchSize = options.throttleBatch ?? 1;
1494
- if (batchSize > queue.length) {
1495
- batchSize = queue.length;
1496
- }
1497
- for (let i = 0; i < batchSize; i++) {
1498
- const [nextSignal, nextContext] = queue.shift();
1499
- this.emit(nextSignal, nextContext);
1500
- }
1501
- await sleep(delayMs);
1502
- }
1503
- this.throttleEmitters.delete(groupId);
1504
- this.throttleQueues.delete(groupId);
1505
- });
1506
- this.throttleEmitters.get(groupId)();
1507
- }
1508
- }
1509
- /**
1510
- * Aggregates and debounces multiple events with the same identifier to minimize redundant operations.
1511
- *
1512
- * @param {string} signal - The identifier for the event being emitted.
1513
- * @param {AnyObject} context - The context data associated with the event.
1514
- * @param {Object} [options] - Configuration options for handling the squashed event.
1515
- * @param {boolean} [options.squash=true] - Whether the event should be squashed.
1516
- * @param {string|null} [options.squashId=null] - A unique identifier for the squashed group of events. Defaults to the signal if null.
1517
- * @param {function|null} [options.mergeFunction=null] - A custom merge function that combines old and new contexts. If null, a default merge is used.
1518
- * @return {void} Does not return a value.
1519
- */
1520
- squash(signal, context, options = { squash: true }) {
1521
- let { squashId, delayMs = 300 } = options;
1522
- if (!squashId) {
1523
- squashId = signal;
1524
- }
1525
- if (!this.squashedEmitters.has(squashId)) {
1526
- this.squashedEmitters.set(
1527
- squashId,
1528
- debounce_default(() => {
1529
- options.squash = false;
1530
- this.emit(
1531
- signal,
1532
- options.mergeFunction ? options.mergeFunction(
1533
- this.squashedContexts.get(squashId)[0],
1534
- ...this.squashedContexts.get(squashId).slice(1)
1535
- ) : merge_default(
1536
- this.squashedContexts.get(squashId)[0],
1537
- ...this.squashedContexts.get(squashId).slice(1)
1538
- ),
1539
- options
1540
- );
1541
- this.squashedEmitters.delete(squashId);
1542
- this.squashedContexts.delete(squashId);
1543
- }, delayMs ?? 300)
1544
- );
1545
- this.squashedContexts.set(squashId, [context]);
1546
- } else {
1547
- this.squashedContexts.get(squashId)?.push(context);
1548
- }
1549
- this.squashedEmitters.get(squashId)();
1550
- }
1551
680
  /**
1552
681
  * Emits a signal with the specified context, triggering any associated handlers for that signal.
1553
682
  *
@@ -1721,6 +850,34 @@ var SignalBroker = class _SignalBroker {
1721
850
  this.emit("meta.signal_broker.added", { signalName: _signal });
1722
851
  }
1723
852
  }
853
+ /**
854
+ * Observes a signal with a routine/task.
855
+ * @param signal The signal (e.g., 'domain.action', 'domain.*' for wildcards).
856
+ * @param routineOrTask The observer.
857
+ * @edge Duplicates ignored; supports wildcards for broad listening.
858
+ */
859
+ observe(signal, routineOrTask) {
860
+ this.addSignal(signal);
861
+ this.signalObservers.get(signal).tasks.add(routineOrTask);
862
+ }
863
+ registerEmittedSignal(signal) {
864
+ this.emittedSignalsRegistry.add(signal);
865
+ }
866
+ /**
867
+ * Unsubscribes a routine/task from a signal.
868
+ * @param signal The signal.
869
+ * @param routineOrTask The observer.
870
+ * @edge Removes all instances if duplicate; deletes if empty.
871
+ */
872
+ unsubscribe(signal, routineOrTask) {
873
+ const obs = this.signalObservers.get(signal);
874
+ if (obs) {
875
+ obs.tasks.delete(routineOrTask);
876
+ if (obs.tasks.size === 0) {
877
+ this.signalObservers.delete(signal);
878
+ }
879
+ }
880
+ }
1724
881
  /**
1725
882
  * Lists all observed signals.
1726
883
  * @returns Array of signals.
@@ -1735,6 +892,10 @@ var SignalBroker = class _SignalBroker {
1735
892
  this.signalObservers.clear();
1736
893
  this.emittedSignalsRegistry.clear();
1737
894
  }
895
+ shutdown() {
896
+ this.clearSquashState();
897
+ this.reset();
898
+ }
1738
899
  };
1739
900
 
1740
901
  // src/engine/GraphRunner.ts
@@ -3488,7 +2649,7 @@ var Task = class _Task extends SignalEmitter {
3488
2649
  * @param {number} [retryDelayMax=0] - The maximum delay (in milliseconds) allowed between retries.
3489
2650
  * @param {number} [retryDelayFactor=1] - The factor by which the retry delay increases after each attempt.
3490
2651
  */
3491
- constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false, isSubMeta = false, isHidden = false, getTagCallback = void 0, inputSchema = void 0, validateInputContext = false, outputSchema = void 0, validateOutputContext = false, retryCount = 0, retryDelay = 0, retryDelayMax = 0, retryDelayFactor = 1) {
2652
+ constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false, isSubMeta = false, isHidden = false, getTagCallback = void 0, inputSchema = { type: "object" }, validateInputContext = false, outputSchema = { type: "object" }, validateOutputContext = false, retryCount = 0, retryDelay = 0, retryDelayMax = 0, retryDelayFactor = 1) {
3492
2653
  super(isSubMeta || isHidden);
3493
2654
  this.version = 1;
3494
2655
  this.isMeta = false;
@@ -3500,9 +2661,9 @@ var Task = class _Task extends SignalEmitter {
3500
2661
  this.isDeputy = false;
3501
2662
  this.isEphemeral = false;
3502
2663
  this.isDebounce = false;
3503
- this.inputContextSchema = void 0;
2664
+ this.inputContextSchema = { type: "object" };
3504
2665
  this.validateInputContext = false;
3505
- this.outputContextSchema = void 0;
2666
+ this.outputContextSchema = { type: "object" };
3506
2667
  this.validateOutputContext = false;
3507
2668
  this.retryCount = 0;
3508
2669
  this.retryDelay = 0;
@@ -4264,8 +3425,12 @@ var Task = class _Task extends SignalEmitter {
4264
3425
  this.handlesIntents.add(intentName);
4265
3426
  Cadenza.inquiryBroker.observe(intentName, this);
4266
3427
  const intent = Cadenza.inquiryBroker.intents.get(intentName);
4267
- this.inputContextSchema = intent?.input;
4268
- this.outputContextSchema = intent?.output;
3428
+ if (intent?.input) {
3429
+ this.inputContextSchema = intent.input;
3430
+ }
3431
+ if (intent?.output) {
3432
+ this.outputContextSchema = intent.output;
3433
+ }
4269
3434
  }
4270
3435
  return this;
4271
3436
  }
@@ -5264,10 +4429,9 @@ var GraphRunStrategy = class {
5264
4429
  // src/engine/ThrottleEngine.ts
5265
4430
  var ThrottleEngine = class _ThrottleEngine {
5266
4431
  constructor() {
5267
- this.queues = {};
5268
- this.runningCounts = {};
5269
- this.maxConcurrencyPerTag = {};
5270
- this.functionIdToPromiseResolve = {};
4432
+ this.tagState = /* @__PURE__ */ new Map();
4433
+ this.nextId = 0;
4434
+ this.pendingResolves = /* @__PURE__ */ new Map();
5271
4435
  }
5272
4436
  static get instance() {
5273
4437
  if (!this.instance_) {
@@ -5275,11 +4439,24 @@ var ThrottleEngine = class _ThrottleEngine {
5275
4439
  }
5276
4440
  return this.instance_;
5277
4441
  }
4442
+ getTagState(tag) {
4443
+ let state = this.tagState.get(tag);
4444
+ if (!state) {
4445
+ state = {
4446
+ queue: [],
4447
+ runningCount: 0,
4448
+ maxConcurrency: 1
4449
+ };
4450
+ this.tagState.set(tag, state);
4451
+ }
4452
+ return state;
4453
+ }
5278
4454
  /**
5279
4455
  * Set a custom concurrency limit for a specific tag
5280
4456
  */
5281
4457
  setConcurrencyLimit(tag, limit) {
5282
- this.maxConcurrencyPerTag[tag] = limit;
4458
+ const state = this.getTagState(tag);
4459
+ state.maxConcurrency = limit;
5283
4460
  }
5284
4461
  /**
5285
4462
  * Manages the execution of a function `fn` applied on a specified node `node` with controlled concurrency for a given tag.
@@ -5291,13 +4468,12 @@ var ThrottleEngine = class _ThrottleEngine {
5291
4468
  * @return {Promise<GraphNode[]>} A promise resolving to an array of GraphNode objects once the throttled function execution completes.
5292
4469
  */
5293
4470
  throttle(fn, node, tag = "default") {
5294
- var _a, _b;
4471
+ const state = this.getTagState(tag);
4472
+ const id = this.nextId++;
5295
4473
  const functionPromise = new Promise((resolve) => {
5296
- this.functionIdToPromiseResolve[node.id] = resolve;
4474
+ this.pendingResolves.set(id, resolve);
5297
4475
  });
5298
- (_a = this.queues)[tag] ?? (_a[tag] = []);
5299
- this.queues[tag].push([fn, node]);
5300
- (_b = this.maxConcurrencyPerTag)[tag] ?? (_b[tag] = 1);
4476
+ state.queue.push([fn, node, id]);
5301
4477
  this.processQueue(tag);
5302
4478
  return functionPromise;
5303
4479
  }
@@ -5308,34 +4484,44 @@ var ThrottleEngine = class _ThrottleEngine {
5308
4484
  * @return {void} Does not return a value; it processes tasks asynchronously and manages state internally.
5309
4485
  */
5310
4486
  processQueue(tag) {
5311
- const maxAllowed = this.maxConcurrencyPerTag[tag];
5312
- while ((this.queues[tag]?.length ?? 0) > 0 && (this.runningCounts[tag] ?? 0) < maxAllowed) {
5313
- this.runningCounts[tag] = (this.runningCounts[tag] || 0) + 1;
5314
- const item = this.queues[tag].shift();
5315
- this.process(item).then(() => {
5316
- this.runningCounts[tag]--;
5317
- this.processQueue(tag);
5318
- });
5319
- }
5320
- if ((this.queues[tag]?.length ?? 0) === 0 && this.runningCounts[tag] === 0) {
5321
- delete this.queues[tag];
5322
- delete this.runningCounts[tag];
5323
- }
4487
+ const tagData = this.tagState.get(tag);
4488
+ if (!tagData) return;
4489
+ const maxAllowed = tagData.maxConcurrency;
4490
+ const processNext = () => {
4491
+ while (tagData.queue.length > 0 && tagData.runningCount < maxAllowed) {
4492
+ tagData.runningCount++;
4493
+ const item = tagData.queue.shift();
4494
+ this.process(item).catch(() => []).finally(() => {
4495
+ tagData.runningCount--;
4496
+ processNext();
4497
+ });
4498
+ }
4499
+ if (tagData.queue.length === 0 && tagData.runningCount === 0) {
4500
+ }
4501
+ };
4502
+ processNext();
5324
4503
  }
5325
4504
  /**
5326
4505
  * Processes a given item consisting of a function and a graph node.
5327
4506
  *
5328
- * @param {Array} item - An array where the first element is a processing function and the second element is a graph node.
4507
+ * @param {Array} item - An array where the first element is a processing function, the second element is a graph node, and the third is the unique ID.
5329
4508
  * @param {Function} item[0] - The function to process the graph node.
5330
4509
  * @param {GraphNode} item[1] - The graph node to be processed.
4510
+ * @param {number} item[2] - The unique ID for promise resolution.
5331
4511
  * @return {Promise<void>} A promise that resolves when the processing and cleanup are complete.
5332
4512
  */
5333
4513
  async process(item) {
5334
4514
  const fn = item[0];
5335
4515
  const node = item[1];
5336
- const context = await fn(node);
5337
- this.functionIdToPromiseResolve[node.id](context);
5338
- delete this.functionIdToPromiseResolve[node.id];
4516
+ const id = item[2];
4517
+ try {
4518
+ const context = await fn(node);
4519
+ this.pendingResolves.get(id)?.(context);
4520
+ } catch (e) {
4521
+ this.pendingResolves.get(id)?.([]);
4522
+ } finally {
4523
+ this.pendingResolves.delete(id);
4524
+ }
5339
4525
  }
5340
4526
  };
5341
4527
 
@@ -5630,16 +4816,16 @@ var InquiryBroker = class _InquiryBroker extends SignalEmitter {
5630
4816
  this.addIntent({
5631
4817
  name: inquiry,
5632
4818
  description: "",
5633
- input: void 0,
5634
- output: void 0
4819
+ input: { type: "object" },
4820
+ output: { type: "object" }
5635
4821
  });
5636
- this.emit("meta.inquiry_broker.added", { inquiryName: inquiry });
5637
4822
  }
5638
4823
  }
5639
4824
  addIntent(intent) {
5640
4825
  if (!this.intents.has(intent.name)) {
5641
4826
  this.validateInquiryName(intent.name);
5642
4827
  this.intents.set(intent.name, intent);
4828
+ this.emit("meta.inquiry_broker.added", { data: { ...intent } });
5643
4829
  } else {
5644
4830
  const currentIntent = this.intents.get(intent.name);
5645
4831
  if (currentIntent.description !== intent.description) {
@@ -5666,6 +4852,7 @@ var InquiryBroker = class _InquiryBroker extends SignalEmitter {
5666
4852
  return Promise.resolve({});
5667
4853
  }
5668
4854
  return new Promise((resolve) => {
4855
+ this.emit("meta.inquiry_broker.inquire", {});
5669
4856
  let joinedContext = {};
5670
4857
  const pendingTasks = Array.from(tasks).map((task) => task.name);
5671
4858
  const resolveTasks = [];
@@ -5869,7 +5056,7 @@ var Cadenza = class {
5869
5056
  return this.registry?.routines.get(routineName);
5870
5057
  }
5871
5058
  static defineIntent(intent) {
5872
- this.inquiryBroker?.intents.set(intent.name, intent);
5059
+ this.inquiryBroker?.addIntent(intent);
5873
5060
  return intent;
5874
5061
  }
5875
5062
  static async inquire(inquiry, context, options) {
@@ -6427,17 +5614,4 @@ var index_default = Cadenza;
6427
5614
  SignalEmitter,
6428
5615
  Task
6429
5616
  });
6430
- /*! Bundled license information:
6431
-
6432
- lodash-es/lodash.js:
6433
- (**
6434
- * @license
6435
- * Lodash (Custom Build) <https://lodash.com/>
6436
- * Build: `lodash modularize exports="es" -o ./`
6437
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
6438
- * Released under MIT license <https://lodash.com/license>
6439
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
6440
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
6441
- *)
6442
- */
6443
5617
  //# sourceMappingURL=index.js.map