@xpert-ai/chatkit-types 0.0.4 → 0.0.5

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
@@ -1,10 +1,17 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
4
+ };
2
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
6
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- var _a;
5
- var __defProp2 = Object.defineProperty;
7
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
+ var _a, _collection, _storages, _SignalArray_instances, readStorageFor_fn, dirtyStorageFor_fn;
12
+ var __defProp$1 = Object.defineProperty;
6
13
  var __export = (target, all) => {
7
- for (var name in all) __defProp2(target, name, {
14
+ for (var name in all) __defProp$1(target, name, {
8
15
  get: all[name],
9
16
  enumerable: true
10
17
  });
@@ -793,6 +800,1325 @@ function isToolMessageChunk(x) {
793
800
  function isClientToolRequest(value) {
794
801
  return value && Array.isArray(value.clientToolCalls);
795
802
  }
803
+ const eventInit = {
804
+ bubbles: true,
805
+ cancelable: true,
806
+ composed: true
807
+ };
808
+ const _StateEvent = class _StateEvent extends CustomEvent {
809
+ constructor(payload) {
810
+ super(_StateEvent.eventName, { detail: payload, ...eventInit });
811
+ this.payload = payload;
812
+ }
813
+ };
814
+ _StateEvent.eventName = "a2uiaction";
815
+ let StateEvent = _StateEvent;
816
+ const opacityBehavior = `
817
+ &:not([disabled]) {
818
+ cursor: pointer;
819
+ opacity: var(--opacity, 0);
820
+ transition: opacity var(--speed, 0.2s) cubic-bezier(0, 0, 0.3, 1);
821
+
822
+ &:hover,
823
+ &:focus {
824
+ opacity: 1;
825
+ }
826
+ }`;
827
+ `
828
+ ${new Array(21).fill(0).map((_, idx) => {
829
+ return `.behavior-ho-${idx * 5} {
830
+ --opacity: ${idx / 20};
831
+ ${opacityBehavior}
832
+ }`;
833
+ }).join("\n")}
834
+
835
+ .behavior-o-s {
836
+ overflow: scroll;
837
+ }
838
+
839
+ .behavior-o-a {
840
+ overflow: auto;
841
+ }
842
+
843
+ .behavior-o-h {
844
+ overflow: hidden;
845
+ }
846
+
847
+ .behavior-sw-n {
848
+ scrollbar-width: none;
849
+ }
850
+ `;
851
+ const grid = 4;
852
+ `
853
+ ${new Array(25).fill(0).map((_, idx) => {
854
+ return `
855
+ .border-bw-${idx} { border-width: ${idx}px; }
856
+ .border-btw-${idx} { border-top-width: ${idx}px; }
857
+ .border-bbw-${idx} { border-bottom-width: ${idx}px; }
858
+ .border-blw-${idx} { border-left-width: ${idx}px; }
859
+ .border-brw-${idx} { border-right-width: ${idx}px; }
860
+
861
+ .border-ow-${idx} { outline-width: ${idx}px; }
862
+ .border-br-${idx} { border-radius: ${idx * grid}px; overflow: hidden;}`;
863
+ }).join("\n")}
864
+
865
+ .border-br-50pc {
866
+ border-radius: 50%;
867
+ }
868
+
869
+ .border-bs-s {
870
+ border-style: solid;
871
+ }
872
+ `;
873
+ const shades = [
874
+ 0,
875
+ 5,
876
+ 10,
877
+ 15,
878
+ 20,
879
+ 25,
880
+ 30,
881
+ 35,
882
+ 40,
883
+ 50,
884
+ 60,
885
+ 70,
886
+ 80,
887
+ 90,
888
+ 95,
889
+ 98,
890
+ 99,
891
+ 100
892
+ ];
893
+ function toProp(key) {
894
+ if (key.startsWith("nv")) {
895
+ return `--nv-${key.slice(2)}`;
896
+ }
897
+ return `--${key[0]}-${key.slice(1)}`;
898
+ }
899
+ const color = (src) => `
900
+ ${src.map((key) => {
901
+ const inverseKey = getInverseKey(key);
902
+ return `.color-bc-${key} { border-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`;
903
+ }).join("\n")}
904
+
905
+ ${src.map((key) => {
906
+ const inverseKey = getInverseKey(key);
907
+ const vals = [
908
+ `.color-bgc-${key} { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`,
909
+ `.color-bbgc-${key}::backdrop { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`
910
+ ];
911
+ for (let o = 0.1; o < 1; o += 0.1) {
912
+ vals.push(`.color-bbgc-${key}_${(o * 100).toFixed(0)}::backdrop {
913
+ background-color: light-dark(oklch(from var(${toProp(key)}) l c h / calc(alpha * ${o.toFixed(1)})), oklch(from var(${toProp(inverseKey)}) l c h / calc(alpha * ${o.toFixed(1)})) );
914
+ }
915
+ `);
916
+ }
917
+ return vals.join("\n");
918
+ }).join("\n")}
919
+
920
+ ${src.map((key) => {
921
+ const inverseKey = getInverseKey(key);
922
+ return `.color-c-${key} { color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`;
923
+ }).join("\n")}
924
+ `;
925
+ const getInverseKey = (key) => {
926
+ const match = key.match(/^([a-z]+)(\d+)$/);
927
+ if (!match)
928
+ return key;
929
+ const [, prefix, shadeStr] = match;
930
+ const shade = parseInt(shadeStr, 10);
931
+ const target = 100 - shade;
932
+ const inverseShade = shades.reduce((prev, curr) => Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev);
933
+ return `${prefix}${inverseShade}`;
934
+ };
935
+ const keyFactory = (prefix) => {
936
+ return shades.map((v) => `${prefix}${v}`);
937
+ };
938
+ [
939
+ color(keyFactory("p")),
940
+ color(keyFactory("s")),
941
+ color(keyFactory("t")),
942
+ color(keyFactory("n")),
943
+ color(keyFactory("nv")),
944
+ color(keyFactory("e")),
945
+ `
946
+ .color-bgc-transparent {
947
+ background-color: transparent;
948
+ }
949
+
950
+ :host {
951
+ color-scheme: var(--color-scheme);
952
+ }
953
+ `
954
+ ];
955
+ `
956
+ :host {
957
+ ${new Array(16).fill(0).map((_, idx) => {
958
+ return `--g-${idx + 1}: ${(idx + 1) * grid}px;`;
959
+ }).join("\n")}
960
+ }
961
+
962
+ ${new Array(49).fill(0).map((_, index) => {
963
+ const idx = index - 24;
964
+ const lbl = idx < 0 ? `n${Math.abs(idx)}` : idx.toString();
965
+ return `
966
+ .layout-p-${lbl} { --padding: ${idx * grid}px; padding: var(--padding); }
967
+ .layout-pt-${lbl} { padding-top: ${idx * grid}px; }
968
+ .layout-pr-${lbl} { padding-right: ${idx * grid}px; }
969
+ .layout-pb-${lbl} { padding-bottom: ${idx * grid}px; }
970
+ .layout-pl-${lbl} { padding-left: ${idx * grid}px; }
971
+
972
+ .layout-m-${lbl} { --margin: ${idx * grid}px; margin: var(--margin); }
973
+ .layout-mt-${lbl} { margin-top: ${idx * grid}px; }
974
+ .layout-mr-${lbl} { margin-right: ${idx * grid}px; }
975
+ .layout-mb-${lbl} { margin-bottom: ${idx * grid}px; }
976
+ .layout-ml-${lbl} { margin-left: ${idx * grid}px; }
977
+
978
+ .layout-t-${lbl} { top: ${idx * grid}px; }
979
+ .layout-r-${lbl} { right: ${idx * grid}px; }
980
+ .layout-b-${lbl} { bottom: ${idx * grid}px; }
981
+ .layout-l-${lbl} { left: ${idx * grid}px; }`;
982
+ }).join("\n")}
983
+
984
+ ${new Array(25).fill(0).map((_, idx) => {
985
+ return `
986
+ .layout-g-${idx} { gap: ${idx * grid}px; }`;
987
+ }).join("\n")}
988
+
989
+ ${new Array(8).fill(0).map((_, idx) => {
990
+ return `
991
+ .layout-grd-col${idx + 1} { grid-template-columns: ${"1fr ".repeat(idx + 1).trim()}; }`;
992
+ }).join("\n")}
993
+
994
+ .layout-pos-a {
995
+ position: absolute;
996
+ }
997
+
998
+ .layout-pos-rel {
999
+ position: relative;
1000
+ }
1001
+
1002
+ .layout-dsp-none {
1003
+ display: none;
1004
+ }
1005
+
1006
+ .layout-dsp-block {
1007
+ display: block;
1008
+ }
1009
+
1010
+ .layout-dsp-grid {
1011
+ display: grid;
1012
+ }
1013
+
1014
+ .layout-dsp-iflex {
1015
+ display: inline-flex;
1016
+ }
1017
+
1018
+ .layout-dsp-flexvert {
1019
+ display: flex;
1020
+ flex-direction: column;
1021
+ }
1022
+
1023
+ .layout-dsp-flexhor {
1024
+ display: flex;
1025
+ flex-direction: row;
1026
+ }
1027
+
1028
+ .layout-fw-w {
1029
+ flex-wrap: wrap;
1030
+ }
1031
+
1032
+ .layout-al-fs {
1033
+ align-items: start;
1034
+ }
1035
+
1036
+ .layout-al-fe {
1037
+ align-items: end;
1038
+ }
1039
+
1040
+ .layout-al-c {
1041
+ align-items: center;
1042
+ }
1043
+
1044
+ .layout-as-n {
1045
+ align-self: normal;
1046
+ }
1047
+
1048
+ .layout-js-c {
1049
+ justify-self: center;
1050
+ }
1051
+
1052
+ .layout-sp-c {
1053
+ justify-content: center;
1054
+ }
1055
+
1056
+ .layout-sp-ev {
1057
+ justify-content: space-evenly;
1058
+ }
1059
+
1060
+ .layout-sp-bt {
1061
+ justify-content: space-between;
1062
+ }
1063
+
1064
+ .layout-sp-s {
1065
+ justify-content: start;
1066
+ }
1067
+
1068
+ .layout-sp-e {
1069
+ justify-content: end;
1070
+ }
1071
+
1072
+ .layout-ji-e {
1073
+ justify-items: end;
1074
+ }
1075
+
1076
+ .layout-r-none {
1077
+ resize: none;
1078
+ }
1079
+
1080
+ .layout-fs-c {
1081
+ field-sizing: content;
1082
+ }
1083
+
1084
+ .layout-fs-n {
1085
+ field-sizing: none;
1086
+ }
1087
+
1088
+ .layout-flx-0 {
1089
+ flex: 0 0 auto;
1090
+ }
1091
+
1092
+ .layout-flx-1 {
1093
+ flex: 1 0 auto;
1094
+ }
1095
+
1096
+ .layout-c-s {
1097
+ contain: strict;
1098
+ }
1099
+
1100
+ /** Widths **/
1101
+
1102
+ ${new Array(10).fill(0).map((_, idx) => {
1103
+ const weight = (idx + 1) * 10;
1104
+ return `.layout-w-${weight} { width: ${weight}%; max-width: ${weight}%; }`;
1105
+ }).join("\n")}
1106
+
1107
+ ${new Array(16).fill(0).map((_, idx) => {
1108
+ const weight = idx * grid;
1109
+ return `.layout-wp-${idx} { width: ${weight}px; }`;
1110
+ }).join("\n")}
1111
+
1112
+ /** Heights **/
1113
+
1114
+ ${new Array(10).fill(0).map((_, idx) => {
1115
+ const height = (idx + 1) * 10;
1116
+ return `.layout-h-${height} { height: ${height}%; }`;
1117
+ }).join("\n")}
1118
+
1119
+ ${new Array(16).fill(0).map((_, idx) => {
1120
+ const height = idx * grid;
1121
+ return `.layout-hp-${idx} { height: ${height}px; }`;
1122
+ }).join("\n")}
1123
+
1124
+ .layout-el-cv {
1125
+ & img,
1126
+ & video {
1127
+ width: 100%;
1128
+ height: 100%;
1129
+ object-fit: cover;
1130
+ margin: 0;
1131
+ }
1132
+ }
1133
+
1134
+ .layout-ar-sq {
1135
+ aspect-ratio: 1 / 1;
1136
+ }
1137
+
1138
+ .layout-ex-fb {
1139
+ margin: calc(var(--padding) * -1) 0 0 calc(var(--padding) * -1);
1140
+ width: calc(100% + var(--padding) * 2);
1141
+ height: calc(100% + var(--padding) * 2);
1142
+ }
1143
+ `;
1144
+ `
1145
+ ${new Array(21).fill(0).map((_, idx) => {
1146
+ return `.opacity-el-${idx * 5} { opacity: ${idx / 20}; }`;
1147
+ }).join("\n")}
1148
+ `;
1149
+ `
1150
+ :host {
1151
+ --default-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
1152
+ --default-font-family-mono: "Courier New", Courier, monospace;
1153
+ }
1154
+
1155
+ .typography-f-s {
1156
+ font-family: var(--font-family, var(--default-font-family));
1157
+ font-optical-sizing: auto;
1158
+ font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0;
1159
+ }
1160
+
1161
+ .typography-f-sf {
1162
+ font-family: var(--font-family-flex, var(--default-font-family));
1163
+ font-optical-sizing: auto;
1164
+ }
1165
+
1166
+ .typography-f-c {
1167
+ font-family: var(--font-family-mono, var(--default-font-family));
1168
+ font-optical-sizing: auto;
1169
+ font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0;
1170
+ }
1171
+
1172
+ .typography-v-r {
1173
+ font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0, "ROND" 100;
1174
+ }
1175
+
1176
+ .typography-ta-s {
1177
+ text-align: start;
1178
+ }
1179
+
1180
+ .typography-ta-c {
1181
+ text-align: center;
1182
+ }
1183
+
1184
+ .typography-fs-n {
1185
+ font-style: normal;
1186
+ }
1187
+
1188
+ .typography-fs-i {
1189
+ font-style: italic;
1190
+ }
1191
+
1192
+ .typography-sz-ls {
1193
+ font-size: 11px;
1194
+ line-height: 16px;
1195
+ }
1196
+
1197
+ .typography-sz-lm {
1198
+ font-size: 12px;
1199
+ line-height: 16px;
1200
+ }
1201
+
1202
+ .typography-sz-ll {
1203
+ font-size: 14px;
1204
+ line-height: 20px;
1205
+ }
1206
+
1207
+ .typography-sz-bs {
1208
+ font-size: 12px;
1209
+ line-height: 16px;
1210
+ }
1211
+
1212
+ .typography-sz-bm {
1213
+ font-size: 14px;
1214
+ line-height: 20px;
1215
+ }
1216
+
1217
+ .typography-sz-bl {
1218
+ font-size: 16px;
1219
+ line-height: 24px;
1220
+ }
1221
+
1222
+ .typography-sz-ts {
1223
+ font-size: 14px;
1224
+ line-height: 20px;
1225
+ }
1226
+
1227
+ .typography-sz-tm {
1228
+ font-size: 16px;
1229
+ line-height: 24px;
1230
+ }
1231
+
1232
+ .typography-sz-tl {
1233
+ font-size: 22px;
1234
+ line-height: 28px;
1235
+ }
1236
+
1237
+ .typography-sz-hs {
1238
+ font-size: 24px;
1239
+ line-height: 32px;
1240
+ }
1241
+
1242
+ .typography-sz-hm {
1243
+ font-size: 28px;
1244
+ line-height: 36px;
1245
+ }
1246
+
1247
+ .typography-sz-hl {
1248
+ font-size: 32px;
1249
+ line-height: 40px;
1250
+ }
1251
+
1252
+ .typography-sz-ds {
1253
+ font-size: 36px;
1254
+ line-height: 44px;
1255
+ }
1256
+
1257
+ .typography-sz-dm {
1258
+ font-size: 45px;
1259
+ line-height: 52px;
1260
+ }
1261
+
1262
+ .typography-sz-dl {
1263
+ font-size: 57px;
1264
+ line-height: 64px;
1265
+ }
1266
+
1267
+ .typography-ws-p {
1268
+ white-space: pre-line;
1269
+ }
1270
+
1271
+ .typography-ws-nw {
1272
+ white-space: nowrap;
1273
+ }
1274
+
1275
+ .typography-td-none {
1276
+ text-decoration: none;
1277
+ }
1278
+
1279
+ /** Weights **/
1280
+
1281
+ ${new Array(9).fill(0).map((_, idx) => {
1282
+ const weight = (idx + 1) * 100;
1283
+ return `.typography-w-${weight} { font-weight: ${weight}; }`;
1284
+ }).join("\n")}
1285
+ `;
1286
+ var __defProp2 = Object.defineProperty;
1287
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1288
+ var __publicField2 = (obj, key, value) => {
1289
+ __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
1290
+ return value;
1291
+ };
1292
+ var __accessCheck2 = (obj, member, msg) => {
1293
+ if (!member.has(obj))
1294
+ throw TypeError("Cannot " + msg);
1295
+ };
1296
+ var __privateIn = (member, obj) => {
1297
+ if (Object(obj) !== obj)
1298
+ throw TypeError('Cannot use the "in" operator on this value');
1299
+ return member.has(obj);
1300
+ };
1301
+ var __privateAdd2 = (obj, member, value) => {
1302
+ if (member.has(obj))
1303
+ throw TypeError("Cannot add the same private member more than once");
1304
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1305
+ };
1306
+ var __privateMethod2 = (obj, member, method) => {
1307
+ __accessCheck2(obj, member, "access private method");
1308
+ return method;
1309
+ };
1310
+ /**
1311
+ * @license
1312
+ * Copyright Google LLC All Rights Reserved.
1313
+ *
1314
+ * Use of this source code is governed by an MIT-style license that can be
1315
+ * found in the LICENSE file at https://angular.io/license
1316
+ */
1317
+ function defaultEquals(a, b) {
1318
+ return Object.is(a, b);
1319
+ }
1320
+ /**
1321
+ * @license
1322
+ * Copyright Google LLC All Rights Reserved.
1323
+ *
1324
+ * Use of this source code is governed by an MIT-style license that can be
1325
+ * found in the LICENSE file at https://angular.io/license
1326
+ */
1327
+ let activeConsumer = null;
1328
+ let inNotificationPhase = false;
1329
+ let epoch = 1;
1330
+ const SIGNAL = /* @__PURE__ */ Symbol("SIGNAL");
1331
+ function setActiveConsumer(consumer) {
1332
+ const prev = activeConsumer;
1333
+ activeConsumer = consumer;
1334
+ return prev;
1335
+ }
1336
+ function getActiveConsumer() {
1337
+ return activeConsumer;
1338
+ }
1339
+ function isInNotificationPhase() {
1340
+ return inNotificationPhase;
1341
+ }
1342
+ const REACTIVE_NODE = {
1343
+ version: 0,
1344
+ lastCleanEpoch: 0,
1345
+ dirty: false,
1346
+ producerNode: void 0,
1347
+ producerLastReadVersion: void 0,
1348
+ producerIndexOfThis: void 0,
1349
+ nextProducerIndex: 0,
1350
+ liveConsumerNode: void 0,
1351
+ liveConsumerIndexOfThis: void 0,
1352
+ consumerAllowSignalWrites: false,
1353
+ consumerIsAlwaysLive: false,
1354
+ producerMustRecompute: () => false,
1355
+ producerRecomputeValue: () => {
1356
+ },
1357
+ consumerMarkedDirty: () => {
1358
+ },
1359
+ consumerOnSignalRead: () => {
1360
+ }
1361
+ };
1362
+ function producerAccessed(node) {
1363
+ if (inNotificationPhase) {
1364
+ throw new Error(
1365
+ typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : ""
1366
+ );
1367
+ }
1368
+ if (activeConsumer === null) {
1369
+ return;
1370
+ }
1371
+ activeConsumer.consumerOnSignalRead(node);
1372
+ const idx = activeConsumer.nextProducerIndex++;
1373
+ assertConsumerNode(activeConsumer);
1374
+ if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {
1375
+ if (consumerIsLive(activeConsumer)) {
1376
+ const staleProducer = activeConsumer.producerNode[idx];
1377
+ producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);
1378
+ }
1379
+ }
1380
+ if (activeConsumer.producerNode[idx] !== node) {
1381
+ activeConsumer.producerNode[idx] = node;
1382
+ activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0;
1383
+ }
1384
+ activeConsumer.producerLastReadVersion[idx] = node.version;
1385
+ }
1386
+ function producerIncrementEpoch() {
1387
+ epoch++;
1388
+ }
1389
+ function producerUpdateValueVersion(node) {
1390
+ if (!node.dirty && node.lastCleanEpoch === epoch) {
1391
+ return;
1392
+ }
1393
+ if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {
1394
+ node.dirty = false;
1395
+ node.lastCleanEpoch = epoch;
1396
+ return;
1397
+ }
1398
+ node.producerRecomputeValue(node);
1399
+ node.dirty = false;
1400
+ node.lastCleanEpoch = epoch;
1401
+ }
1402
+ function producerNotifyConsumers(node) {
1403
+ if (node.liveConsumerNode === void 0) {
1404
+ return;
1405
+ }
1406
+ const prev = inNotificationPhase;
1407
+ inNotificationPhase = true;
1408
+ try {
1409
+ for (const consumer of node.liveConsumerNode) {
1410
+ if (!consumer.dirty) {
1411
+ consumerMarkDirty(consumer);
1412
+ }
1413
+ }
1414
+ } finally {
1415
+ inNotificationPhase = prev;
1416
+ }
1417
+ }
1418
+ function producerUpdatesAllowed() {
1419
+ return (activeConsumer == null ? void 0 : activeConsumer.consumerAllowSignalWrites) !== false;
1420
+ }
1421
+ function consumerMarkDirty(node) {
1422
+ var _a2;
1423
+ node.dirty = true;
1424
+ producerNotifyConsumers(node);
1425
+ (_a2 = node.consumerMarkedDirty) == null ? void 0 : _a2.call(node.wrapper ?? node);
1426
+ }
1427
+ function consumerBeforeComputation(node) {
1428
+ node && (node.nextProducerIndex = 0);
1429
+ return setActiveConsumer(node);
1430
+ }
1431
+ function consumerAfterComputation(node, prevConsumer) {
1432
+ setActiveConsumer(prevConsumer);
1433
+ if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) {
1434
+ return;
1435
+ }
1436
+ if (consumerIsLive(node)) {
1437
+ for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {
1438
+ producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
1439
+ }
1440
+ }
1441
+ while (node.producerNode.length > node.nextProducerIndex) {
1442
+ node.producerNode.pop();
1443
+ node.producerLastReadVersion.pop();
1444
+ node.producerIndexOfThis.pop();
1445
+ }
1446
+ }
1447
+ function consumerPollProducersForChange(node) {
1448
+ assertConsumerNode(node);
1449
+ for (let i = 0; i < node.producerNode.length; i++) {
1450
+ const producer = node.producerNode[i];
1451
+ const seenVersion = node.producerLastReadVersion[i];
1452
+ if (seenVersion !== producer.version) {
1453
+ return true;
1454
+ }
1455
+ producerUpdateValueVersion(producer);
1456
+ if (seenVersion !== producer.version) {
1457
+ return true;
1458
+ }
1459
+ }
1460
+ return false;
1461
+ }
1462
+ function producerAddLiveConsumer(node, consumer, indexOfThis) {
1463
+ var _a2;
1464
+ assertProducerNode(node);
1465
+ assertConsumerNode(node);
1466
+ if (node.liveConsumerNode.length === 0) {
1467
+ (_a2 = node.watched) == null ? void 0 : _a2.call(node.wrapper);
1468
+ for (let i = 0; i < node.producerNode.length; i++) {
1469
+ node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);
1470
+ }
1471
+ }
1472
+ node.liveConsumerIndexOfThis.push(indexOfThis);
1473
+ return node.liveConsumerNode.push(consumer) - 1;
1474
+ }
1475
+ function producerRemoveLiveConsumerAtIndex(node, idx) {
1476
+ var _a2;
1477
+ assertProducerNode(node);
1478
+ assertConsumerNode(node);
1479
+ if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) {
1480
+ throw new Error(
1481
+ `Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`
1482
+ );
1483
+ }
1484
+ if (node.liveConsumerNode.length === 1) {
1485
+ (_a2 = node.unwatched) == null ? void 0 : _a2.call(node.wrapper);
1486
+ for (let i = 0; i < node.producerNode.length; i++) {
1487
+ producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
1488
+ }
1489
+ }
1490
+ const lastIdx = node.liveConsumerNode.length - 1;
1491
+ node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];
1492
+ node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];
1493
+ node.liveConsumerNode.length--;
1494
+ node.liveConsumerIndexOfThis.length--;
1495
+ if (idx < node.liveConsumerNode.length) {
1496
+ const idxProducer = node.liveConsumerIndexOfThis[idx];
1497
+ const consumer = node.liveConsumerNode[idx];
1498
+ assertConsumerNode(consumer);
1499
+ consumer.producerIndexOfThis[idxProducer] = idx;
1500
+ }
1501
+ }
1502
+ function consumerIsLive(node) {
1503
+ var _a2;
1504
+ return node.consumerIsAlwaysLive || (((_a2 = node == null ? void 0 : node.liveConsumerNode) == null ? void 0 : _a2.length) ?? 0) > 0;
1505
+ }
1506
+ function assertConsumerNode(node) {
1507
+ node.producerNode ?? (node.producerNode = []);
1508
+ node.producerIndexOfThis ?? (node.producerIndexOfThis = []);
1509
+ node.producerLastReadVersion ?? (node.producerLastReadVersion = []);
1510
+ }
1511
+ function assertProducerNode(node) {
1512
+ node.liveConsumerNode ?? (node.liveConsumerNode = []);
1513
+ node.liveConsumerIndexOfThis ?? (node.liveConsumerIndexOfThis = []);
1514
+ }
1515
+ /**
1516
+ * @license
1517
+ * Copyright Google LLC All Rights Reserved.
1518
+ *
1519
+ * Use of this source code is governed by an MIT-style license that can be
1520
+ * found in the LICENSE file at https://angular.io/license
1521
+ */
1522
+ function computedGet(node) {
1523
+ producerUpdateValueVersion(node);
1524
+ producerAccessed(node);
1525
+ if (node.value === ERRORED) {
1526
+ throw node.error;
1527
+ }
1528
+ return node.value;
1529
+ }
1530
+ function createComputed(computation) {
1531
+ const node = Object.create(COMPUTED_NODE);
1532
+ node.computation = computation;
1533
+ const computed = () => computedGet(node);
1534
+ computed[SIGNAL] = node;
1535
+ return computed;
1536
+ }
1537
+ const UNSET = /* @__PURE__ */ Symbol("UNSET");
1538
+ const COMPUTING = /* @__PURE__ */ Symbol("COMPUTING");
1539
+ const ERRORED = /* @__PURE__ */ Symbol("ERRORED");
1540
+ const COMPUTED_NODE = /* @__PURE__ */ (() => {
1541
+ return {
1542
+ ...REACTIVE_NODE,
1543
+ value: UNSET,
1544
+ dirty: true,
1545
+ error: null,
1546
+ equal: defaultEquals,
1547
+ producerMustRecompute(node) {
1548
+ return node.value === UNSET || node.value === COMPUTING;
1549
+ },
1550
+ producerRecomputeValue(node) {
1551
+ if (node.value === COMPUTING) {
1552
+ throw new Error("Detected cycle in computations.");
1553
+ }
1554
+ const oldValue = node.value;
1555
+ node.value = COMPUTING;
1556
+ const prevConsumer = consumerBeforeComputation(node);
1557
+ let newValue;
1558
+ let wasEqual = false;
1559
+ try {
1560
+ newValue = node.computation.call(node.wrapper);
1561
+ const oldOk = oldValue !== UNSET && oldValue !== ERRORED;
1562
+ wasEqual = oldOk && node.equal.call(node.wrapper, oldValue, newValue);
1563
+ } catch (err) {
1564
+ newValue = ERRORED;
1565
+ node.error = err;
1566
+ } finally {
1567
+ consumerAfterComputation(node, prevConsumer);
1568
+ }
1569
+ if (wasEqual) {
1570
+ node.value = oldValue;
1571
+ return;
1572
+ }
1573
+ node.value = newValue;
1574
+ node.version++;
1575
+ }
1576
+ };
1577
+ })();
1578
+ /**
1579
+ * @license
1580
+ * Copyright Google LLC All Rights Reserved.
1581
+ *
1582
+ * Use of this source code is governed by an MIT-style license that can be
1583
+ * found in the LICENSE file at https://angular.io/license
1584
+ */
1585
+ function defaultThrowError() {
1586
+ throw new Error();
1587
+ }
1588
+ let throwInvalidWriteToSignalErrorFn = defaultThrowError;
1589
+ function throwInvalidWriteToSignalError() {
1590
+ throwInvalidWriteToSignalErrorFn();
1591
+ }
1592
+ /**
1593
+ * @license
1594
+ * Copyright Google LLC All Rights Reserved.
1595
+ *
1596
+ * Use of this source code is governed by an MIT-style license that can be
1597
+ * found in the LICENSE file at https://angular.io/license
1598
+ */
1599
+ function createSignal(initialValue) {
1600
+ const node = Object.create(SIGNAL_NODE);
1601
+ node.value = initialValue;
1602
+ const getter = () => {
1603
+ producerAccessed(node);
1604
+ return node.value;
1605
+ };
1606
+ getter[SIGNAL] = node;
1607
+ return getter;
1608
+ }
1609
+ function signalGetFn() {
1610
+ producerAccessed(this);
1611
+ return this.value;
1612
+ }
1613
+ function signalSetFn(node, newValue) {
1614
+ if (!producerUpdatesAllowed()) {
1615
+ throwInvalidWriteToSignalError();
1616
+ }
1617
+ if (!node.equal.call(node.wrapper, node.value, newValue)) {
1618
+ node.value = newValue;
1619
+ signalValueChanged(node);
1620
+ }
1621
+ }
1622
+ const SIGNAL_NODE = /* @__PURE__ */ (() => {
1623
+ return {
1624
+ ...REACTIVE_NODE,
1625
+ equal: defaultEquals,
1626
+ value: void 0
1627
+ };
1628
+ })();
1629
+ function signalValueChanged(node) {
1630
+ node.version++;
1631
+ producerIncrementEpoch();
1632
+ producerNotifyConsumers(node);
1633
+ }
1634
+ /**
1635
+ * @license
1636
+ * Copyright 2024 Bloomberg Finance L.P.
1637
+ *
1638
+ * Licensed under the Apache License, Version 2.0 (the "License");
1639
+ * you may not use this file except in compliance with the License.
1640
+ * You may obtain a copy of the License at
1641
+ *
1642
+ * http://www.apache.org/licenses/LICENSE-2.0
1643
+ *
1644
+ * Unless required by applicable law or agreed to in writing, software
1645
+ * distributed under the License is distributed on an "AS IS" BASIS,
1646
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1647
+ * See the License for the specific language governing permissions and
1648
+ * limitations under the License.
1649
+ */
1650
+ const NODE = Symbol("node");
1651
+ var Signal;
1652
+ ((Signal2) => {
1653
+ var _a2, _brand, _b, _brand2;
1654
+ class State {
1655
+ constructor(initialValue, options = {}) {
1656
+ __privateAdd2(this, _brand);
1657
+ __publicField2(this, _a2);
1658
+ const ref = createSignal(initialValue);
1659
+ const node = ref[SIGNAL];
1660
+ this[NODE] = node;
1661
+ node.wrapper = this;
1662
+ if (options) {
1663
+ const equals = options.equals;
1664
+ if (equals) {
1665
+ node.equal = equals;
1666
+ }
1667
+ node.watched = options[Signal2.subtle.watched];
1668
+ node.unwatched = options[Signal2.subtle.unwatched];
1669
+ }
1670
+ }
1671
+ get() {
1672
+ if (!(0, Signal2.isState)(this))
1673
+ throw new TypeError("Wrong receiver type for Signal.State.prototype.get");
1674
+ return signalGetFn.call(this[NODE]);
1675
+ }
1676
+ set(newValue) {
1677
+ if (!(0, Signal2.isState)(this))
1678
+ throw new TypeError("Wrong receiver type for Signal.State.prototype.set");
1679
+ if (isInNotificationPhase()) {
1680
+ throw new Error("Writes to signals not permitted during Watcher callback");
1681
+ }
1682
+ const ref = this[NODE];
1683
+ signalSetFn(ref, newValue);
1684
+ }
1685
+ }
1686
+ _a2 = NODE;
1687
+ _brand = /* @__PURE__ */ new WeakSet();
1688
+ Signal2.isState = (s) => typeof s === "object" && __privateIn(_brand, s);
1689
+ Signal2.State = State;
1690
+ class Computed {
1691
+ // Create a Signal which evaluates to the value returned by the callback.
1692
+ // Callback is called with this signal as the parameter.
1693
+ constructor(computation, options) {
1694
+ __privateAdd2(this, _brand2);
1695
+ __publicField2(this, _b);
1696
+ const ref = createComputed(computation);
1697
+ const node = ref[SIGNAL];
1698
+ node.consumerAllowSignalWrites = true;
1699
+ this[NODE] = node;
1700
+ node.wrapper = this;
1701
+ if (options) {
1702
+ const equals = options.equals;
1703
+ if (equals) {
1704
+ node.equal = equals;
1705
+ }
1706
+ node.watched = options[Signal2.subtle.watched];
1707
+ node.unwatched = options[Signal2.subtle.unwatched];
1708
+ }
1709
+ }
1710
+ get() {
1711
+ if (!(0, Signal2.isComputed)(this))
1712
+ throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");
1713
+ return computedGet(this[NODE]);
1714
+ }
1715
+ }
1716
+ _b = NODE;
1717
+ _brand2 = /* @__PURE__ */ new WeakSet();
1718
+ Signal2.isComputed = (c) => typeof c === "object" && __privateIn(_brand2, c);
1719
+ Signal2.Computed = Computed;
1720
+ ((subtle2) => {
1721
+ var _a22, _brand3, _assertSignals, assertSignals_fn;
1722
+ function untrack(cb) {
1723
+ let output;
1724
+ let prevActiveConsumer = null;
1725
+ try {
1726
+ prevActiveConsumer = setActiveConsumer(null);
1727
+ output = cb();
1728
+ } finally {
1729
+ setActiveConsumer(prevActiveConsumer);
1730
+ }
1731
+ return output;
1732
+ }
1733
+ subtle2.untrack = untrack;
1734
+ function introspectSources(sink) {
1735
+ var _a3;
1736
+ if (!(0, Signal2.isComputed)(sink) && !(0, Signal2.isWatcher)(sink)) {
1737
+ throw new TypeError("Called introspectSources without a Computed or Watcher argument");
1738
+ }
1739
+ return ((_a3 = sink[NODE].producerNode) == null ? void 0 : _a3.map((n) => n.wrapper)) ?? [];
1740
+ }
1741
+ subtle2.introspectSources = introspectSources;
1742
+ function introspectSinks(signal) {
1743
+ var _a3;
1744
+ if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
1745
+ throw new TypeError("Called introspectSinks without a Signal argument");
1746
+ }
1747
+ return ((_a3 = signal[NODE].liveConsumerNode) == null ? void 0 : _a3.map((n) => n.wrapper)) ?? [];
1748
+ }
1749
+ subtle2.introspectSinks = introspectSinks;
1750
+ function hasSinks(signal) {
1751
+ if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
1752
+ throw new TypeError("Called hasSinks without a Signal argument");
1753
+ }
1754
+ const liveConsumerNode = signal[NODE].liveConsumerNode;
1755
+ if (!liveConsumerNode)
1756
+ return false;
1757
+ return liveConsumerNode.length > 0;
1758
+ }
1759
+ subtle2.hasSinks = hasSinks;
1760
+ function hasSources(signal) {
1761
+ if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isWatcher)(signal)) {
1762
+ throw new TypeError("Called hasSources without a Computed or Watcher argument");
1763
+ }
1764
+ const producerNode = signal[NODE].producerNode;
1765
+ if (!producerNode)
1766
+ return false;
1767
+ return producerNode.length > 0;
1768
+ }
1769
+ subtle2.hasSources = hasSources;
1770
+ class Watcher {
1771
+ // When a (recursive) source of Watcher is written to, call this callback,
1772
+ // if it hasn't already been called since the last `watch` call.
1773
+ // No signals may be read or written during the notify.
1774
+ constructor(notify) {
1775
+ __privateAdd2(this, _brand3);
1776
+ __privateAdd2(this, _assertSignals);
1777
+ __publicField2(this, _a22);
1778
+ let node = Object.create(REACTIVE_NODE);
1779
+ node.wrapper = this;
1780
+ node.consumerMarkedDirty = notify;
1781
+ node.consumerIsAlwaysLive = true;
1782
+ node.consumerAllowSignalWrites = false;
1783
+ node.producerNode = [];
1784
+ this[NODE] = node;
1785
+ }
1786
+ // Add these signals to the Watcher's set, and set the watcher to run its
1787
+ // notify callback next time any signal in the set (or one of its dependencies) changes.
1788
+ // Can be called with no arguments just to reset the "notified" state, so that
1789
+ // the notify callback will be invoked again.
1790
+ watch(...signals) {
1791
+ if (!(0, Signal2.isWatcher)(this)) {
1792
+ throw new TypeError("Called unwatch without Watcher receiver");
1793
+ }
1794
+ __privateMethod2(this, _assertSignals, assertSignals_fn).call(this, signals);
1795
+ const node = this[NODE];
1796
+ node.dirty = false;
1797
+ const prev = setActiveConsumer(node);
1798
+ for (const signal of signals) {
1799
+ producerAccessed(signal[NODE]);
1800
+ }
1801
+ setActiveConsumer(prev);
1802
+ }
1803
+ // Remove these signals from the watched set (e.g., for an effect which is disposed)
1804
+ unwatch(...signals) {
1805
+ if (!(0, Signal2.isWatcher)(this)) {
1806
+ throw new TypeError("Called unwatch without Watcher receiver");
1807
+ }
1808
+ __privateMethod2(this, _assertSignals, assertSignals_fn).call(this, signals);
1809
+ const node = this[NODE];
1810
+ assertConsumerNode(node);
1811
+ for (let i = node.producerNode.length - 1; i >= 0; i--) {
1812
+ if (signals.includes(node.producerNode[i].wrapper)) {
1813
+ producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
1814
+ const lastIdx = node.producerNode.length - 1;
1815
+ node.producerNode[i] = node.producerNode[lastIdx];
1816
+ node.producerIndexOfThis[i] = node.producerIndexOfThis[lastIdx];
1817
+ node.producerNode.length--;
1818
+ node.producerIndexOfThis.length--;
1819
+ node.nextProducerIndex--;
1820
+ if (i < node.producerNode.length) {
1821
+ const idxConsumer = node.producerIndexOfThis[i];
1822
+ const producer = node.producerNode[i];
1823
+ assertProducerNode(producer);
1824
+ producer.liveConsumerIndexOfThis[idxConsumer] = i;
1825
+ }
1826
+ }
1827
+ }
1828
+ }
1829
+ // Returns the set of computeds in the Watcher's set which are still yet
1830
+ // to be re-evaluated
1831
+ getPending() {
1832
+ if (!(0, Signal2.isWatcher)(this)) {
1833
+ throw new TypeError("Called getPending without Watcher receiver");
1834
+ }
1835
+ const node = this[NODE];
1836
+ return node.producerNode.filter((n) => n.dirty).map((n) => n.wrapper);
1837
+ }
1838
+ }
1839
+ _a22 = NODE;
1840
+ _brand3 = /* @__PURE__ */ new WeakSet();
1841
+ _assertSignals = /* @__PURE__ */ new WeakSet();
1842
+ assertSignals_fn = function(signals) {
1843
+ for (const signal of signals) {
1844
+ if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) {
1845
+ throw new TypeError("Called watch/unwatch without a Computed or State argument");
1846
+ }
1847
+ }
1848
+ };
1849
+ Signal2.isWatcher = (w) => __privateIn(_brand3, w);
1850
+ subtle2.Watcher = Watcher;
1851
+ function currentComputed() {
1852
+ var _a3;
1853
+ return (_a3 = getActiveConsumer()) == null ? void 0 : _a3.wrapper;
1854
+ }
1855
+ subtle2.currentComputed = currentComputed;
1856
+ subtle2.watched = Symbol("watched");
1857
+ subtle2.unwatched = Symbol("unwatched");
1858
+ })(Signal2.subtle || (Signal2.subtle = {}));
1859
+ })(Signal || (Signal = {}));
1860
+ const createStorage = (initial = null) => new Signal.State(initial, {
1861
+ equals: () => false
1862
+ });
1863
+ const ARRAY_GETTER_METHODS = /* @__PURE__ */ new Set([Symbol.iterator, "concat", "entries", "every", "filter", "find", "findIndex", "flat", "flatMap", "forEach", "includes", "indexOf", "join", "keys", "lastIndexOf", "map", "reduce", "reduceRight", "slice", "some", "values"]);
1864
+ const ARRAY_WRITE_THEN_READ_METHODS = /* @__PURE__ */ new Set(["fill", "push", "unshift"]);
1865
+ function convertToInt(prop) {
1866
+ if (typeof prop === "symbol") return null;
1867
+ const num = Number(prop);
1868
+ if (isNaN(num)) return null;
1869
+ return num % 1 === 0 ? num : null;
1870
+ }
1871
+ const _SignalArray = class _SignalArray {
1872
+ constructor(arr = []) {
1873
+ __privateAdd(this, _SignalArray_instances);
1874
+ __privateAdd(this, _collection, createStorage());
1875
+ __privateAdd(this, _storages, /* @__PURE__ */ new Map());
1876
+ let clone = arr.slice();
1877
+ let self = this;
1878
+ let boundFns = /* @__PURE__ */ new Map();
1879
+ let nativelyAccessingLengthFromPushOrUnshift = false;
1880
+ return new Proxy(clone, {
1881
+ get(target, prop) {
1882
+ var _a2;
1883
+ let index = convertToInt(prop);
1884
+ if (index !== null) {
1885
+ __privateMethod(_a2 = self, _SignalArray_instances, readStorageFor_fn).call(_a2, index);
1886
+ __privateGet(self, _collection).get();
1887
+ return target[index];
1888
+ }
1889
+ if (prop === "length") {
1890
+ if (nativelyAccessingLengthFromPushOrUnshift) {
1891
+ nativelyAccessingLengthFromPushOrUnshift = false;
1892
+ } else {
1893
+ __privateGet(self, _collection).get();
1894
+ }
1895
+ return target[prop];
1896
+ }
1897
+ if (ARRAY_WRITE_THEN_READ_METHODS.has(prop)) {
1898
+ nativelyAccessingLengthFromPushOrUnshift = true;
1899
+ }
1900
+ if (ARRAY_GETTER_METHODS.has(prop)) {
1901
+ let fn = boundFns.get(prop);
1902
+ if (fn === void 0) {
1903
+ fn = (...args) => {
1904
+ __privateGet(self, _collection).get();
1905
+ return target[prop](...args);
1906
+ };
1907
+ boundFns.set(prop, fn);
1908
+ }
1909
+ return fn;
1910
+ }
1911
+ return target[prop];
1912
+ },
1913
+ set(target, prop, value) {
1914
+ var _a2;
1915
+ target[prop] = value;
1916
+ let index = convertToInt(prop);
1917
+ if (index !== null) {
1918
+ __privateMethod(_a2 = self, _SignalArray_instances, dirtyStorageFor_fn).call(_a2, index);
1919
+ __privateGet(self, _collection).set(null);
1920
+ } else if (prop === "length") {
1921
+ __privateGet(self, _collection).set(null);
1922
+ }
1923
+ return true;
1924
+ },
1925
+ getPrototypeOf() {
1926
+ return _SignalArray.prototype;
1927
+ }
1928
+ });
1929
+ }
1930
+ /**
1931
+ * Creates an array from an iterable object.
1932
+ * @param iterable An iterable object to convert to an array.
1933
+ */
1934
+ /**
1935
+ * Creates an array from an iterable object.
1936
+ * @param iterable An iterable object to convert to an array.
1937
+ * @param mapfn A mapping function to call on every element of the array.
1938
+ * @param thisArg Value of 'this' used to invoke the mapfn.
1939
+ */
1940
+ static from(iterable, mapfn, thisArg) {
1941
+ return mapfn ? new _SignalArray(Array.from(iterable, mapfn, thisArg)) : new _SignalArray(Array.from(iterable));
1942
+ }
1943
+ static of(...arr) {
1944
+ return new _SignalArray(arr);
1945
+ }
1946
+ };
1947
+ _collection = new WeakMap();
1948
+ _storages = new WeakMap();
1949
+ _SignalArray_instances = new WeakSet();
1950
+ readStorageFor_fn = function(index) {
1951
+ let storage = __privateGet(this, _storages).get(index);
1952
+ if (storage === void 0) {
1953
+ storage = createStorage();
1954
+ __privateGet(this, _storages).set(index, storage);
1955
+ }
1956
+ storage.get();
1957
+ };
1958
+ dirtyStorageFor_fn = function(index) {
1959
+ const storage = __privateGet(this, _storages).get(index);
1960
+ if (storage) {
1961
+ storage.set(null);
1962
+ }
1963
+ };
1964
+ let SignalArray = _SignalArray;
1965
+ Object.setPrototypeOf(SignalArray.prototype, Array.prototype);
1966
+ class SignalMap {
1967
+ constructor(existing) {
1968
+ __publicField(this, "collection", createStorage());
1969
+ __publicField(this, "storages", /* @__PURE__ */ new Map());
1970
+ __publicField(this, "vals");
1971
+ this.vals = existing ? new Map(existing) : /* @__PURE__ */ new Map();
1972
+ }
1973
+ readStorageFor(key) {
1974
+ const {
1975
+ storages
1976
+ } = this;
1977
+ let storage = storages.get(key);
1978
+ if (storage === void 0) {
1979
+ storage = createStorage();
1980
+ storages.set(key, storage);
1981
+ }
1982
+ storage.get();
1983
+ }
1984
+ dirtyStorageFor(key) {
1985
+ const storage = this.storages.get(key);
1986
+ if (storage) {
1987
+ storage.set(null);
1988
+ }
1989
+ }
1990
+ // **** KEY GETTERS ****
1991
+ get(key) {
1992
+ this.readStorageFor(key);
1993
+ return this.vals.get(key);
1994
+ }
1995
+ has(key) {
1996
+ this.readStorageFor(key);
1997
+ return this.vals.has(key);
1998
+ }
1999
+ // **** ALL GETTERS ****
2000
+ entries() {
2001
+ this.collection.get();
2002
+ return this.vals.entries();
2003
+ }
2004
+ keys() {
2005
+ this.collection.get();
2006
+ return this.vals.keys();
2007
+ }
2008
+ values() {
2009
+ this.collection.get();
2010
+ return this.vals.values();
2011
+ }
2012
+ forEach(fn) {
2013
+ this.collection.get();
2014
+ this.vals.forEach(fn);
2015
+ }
2016
+ get size() {
2017
+ this.collection.get();
2018
+ return this.vals.size;
2019
+ }
2020
+ [Symbol.iterator]() {
2021
+ this.collection.get();
2022
+ return this.vals[Symbol.iterator]();
2023
+ }
2024
+ get [Symbol.toStringTag]() {
2025
+ return this.vals[Symbol.toStringTag];
2026
+ }
2027
+ // **** KEY SETTERS ****
2028
+ set(key, value) {
2029
+ this.dirtyStorageFor(key);
2030
+ this.collection.set(null);
2031
+ this.vals.set(key, value);
2032
+ return this;
2033
+ }
2034
+ delete(key) {
2035
+ this.dirtyStorageFor(key);
2036
+ this.collection.set(null);
2037
+ return this.vals.delete(key);
2038
+ }
2039
+ // **** ALL SETTERS ****
2040
+ clear() {
2041
+ this.storages.forEach((s) => s.set(null));
2042
+ this.collection.set(null);
2043
+ this.vals.clear();
2044
+ }
2045
+ }
2046
+ Object.setPrototypeOf(SignalMap.prototype, Map.prototype);
2047
+ class SignalSet {
2048
+ constructor(existing) {
2049
+ __publicField(this, "collection", createStorage());
2050
+ __publicField(this, "storages", /* @__PURE__ */ new Map());
2051
+ __publicField(this, "vals");
2052
+ this.vals = new Set(existing);
2053
+ }
2054
+ storageFor(key) {
2055
+ const storages = this.storages;
2056
+ let storage = storages.get(key);
2057
+ if (storage === void 0) {
2058
+ storage = createStorage();
2059
+ storages.set(key, storage);
2060
+ }
2061
+ return storage;
2062
+ }
2063
+ dirtyStorageFor(key) {
2064
+ const storage = this.storages.get(key);
2065
+ if (storage) {
2066
+ storage.set(null);
2067
+ }
2068
+ }
2069
+ // **** KEY GETTERS ****
2070
+ has(value) {
2071
+ this.storageFor(value).get();
2072
+ return this.vals.has(value);
2073
+ }
2074
+ // **** ALL GETTERS ****
2075
+ entries() {
2076
+ this.collection.get();
2077
+ return this.vals.entries();
2078
+ }
2079
+ keys() {
2080
+ this.collection.get();
2081
+ return this.vals.keys();
2082
+ }
2083
+ values() {
2084
+ this.collection.get();
2085
+ return this.vals.values();
2086
+ }
2087
+ forEach(fn) {
2088
+ this.collection.get();
2089
+ this.vals.forEach(fn);
2090
+ }
2091
+ get size() {
2092
+ this.collection.get();
2093
+ return this.vals.size;
2094
+ }
2095
+ [Symbol.iterator]() {
2096
+ this.collection.get();
2097
+ return this.vals[Symbol.iterator]();
2098
+ }
2099
+ get [Symbol.toStringTag]() {
2100
+ return this.vals[Symbol.toStringTag];
2101
+ }
2102
+ // **** KEY SETTERS ****
2103
+ add(value) {
2104
+ this.dirtyStorageFor(value);
2105
+ this.collection.set(null);
2106
+ this.vals.add(value);
2107
+ return this;
2108
+ }
2109
+ delete(value) {
2110
+ this.dirtyStorageFor(value);
2111
+ this.collection.set(null);
2112
+ return this.vals.delete(value);
2113
+ }
2114
+ // **** ALL SETTERS ****
2115
+ clear() {
2116
+ this.storages.forEach((s) => s.set(null));
2117
+ this.collection.set(null);
2118
+ this.vals.clear();
2119
+ }
2120
+ }
2121
+ Object.setPrototypeOf(SignalSet.prototype, Set.prototype);
796
2122
  var ChatMessageTypeEnum = /* @__PURE__ */ ((ChatMessageTypeEnum2) => {
797
2123
  ChatMessageTypeEnum2["MESSAGE"] = "message";
798
2124
  ChatMessageTypeEnum2["EVENT"] = "event";
@@ -815,6 +2141,7 @@ var ChatMessageEventTypeEnum = /* @__PURE__ */ ((ChatMessageEventTypeEnum2) => {
815
2141
  ChatMessageEventTypeEnum2["ON_INTERRUPT"] = "on_interrupt";
816
2142
  ChatMessageEventTypeEnum2["ON_ERROR"] = "on_error";
817
2143
  ChatMessageEventTypeEnum2["ON_CHAT_EVENT"] = "on_chat_event";
2144
+ ChatMessageEventTypeEnum2["ON_CLIENT_EFFECT"] = "on_client_effect";
818
2145
  return ChatMessageEventTypeEnum2;
819
2146
  })(ChatMessageEventTypeEnum || {});
820
2147
  var ChatMessageStepCategory = /* @__PURE__ */ ((ChatMessageStepCategory2) => {
@@ -829,10 +2156,36 @@ var ChatMessageStepCategory = /* @__PURE__ */ ((ChatMessageStepCategory2) => {
829
2156
  ChatMessageStepCategory2["Knowledges"] = "knowledges";
830
2157
  return ChatMessageStepCategory2;
831
2158
  })(ChatMessageStepCategory || {});
2159
+ const STATE_VARIABLE_HUMAN = "human";
2160
+ const ALLOWED_KEYS = [
2161
+ "api",
2162
+ "theme",
2163
+ "composer",
2164
+ "startScreen"
2165
+ ];
2166
+ function filterPlaygroundOptions(options) {
2167
+ const filtered = {};
2168
+ for (const key of ALLOWED_KEYS) {
2169
+ if (key in options && options[key] !== void 0) {
2170
+ filtered[key] = options[key];
2171
+ }
2172
+ }
2173
+ return filtered;
2174
+ }
2175
+ function mergeWithPlaygroundOptions(localOptions, playgroundOptions) {
2176
+ const filteredPlayground = filterPlaygroundOptions(playgroundOptions);
2177
+ return {
2178
+ ...localOptions,
2179
+ ...filteredPlayground
2180
+ };
2181
+ }
832
2182
  export {
833
2183
  ChatMessageEventTypeEnum,
834
2184
  ChatMessageStepCategory,
835
2185
  ChatMessageTypeEnum,
836
- isClientToolRequest
2186
+ STATE_VARIABLE_HUMAN,
2187
+ filterPlaygroundOptions,
2188
+ isClientToolRequest,
2189
+ mergeWithPlaygroundOptions
837
2190
  };
838
2191
  //# sourceMappingURL=index.js.map