@walkeros/cli 4.5.0 → 4.5.1-next-1788726985928

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/cli.js CHANGED
@@ -175,9 +175,9 @@ function N(e5) {
175
175
  throw new Error(String(e5));
176
176
  }
177
177
  function z(e5, t4) {
178
- const n5 = false !== t4?.stripAnnotations, r6 = {}, o4 = /* @__PURE__ */ new Set();
179
- function s4(t5) {
180
- if (r6[t5]) return r6[t5];
178
+ const n5 = false !== t4?.stripAnnotations, r5 = {}, o4 = /* @__PURE__ */ new Set();
179
+ function s5(t5) {
180
+ if (r5[t5]) return r5[t5];
181
181
  o4.has(t5) && N(`Circular extend chain detected: ${[...o4, t5].join(" \u2192 ")}`);
182
182
  const i5 = e5[t5];
183
183
  i5 || N(`Contract "${t5}" not found`), o4.add(t5);
@@ -189,34 +189,34 @@ function z(e5, t4) {
189
189
  void 0 === e6.description && void 0 === t6.description || (n6.description = t6.description ?? e6.description);
190
190
  e6.schema && t6.schema ? n6.schema = U(e6.schema, t6.schema) : (e6.schema || t6.schema) && (n6.schema = { ...e6.schema || t6.schema });
191
191
  if (e6.events || t6.events) {
192
- const r7 = {}, o5 = /* @__PURE__ */ new Set([...Object.keys(e6.events || {}), ...Object.keys(t6.events || {})]);
192
+ const r6 = {}, o5 = /* @__PURE__ */ new Set([...Object.keys(e6.events || {}), ...Object.keys(t6.events || {})]);
193
193
  for (const n7 of o5) {
194
- const o6 = e6.events?.[n7] || {}, s5 = t6.events?.[n7] || {}, i6 = /* @__PURE__ */ new Set([...Object.keys(o6), ...Object.keys(s5)]);
195
- r7[n7] = {};
194
+ const o6 = e6.events?.[n7] || {}, s6 = t6.events?.[n7] || {}, i6 = /* @__PURE__ */ new Set([...Object.keys(o6), ...Object.keys(s6)]);
195
+ r6[n7] = {};
196
196
  for (const e7 of i6) {
197
- const t7 = o6[e7], i7 = s5[e7];
198
- r7[n7][e7] = t7 && i7 ? U(t7, i7) : { ...t7 || i7 };
197
+ const t7 = o6[e7], i7 = s6[e7];
198
+ r6[n7][e7] = t7 && i7 ? U(t7, i7) : { ...t7 || i7 };
199
199
  }
200
200
  }
201
- n6.events = r7;
201
+ n6.events = r6;
202
202
  }
203
203
  return n6;
204
- })(s4(i5.extend), i5);
204
+ })(s5(i5.extend), i5);
205
205
  } else a4 = { ...i5 };
206
206
  if (delete a4.extend, a4.events && (a4.events = (function(e6) {
207
207
  const t6 = {};
208
208
  for (const n6 of Object.keys(e6)) if ("*" !== n6) {
209
209
  t6[n6] = {};
210
- for (const r7 of Object.keys(e6[n6] || {})) {
210
+ for (const r6 of Object.keys(e6[n6] || {})) {
211
211
  let o5 = {};
212
- const s5 = e6["*"]?.["*"];
213
- s5 && (o5 = U(o5, s5));
214
- const i6 = e6["*"]?.[r7];
215
- i6 && "*" !== r7 && (o5 = U(o5, i6));
212
+ const s6 = e6["*"]?.["*"];
213
+ s6 && (o5 = U(o5, s6));
214
+ const i6 = e6["*"]?.[r6];
215
+ i6 && "*" !== r6 && (o5 = U(o5, i6));
216
216
  const a5 = e6[n6]?.["*"];
217
- a5 && "*" !== r7 && (o5 = U(o5, a5));
218
- const c2 = e6[n6]?.[r7];
219
- c2 && (o5 = U(o5, c2)), t6[n6][r7] = o5;
217
+ a5 && "*" !== r6 && (o5 = U(o5, a5));
218
+ const c2 = e6[n6]?.[r6];
219
+ c2 && (o5 = U(o5, c2)), t6[n6][r6] = o5;
220
220
  }
221
221
  }
222
222
  e6["*"] && (t6["*"] = { ...e6["*"] });
@@ -225,31 +225,31 @@ function z(e5, t4) {
225
225
  const e6 = {};
226
226
  for (const [t6, n6] of Object.entries(a4.events)) {
227
227
  e6[t6] = {};
228
- for (const [r7, o5] of Object.entries(n6)) e6[t6][r7] = L(o5);
228
+ for (const [r6, o5] of Object.entries(n6)) e6[t6][r6] = L(o5);
229
229
  }
230
230
  a4.events = e6;
231
231
  }
232
- return o4.delete(t5), r6[t5] = a4, a4;
232
+ return o4.delete(t5), r5[t5] = a4, a4;
233
233
  }
234
- for (const t5 of Object.keys(e5)) s4(t5);
235
- return r6;
234
+ for (const t5 of Object.keys(e5)) s5(t5);
235
+ return r5;
236
236
  }
237
237
  function U(e5, t4) {
238
238
  const n5 = { ...e5 };
239
- for (const r6 of Object.keys(t4)) {
240
- const o4 = e5[r6], s4 = t4[r6];
241
- "required" === r6 && Array.isArray(o4) && Array.isArray(s4) ? n5[r6] = [.../* @__PURE__ */ new Set([...o4, ...s4])] : F(o4) && F(s4) ? n5[r6] = U(o4, s4) : n5[r6] = s4;
239
+ for (const r5 of Object.keys(t4)) {
240
+ const o4 = e5[r5], s5 = t4[r5];
241
+ "required" === r5 && Array.isArray(o4) && Array.isArray(s5) ? n5[r5] = [.../* @__PURE__ */ new Set([...o4, ...s5])] : F(o4) && F(s5) ? n5[r5] = U(o4, s5) : n5[r5] = s5;
242
242
  }
243
243
  return n5;
244
244
  }
245
245
  function L(e5) {
246
246
  const t4 = {};
247
- for (const [n5, r6] of Object.entries(e5)) T.has(n5) || (R.has(n5) && F(r6) ? t4[n5] = D(r6) : P.has(n5) && Array.isArray(r6) ? t4[n5] = r6.map((e6) => F(e6) ? L(e6) : e6) : C.has(n5) && F(r6) ? t4[n5] = L(r6) : t4[n5] = r6);
247
+ for (const [n5, r5] of Object.entries(e5)) T.has(n5) || (R.has(n5) && F(r5) ? t4[n5] = D(r5) : P.has(n5) && Array.isArray(r5) ? t4[n5] = r5.map((e6) => F(e6) ? L(e6) : e6) : C.has(n5) && F(r5) ? t4[n5] = L(r5) : t4[n5] = r5);
248
248
  return t4;
249
249
  }
250
250
  function D(e5) {
251
251
  const t4 = {};
252
- for (const [n5, r6] of Object.entries(e5)) t4[n5] = F(r6) ? L(r6) : r6;
252
+ for (const [n5, r5] of Object.entries(e5)) t4[n5] = F(r5) ? L(r5) : r5;
253
253
  return t4;
254
254
  }
255
255
  function F(e5) {
@@ -261,72 +261,72 @@ function X(...e5) {
261
261
  return t4;
262
262
  }
263
263
  function te(e5, t4, n5) {
264
- const r6 = `$flow.${e5}${t4 ? `.${t4}` : ""}`;
265
- if ("unknown-flow" === n5) return `${r6} cannot resolve: flow "${e5}" does not exist in this config.`;
266
- return `${r6} is empty. Set ${t4 ? `flows.${e5}.config.${t4}` : `flows.${e5}.config`}, or run \`walkeros deploy ${e5}\` first.`;
264
+ const r5 = `$flow.${e5}${t4 ? `.${t4}` : ""}`;
265
+ if ("unknown-flow" === n5) return `${r5} cannot resolve: flow "${e5}" does not exist in this config.`;
266
+ return `${r5} is empty. Set ${t4 ? `flows.${e5}.config.${t4}` : `flows.${e5}.config`}, or run \`walkeros deploy ${e5}\` first.`;
267
267
  }
268
268
  function ne(e5, t4, n5) {
269
- const r6 = t4.split(".");
269
+ const r5 = t4.split(".");
270
270
  let o4 = e5;
271
- for (let e6 = 0; e6 < r6.length; e6++) {
272
- const s4 = r6[e6];
271
+ for (let e6 = 0; e6 < r5.length; e6++) {
272
+ const s5 = r5[e6];
273
273
  if (null == o4 || "object" != typeof o4) {
274
- const o5 = r6.slice(0, e6).join(".");
275
- N(`Path "${t4}" not found in "${n5}": "${s4}" does not exist${o5 ? ` in "${o5}"` : ""}`);
274
+ const o5 = r5.slice(0, e6).join(".");
275
+ N(`Path "${t4}" not found in "${n5}": "${s5}" does not exist${o5 ? ` in "${o5}"` : ""}`);
276
276
  }
277
277
  const i5 = o4;
278
- if (!(s4 in i5)) {
279
- const o5 = r6.slice(0, e6).join(".");
280
- N(`Path "${t4}" not found in "${n5}": "${s4}" does not exist${o5 ? ` in "${o5}"` : ""}`);
278
+ if (!(s5 in i5)) {
279
+ const o5 = r5.slice(0, e6).join(".");
280
+ N(`Path "${t4}" not found in "${n5}": "${s5}" does not exist${o5 ? ` in "${o5}"` : ""}`);
281
281
  }
282
- o4 = i5[s4];
282
+ o4 = i5[s5];
283
283
  }
284
284
  return o4;
285
285
  }
286
- function re(e5, t4, n5, r6, o4, s4) {
286
+ function re(e5, t4, n5, r5, o4, s5) {
287
287
  if ("string" == typeof e5) {
288
288
  const i5 = e5.match(q);
289
289
  if (i5) {
290
290
  const e6 = i5[1].split("."), a5 = e6[0], c3 = e6.slice(1).join(".");
291
291
  void 0 === t4[a5] && N(`Variable "${a5}" not found`);
292
- const f3 = s4 ?? /* @__PURE__ */ new Set();
292
+ const f3 = s5 ?? /* @__PURE__ */ new Set();
293
293
  if (f3.has(a5)) {
294
294
  N(`Cyclic $var reference: ${[...f3, a5].join(" -> ")}`);
295
295
  }
296
296
  let u4;
297
297
  f3.add(a5);
298
298
  try {
299
- u4 = re(t4[a5], t4, n5, r6, o4, f3);
299
+ u4 = re(t4[a5], t4, n5, r5, o4, f3);
300
300
  } finally {
301
301
  f3.delete(a5);
302
302
  }
303
303
  return c3 && (u4 = ne(u4, c3, `$var.${a5}`)), u4;
304
304
  }
305
305
  const a4 = e5.match(B);
306
- if (a4 && r6) {
306
+ if (a4 && r5) {
307
307
  const e6 = a4[1], t5 = a4[2];
308
- e6 in r6 || N(`Contract "${e6}" not found`);
309
- let n6 = r6[e6];
308
+ e6 in r5 || N(`Contract "${e6}" not found`);
309
+ let n6 = r5[e6];
310
310
  return t5 && (n6 = ne(n6, t5, `$contract.${e6}`)), n6;
311
311
  }
312
312
  const c2 = e5.match(Z);
313
313
  if (c2) {
314
- const t5 = c2[1], r7 = c2[2], s5 = false === n5?.strictFlowRefs;
315
- o4 || N(`$flow.${t5}${r7 ? `.${r7}` : ""} cannot be resolved without a flow resolver`);
314
+ const t5 = c2[1], r6 = c2[2], s6 = false === n5?.strictFlowRefs;
315
+ o4 || N(`$flow.${t5}${r6 ? `.${r6}` : ""} cannot be resolved without a flow resolver`);
316
316
  const i6 = o4(t5);
317
317
  if (!i6) {
318
- if (s5) return n5?.onWarning?.(te(t5, r7, "unknown-flow")), e5;
318
+ if (s6) return n5?.onWarning?.(te(t5, r6, "unknown-flow")), e5;
319
319
  N(`Flow "${t5}" not found in $flow.${t5}`);
320
320
  }
321
321
  let a5 = i6;
322
- if (r7) if (s5) {
322
+ if (r6) if (s6) {
323
323
  try {
324
- a5 = ne(a5, r7, `$flow.${t5}`);
324
+ a5 = ne(a5, r6, `$flow.${t5}`);
325
325
  } catch {
326
- return n5?.onWarning?.(te(t5, r7, "missing-key")), e5;
326
+ return n5?.onWarning?.(te(t5, r6, "missing-key")), e5;
327
327
  }
328
- if (null == a5 || "" === a5) return n5?.onWarning?.(te(t5, r7, "missing-key")), e5;
329
- } else a5 = ne(a5, r7, `$flow.${t5}`);
328
+ if (null == a5 || "" === a5) return n5?.onWarning?.(te(t5, r6, "missing-key")), e5;
329
+ } else a5 = ne(a5, r6, `$flow.${t5}`);
330
330
  return a5;
331
331
  }
332
332
  const f2 = e5.match(H);
@@ -338,14 +338,14 @@ function re(e5, t4, n5, r6, o4, s4) {
338
338
  let u3 = e5.replace(K, (e6, i6) => {
339
339
  const a5 = i6.split("."), c3 = a5[0], f3 = a5.slice(1).join(".");
340
340
  void 0 === t4[c3] && N(`Variable "${c3}" not found`);
341
- const u4 = s4 ?? /* @__PURE__ */ new Set();
341
+ const u4 = s5 ?? /* @__PURE__ */ new Set();
342
342
  if (u4.has(c3)) {
343
343
  N(`Cyclic $var reference: ${[...u4, c3].join(" -> ")}`);
344
344
  }
345
345
  let l3;
346
346
  u4.add(c3);
347
347
  try {
348
- l3 = re(t4[c3], t4, n5, r6, o4, u4);
348
+ l3 = re(t4[c3], t4, n5, r5, o4, u4);
349
349
  } finally {
350
350
  u4.delete(c3);
351
351
  }
@@ -354,12 +354,12 @@ function re(e5, t4, n5, r6, o4, s4) {
354
354
  }
355
355
  return String(l3);
356
356
  });
357
- return u3 = u3.replace(W, (e6, t5, r7) => n5?.deferred ? void 0 !== r7 ? `${Q}${t5}:${r7}` : `${Q}${t5}` : "undefined" != typeof process && void 0 !== process.env?.[t5] ? process.env[t5] : void 0 !== r7 ? r7 : void N(`Environment variable "${t5}" not found and no default provided`)), u3;
357
+ return u3 = u3.replace(W, (e6, t5, r6) => n5?.deferred ? void 0 !== r6 ? `${Q}${t5}:${r6}` : `${Q}${t5}` : "undefined" != typeof process && void 0 !== process.env?.[t5] ? process.env[t5] : void 0 !== r6 ? r6 : void N(`Environment variable "${t5}" not found and no default provided`)), u3;
358
358
  }
359
- if (Array.isArray(e5)) return e5.map((e6) => re(e6, t4, n5, r6, o4, s4));
359
+ if (Array.isArray(e5)) return e5.map((e6) => re(e6, t4, n5, r5, o4, s5));
360
360
  if (null !== e5 && "object" == typeof e5) {
361
361
  const i5 = {};
362
- for (const [a4, c2] of Object.entries(e5)) i5[a4] = re(c2, t4, n5, r6, o4, s4);
362
+ for (const [a4, c2] of Object.entries(e5)) i5[a4] = re(c2, t4, n5, r5, o4, s5);
363
363
  return i5;
364
364
  }
365
365
  return e5;
@@ -369,61 +369,61 @@ function oe(e5) {
369
369
  return t4 ? "_" + n5 : n5;
370
370
  }
371
371
  function se(e5, t4, n5) {
372
- const r6 = /* @__PURE__ */ new Map(), o4 = /* @__PURE__ */ new Set(), s4 = [], i5 = (t5) => {
373
- if (r6.has(t5)) return r6.get(t5);
372
+ const r5 = /* @__PURE__ */ new Map(), o4 = /* @__PURE__ */ new Set(), s5 = [], i5 = (t5) => {
373
+ if (r5.has(t5)) return r5.get(t5);
374
374
  const a5 = e5.flows[t5];
375
375
  if (a5) {
376
376
  if (o4.has(t5)) {
377
- N(`Cyclic $flow reference: ${[...s4, t5].join(" -> ")}`);
377
+ N(`Cyclic $flow reference: ${[...s5, t5].join(" -> ")}`);
378
378
  }
379
- o4.add(t5), s4.push(t5);
379
+ o4.add(t5), s5.push(t5);
380
380
  try {
381
- const o5 = X(e5.variables, a5.variables), s5 = re(a5.config ?? {}, o5, n5, void 0, i5);
382
- return r6.set(t5, s5), s5;
381
+ const o5 = X(e5.variables, a5.variables), s6 = re(a5.config ?? {}, o5, n5, void 0, i5);
382
+ return r5.set(t5, s6), s6;
383
383
  } finally {
384
- o4.delete(t5), s4.pop();
384
+ o4.delete(t5), s5.pop();
385
385
  }
386
386
  }
387
387
  }, a4 = Object.keys(e5.flows);
388
388
  t4 || (1 === a4.length ? t4 = a4[0] : N(`Multiple flows found (${a4.join(", ")}). Please specify a flow.`));
389
389
  const c2 = e5.flows[t4];
390
- c2 || N(`Flow "${t4}" not found. Available: ${a4.join(", ")}`), o4.add(t4), s4.push(t4);
390
+ c2 || N(`Flow "${t4}" not found. Available: ${a4.join(", ")}`), o4.add(t4), s5.push(t4);
391
391
  try {
392
- return (function(e6, t5, n6, r7) {
392
+ return (function(e6, t5, n6, r6) {
393
393
  const o5 = JSON.parse(JSON.stringify(t5));
394
- let s5;
394
+ let s6;
395
395
  if (e6.contract) {
396
396
  const o6 = X(e6.variables, t5.variables);
397
- s5 = z(re(e6.contract, o6, n6, void 0, r7));
397
+ s6 = z(re(e6.contract, o6, n6, void 0, r6));
398
398
  }
399
399
  if (o5.config) {
400
400
  const i6 = X(e6.variables, t5.variables);
401
- o5.config = re(o5.config, i6, n6, s5, r7);
401
+ o5.config = re(o5.config, i6, n6, s6, r6);
402
402
  }
403
403
  if (o5.sources) for (const [i6, a5] of Object.entries(o5.sources)) {
404
- const c3 = X(e6.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s5, r7), u3 = re(a5.env, c3, n6, s5, r7);
404
+ const c3 = X(e6.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s6, r6), u3 = re(a5.env, c3, n6, s6, r6);
405
405
  o5.sources[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, primary: a5.primary, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
406
406
  }
407
407
  if (o5.destinations) for (const [i6, a5] of Object.entries(o5.destinations)) {
408
- const c3 = X(e6.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s5, r7), u3 = re(a5.env, c3, n6, s5, r7);
408
+ const c3 = X(e6.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s6, r6), u3 = re(a5.env, c3, n6, s6, r6);
409
409
  o5.destinations[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
410
410
  }
411
411
  if (o5.stores) for (const [i6, a5] of Object.entries(o5.stores)) {
412
- const c3 = X(e6.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s5, r7), u3 = re(a5.env, c3, n6, s5, r7);
412
+ const c3 = X(e6.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s6, r6), u3 = re(a5.env, c3, n6, s6, r6);
413
413
  o5.stores[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, cache: a5.cache, variables: a5.variables, code: a5.code };
414
414
  }
415
415
  if (o5.transformers) for (const [i6, a5] of Object.entries(o5.transformers)) {
416
- const c3 = X(e6.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s5, r7), u3 = re(a5.env, c3, n6, s5, r7);
416
+ const c3 = X(e6.variables, t5.variables, a5.variables), f2 = re(a5.config, c3, n6, s6, r6), u3 = re(a5.env, c3, n6, s6, r6);
417
417
  o5.transformers[i6] = { package: a5.package, import: a5.import, config: f2, env: u3, variables: a5.variables, before: a5.before, next: a5.next, cache: a5.cache, code: a5.code };
418
418
  }
419
419
  if (o5.collector) {
420
- const i6 = X(e6.variables, t5.variables), a5 = re(o5.collector, i6, n6, s5, r7);
420
+ const i6 = X(e6.variables, t5.variables), a5 = re(o5.collector, i6, n6, s6, r6);
421
421
  o5.collector = a5;
422
422
  }
423
423
  return o5;
424
424
  })(e5, c2, n5, i5);
425
425
  } finally {
426
- o4.delete(t4), s4.pop();
426
+ o4.delete(t4), s5.pop();
427
427
  }
428
428
  }
429
429
  function ie(e5) {
@@ -433,11 +433,11 @@ function ie(e5) {
433
433
  }
434
434
  function ce(e5, t4 = {}, n5 = {}) {
435
435
  n5 = { ...ae, ...n5 };
436
- const r6 = Object.entries(t4).reduce((t5, [r7, o4]) => {
437
- const s4 = e5[r7];
438
- return n5.merge && Array.isArray(s4) && Array.isArray(o4) ? t5[r7] = o4.reduce((e6, t6) => e6.includes(t6) ? e6 : [...e6, t6], [...s4]) : (n5.extend || r7 in e5) && (t5[r7] = o4), t5;
436
+ const r5 = Object.entries(t4).reduce((t5, [r6, o4]) => {
437
+ const s5 = e5[r6];
438
+ return n5.merge && Array.isArray(s5) && Array.isArray(o4) ? t5[r6] = o4.reduce((e6, t6) => e6.includes(t6) ? e6 : [...e6, t6], [...s5]) : (n5.extend || r6 in e5) && (t5[r6] = o4), t5;
439
439
  }, {});
440
- return n5.shallow ? { ...e5, ...r6 } : (Object.assign(e5, r6), e5);
440
+ return n5.shallow ? { ...e5, ...r5 } : (Object.assign(e5, r5), e5);
441
441
  }
442
442
  function ue(e5) {
443
443
  return Array.isArray(e5);
@@ -470,7 +470,7 @@ function we(e5, t4 = /* @__PURE__ */ new WeakMap()) {
470
470
  if ("[object Object]" === n5) {
471
471
  const n6 = {};
472
472
  t4.set(e5, n6);
473
- for (const r6 in e5) Object.prototype.hasOwnProperty.call(e5, r6) && (n6[r6] = we(e5[r6], t4));
473
+ for (const r5 in e5) Object.prototype.hasOwnProperty.call(e5, r5) && (n6[r5] = we(e5[r5], t4));
474
474
  return n6;
475
475
  }
476
476
  if ("[object Array]" === n5) {
@@ -487,17 +487,17 @@ function we(e5, t4 = /* @__PURE__ */ new WeakMap()) {
487
487
  return e5;
488
488
  }
489
489
  function ke(e5, t4 = "", n5) {
490
- const r6 = t4.split(".");
490
+ const r5 = t4.split(".");
491
491
  let o4 = e5;
492
- for (let e6 = 0; e6 < r6.length; e6++) {
493
- const t5 = r6[e6];
492
+ for (let e6 = 0; e6 < r5.length; e6++) {
493
+ const t5 = r5[e6];
494
494
  if ("*" === t5 && ue(o4)) {
495
- const t6 = r6.slice(e6 + 1).join("."), s4 = [];
495
+ const t6 = r5.slice(e6 + 1).join("."), s5 = [];
496
496
  for (const e7 of o4) {
497
- const r7 = ke(e7, t6, n5);
498
- s4.push(r7);
497
+ const r6 = ke(e7, t6, n5);
498
+ s5.push(r6);
499
499
  }
500
- return s4;
500
+ return s5;
501
501
  }
502
502
  if (o4 = ve(o4) || ue(o4) ? o4[t5] : void 0, void 0 === o4) break;
503
503
  }
@@ -505,30 +505,30 @@ function ke(e5, t4 = "", n5) {
505
505
  }
506
506
  function $e(e5, t4, n5) {
507
507
  if (!ve(e5)) return e5;
508
- const r6 = we(e5), o4 = t4.split(".");
509
- let s4 = r6;
508
+ const r5 = we(e5), o4 = t4.split(".");
509
+ let s5 = r5;
510
510
  for (let e6 = 0; e6 < o4.length; e6++) {
511
511
  const t5 = o4[e6];
512
- e6 === o4.length - 1 ? s4[t5] = n5 : (t5 in s4 && "object" == typeof s4[t5] && null !== s4[t5] || (s4[t5] = {}), s4 = s4[t5]);
512
+ e6 === o4.length - 1 ? s5[t5] = n5 : (t5 in s5 && "object" == typeof s5[t5] && null !== s5[t5] || (s5[t5] = {}), s5 = s5[t5]);
513
513
  }
514
- return r6;
514
+ return r5;
515
515
  }
516
516
  function Se(e5, t4) {
517
517
  if (!ve(e5) && !ue(e5)) return e5;
518
- const n5 = we(e5), r6 = t4.split(".");
518
+ const n5 = we(e5), r5 = t4.split(".");
519
519
  let o4 = n5;
520
- for (let e6 = 0; e6 < r6.length; e6++) {
521
- const t5 = r6[e6], s4 = e6 === r6.length - 1;
520
+ for (let e6 = 0; e6 < r5.length; e6++) {
521
+ const t5 = r5[e6], s5 = e6 === r5.length - 1;
522
522
  if (ue(o4)) {
523
523
  const e7 = Number(t5);
524
524
  if (!Number.isInteger(e7) || e7 < 0 || e7 >= o4.length) return n5;
525
- if (s4) o4.splice(e7, 1);
525
+ if (s5) o4.splice(e7, 1);
526
526
  else {
527
527
  const t6 = o4[e7];
528
528
  if (!ve(t6) && !ue(t6)) return n5;
529
529
  o4 = t6;
530
530
  }
531
- } else if (s4) delete o4[t5];
531
+ } else if (s5) delete o4[t5];
532
532
  else {
533
533
  const e7 = o4[t5];
534
534
  if (!ve(e7) && !ue(e7)) return n5;
@@ -538,43 +538,43 @@ function Se(e5, t4) {
538
538
  return n5;
539
539
  }
540
540
  function je(e5, t4, n5) {
541
- if (ve(n5)) for (const [r6, o4] of Object.entries(n5)) void 0 !== o4 && je(e5, `${t4}_${r6}`, o4);
541
+ if (ve(n5)) for (const [r5, o4] of Object.entries(n5)) void 0 !== o4 && je(e5, `${t4}_${r5}`, o4);
542
542
  else e5[t4] = n5;
543
543
  }
544
544
  function Ie(e5, t4) {
545
- const n5 = {}, r6 = t4.includes("all") ? Object.keys(Ae) : t4;
546
- for (const t5 of r6) {
547
- const r7 = Ae[t5];
548
- if (!r7) continue;
549
- const o4 = r7(e5);
550
- if (ve(o4)) for (const [e6, r8] of Object.entries(o4)) {
551
- if (void 0 === r8) continue;
552
- je(n5, `${t5}_${e6}`, "context" === t5 && Array.isArray(r8) ? r8[0] : r8);
545
+ const n5 = {}, r5 = t4.includes("all") ? Object.keys(Ae) : t4;
546
+ for (const t5 of r5) {
547
+ const r6 = Ae[t5];
548
+ if (!r6) continue;
549
+ const o4 = r6(e5);
550
+ if (ve(o4)) for (const [e6, r7] of Object.entries(o4)) {
551
+ if (void 0 === r7) continue;
552
+ je(n5, `${t5}_${e6}`, "context" === t5 && Array.isArray(r7) ? r7[0] : r7);
553
553
  }
554
554
  }
555
555
  return n5;
556
556
  }
557
557
  function Ee(e5, t4 = {}, n5 = {}) {
558
- const r6 = { ...t4, ...n5 }, o4 = {};
559
- let s4 = !e5 || 0 === Object.keys(e5).length;
560
- return Object.keys(r6).forEach((t5) => {
561
- r6[t5] && (o4[t5] = true, e5 && e5[t5] && (s4 = true));
562
- }), !!s4 && o4;
558
+ const r5 = { ...t4, ...n5 }, o4 = {};
559
+ let s5 = !e5 || 0 === Object.keys(e5).length;
560
+ return Object.keys(r5).forEach((t5) => {
561
+ r5[t5] && (o4[t5] = true, e5 && e5[t5] && (s5 = true));
562
+ }), !!s5 && o4;
563
563
  }
564
564
  function Me(e5 = 6, t4 = "0123456789abcdefghijklmnopqrstuvwxyz") {
565
565
  const n5 = t4.length;
566
566
  if (e5 <= 0 || 0 === n5) return "";
567
- let r6 = "";
567
+ let r5 = "";
568
568
  if (n5 <= 256) {
569
569
  const o4 = 256 - 256 % n5;
570
- for (; r6.length < e5; ) {
571
- const s4 = e5 - r6.length, i5 = new Uint8Array(Math.ceil(1.3 * s4) + 4);
570
+ for (; r5.length < e5; ) {
571
+ const s5 = e5 - r5.length, i5 = new Uint8Array(Math.ceil(1.3 * s5) + 4);
572
572
  if (!Ne(i5)) break;
573
- for (let s5 = 0; s5 < i5.length && r6.length < e5; s5++) i5[s5] < o4 && (r6 += t4[i5[s5] % n5]);
573
+ for (let s6 = 0; s6 < i5.length && r5.length < e5; s6++) i5[s6] < o4 && (r5 += t4[i5[s6] % n5]);
574
574
  }
575
575
  }
576
- for (; r6.length < e5; ) r6 += t4[Math.random() * n5 | 0];
577
- return r6;
576
+ for (; r5.length < e5; ) r5 += t4[Math.random() * n5 | 0];
577
+ return r5;
578
578
  }
579
579
  function Ne(e5) {
580
580
  try {
@@ -599,14 +599,14 @@ function De(e5) {
599
599
  if ("string" != typeof e5) return;
600
600
  const t4 = Le.exec(e5)?.groups;
601
601
  if (!t4) return;
602
- const { version: n5, trace: r6, span: o4 } = t4;
603
- return void 0 === n5 || void 0 === r6 || void 0 === o4 || "ff" === n5 || /^0+$/.test(r6) || /^0+$/.test(o4) ? void 0 : { trace: r6, parentSpan: o4 };
602
+ const { version: n5, trace: r5, span: o4 } = t4;
603
+ return void 0 === n5 || void 0 === r5 || void 0 === o4 || "ff" === n5 || /^0+$/.test(r5) || /^0+$/.test(o4) ? void 0 : { trace: r5, parentSpan: o4 };
604
604
  }
605
605
  function Ke(e5, t4) {
606
606
  return "number" == typeof e5 ? { wait: e5 } : e5 ? { wait: e5.wait ?? t4, size: e5.size, age: e5.age } : { wait: t4 };
607
607
  }
608
608
  function We(e5, t4 = 1e3, n5 = false) {
609
- const { wait: r6, size: o4, age: s4 } = Ke(t4, 1e3);
609
+ const { wait: r5, size: o4, age: s5 } = Ke(t4, 1e3);
610
610
  let i5, a4, c2 = null, f2 = null, u3 = false, l3 = [], p3 = 0;
611
611
  const d2 = () => {
612
612
  c2 && (clearTimeout(c2), c2 = null), f2 && (clearTimeout(f2), f2 = null), p3 = 0, a4 = void 0;
@@ -618,9 +618,9 @@ function We(e5, t4 = 1e3, n5 = false) {
618
618
  const g4 = n5 && !u3;
619
619
  if (a4 = t5, p3 += 1, l3.push(d3), c2 && clearTimeout(c2), c2 = setTimeout(() => {
620
620
  c2 = null, n5 && !u3 || m3();
621
- }, r6), void 0 === s4 || f2 || (f2 = setTimeout(() => {
621
+ }, r5), void 0 === s5 || f2 || (f2 = setTimeout(() => {
622
622
  f2 = null, m3();
623
- }, s4)), void 0 !== o4 && p3 >= o4) m3();
623
+ }, s5)), void 0 !== o4 && p3 >= o4) m3();
624
624
  else if (g4) {
625
625
  u3 = true, i5 = e5(...t5);
626
626
  const n6 = l3;
@@ -638,8 +638,8 @@ function Ze(e5) {
638
638
  return { message: e5.message, name: e5.name, stack: e5.stack, cause: e5.cause };
639
639
  }
640
640
  function Ve(e5, t4) {
641
- let n5, r6 = {};
642
- return e5 instanceof Error ? (n5 = e5.message, r6.error = Ze(e5)) : n5 = e5, void 0 !== t4 && (t4 instanceof Error ? r6.error = Ze(t4) : "object" == typeof t4 && null !== t4 ? (r6 = { ...r6, ...t4 }, "error" in r6 && r6.error instanceof Error && (r6.error = Ze(r6.error))) : r6.value = t4), { message: n5, context: r6 };
641
+ let n5, r5 = {};
642
+ return e5 instanceof Error ? (n5 = e5.message, r5.error = Ze(e5)) : n5 = e5, void 0 !== t4 && (t4 instanceof Error ? r5.error = Ze(t4) : "object" == typeof t4 && null !== t4 ? (r5 = { ...r5, ...t4 }, "error" in r5 && r5.error instanceof Error && (r5.error = Ze(r5.error))) : r5.value = t4), { message: n5, context: r5 };
643
643
  }
644
644
  function Je(e5 = {}) {
645
645
  return Ge({ level: void 0 !== e5.level ? (function(e6) {
@@ -647,18 +647,18 @@ function Je(e5 = {}) {
647
647
  })(e5.level) : 0, handler: e5.handler, jsonHandler: e5.jsonHandler, scope: [] });
648
648
  }
649
649
  function Ge(e5) {
650
- const { level: t4, handler: n5, jsonHandler: r6, scope: o4 } = e5, s4 = (e6, r7, s5) => {
650
+ const { level: t4, handler: n5, jsonHandler: r5, scope: o4 } = e5, s5 = (e6, r6, s6) => {
651
651
  if (e6 <= t4) {
652
- const t5 = Ve(r7, s5);
652
+ const t5 = Ve(r6, s6);
653
653
  n5 ? n5(e6, t5.message, t5.context, o4, He) : He(e6, t5.message, t5.context, o4);
654
654
  }
655
655
  };
656
- return { error: (e6, t5) => s4(0, e6, t5), warn: (e6, t5) => s4(1, e6, t5), info: (e6, t5) => s4(2, e6, t5), debug: (e6, t5) => s4(3, e6, t5), throw: (e6, t5) => {
657
- const r7 = Ve(e6, t5);
658
- throw n5 ? n5(0, r7.message, r7.context, o4, He) : He(0, r7.message, r7.context, o4), new Error(r7.message);
656
+ return { error: (e6, t5) => s5(0, e6, t5), warn: (e6, t5) => s5(1, e6, t5), info: (e6, t5) => s5(2, e6, t5), debug: (e6, t5) => s5(3, e6, t5), throw: (e6, t5) => {
657
+ const r6 = Ve(e6, t5);
658
+ throw n5 ? n5(0, r6.message, r6.context, o4, He) : He(0, r6.message, r6.context, o4), new Error(r6.message);
659
659
  }, json: (e6) => {
660
- r6 ? r6(e6) : console.log(JSON.stringify(e6, null, 2));
661
- }, scope: (e6) => Ge({ level: t4, handler: n5, jsonHandler: r6, scope: [...o4, e6] }) };
660
+ r5 ? r5(e6) : console.log(JSON.stringify(e6, null, 2));
661
+ }, scope: (e6) => Ge({ level: t4, handler: n5, jsonHandler: r5, scope: [...o4, e6] }) };
662
662
  }
663
663
  function Ye(e5) {
664
664
  return le(e5) || be(e5) || he(e5) || !de(e5) || ue(e5) && e5.every(Ye) || ve(e5) && Object.values(e5).every(Ye);
@@ -667,9 +667,9 @@ function Qe(e5) {
667
667
  return Ye(e5) ? e5 : void 0;
668
668
  }
669
669
  function et(e5, t4, n5) {
670
- return function(...r6) {
670
+ return function(...r5) {
671
671
  try {
672
- return e5(...r6);
672
+ return e5(...r5);
673
673
  } catch (e6) {
674
674
  if (!t4) return;
675
675
  return t4(e6);
@@ -679,9 +679,9 @@ function et(e5, t4, n5) {
679
679
  };
680
680
  }
681
681
  function tt(e5, t4, n5) {
682
- return async function(...r6) {
682
+ return async function(...r5) {
683
683
  try {
684
- return await e5(...r6);
684
+ return await e5(...r5);
685
685
  } catch (e6) {
686
686
  if (!t4) return;
687
687
  return await t4(e6);
@@ -691,42 +691,42 @@ function tt(e5, t4, n5) {
691
691
  };
692
692
  }
693
693
  async function rt(e5, t4, n5) {
694
- const [r6, o4] = (e5.name || "").split(" ");
695
- if (!t4 || !r6 || !o4) return {};
696
- let s4, i5 = "", a4 = r6, c2 = o4;
694
+ const [r5, o4] = (e5.name || "").split(" ");
695
+ if (!t4 || !r5 || !o4) return {};
696
+ let s5, i5 = "", a4 = r5, c2 = o4;
697
697
  const f2 = (t5) => {
698
698
  if (!t5) return;
699
699
  return (ue(t5) ? t5 : [t5]).find((t6) => {
700
700
  if (!t6.condition) return true;
701
701
  if (!n5) return Boolean(t6.condition(e5, void 0));
702
- const r7 = { event: e5, mapping: t6, collector: n5, logger: n5.logger, consent: ve(e5) && e5.consent || n5.consent };
703
- return Boolean(t6.condition(e5, r7));
702
+ const r6 = { event: e5, mapping: t6, collector: n5, logger: n5.logger, consent: ve(e5) && e5.consent || n5.consent };
703
+ return Boolean(t6.condition(e5, r6));
704
704
  });
705
705
  };
706
706
  t4[a4] || (a4 = "*");
707
707
  const u3 = t4[a4];
708
- return u3 && (u3[c2] || (c2 = "*"), s4 = f2(u3[c2])), s4 || (a4 = "*", c2 = "*", s4 = f2(t4[a4]?.[c2])), s4 && (i5 = `${a4} ${c2}`), { eventMapping: s4, mappingKey: i5 };
708
+ return u3 && (u3[c2] || (c2 = "*"), s5 = f2(u3[c2])), s5 || (a4 = "*", c2 = "*", s5 = f2(t4[a4]?.[c2])), s5 && (i5 = `${a4} ${c2}`), { eventMapping: s5, mappingKey: i5 };
709
709
  }
710
710
  async function ot(e5, t4 = {}, n5 = {}) {
711
711
  if (!de(e5)) return;
712
- const r6 = ve(e5) && e5.consent || n5.consent || n5.collector?.consent, o4 = n5.event ?? (ve(e5) ? e5 : {});
712
+ const r5 = ve(e5) && e5.consent || n5.consent || n5.collector?.consent, o4 = n5.event ?? (ve(e5) ? e5 : {});
713
713
  if (!n5.collector) throw new Error("getMappingValue: context.collector is required");
714
- const s4 = { event: o4, mapping: t4, collector: n5.collector, logger: n5.collector.logger, consent: r6 }, i5 = ue(t4) ? t4 : [t4];
714
+ const s5 = { event: o4, mapping: t4, collector: n5.collector, logger: n5.collector.logger, consent: r5 }, i5 = ue(t4) ? t4 : [t4];
715
715
  for (const t5 of i5) {
716
- const r7 = await tt(st, (e6) => {
716
+ const r6 = await tt(st, (e6) => {
717
717
  if (e6 instanceof nt) throw e6;
718
- n5.collector && n5.collector.status.failed++, s4.logger.error("mapping processing failed", { event: o4, error: e6 });
719
- })(e5, t5, { ...s4, mapping: t5 });
720
- if (de(r7)) return r7;
718
+ n5.collector && n5.collector.status.failed++, s5.logger.error("mapping processing failed", { event: o4, error: e6 });
719
+ })(e5, t5, { ...s5, mapping: t5 });
720
+ if (de(r6)) return r6;
721
721
  }
722
722
  }
723
723
  async function st(e5, t4, n5) {
724
- return (ue(t4) ? t4 : [t4]).reduce(async (t5, r6) => {
724
+ return (ue(t4) ? t4 : [t4]).reduce(async (t5, r5) => {
725
725
  const o4 = await t5;
726
726
  if (o4) return o4;
727
- const s4 = be(r6) ? { key: r6 } : r6;
728
- if (!Object.keys(s4).length) return;
729
- const { condition: i5, consent: a4, fn: c2, key: f2, loop: u3, map: l3, set: p3, validate: d2, value: m3 } = s4, g3 = { ...n5, mapping: r6 };
727
+ const s5 = be(r5) ? { key: r5 } : r5;
728
+ if (!Object.keys(s5).length) return;
729
+ const { condition: i5, consent: a4, fn: c2, key: f2, loop: u3, map: l3, set: p3, validate: d2, value: m3 } = s5, g3 = { ...n5, mapping: r5 };
730
730
  if (i5 && !await tt(i5, (e6) => {
731
731
  if (e6 instanceof nt) throw e6;
732
732
  return g3.logger.error("mapping condition failed", { event: g3.event, error: e6 }), false;
@@ -737,11 +737,11 @@ async function st(e5, t4, n5) {
737
737
  if (e6 instanceof nt) throw e6;
738
738
  g3.logger.error("mapping fn failed", { event: g3.event, error: e6 });
739
739
  })(e5, g3)), f2 && (h2 = ke(e5, f2, m3)), u3) {
740
- const [t6, n6] = u3, r7 = "this" === t6 ? [e5] : await ot(e5, t6, g3);
741
- ue(r7) && (h2 = (await Promise.all(r7.map((e6) => ot(e6, n6, g3)))).filter(de));
742
- } else l3 ? h2 = await Object.entries(l3).reduce(async (t6, [n6, r7]) => {
743
- const o5 = await t6, s5 = await ot(e5, r7, g3);
744
- return de(s5) && (o5[n6] = s5), o5;
740
+ const [t6, n6] = u3, r6 = "this" === t6 ? [e5] : await ot(e5, t6, g3);
741
+ ue(r6) && (h2 = (await Promise.all(r6.map((e6) => ot(e6, n6, g3)))).filter(de));
742
+ } else l3 ? h2 = await Object.entries(l3).reduce(async (t6, [n6, r6]) => {
743
+ const o5 = await t6, s6 = await ot(e5, r6, g3);
744
+ return de(s6) && (o5[n6] = s6), o5;
745
745
  }, Promise.resolve({})) : p3 && (h2 = await Promise.all(p3.map((t6) => st(e5, t6, g3))));
746
746
  d2 && !await tt(d2, (e6) => {
747
747
  if (e6 instanceof nt) throw e6;
@@ -752,31 +752,31 @@ async function st(e5, t4, n5) {
752
752
  }, Promise.resolve(void 0));
753
753
  }
754
754
  async function it(e5, t4, n5) {
755
- t4.policy && await Promise.all(Object.entries(t4.policy).map(async ([t5, r7]) => {
756
- const o5 = await ot(e5, r7, { collector: n5, event: e5 });
755
+ t4.policy && await Promise.all(Object.entries(t4.policy).map(async ([t5, r6]) => {
756
+ const o5 = await ot(e5, r6, { collector: n5, event: e5 });
757
757
  e5 = $e(e5, t5, o5);
758
758
  }));
759
- const { eventMapping: r6, mappingKey: o4 } = await rt(e5, t4.mapping, n5);
760
- r6?.policy && await Promise.all(Object.entries(r6.policy).map(async ([t5, r7]) => {
761
- const o5 = await ot(e5, r7, { collector: n5, event: e5 });
759
+ const { eventMapping: r5, mappingKey: o4 } = await rt(e5, t4.mapping, n5);
760
+ r5?.policy && await Promise.all(Object.entries(r5.policy).map(async ([t5, r6]) => {
761
+ const o5 = await ot(e5, r6, { collector: n5, event: e5 });
762
762
  e5 = $e(e5, t5, o5);
763
763
  }));
764
- let s4 = t4.data && await ot(e5, t4.data, { collector: n5, event: e5 });
765
- const i5 = Boolean(r6?.silent);
766
- if (r6) {
767
- if (r6.ignore) return { event: e5, data: s4, mapping: r6, mappingKey: o4, ignore: true, silent: i5 };
768
- if (r6.name && (e5.name = r6.name), r6.data) {
769
- const t5 = r6.data && await ot(e5, r6.data, { collector: n5, event: e5 });
770
- s4 = ve(s4) && ve(t5) ? ce(s4, t5) : t5;
764
+ let s5 = t4.data && await ot(e5, t4.data, { collector: n5, event: e5 });
765
+ const i5 = Boolean(r5?.silent);
766
+ if (r5) {
767
+ if (r5.ignore) return { event: e5, data: s5, mapping: r5, mappingKey: o4, ignore: true, silent: i5 };
768
+ if (r5.name && (e5.name = r5.name), r5.data) {
769
+ const t5 = r5.data && await ot(e5, r5.data, { collector: n5, event: e5 });
770
+ s5 = ve(s5) && ve(t5) ? ce(s5, t5) : t5;
771
771
  }
772
772
  }
773
- const a4 = r6?.include ?? t4.include;
773
+ const a4 = r5?.include ?? t4.include;
774
774
  if (a4 && a4.length > 0) {
775
775
  const t5 = Ie(e5, a4);
776
- Object.keys(t5).length > 0 && (s4 = ve(s4) ? ce(t5, s4) : s4 ?? t5);
776
+ Object.keys(t5).length > 0 && (s5 = ve(s5) ? ce(t5, s5) : s5 ?? t5);
777
777
  }
778
- if (r6?.remove && ve(s4)) for (const e6 of r6.remove) s4 = Se(s4, e6);
779
- return { event: e5, data: s4, mapping: r6, mappingKey: o4, ignore: false, silent: i5 };
778
+ if (r5?.remove && ve(s5)) for (const e6 of r5.remove) s5 = Se(s5, e6);
779
+ return { event: e5, data: s5, mapping: r5, mappingKey: o4, ignore: false, silent: i5 };
780
780
  }
781
781
  function gt(e5) {
782
782
  return void 0 === e5 || ye(e5, "") ? e5 : JSON.stringify(e5);
@@ -784,25 +784,25 @@ function gt(e5) {
784
784
  function ht(e5 = {}) {
785
785
  return ce({ "Content-Type": "application/json; charset=utf-8" }, e5);
786
786
  }
787
- function wt(e5, t4, n5, r6) {
787
+ function wt(e5, t4, n5, r5) {
788
788
  const o4 = e5;
789
789
  return function(...e6) {
790
- let s4;
790
+ let s5;
791
791
  const i5 = "pre" + t4, a4 = "post" + t4, c2 = n5[i5], f2 = n5[a4], u3 = (e7, t5) => {
792
- r6 ? r6.warn(e7, { error: t5 }) : console.warn(e7, t5);
792
+ r5 ? r5.warn(e7, { error: t5 }) : console.warn(e7, t5);
793
793
  };
794
794
  if (c2) try {
795
- s4 = c2({ fn: o4 }, ...e6);
795
+ s5 = c2({ fn: o4 }, ...e6);
796
796
  } catch (t5) {
797
- u3(`Hook ${String(i5)} failed, falling back to original function`, t5), s4 = o4(...e6);
797
+ u3(`Hook ${String(i5)} failed, falling back to original function`, t5), s5 = o4(...e6);
798
798
  }
799
- else s4 = o4(...e6);
799
+ else s5 = o4(...e6);
800
800
  if (f2) try {
801
- s4 = f2({ fn: o4, result: s4 }, ...e6);
801
+ s5 = f2({ fn: o4, result: s5 }, ...e6);
802
802
  } catch (e7) {
803
803
  u3(`Hook ${String(a4)} failed, keeping original result`, e7);
804
804
  }
805
- return s4;
805
+ return s5;
806
806
  };
807
807
  }
808
808
  function kt(e5, t4) {
@@ -817,13 +817,13 @@ function kt(e5, t4) {
817
817
  function $t(e5, t4) {
818
818
  const n5 = "function" == typeof t4 ? t4 : () => t4;
819
819
  return function(t5) {
820
- const r6 = n5();
821
- if (!r6) return;
822
- const o4 = r6.level ?? "standard";
820
+ const r5 = n5();
821
+ if (!r5) return;
822
+ const o4 = r5.level ?? "standard";
823
823
  if ("off" === o4) return;
824
- const s4 = r6.sample, i5 = "number" == typeof s4 && Number.isFinite(s4) ? s4 : 1;
824
+ const s5 = r5.sample, i5 = "number" == typeof s5 && Number.isFinite(s5) ? s5 : 1;
825
825
  if (t5.eventId && !kt(t5.eventId, i5)) return;
826
- const a4 = r6.includeIn ?? "trace" === o4, c2 = r6.includeOut ?? "trace" === o4, f2 = r6.includeMappingKey ?? "trace" === o4, u3 = { ...t5 };
826
+ const a4 = r5.includeIn ?? "trace" === o4, c2 = r5.includeOut ?? "trace" === o4, f2 = r5.includeMappingKey ?? "trace" === o4, u3 = { ...t5 };
827
827
  a4 || delete u3.inEvent, c2 || (delete u3.outEvent, delete u3.calls), f2 || delete u3.mappingKey, "trace" !== o4 && u3.error?.message && u3.error.message.length > 256 && (u3.error = { ...u3.error, message: u3.error.message.slice(0, 256) + "\u2026" });
828
828
  try {
829
829
  e5(u3);
@@ -834,20 +834,20 @@ function $t(e5, t4) {
834
834
  function At(e5) {
835
835
  const t4 = e5.now ?? (() => Date.now()), { traceUntil: n5 } = e5;
836
836
  if ("string" == typeof n5 && n5.length > 0) {
837
- const r7 = Date.parse(n5);
838
- if (!Number.isNaN(r7) && r7 > t4()) return { flowId: e5.flowId, level: "trace", includeIn: true, includeOut: true, sample: 1 };
837
+ const r6 = Date.parse(n5);
838
+ if (!Number.isNaN(r6) && r6 > t4()) return { flowId: e5.flowId, level: "trace", includeIn: true, includeOut: true, sample: 1 };
839
839
  }
840
- const r6 = e5.observe?.level ?? "standard";
841
- if ("off" === r6) return null;
840
+ const r5 = e5.observe?.level ?? "standard";
841
+ if ("off" === r5) return null;
842
842
  const o4 = e5.observe?.sample ?? 1;
843
- return { flowId: e5.flowId, level: r6, sample: o4 };
843
+ return { flowId: e5.flowId, level: r5, sample: o4 };
844
844
  }
845
845
  function It(e5) {
846
846
  if (!jt.test(e5)) return null;
847
- const t4 = e5.length % 4 == 0 ? "" : "=".repeat(4 - e5.length % 4), n5 = e5.replace(/-/g, "+").replace(/_/g, "/") + t4, r6 = globalThis.atob;
848
- if (!r6) return null;
847
+ const t4 = e5.length % 4 == 0 ? "" : "=".repeat(4 - e5.length % 4), n5 = e5.replace(/-/g, "+").replace(/_/g, "/") + t4, r5 = globalThis.atob;
848
+ if (!r5) return null;
849
849
  try {
850
- const e6 = r6(n5), t5 = new Uint8Array(e6.length);
850
+ const e6 = r5(n5), t5 = new Uint8Array(e6.length);
851
851
  for (let n6 = 0; n6 < e6.length; n6++) t5[n6] = e6.charCodeAt(n6);
852
852
  return t5;
853
853
  } catch {
@@ -865,9 +865,9 @@ function Et(e5) {
865
865
  const n5 = (function(e6) {
866
866
  let t5 = "";
867
867
  for (let n6 = 0; n6 < e6.length; n6++) {
868
- const r6 = e6[n6];
869
- if (void 0 === r6 || r6 > 127) return null;
870
- t5 += String.fromCharCode(r6);
868
+ const r5 = e6[n6];
869
+ if (void 0 === r5 || r5 > 127) return null;
870
+ t5 += String.fromCharCode(r5);
871
871
  }
872
872
  return t5;
873
873
  })(t4);
@@ -883,41 +883,41 @@ function Ot(e5) {
883
883
  }
884
884
  function _t(e5) {
885
885
  if (!e5) return null;
886
- const t4 = e5.split("."), [n5, r6, o4] = t4;
887
- if (3 !== t4.length || !n5 || !r6 || !o4) return null;
888
- const s4 = Et(n5);
889
- if (!Ot(s4)) return null;
890
- const i5 = s4.kid, a4 = s4.alg;
886
+ const t4 = e5.split("."), [n5, r5, o4] = t4;
887
+ if (3 !== t4.length || !n5 || !r5 || !o4) return null;
888
+ const s5 = Et(n5);
889
+ if (!Ot(s5)) return null;
890
+ const i5 = s5.kid, a4 = s5.alg;
891
891
  if ("string" != typeof i5 || "ES256" !== a4) return null;
892
- const c2 = Et(r6);
892
+ const c2 = Et(r5);
893
893
  if (!(function(e6) {
894
894
  if (!Ot(e6)) return false;
895
895
  const t5 = e6;
896
896
  return "string" == typeof t5.iss && Array.isArray(t5.aud) && t5.aud.every((e7) => "string" == typeof e7) && "number" == typeof t5.iat && "number" == typeof t5.sxp && "string" == typeof t5.art && jt.test(t5.art) && "string" == typeof t5.sri && "string" == typeof t5.pb && "activate" === t5.cap && "string" == typeof t5.jti && "string" == typeof t5.pid && (void 0 === t5.ses || "string" == typeof t5.ses) && (void 0 === t5.sb || "string" == typeof t5.sb);
897
897
  })(c2)) return null;
898
898
  const f2 = It(o4);
899
- return f2 && 64 === f2.byteLength ? { grant: c2, kid: i5, signed: xt(`${n5}.${r6}`), signature: f2 } : null;
899
+ return f2 && 64 === f2.byteLength ? { grant: c2, kid: i5, signed: xt(`${n5}.${r5}`), signature: f2 } : null;
900
900
  }
901
901
  async function Ct(e5, t4) {
902
902
  const n5 = _t(e5);
903
903
  if (!n5) return { ok: false, reason: "malformed" };
904
- const { grant: r6, kid: o4, signed: s4, signature: i5 } = n5;
905
- if (r6.iss !== t4.iss) return { ok: false, reason: "foreign-issuer" };
906
- if ("activate" !== r6.cap) return { ok: false, reason: "cap-mismatch" };
907
- if (1e3 * r6.iat > t4.now + 6e4) return { ok: false, reason: "expired" };
908
- if (1e3 * r6.sxp - 1e3 * r6.iat > Tt) return { ok: false, reason: "expired" };
909
- const a4 = "url" === t4.source ? Math.min(1e3 * r6.iat + Mt, 1e3 * r6.sxp) : 1e3 * r6.sxp;
904
+ const { grant: r5, kid: o4, signed: s5, signature: i5 } = n5;
905
+ if (r5.iss !== t4.iss) return { ok: false, reason: "foreign-issuer" };
906
+ if ("activate" !== r5.cap) return { ok: false, reason: "cap-mismatch" };
907
+ if (1e3 * r5.iat > t4.now + 6e4) return { ok: false, reason: "expired" };
908
+ if (1e3 * r5.sxp - 1e3 * r5.iat > Tt) return { ok: false, reason: "expired" };
909
+ const a4 = "url" === t4.source ? Math.min(1e3 * r5.iat + Mt, 1e3 * r5.sxp) : 1e3 * r5.sxp;
910
910
  if (t4.now >= a4) return { ok: false, reason: "expired" };
911
- if (void 0 !== t4.origin && !r6.aud.includes(t4.origin)) return { ok: false, reason: "aud-mismatch" };
911
+ if (void 0 !== t4.origin && !r5.aud.includes(t4.origin)) return { ok: false, reason: "aud-mismatch" };
912
912
  if (t4.acceptForeign) {
913
913
  const e6 = t4.demoAllowlist ?? [];
914
- if (1 !== r6.aud.length || !r6.aud.every((t5) => e6.includes(t5))) return { ok: false, reason: "aud-mismatch" };
914
+ if (1 !== r5.aud.length || !r5.aud.every((t5) => e6.includes(t5))) return { ok: false, reason: "aud-mismatch" };
915
915
  }
916
- if (!(t4.acceptForeign || t4.pb && r6.pb === t4.pb)) return { ok: false, reason: "pb-mismatch" };
917
- const c2 = void 0 !== r6.ses || void 0 !== r6.sb;
916
+ if (!(t4.acceptForeign || t4.pb && r5.pb === t4.pb)) return { ok: false, reason: "pb-mismatch" };
917
+ const c2 = void 0 !== r5.ses || void 0 !== r5.sb;
918
918
  if (t4.expectSession) {
919
- if (r6.ses !== t4.expectSession.ses) return { ok: false, reason: "sb-mismatch" };
920
- if (!r6.sb || r6.sb !== t4.expectSession.sb) return { ok: false, reason: "sb-mismatch" };
919
+ if (r5.ses !== t4.expectSession.ses) return { ok: false, reason: "sb-mismatch" };
920
+ if (!r5.sb || r5.sb !== t4.expectSession.sb) return { ok: false, reason: "sb-mismatch" };
921
921
  } else if (c2) return { ok: false, reason: "sb-mismatch" };
922
922
  const f2 = t4.keyring.find((e6) => e6.kid === o4);
923
923
  if (!f2) return { ok: false, reason: "kid-mismatch" };
@@ -929,11 +929,11 @@ async function Ct(e5, t4) {
929
929
  if (!p3) return { ok: false, reason: "kid-mismatch" };
930
930
  try {
931
931
  const e6 = await l3.importKey("spki", p3, { name: "ECDSA", namedCurve: "P-256" }, false, ["verify"]);
932
- if (!await l3.verify({ name: "ECDSA", hash: "SHA-256" }, e6, i5, s4)) return { ok: false, reason: "bad-signature" };
932
+ if (!await l3.verify({ name: "ECDSA", hash: "SHA-256" }, e6, i5, s5)) return { ok: false, reason: "bad-signature" };
933
933
  } catch {
934
934
  return { ok: false, reason: "bad-signature" };
935
935
  }
936
- return { ok: true, grant: r6 };
936
+ return { ok: true, grant: r5 };
937
937
  }
938
938
  function ln() {
939
939
  return un;
@@ -950,7 +950,7 @@ function dn(e5, t4) {
950
950
  }
951
951
  }
952
952
  function mn(e5) {
953
- const t4 = e5.batchMs, n5 = "number" == typeof t4 && Number.isFinite(t4) && t4 > 0 ? Math.floor(t4) : 50, r6 = e5.batchSize, o4 = "number" == typeof r6 && Number.isFinite(r6) && r6 >= 1 ? Math.floor(r6) : 50, s4 = e5.maxBodyBytes, i5 = "number" == typeof s4 && Number.isFinite(s4) && s4 >= 1 ? Math.floor(s4) : 6e4, a4 = e5.fetch ?? ((e6, t5) => globalThis.fetch(e6, t5)), c2 = e5.onError ?? (() => {
953
+ const t4 = e5.batchMs, n5 = "number" == typeof t4 && Number.isFinite(t4) && t4 > 0 ? Math.floor(t4) : 50, r5 = e5.batchSize, o4 = "number" == typeof r5 && Number.isFinite(r5) && r5 >= 1 ? Math.floor(r5) : 50, s5 = e5.maxBodyBytes, i5 = "number" == typeof s5 && Number.isFinite(s5) && s5 >= 1 ? Math.floor(s5) : 6e4, a4 = e5.fetch ?? ((e6, t5) => globalThis.fetch(e6, t5)), c2 = e5.onError ?? (() => {
954
954
  }), f2 = {};
955
955
  for (const [t5, n6] of Object.entries(e5.headers ?? {})) {
956
956
  const e6 = t5.toLowerCase();
@@ -963,18 +963,18 @@ function mn(e5) {
963
963
  if ((function(e7) {
964
964
  let t6 = 0;
965
965
  for (let n7 = 0; n7 < e7.length; n7++) {
966
- const r8 = e7.charCodeAt(n7);
967
- if (r8 < 128) t6 += 1;
968
- else if (r8 < 2048) t6 += 2;
969
- else if (r8 >= 55296 && r8 <= 56319 && n7 + 1 < e7.length) {
970
- const r9 = e7.charCodeAt(n7 + 1);
971
- r9 >= 56320 && r9 <= 57343 ? (t6 += 4, n7++) : t6 += 3;
966
+ const r7 = e7.charCodeAt(n7);
967
+ if (r7 < 128) t6 += 1;
968
+ else if (r7 < 2048) t6 += 2;
969
+ else if (r7 >= 55296 && r7 <= 56319 && n7 + 1 < e7.length) {
970
+ const r8 = e7.charCodeAt(n7 + 1);
971
+ r8 >= 56320 && r8 <= 57343 ? (t6 += 4, n7++) : t6 += 3;
972
972
  } else t6 += 3;
973
973
  }
974
974
  return t6;
975
975
  })(n6) <= i5) return [n6];
976
- const r7 = Math.floor(e6.length / 2);
977
- return [...d2(e6.slice(0, r7)), ...d2(e6.slice(r7))];
976
+ const r6 = Math.floor(e6.length / 2);
977
+ return [...d2(e6.slice(0, r6)), ...d2(e6.slice(r6))];
978
978
  }
979
979
  function m3(t5) {
980
980
  return Promise.resolve().then(() => a4(e5.url, { method: "POST", headers: { ...f2, "Content-Type": "application/json", Authorization: `Bearer ${e5.token}` }, body: t5 })).then((t6) => {
@@ -1000,34 +1000,34 @@ function jn(e5) {
1000
1000
  return "string" == typeof e5 || Array.isArray(e5) && e5.every((e6) => "string" == typeof e6) ? e5 : void 0;
1001
1001
  }
1002
1002
  async function In(e5, t4) {
1003
- const n5 = t4?.version || "latest", r6 = t4?.timeout || 1e4, o4 = new AbortController(), s4 = setTimeout(() => o4.abort(), r6), i5 = o4.signal, a4 = t4?.client ? { "X-Walkeros-Client": t4.client } : void 0;
1003
+ const n5 = t4?.version || "latest", r5 = t4?.timeout || 1e4, o4 = new AbortController(), s5 = setTimeout(() => o4.abort(), r5), i5 = o4.signal, a4 = t4?.client ? { "X-Walkeros-Client": t4.client } : void 0;
1004
1004
  try {
1005
1005
  if (t4?.baseUrl) {
1006
- const r8 = `${t4.baseUrl}/api/packages/${encodeURIComponent(e5)}?version=${encodeURIComponent(n5)}&expand=all`, o6 = await fetch(r8, { signal: i5, ...a4 && { headers: a4 } });
1007
- if (!o6.ok) throw new Error(`Failed to fetch ${r8} (HTTP ${o6.status})`);
1006
+ const r7 = `${t4.baseUrl}/api/packages/${encodeURIComponent(e5)}?version=${encodeURIComponent(n5)}&expand=all`, o6 = await fetch(r7, { signal: i5, ...a4 && { headers: a4 } });
1007
+ if (!o6.ok) throw new Error(`Failed to fetch ${r7} (HTTP ${o6.status})`);
1008
1008
  return (function(e6, t5, n6) {
1009
- const r9 = n6.schemas || {}, o7 = n6.examples || {}, s5 = n6.hints, i6 = n6.hintKeys ?? (s5 ? Object.keys(s5) : []), a5 = n6.exampleSummaries ?? [], c2 = n6.platform;
1010
- return { packageName: n6.package || e6, version: "string" == typeof n6.version ? n6.version : t5, ...void 0 !== n6.description && { description: n6.description }, ...void 0 !== n6.type && { type: n6.type }, ...void 0 !== c2 && { platform: c2 }, schemas: r9, examples: o7, ...void 0 !== n6.docs && { docs: n6.docs }, ...void 0 !== n6.source && { source: n6.source }, ...s5 && Object.keys(s5).length > 0 ? { hints: s5 } : {}, hintKeys: i6, exampleSummaries: a5 };
1009
+ const r8 = n6.schemas || {}, o7 = n6.examples || {}, s6 = n6.hints, i6 = n6.hintKeys ?? (s6 ? Object.keys(s6) : []), a5 = n6.exampleSummaries ?? [], c2 = n6.platform;
1010
+ return { packageName: n6.package || e6, version: "string" == typeof n6.version ? n6.version : t5, ...void 0 !== n6.description && { description: n6.description }, ...void 0 !== n6.type && { type: n6.type }, ...void 0 !== c2 && { platform: c2 }, schemas: r8, examples: o7, ...void 0 !== n6.docs && { docs: n6.docs }, ...void 0 !== n6.source && { source: n6.source }, ...s6 && Object.keys(s6).length > 0 ? { hints: s6 } : {}, hintKeys: i6, exampleSummaries: a5 };
1011
1011
  })(e5, n5, await o6.json());
1012
1012
  }
1013
- const r7 = `https://cdn.jsdelivr.net/npm/${e5}@${n5}`, o5 = await xn(`${r7}/package.json`, i5, a4);
1014
- return (function(e6, t5, n6, r8) {
1015
- const o6 = r8.$meta || {}, s5 = r8.schemas || {}, i6 = r8.examples || {}, a5 = r8.hints, c2 = a5 ? Object.keys(a5) : [], f2 = [], u3 = i6.step || {};
1013
+ const r6 = `https://cdn.jsdelivr.net/npm/${e5}@${n5}`, o5 = await xn(`${r6}/package.json`, i5, a4);
1014
+ return (function(e6, t5, n6, r7) {
1015
+ const o6 = r7.$meta || {}, s6 = r7.schemas || {}, i6 = r7.examples || {}, a5 = r7.hints, c2 = a5 ? Object.keys(a5) : [], f2 = [], u3 = i6.step || {};
1016
1016
  for (const [e7, t6] of Object.entries(u3)) {
1017
- const n7 = t6, r9 = { name: e7 };
1018
- "string" == typeof n7?.description && (r9.description = n7.description), f2.push(r9);
1017
+ const n7 = t6, r8 = { name: e7 };
1018
+ "string" == typeof n7?.description && (r8.description = n7.description), f2.push(r8);
1019
1019
  }
1020
1020
  const l3 = "string" == typeof o6.docs ? o6.docs : void 0, p3 = "string" == typeof o6.source ? o6.source : void 0;
1021
- return { packageName: e6, version: "string" == typeof n6.version ? n6.version : t5, description: "string" == typeof n6.description ? n6.description : void 0, type: "string" == typeof o6.type ? o6.type : void 0, platform: jn(o6.platform), schemas: s5, examples: i6, ...l3 ? { docs: l3 } : {}, ...p3 ? { source: p3 } : {}, ...a5 && Object.keys(a5).length > 0 ? { hints: a5 } : {}, hintKeys: c2, exampleSummaries: f2 };
1022
- })(e5, n5, o5, await xn(`${r7}/dist/walkerOS.json`, i5, a4));
1021
+ return { packageName: e6, version: "string" == typeof n6.version ? n6.version : t5, description: "string" == typeof n6.description ? n6.description : void 0, type: "string" == typeof o6.type ? o6.type : void 0, platform: jn(o6.platform), schemas: s6, examples: i6, ...l3 ? { docs: l3 } : {}, ...p3 ? { source: p3 } : {}, ...a5 && Object.keys(a5).length > 0 ? { hints: a5 } : {}, hintKeys: c2, exampleSummaries: f2 };
1022
+ })(e5, n5, o5, await xn(`${r6}/dist/walkerOS.json`, i5, a4));
1023
1023
  } finally {
1024
- clearTimeout(s4);
1024
+ clearTimeout(s5);
1025
1025
  }
1026
1026
  }
1027
1027
  async function xn(e5, t4, n5) {
1028
- const r6 = await fetch(e5, { signal: t4, ...n5 && { headers: n5 } });
1029
- if (!r6.ok) throw new Error(`Failed to fetch ${e5} (HTTP ${r6.status})`);
1030
- return await r6.json();
1028
+ const r5 = await fetch(e5, { signal: t4, ...n5 && { headers: n5 } });
1029
+ if (!r5.ok) throw new Error(`Failed to fetch ${e5} (HTTP ${r5.status})`);
1030
+ return await r5.json();
1031
1031
  }
1032
1032
  async function En(e5, t4) {
1033
1033
  const n5 = await In(e5, t4);
@@ -1039,8 +1039,8 @@ function Nn(e5) {
1039
1039
  }
1040
1040
  function Cn(e5) {
1041
1041
  if (!e5.startsWith(Tn)) return null;
1042
- const t4 = e5.slice(5).split("."), [n5, r6, o4] = t4;
1043
- return 3 === t4.length && n5 && r6 && o4 ? { pb: n5, ses: r6, secret: o4 } : null;
1042
+ const t4 = e5.slice(5).split("."), [n5, r5, o4] = t4;
1043
+ return 3 === t4.length && n5 && r5 && o4 ? { pb: n5, ses: r5, secret: o4 } : null;
1044
1044
  }
1045
1045
  function qn(e5) {
1046
1046
  return ve(e5) && "string" == typeof e5.method && ve(e5.headers);
@@ -1056,7 +1056,7 @@ function Hn(e5) {
1056
1056
  return (e6) => t4.some((t5) => t5(e6));
1057
1057
  }
1058
1058
  return (function(e6) {
1059
- const { key: t4, operator: n5, value: r6, not: o4 } = e6, s4 = (function(e7, t5) {
1059
+ const { key: t4, operator: n5, value: r5, not: o4 } = e6, s5 = (function(e7, t5) {
1060
1060
  switch (e7) {
1061
1061
  case "eq":
1062
1062
  return (e8) => String(e8 ?? "") === t5;
@@ -1081,10 +1081,10 @@ function Hn(e5) {
1081
1081
  case "exists":
1082
1082
  return (e8) => null != e8;
1083
1083
  }
1084
- })(n5, r6);
1084
+ })(n5, r5);
1085
1085
  return (e7) => {
1086
- const n6 = ke(e7, t4), r7 = s4(n6);
1087
- return o4 ? !r7 : r7;
1086
+ const n6 = ke(e7, t4), r6 = s5(n6);
1087
+ return o4 ? !r6 : r6;
1088
1088
  };
1089
1089
  })(e5);
1090
1090
  }
@@ -1137,8 +1137,8 @@ function er(e5, t4 = {}) {
1137
1137
  t5 ? n5 = t5 : (n5 = Xn(e5), n5 && Qn.set(e5, n5));
1138
1138
  } else n5 = Xn(e5);
1139
1139
  if (!n5) return [];
1140
- const r6 = tr(n5, t4);
1141
- return void 0 === r6 ? [] : Array.isArray(r6) ? r6 : [r6];
1140
+ const r5 = tr(n5, t4);
1141
+ return void 0 === r5 ? [] : Array.isArray(r5) ? r5 : [r5];
1142
1142
  }
1143
1143
  function tr(e5, t4 = {}) {
1144
1144
  if (e5) {
@@ -1150,17 +1150,17 @@ function tr(e5, t4 = {}) {
1150
1150
  }
1151
1151
  if ("sequence" === e5.type) {
1152
1152
  const n5 = [];
1153
- for (const r6 of e5.value) {
1154
- const e6 = tr(r6, t4);
1153
+ for (const r5 of e5.value) {
1154
+ const e6 = tr(r5, t4);
1155
1155
  void 0 !== e6 && (Array.isArray(e6) ? n5.push(...e6) : n5.push(e6));
1156
1156
  }
1157
1157
  return n5.length > 0 ? n5 : void 0;
1158
1158
  }
1159
1159
  if ("many" === e5.type) {
1160
1160
  const n5 = [];
1161
- for (const r6 of e5.routes) {
1162
- if (!r6.match(t4)) continue;
1163
- const e6 = tr(r6.next, t4);
1161
+ for (const r5 of e5.routes) {
1162
+ if (!r5.match(t4)) continue;
1163
+ const e6 = tr(r5.next, t4);
1164
1164
  void 0 !== e6 && (Array.isArray(e6) ? n5.push(...e6) : n5.push(e6));
1165
1165
  }
1166
1166
  return n5.length > 0 ? n5 : void 0;
@@ -1169,15 +1169,15 @@ function tr(e5, t4 = {}) {
1169
1169
  }
1170
1170
  }
1171
1171
  function or(e5, t4, n5 = Date.now) {
1172
- const r6 = { [nr]: e5 };
1173
- return void 0 !== t4 && (r6[rr] = n5() + t4), r6;
1172
+ const r5 = { [nr]: e5 };
1173
+ return void 0 !== t4 && (r5[rr] = n5() + t4), r5;
1174
1174
  }
1175
1175
  function sr(e5, t4 = Date.now) {
1176
1176
  if (void 0 === e5) return;
1177
1177
  if (null === (n5 = e5) || "object" != typeof n5 || Array.isArray(n5) || !(nr in e5)) return { value: e5 };
1178
1178
  var n5;
1179
- const r6 = e5[rr];
1180
- return "number" == typeof r6 && t4() > r6 ? { expired: true } : { value: e5[nr] };
1179
+ const r5 = e5[rr];
1180
+ return "number" == typeof r5 && t4() > r5 ? { expired: true } : { value: e5[nr] };
1181
1181
  }
1182
1182
  function cr(e5) {
1183
1183
  return null !== e5 && "object" == typeof e5 && !Array.isArray(e5);
@@ -1192,12 +1192,12 @@ function gr(e5, t4) {
1192
1192
  function hr(e5) {
1193
1193
  return { stop: e5.stop ?? false, storeId: e5.store, namespace: e5.namespace, rules: e5.rules.map((e6) => ({ match: e6.match ? Hn(e6.match) : () => true, key: e6.key, ttl: e6.ttl, update: e6.update })) };
1194
1194
  }
1195
- async function vr(e5, t4, n5, r6) {
1195
+ async function vr(e5, t4, n5, r5) {
1196
1196
  const o4 = e5.rules.find((e6) => e6.match(n5));
1197
1197
  if (!o4) return null;
1198
- const s4 = o4.key.map((e6) => String(ke(n5, e6) ?? ""));
1199
- if (s4.every((e6) => "" === e6)) return null;
1200
- const i5 = s4.join(":"), a4 = r6 ?? e5.namespace, c2 = a4 ? `${a4}:${i5}` : i5, f2 = sr(await t4.get(c2));
1198
+ const s5 = o4.key.map((e6) => String(ke(n5, e6) ?? ""));
1199
+ if (s5.every((e6) => "" === e6)) return null;
1200
+ const i5 = s5.join(":"), a4 = r5 ?? e5.namespace, c2 = a4 ? `${a4}:${i5}` : i5, f2 = sr(await t4.get(c2));
1201
1201
  if (void 0 === f2) return { status: "MISS", key: c2, rule: o4 };
1202
1202
  if ("expired" in f2) {
1203
1203
  try {
@@ -1208,46 +1208,46 @@ async function vr(e5, t4, n5, r6) {
1208
1208
  }
1209
1209
  return { status: "HIT", key: c2, value: f2.value, rule: o4 };
1210
1210
  }
1211
- function yr(e5, t4, n5, r6) {
1211
+ function yr(e5, t4, n5, r5) {
1212
1212
  if (!pr(n5)) return;
1213
- const o4 = 1e3 * r6, s4 = e5.set(t4, or(n5, o4), o4);
1214
- s4 instanceof Promise && s4.catch(() => {
1213
+ const o4 = 1e3 * r5, s5 = e5.set(t4, or(n5, o4), o4);
1214
+ s5 instanceof Promise && s5.catch(() => {
1215
1215
  });
1216
1216
  }
1217
- async function br(e5, t4, n5, r6) {
1217
+ async function br(e5, t4, n5, r5) {
1218
1218
  if (!t4) return e5;
1219
1219
  let o4 = e5;
1220
- for (const [e6, s4] of Object.entries(t4)) {
1221
- o4 = $e(o4, e6, await ot(n5, s4, { collector: r6 }));
1220
+ for (const [e6, s5] of Object.entries(t4)) {
1221
+ o4 = $e(o4, e6, await ot(n5, s5, { collector: r5 }));
1222
1222
  }
1223
1223
  return o4;
1224
1224
  }
1225
1225
  function wr(e5) {
1226
1226
  return ue(e5) ? e5 : [e5];
1227
1227
  }
1228
- async function kr(e5, t4, n5, r6) {
1228
+ async function kr(e5, t4, n5, r5) {
1229
1229
  let o4 = n5;
1230
1230
  for (const n6 of e5) await tt(async () => {
1231
1231
  const e6 = t4(n6.store);
1232
1232
  if (!e6) return;
1233
- const s4 = await ot(o4, n6.key, { collector: r6, event: o4 });
1234
- if (!be(s4)) return;
1235
- const i5 = n6.store ? s4 : `state:${s4}`;
1233
+ const s5 = await ot(o4, n6.key, { collector: r5, event: o4 });
1234
+ if (!be(s5)) return;
1235
+ const i5 = n6.store ? s5 : `state:${s5}`;
1236
1236
  if ("set" === n6.mode) {
1237
- const t5 = await ot(o4, n6.value, { collector: r6, event: o4 });
1237
+ const t5 = await ot(o4, n6.value, { collector: r5, event: o4 });
1238
1238
  if (!de(t5)) return;
1239
1239
  await e6.set(i5, t5);
1240
1240
  } else {
1241
1241
  const t5 = be(a4 = n6.value) ? a4 : ve(a4) && be(a4.key) ? a4.key : void 0;
1242
1242
  if (!t5) return;
1243
- const r7 = await e6.get(i5);
1244
- if (!de(r7)) return;
1245
- o4 = $e(o4, t5, r7);
1243
+ const r6 = await e6.get(i5);
1244
+ if (!de(r6)) return;
1245
+ o4 = $e(o4, t5, r6);
1246
1246
  }
1247
1247
  var a4;
1248
1248
  }, (e6) => {
1249
1249
  if (e6 instanceof nt) throw e6;
1250
- r6.logger?.error?.("[state] operation failed", e6);
1250
+ r5.logger?.error?.("[state] operation failed", e6);
1251
1251
  })();
1252
1252
  return o4;
1253
1253
  }
@@ -1255,9 +1255,9 @@ function Ir(e5, t4) {
1255
1255
  const n5 = (function(e6) {
1256
1256
  return /* @__PURE__ */ new Set([...$r[e6], ...Sr, ...Ar[e6]]);
1257
1257
  })(t4);
1258
- for (const r7 of Object.keys(e5)) if (!n5.has(r7)) return { ok: false, code: "UNKNOWN_KEY", key: r7, reason: `Unknown key "${r7}" on ${t4}. Allowed: ${[...n5].sort().join(", ")}.` };
1259
- const r6 = void 0 !== e5.package, o4 = void 0 !== e5.import, s4 = void 0 !== e5.code;
1260
- return s4 && "string" == typeof e5.code ? { ok: false, code: "OBSOLETE_CODE_STRING", key: "code", reason: `code: "<name>" is no longer supported. Use import: "${e5.code}" with the package field instead.` } : s4 && ("object" != typeof e5.code && "function" != typeof e5.code || null === e5.code || Array.isArray(e5.code)) ? { ok: false, code: "INVALID_CODE_SHAPE", key: "code", reason: "code must be an object ({ push, type?, init? }) or a resolved function value." } : s4 && r6 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : s4 && o4 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o4 && !r6 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o4 || "string" == typeof e5.import && jr.test(e5.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${jr.source}. Got: ${JSON.stringify(e5.import)}.` };
1258
+ for (const r6 of Object.keys(e5)) if (!n5.has(r6)) return { ok: false, code: "UNKNOWN_KEY", key: r6, reason: `Unknown key "${r6}" on ${t4}. Allowed: ${[...n5].sort().join(", ")}.` };
1259
+ const r5 = void 0 !== e5.package, o4 = void 0 !== e5.import, s5 = void 0 !== e5.code;
1260
+ return s5 && "string" == typeof e5.code ? { ok: false, code: "OBSOLETE_CODE_STRING", key: "code", reason: `code: "<name>" is no longer supported. Use import: "${e5.code}" with the package field instead.` } : s5 && ("object" != typeof e5.code && "function" != typeof e5.code || null === e5.code || Array.isArray(e5.code)) ? { ok: false, code: "INVALID_CODE_SHAPE", key: "code", reason: "code must be an object ({ push, type?, init? }) or a resolved function value." } : s5 && r5 ? { ok: false, code: "CONFLICT", key: "package", reason: "Cannot specify both `code` and `package`. Use one or the other." } : s5 && o4 ? { ok: false, code: "CONFLICT", key: "import", reason: "Cannot specify both `code` and `import`." } : o4 && !r5 ? { ok: false, code: "MISSING_PACKAGE", key: "import", reason: "`import` requires `package` to be set." } : !o4 || "string" == typeof e5.import && jr.test(e5.import) ? { ok: true } : { ok: false, code: "INVALID_IMPORT", key: "import", reason: `import must match ${jr.source}. Got: ${JSON.stringify(e5.import)}.` };
1261
1261
  }
1262
1262
  function xr(e5, t4) {
1263
1263
  return "Transformer" === t4 && (void 0 === e5.code && void 0 === e5.package && void 0 === e5.import && (void 0 !== e5.before || void 0 !== e5.next || void 0 !== e5.cache || void 0 !== e5.state || void 0 !== e5.mapping));
@@ -1268,7 +1268,7 @@ var init_dist = __esm({
1268
1268
  "use strict";
1269
1269
  e = Object.defineProperty;
1270
1270
  t = (t4, n5) => {
1271
- for (var r6 in n5) e(t4, r6, { get: n5[r6], enumerable: true });
1271
+ for (var r5 in n5) e(t4, r5, { get: n5[r5], enumerable: true });
1272
1272
  };
1273
1273
  r = {};
1274
1274
  t(r, { stepId: () => o });
@@ -1299,9 +1299,9 @@ var init_dist = __esm({
1299
1299
  Ae = { data: (e5) => e5.data, globals: (e5) => e5.globals, context: (e5) => e5.context, user: (e5) => e5.user, source: (e5) => e5.source, event: (e5) => ({ entity: e5.entity, action: e5.action, id: e5.id, timestamp: e5.timestamp, name: e5.name, trigger: e5.trigger, timing: e5.timing }) };
1300
1300
  Te = "0123456789abcdef";
1301
1301
  Le = /^(?<version>[0-9a-f]{2})-(?<trace>[0-9a-f]{32})-(?<span>[0-9a-f]{16})-[0-9a-f]{2}$/;
1302
- He = (e5, t4, n5, r6) => {
1303
- const o4 = `${l[e5]}${r6.length > 0 ? ` [${r6.join(":")}]` : ""}`, s4 = Object.keys(n5).length > 0, i5 = 0 === e5 ? console.error : 1 === e5 ? console.warn : console.log;
1304
- s4 ? i5(o4, t4, n5) : i5(o4, t4);
1302
+ He = (e5, t4, n5, r5) => {
1303
+ const o4 = `${l[e5]}${r5.length > 0 ? ` [${r5.join(":")}]` : ""}`, s5 = Object.keys(n5).length > 0, i5 = 0 === e5 ? console.error : 1 === e5 ? console.warn : console.log;
1304
+ s5 ? i5(o4, t4, n5) : i5(o4, t4);
1305
1305
  };
1306
1306
  nt = class e2 extends Error {
1307
1307
  constructor(t4, n5) {
@@ -1332,19 +1332,19 @@ var init_dist = __esm({
1332
1332
  });
1333
1333
 
1334
1334
  // ../server/core/dist/index.mjs
1335
- import * as r3 from "http";
1336
- import * as s from "https";
1335
+ import * as r2 from "http";
1336
+ import * as s2 from "https";
1337
1337
  import { createHash as n2 } from "crypto";
1338
1338
  function a2(a4, n5, i5 = {}) {
1339
1339
  const u3 = ht(i5.headers), c2 = gt(n5), m3 = i5.method || "POST", d2 = i5.timeout || 5e3;
1340
1340
  return new Promise((t4) => {
1341
- const e5 = new URL(a4), n6 = "https:" === e5.protocol ? s : r3, i6 = { method: m3, headers: u3 }, p3 = n6.request(e5, i6, (e6) => {
1342
- const r6 = [];
1341
+ const e5 = new URL(a4), n6 = "https:" === e5.protocol ? s2 : r2, i6 = { method: m3, headers: u3 }, p3 = n6.request(e5, i6, (e6) => {
1342
+ const r5 = [];
1343
1343
  e6.on("data", (t5) => {
1344
- r6.push(t5);
1344
+ r5.push(t5);
1345
1345
  }), e6.on("end", () => {
1346
- const s4 = !!(e6.statusCode && e6.statusCode >= 200 && e6.statusCode < 300), a5 = Buffer.concat(r6).toString(), n7 = et(JSON.parse, () => a5)(a5);
1347
- t4({ ok: s4, data: n7, error: s4 ? void 0 : `${e6.statusCode} ${e6.statusMessage}` });
1346
+ const s5 = !!(e6.statusCode && e6.statusCode >= 200 && e6.statusCode < 300), a5 = Buffer.concat(r5).toString(), n7 = et(JSON.parse, () => a5)(a5);
1347
+ t4({ ok: s5, data: n7, error: s5 ? void 0 : `${e6.statusCode} ${e6.statusMessage}` });
1348
1348
  });
1349
1349
  });
1350
1350
  p3.on("error", (e6) => {
@@ -1355,11 +1355,11 @@ function a2(a4, n5, i5 = {}) {
1355
1355
  });
1356
1356
  }
1357
1357
  async function i2(t4, e5, o4 = {}) {
1358
- const r6 = o4.algorithm ?? "sha256";
1358
+ const r5 = o4.algorithm ?? "sha256";
1359
1359
  return (await (async function(t5, e6) {
1360
1360
  const o5 = n2(e6);
1361
1361
  return o5.update(t5), o5.digest("hex");
1362
- })(t4, r6)).slice(0, e5);
1362
+ })(t4, r5)).slice(0, e5);
1363
1363
  }
1364
1364
  var init_dist2 = __esm({
1365
1365
  "../server/core/dist/index.mjs"() {
@@ -1447,16 +1447,16 @@ var init_config_file = __esm({
1447
1447
  });
1448
1448
 
1449
1449
  // src/core/redact-line.ts
1450
- function escapeRegex(s4) {
1451
- return s4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1450
+ function escapeRegex(s5) {
1451
+ return s5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1452
1452
  }
1453
- function shannonEntropy(s4) {
1454
- if (s4.length === 0) return 0;
1453
+ function shannonEntropy(s5) {
1454
+ if (s5.length === 0) return 0;
1455
1455
  const counts = /* @__PURE__ */ new Map();
1456
- for (const ch of s4) counts.set(ch, (counts.get(ch) ?? 0) + 1);
1456
+ for (const ch of s5) counts.set(ch, (counts.get(ch) ?? 0) + 1);
1457
1457
  let entropy = 0;
1458
1458
  for (const count of counts.values()) {
1459
- const p3 = count / s4.length;
1459
+ const p3 = count / s5.length;
1460
1460
  entropy -= p3 * Math.log2(p3);
1461
1461
  }
1462
1462
  return entropy;
@@ -1494,18 +1494,18 @@ function removePemBlocks(lines) {
1494
1494
  return out;
1495
1495
  }
1496
1496
  function maskLine(line) {
1497
- let s4 = line;
1498
- s4 = s4.replace(RE_URL_CREDS, "$1***$2");
1499
- s4 = s4.replace(
1497
+ let s5 = line;
1498
+ s5 = s5.replace(RE_URL_CREDS, "$1***$2");
1499
+ s5 = s5.replace(
1500
1500
  RE_KV_SECRET,
1501
1501
  (match, boundary, keyPart, value) => shouldMaskToken(value) ? `${boundary}${keyPart}***` : match
1502
1502
  );
1503
- s4 = s4.replace(RE_PREFIXED_TOKEN, "***");
1504
- s4 = s4.replace(
1503
+ s5 = s5.replace(RE_PREFIXED_TOKEN, "***");
1504
+ s5 = s5.replace(
1505
1505
  RE_TOKEN_RUN,
1506
1506
  (match) => shouldMaskToken(match) ? "***" : match
1507
1507
  );
1508
- return s4;
1508
+ return s5;
1509
1509
  }
1510
1510
  function scrubSecrets(line) {
1511
1511
  const withoutJsonKey = line.replace(RE_JSON_SA_FIELD, '$1"***"');
@@ -1576,9 +1576,17 @@ function createCLILoggerConfig(options = {}) {
1576
1576
  // at DEBUG, ERROR always reaches the handler (and the ring) even without
1577
1577
  // --verbose.
1578
1578
  level: l.DEBUG,
1579
- handler: (level, message, _context, scope) => {
1579
+ handler: (level, message, context2, scope) => {
1580
1580
  const scopePath = scope.length > 0 ? `[${scope.join(":")}] ` : "";
1581
- const fullMessage = scrubSecrets(`${scopePath}${message}`);
1581
+ let meta = "";
1582
+ if (Object.keys(context2).length > 0) {
1583
+ try {
1584
+ meta = ` ${JSON.stringify(context2)}`;
1585
+ } catch {
1586
+ meta = " [unserializable context]";
1587
+ }
1588
+ }
1589
+ const fullMessage = scrubSecrets(`${scopePath}${message}${meta}`);
1582
1590
  try {
1583
1591
  options.onLine?.(level, fullMessage);
1584
1592
  } catch {
@@ -2114,14 +2122,14 @@ function ln2(e5) {
2114
2122
  }
2115
2123
  function fn(e5, t4) {
2116
2124
  const i5 = false !== t4?.stripAnnotations, n5 = {}, o4 = /* @__PURE__ */ new Set();
2117
- function r6(t5) {
2125
+ function r5(t5) {
2118
2126
  if (n5[t5]) return n5[t5];
2119
2127
  o4.has(t5) && ln2(`Circular extend chain detected: ${[...o4, t5].join(" \u2192 ")}`);
2120
2128
  const a4 = e5[t5];
2121
2129
  a4 || ln2(`Contract "${t5}" not found`), o4.add(t5);
2122
- let s4 = {};
2130
+ let s5 = {};
2123
2131
  if (a4.extend) {
2124
- s4 = (function(e6, t6) {
2132
+ s5 = (function(e6, t6) {
2125
2133
  const i6 = {};
2126
2134
  void 0 === e6.tagging && void 0 === t6.tagging || (i6.tagging = t6.tagging ?? e6.tagging);
2127
2135
  void 0 === e6.description && void 0 === t6.description || (i6.description = t6.description ?? e6.description);
@@ -2129,65 +2137,65 @@ function fn(e5, t4) {
2129
2137
  if (e6.events || t6.events) {
2130
2138
  const n6 = {}, o5 = /* @__PURE__ */ new Set([...Object.keys(e6.events || {}), ...Object.keys(t6.events || {})]);
2131
2139
  for (const i7 of o5) {
2132
- const o6 = e6.events?.[i7] || {}, r7 = t6.events?.[i7] || {}, a5 = /* @__PURE__ */ new Set([...Object.keys(o6), ...Object.keys(r7)]);
2140
+ const o6 = e6.events?.[i7] || {}, r6 = t6.events?.[i7] || {}, a5 = /* @__PURE__ */ new Set([...Object.keys(o6), ...Object.keys(r6)]);
2133
2141
  n6[i7] = {};
2134
2142
  for (const e7 of a5) {
2135
- const t7 = o6[e7], a6 = r7[e7];
2143
+ const t7 = o6[e7], a6 = r6[e7];
2136
2144
  n6[i7][e7] = t7 && a6 ? gn(t7, a6) : { ...t7 || a6 };
2137
2145
  }
2138
2146
  }
2139
2147
  i6.events = n6;
2140
2148
  }
2141
2149
  return i6;
2142
- })(r6(a4.extend), a4);
2143
- } else s4 = { ...a4 };
2144
- if (delete s4.extend, s4.events && (s4.events = (function(e6) {
2150
+ })(r5(a4.extend), a4);
2151
+ } else s5 = { ...a4 };
2152
+ if (delete s5.extend, s5.events && (s5.events = (function(e6) {
2145
2153
  const t6 = {};
2146
2154
  for (const i6 of Object.keys(e6)) if ("*" !== i6) {
2147
2155
  t6[i6] = {};
2148
2156
  for (const n6 of Object.keys(e6[i6] || {})) {
2149
2157
  let o5 = {};
2150
- const r7 = e6["*"]?.["*"];
2151
- r7 && (o5 = gn(o5, r7));
2158
+ const r6 = e6["*"]?.["*"];
2159
+ r6 && (o5 = gn(o5, r6));
2152
2160
  const a5 = e6["*"]?.[n6];
2153
2161
  a5 && "*" !== n6 && (o5 = gn(o5, a5));
2154
- const s5 = e6[i6]?.["*"];
2155
- s5 && "*" !== n6 && (o5 = gn(o5, s5));
2162
+ const s6 = e6[i6]?.["*"];
2163
+ s6 && "*" !== n6 && (o5 = gn(o5, s6));
2156
2164
  const c2 = e6[i6]?.[n6];
2157
2165
  c2 && (o5 = gn(o5, c2)), t6[i6][n6] = o5;
2158
2166
  }
2159
2167
  }
2160
2168
  e6["*"] && (t6["*"] = { ...e6["*"] });
2161
2169
  return t6;
2162
- })(s4.events)), s4.events && i5) {
2170
+ })(s5.events)), s5.events && i5) {
2163
2171
  const e6 = {};
2164
- for (const [t6, i6] of Object.entries(s4.events)) {
2172
+ for (const [t6, i6] of Object.entries(s5.events)) {
2165
2173
  e6[t6] = {};
2166
- for (const [n6, o5] of Object.entries(i6)) e6[t6][n6] = bn2(o5);
2174
+ for (const [n6, o5] of Object.entries(i6)) e6[t6][n6] = bn(o5);
2167
2175
  }
2168
- s4.events = e6;
2176
+ s5.events = e6;
2169
2177
  }
2170
- return o4.delete(t5), n5[t5] = s4, s4;
2178
+ return o4.delete(t5), n5[t5] = s5, s5;
2171
2179
  }
2172
- for (const t5 of Object.keys(e5)) r6(t5);
2180
+ for (const t5 of Object.keys(e5)) r5(t5);
2173
2181
  return n5;
2174
2182
  }
2175
2183
  function gn(e5, t4) {
2176
2184
  const i5 = { ...e5 };
2177
2185
  for (const n5 of Object.keys(t4)) {
2178
- const o4 = e5[n5], r6 = t4[n5];
2179
- "required" === n5 && Array.isArray(o4) && Array.isArray(r6) ? i5[n5] = [.../* @__PURE__ */ new Set([...o4, ...r6])] : vn(o4) && vn(r6) ? i5[n5] = gn(o4, r6) : i5[n5] = r6;
2186
+ const o4 = e5[n5], r5 = t4[n5];
2187
+ "required" === n5 && Array.isArray(o4) && Array.isArray(r5) ? i5[n5] = [.../* @__PURE__ */ new Set([...o4, ...r5])] : vn(o4) && vn(r5) ? i5[n5] = gn(o4, r5) : i5[n5] = r5;
2180
2188
  }
2181
2189
  return i5;
2182
2190
  }
2183
- function bn2(e5) {
2191
+ function bn(e5) {
2184
2192
  const t4 = {};
2185
- for (const [i5, n5] of Object.entries(e5)) dn2.has(i5) || (mn3.has(i5) && vn(n5) ? t4[i5] = hn(n5) : un3.has(i5) && Array.isArray(n5) ? t4[i5] = n5.map((e6) => vn(e6) ? bn2(e6) : e6) : pn2.has(i5) && vn(n5) ? t4[i5] = bn2(n5) : t4[i5] = n5);
2193
+ for (const [i5, n5] of Object.entries(e5)) dn3.has(i5) || (mn2.has(i5) && vn(n5) ? t4[i5] = hn2(n5) : un2.has(i5) && Array.isArray(n5) ? t4[i5] = n5.map((e6) => vn(e6) ? bn(e6) : e6) : pn2.has(i5) && vn(n5) ? t4[i5] = bn(n5) : t4[i5] = n5);
2186
2194
  return t4;
2187
2195
  }
2188
- function hn(e5) {
2196
+ function hn2(e5) {
2189
2197
  const t4 = {};
2190
- for (const [i5, n5] of Object.entries(e5)) t4[i5] = vn(n5) ? bn2(n5) : n5;
2198
+ for (const [i5, n5] of Object.entries(e5)) t4[i5] = vn(n5) ? bn(n5) : n5;
2191
2199
  return t4;
2192
2200
  }
2193
2201
  function vn(e5) {
@@ -2211,14 +2219,14 @@ function Sn2(e5, t4) {
2211
2219
  })(t5, e5);
2212
2220
  return { valid: false, errors: [{ message: t5 instanceof Error ? t5.message : "Invalid JSON", severity: "error", line: i6, column: n6 }], warnings: [] };
2213
2221
  }
2214
- const n5 = [], o4 = [], r6 = Li.safeParse(i5);
2215
- if (!r6.success) for (const t5 of r6.error.issues) {
2222
+ const n5 = [], o4 = [], r5 = Li.safeParse(i5);
2223
+ if (!r5.success) for (const t5 of r5.error.issues) {
2216
2224
  const i6 = t5.path.join("."), o5 = Mn2(e5, t5.path);
2217
2225
  n5.push({ message: t5.message, severity: "error", path: i6 || "root", ...o5 });
2218
2226
  }
2219
2227
  const a4 = (function(e6) {
2220
2228
  if (!(Fn(e6) && "version" in e6 && "flows" in e6 && Fn(e6.flows))) return;
2221
- const t5 = {}, i6 = [], n6 = [], o5 = [], r7 = [], a5 = [], s4 = [];
2229
+ const t5 = {}, i6 = [], n6 = [], o5 = [], r6 = [], a5 = [], s5 = [];
2222
2230
  let c2;
2223
2231
  const l3 = Object.keys(e6.flows);
2224
2232
  $n(t5, e6.variables), (function(e7, t6) {
@@ -2238,23 +2246,23 @@ function Sn2(e5, t4) {
2238
2246
  for (const [e8, t9] of Object.entries(n7)) i9.actions.includes(e8) || i9.actions.push(e8), i9.properties[e8] = An(t9);
2239
2247
  }
2240
2248
  }
2241
- })(s4, e6.contract);
2242
- for (const s5 of Object.values(e6.flows)) if (Fn(s5)) {
2249
+ })(s5, e6.contract);
2250
+ for (const s6 of Object.values(e6.flows)) if (Fn(s6)) {
2243
2251
  if (!c2) {
2244
- const e7 = s5.config;
2252
+ const e7 = s6.config;
2245
2253
  !Fn(e7) || "web" !== e7.platform && "server" !== e7.platform || (c2 = e7.platform);
2246
2254
  }
2247
- $n(t5, s5.variables);
2255
+ $n(t5, s6.variables);
2248
2256
  for (const e7 of ["sources", "destinations", "transformers"]) {
2249
- const r8 = "sources" === e7 ? "source" : "destinations" === e7 ? "destination" : "transformer", l4 = "sources" === e7 ? i6 : "destinations" === e7 ? n6 : o5;
2250
- if (Fn(s5[e7])) for (const [i7, n7] of Object.entries(s5[e7])) l4.push(i7), Fn(n7) && ($n(t5, n7.variables), "string" == typeof n7.package && a5.push({ package: n7.package, shortName: i7, type: r8, platform: c2 || "web" }));
2257
+ const r7 = "sources" === e7 ? "source" : "destinations" === e7 ? "destination" : "transformer", l4 = "sources" === e7 ? i6 : "destinations" === e7 ? n6 : o5;
2258
+ if (Fn(s6[e7])) for (const [i7, n7] of Object.entries(s6[e7])) l4.push(i7), Fn(n7) && ($n(t5, n7.variables), "string" == typeof n7.package && a5.push({ package: n7.package, shortName: i7, type: r7, platform: c2 || "web" }));
2251
2259
  }
2252
- if (Fn(s5.stores)) for (const [e7, i7] of Object.entries(s5.stores)) r7.push(e7), Fn(i7) && $n(t5, i7.variables);
2260
+ if (Fn(s6.stores)) for (const [e7, i7] of Object.entries(s6.stores)) r6.push(e7), Fn(i7) && $n(t5, i7.variables);
2253
2261
  }
2254
- const d2 = { variables: t5, stepNames: { sources: i6, destinations: n6, transformers: o5, stores: r7 }, flowNames: l3 };
2262
+ const d2 = { variables: t5, stepNames: { sources: i6, destinations: n6, transformers: o5, stores: r6 }, flowNames: l3 };
2255
2263
  c2 && (d2.platform = c2);
2256
2264
  a5.length > 0 && (d2.packages = a5);
2257
- s4.length > 0 && (d2.contract = s4);
2265
+ s5.length > 0 && (d2.contract = s5);
2258
2266
  return d2;
2259
2267
  })(i5);
2260
2268
  return a4 && (t4?.secrets && (a4.secrets = t4.secrets), (function(e6, t5, i6, n6, o5) {
@@ -2262,8 +2270,8 @@ function Sn2(e5, t4) {
2262
2270
  let n7;
2263
2271
  Cn3.lastIndex = 0;
2264
2272
  for (; null !== (n7 = Cn3.exec(e7)); ) {
2265
- const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = Tn2(e7, n7.index, t7.length);
2266
- i7.push({ message: `Malformed reference "${t7}", use a dot, not a colon: "$${o6}.${r7}".`, severity: "warning", path: t7, ...a5 });
2273
+ const t7 = n7[0], o6 = n7[1], r6 = n7[2], a5 = Tn2(e7, n7.index, t7.length);
2274
+ i7.push({ message: `Malformed reference "${t7}", use a dot, not a colon: "$${o6}.${r6}".`, severity: "warning", path: t7, ...a5 });
2267
2275
  }
2268
2276
  })(e6, 0, o5), (function(e7, t6, i7) {
2269
2277
  if (!t6.variables) return;
@@ -2285,8 +2293,8 @@ function Sn2(e5, t4) {
2285
2293
  let n7;
2286
2294
  wn.lastIndex = 0;
2287
2295
  for (; null !== (n7 = wn.exec(e7)); ) {
2288
- const t7 = n7[0], o6 = n7[1], r7 = n7[2], a5 = Tn2(e7, n7.index, t7.length);
2289
- r7 ? i7.push({ message: `Malformed $env reference "${t7}". Use ":" for default values, not "=" (e.g., "$env.${o6}:fallback").`, severity: "warning", path: t7, ...a5 }) : /^[A-Z][A-Z0-9_]*$/.test(o6) || i7.push({ message: `$env.${o6} should use UPPER_SNAKE_CASE by convention (e.g., $env.${o6.toUpperCase()}).`, severity: "warning", path: t7, ...a5 });
2296
+ const t7 = n7[0], o6 = n7[1], r6 = n7[2], a5 = Tn2(e7, n7.index, t7.length);
2297
+ r6 ? i7.push({ message: `Malformed $env reference "${t7}". Use ":" for default values, not "=" (e.g., "$env.${o6}:fallback").`, severity: "warning", path: t7, ...a5 }) : /^[A-Z][A-Z0-9_]*$/.test(o6) || i7.push({ message: `$env.${o6} should use UPPER_SNAKE_CASE by convention (e.g., $env.${o6.toUpperCase()}).`, severity: "warning", path: t7, ...a5 });
2290
2298
  }
2291
2299
  })(e6, 0, o5), (function(e7, t6, i7) {
2292
2300
  const n7 = t6.flowNames ?? [];
@@ -2294,22 +2302,22 @@ function Sn2(e5, t4) {
2294
2302
  let o6;
2295
2303
  kn2.lastIndex = 0;
2296
2304
  for (; null !== (o6 = kn2.exec(e7)); ) {
2297
- const t7 = o6[0], r7 = o6[1];
2298
- if (!n7.includes(r7)) {
2305
+ const t7 = o6[0], r6 = o6[1];
2306
+ if (!n7.includes(r6)) {
2299
2307
  const a5 = Tn2(e7, o6.index, t7.length);
2300
- i7.push({ message: `Unknown flow "$flow.${r7}". Defined: ${n7.join(", ")}`, severity: "warning", path: t7, ...a5 });
2308
+ i7.push({ message: `Unknown flow "$flow.${r6}". Defined: ${n7.join(", ")}`, severity: "warning", path: t7, ...a5 });
2301
2309
  }
2302
2310
  }
2303
2311
  })(e6, i6, o5), (function(e7, t6, i7, n7, o6) {
2304
- const r7 = i7.secrets;
2312
+ const r6 = i7.secrets;
2305
2313
  if (!Fn(t6) || !Fn(t6.flows)) return;
2306
2314
  for (const i8 of Object.values(t6.flows)) {
2307
2315
  if (!Fn(i8)) continue;
2308
- const t7 = i8.config, a5 = !Fn(t7) || "web" !== t7.platform && "server" !== t7.platform ? void 0 : t7.platform, s4 = JSON.stringify(i8);
2316
+ const t7 = i8.config, a5 = !Fn(t7) || "web" !== t7.platform && "server" !== t7.platform ? void 0 : t7.platform, s5 = JSON.stringify(i8);
2309
2317
  let c2;
2310
- for (xn3.lastIndex = 0; null !== (c2 = xn3.exec(s4)); ) {
2311
- const t8 = c2[0], i9 = c2[1], s5 = e7.indexOf(t8), l3 = -1 === s5 ? { line: 1, column: 1 } : Tn2(e7, s5, t8.length);
2312
- "web" !== a5 ? r7 && !r7.includes(i9) && o6.push({ message: `Unknown secret "$secret.${i9}"; not in the project's registered secrets.`, severity: "warning", path: t8, ...l3 }) : n7.push({ message: `Secret "$secret.${i9}" cannot be used in a web flow \u2014 secrets are never sent to the browser; use a server flow.`, severity: "error", path: t8, ...l3 });
2318
+ for (xn3.lastIndex = 0; null !== (c2 = xn3.exec(s5)); ) {
2319
+ const t8 = c2[0], i9 = c2[1], s6 = e7.indexOf(t8), l3 = -1 === s6 ? { line: 1, column: 1 } : Tn2(e7, s6, t8.length);
2320
+ "web" !== a5 ? r6 && !r6.includes(i9) && o6.push({ message: `Unknown secret "$secret.${i9}"; not in the project's registered secrets.`, severity: "warning", path: t8, ...l3 }) : n7.push({ message: `Secret "$secret.${i9}" cannot be used in a web flow \u2014 secrets are never sent to the browser; use a server flow.`, severity: "error", path: t8, ...l3 });
2313
2321
  }
2314
2322
  }
2315
2323
  })(e6, t5, i6, n6, o5);
@@ -2335,12 +2343,12 @@ function In3(e5, t4, i5, n5) {
2335
2343
  if (!Fn(o4.env)) continue;
2336
2344
  const t5 = o4.env.store;
2337
2345
  if ("string" != typeof t5) continue;
2338
- const r6 = Dn.exec(t5);
2339
- if (!r6) continue;
2340
- const a4 = r6[1], s4 = i5[a4];
2341
- if (!Fn(s4)) continue;
2342
- const c2 = s4.package;
2343
- "string" == typeof c2 && jn2.includes(c2) && (En3(s4) || n5.push({ message: `transformer-file serves byte-exact assets; set config.file: true on store "${a4}".`, severity: "warning", path: `stores.${a4}`, ...Rn(e5, a4) }));
2346
+ const r5 = Dn.exec(t5);
2347
+ if (!r5) continue;
2348
+ const a4 = r5[1], s5 = i5[a4];
2349
+ if (!Fn(s5)) continue;
2350
+ const c2 = s5.package;
2351
+ "string" == typeof c2 && jn3.includes(c2) && (En3(s5) || n5.push({ message: `transformer-file serves byte-exact assets; set config.file: true on store "${a4}".`, severity: "warning", path: `stores.${a4}`, ...Rn(e5, a4) }));
2344
2352
  }
2345
2353
  }
2346
2354
  function Rn(e5, t4) {
@@ -2433,7 +2441,7 @@ function Un(e5) {
2433
2441
  for (const [e6, i5] of Object.entries(t4)) i5 && "object" == typeof i5 && ("object" === i5.type && i5.properties && "string" != typeof i5.title && (i5.title = e6), Un(i5));
2434
2442
  }
2435
2443
  }
2436
- var e4, t3, i3, r4, a3, s2, c, l2, d, p, u2, m2, f, g2, b2, h, v2, S, y2, w2, k2, C2, x, j, P2, D2, E, O2, I, R3, $, A, z3, L2, q2, N3, W2, B3, U3, _2, H2, V2, Z3, G, K3, Q2, X2, Y2, ee3, te3, ie3, ne3, oe2, re3, ae3, se3, ce2, le2, de2, pe, ue2, me, fe, ge2, be2, he2, ve2, Se2, ye2, we2, ke2, Ce2, xe, je2, Pe2, De2, Ee2, Oe, Ie2, Re, Je3, Te2, Me2, Fe2, $e2, Ae2, ze, Le3, qe, Ne3, We3, Be2, Ue3, _e, He3, Ve3, Ze3, Ge3, Ke3, Qe3, Xe2, Ye3, et3, tt3, it3, nt3, ot3, rt3, at2, st3, ct2, lt2, dt2, pt2, ut2, mt2, ft2, gt3, bt3, ht3, vt2, St2, yt2, wt3, kt3, Ct3, xt3, jt3, Pt2, Dt2, Et3, Ot3, It3, Rt2, Jt2, Tt3, Mt3, Ft, $t3, At3, zt, Lt2, qt2, Nt2, Wt2, Bt, Ut, _t3, Ht, Vt2, Zt, Gt2, Kt, Qt2, Xt2, Yt2, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, bi, hi, vi, Si, yi, wi, ki, Ci, xi, ji, Di, Ei, Oi, Ii, Ri, Ji, Ti, Mi, Fi, $i, Ai, zi, Li, Ui, _i, Hi, Vi, Zi, Gi, Ki, Qi, Xi, Yi, tn, nn, on, rn, an, sn, cn, dn2, pn2, un3, mn3, yn, wn, kn2, Cn3, xn3, jn2, Pn, Dn, Hn2;
2444
+ var e4, t3, i3, r3, a3, s3, c, l2, d, p, u2, m2, f, g2, b2, h, v2, S, y2, w2, k2, C2, x, j, P2, D2, E, O2, I, R3, $, A, z3, L2, q2, N3, W2, B3, U3, _2, H2, V2, Z3, G, K3, Q2, X2, Y2, ee3, te3, ie3, ne3, oe2, re3, ae3, se3, ce3, le2, de2, pe, ue2, me, fe, ge2, be2, he2, ve2, Se2, ye2, we2, ke2, Ce2, xe, je2, Pe2, De2, Ee2, Oe, Ie2, Re, Je3, Te2, Me2, Fe2, $e2, Ae2, ze, Le3, qe, Ne3, We3, Be2, Ue2, _e, He3, Ve3, Ze3, Ge3, Ke3, Qe3, Xe2, Ye3, et3, tt3, it3, nt3, ot3, rt3, at2, st3, ct2, lt2, dt2, pt2, ut2, mt2, ft2, gt3, bt3, ht3, vt2, St2, yt2, wt3, kt3, Ct3, xt3, jt3, Pt2, Dt2, Et3, Ot3, It3, Rt3, Jt2, Tt3, Mt3, Ft, $t3, At3, zt, Lt2, qt2, Nt2, Wt2, Bt, Ut, _t3, Ht, Vt2, Zt2, Gt, Kt, Qt2, Xt2, Yt2, ei, ti, ii, ni, oi, ri, ai, si, ci, li, di, pi, ui, mi, fi, gi, bi, hi, vi, Si, yi, wi, ki, Ci, xi, ji, Di, Ei, Oi, Ii, Ri, Ji, Ti, Mi, Fi, $i, Ai, zi, Li, Ui, _i, Hi, Vi, Zi, Gi, Ki, Qi, Xi, Yi, tn, nn, on, rn, an, sn, cn, dn3, pn2, un2, mn2, yn, wn, kn2, Cn3, xn3, jn3, Pn, Dn, Hn2;
2437
2445
  var init_dev = __esm({
2438
2446
  "../core/dist/dev.mjs"() {
2439
2447
  "use strict";
@@ -2442,10 +2450,10 @@ var init_dev = __esm({
2442
2450
  for (var n5 in i5) e4(t4, n5, { get: i5[n5], enumerable: true });
2443
2451
  };
2444
2452
  i3 = {};
2445
- t3(i3, { BaseContextConfig: () => A, CacheRuleSchema: () => Ye3, CacheSchema: () => et3, CacheSchemas: () => Ze3, ClickIdEntrySchema: () => rn, CodeSchema: () => tn, CollectorSchemas: () => Ot3, ConsentSchema: () => Z3, ContractActionsSchema: () => Ji, ContractRuleSchema: () => Mi, ContractSchema: () => Fi, ContractSchemaEntry: () => Ri, Counter: () => d, CredentialsSchema: () => sn, DeepPartialEventSchema: () => ie3, DestinationSchemas: () => Te2, DestinationsMapConfig: () => q2, EntitiesSchema: () => Y2, EntitySchema: () => X2, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, EventSchema: () => ee3, FlowBundlePackageSchema: () => vi, FlowBundleSchema: () => Si, FlowCodeSchema: () => yi, FlowConfigSchema: () => Ai, FlowDestinationSchema: () => Oi, FlowJsonSchema: () => Li, FlowSchema: () => zi, FlowSchemas: () => fi, FlowSourceSchema: () => Di, FlowStoreSchema: () => Ii, FlowTransformerSchema: () => Ei, GenericEnvConfig: () => R3, GenericSettingsConfig: () => I, HandlersConfig: () => x, HintSchema: () => nn, HintsSchema: () => on, IdConfig: () => D2, Identifier: () => c, InitConfig: () => E, LoggerConfigSchema: () => nt3, LoggerHandlerSchema: () => it3, LoopSchema: () => fe, MapSchema: () => be2, MappingResultSchema: () => Ce2, MappingSchemas: () => pe, MatchExpressionSchema: () => Ae2, MatcherSchemas: () => Me2, OptionalPrimitiveValue: () => u2, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PolicySchema: () => ve2, PrimaryConfig: () => O2, PrimitiveValue: () => p, ProcessingControlConfig: () => z3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B3, QueueConfig: () => P2, RequiredBoolean: () => s2, RequiredNumber: () => a3, RequiredString: () => r4, RouteSchema: () => Be2, RouteWithoutManySchema: () => Ve3, RuleSchema: () => ye2, RulesSchema: () => we2, RuntimeInstanceConfig: () => $, ServiceAccountSchema: () => an, SetSchema: () => ge2, SourceSchema: () => Q2, SourceSchemas: () => Ut, SourceTypeSchema: () => V2, SourcesMapConfig: () => L2, StateSchema: () => tt3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe2, StoreSchemas: () => li, Timestamp: () => l2, TransformerSchemas: () => oi, UserSchema: () => G, UtilitySchemas: () => m2, ValidateEventsSchema: () => ji, ValueConfigSchema: () => he2, ValueSchema: () => ue2, ValuesSchema: () => me, VerboseConfig: () => j, WalkerOSSchemas: () => N3, configJsonSchema: () => Ui, consentJsonSchema: () => de2, contractJsonSchema: () => Xi, contractRuleJsonSchema: () => Qi, createArraySchema: () => qn3, createConsentConfig: () => F3, createDataTransformationConfig: () => J2, createEnumSchema: () => Nn2, createMappingRulesConfig: () => T3, createObjectSchema: () => zn, createPolicyConfig: () => M, createTupleSchema: () => Wn, credentialsJsonSchema: () => cn, destinationJsonSchema: () => Zi, entityJsonSchema: () => ce2, eventJsonSchema: () => ne3, flowConfigJsonSchema: () => Hi, flowJsonSchema: () => _i, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, orderedPropertiesJsonSchema: () => se3, parseConfig: () => qi, parseFlow: () => Wi, partialEventJsonSchema: () => oe2, policyJsonSchema: () => Oe, propertiesJsonSchema: () => ae3, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Re, safeParseConfig: () => Ni, safeParseFlow: () => Bi, setJsonSchema: () => De2, sourceJsonSchema: () => Vi, sourceTypeJsonSchema: () => le2, storeJsonSchema: () => Ki, transformerJsonSchema: () => Gi, userJsonSchema: () => re3, validateEventsJsonSchema: () => Yi, validateFlowConfig: () => Sn2, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe, z: () => n3, zodToSchema: () => Bn });
2446
- r4 = n3.string();
2453
+ t3(i3, { BaseContextConfig: () => A, CacheRuleSchema: () => Ye3, CacheSchema: () => et3, CacheSchemas: () => Ze3, ClickIdEntrySchema: () => rn, CodeSchema: () => tn, CollectorSchemas: () => Ot3, ConsentSchema: () => Z3, ContractActionsSchema: () => Ji, ContractRuleSchema: () => Mi, ContractSchema: () => Fi, ContractSchemaEntry: () => Ri, Counter: () => d, CredentialsSchema: () => sn, DeepPartialEventSchema: () => ie3, DestinationSchemas: () => Te2, DestinationsMapConfig: () => q2, EntitiesSchema: () => Y2, EntitySchema: () => X2, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, EventSchema: () => ee3, FlowBundlePackageSchema: () => vi, FlowBundleSchema: () => Si, FlowCodeSchema: () => yi, FlowConfigSchema: () => Ai, FlowDestinationSchema: () => Oi, FlowJsonSchema: () => Li, FlowSchema: () => zi, FlowSchemas: () => fi, FlowSourceSchema: () => Di, FlowStoreSchema: () => Ii, FlowTransformerSchema: () => Ei, GenericEnvConfig: () => R3, GenericSettingsConfig: () => I, HandlersConfig: () => x, HintSchema: () => nn, HintsSchema: () => on, IdConfig: () => D2, Identifier: () => c, InitConfig: () => E, LoggerConfigSchema: () => nt3, LoggerHandlerSchema: () => it3, LoopSchema: () => fe, MapSchema: () => be2, MappingResultSchema: () => Ce2, MappingSchemas: () => pe, MatchExpressionSchema: () => Ae2, MatcherSchemas: () => Me2, OptionalPrimitiveValue: () => u2, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PolicySchema: () => ve2, PrimaryConfig: () => O2, PrimitiveValue: () => p, ProcessingControlConfig: () => z3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B3, QueueConfig: () => P2, RequiredBoolean: () => s3, RequiredNumber: () => a3, RequiredString: () => r3, RouteSchema: () => Be2, RouteWithoutManySchema: () => Ve3, RuleSchema: () => ye2, RulesSchema: () => we2, RuntimeInstanceConfig: () => $, ServiceAccountSchema: () => an, SetSchema: () => ge2, SourceSchema: () => Q2, SourceSchemas: () => Ut, SourceTypeSchema: () => V2, SourcesMapConfig: () => L2, StateSchema: () => tt3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe2, StoreSchemas: () => li, Timestamp: () => l2, TransformerSchemas: () => oi, UserSchema: () => G, UtilitySchemas: () => m2, ValidateEventsSchema: () => ji, ValueConfigSchema: () => he2, ValueSchema: () => ue2, ValuesSchema: () => me, VerboseConfig: () => j, WalkerOSSchemas: () => N3, configJsonSchema: () => Ui, consentJsonSchema: () => de2, contractJsonSchema: () => Xi, contractRuleJsonSchema: () => Qi, createArraySchema: () => qn3, createConsentConfig: () => F3, createDataTransformationConfig: () => J2, createEnumSchema: () => Nn2, createMappingRulesConfig: () => T3, createObjectSchema: () => zn, createPolicyConfig: () => M, createTupleSchema: () => Wn, credentialsJsonSchema: () => cn, destinationJsonSchema: () => Zi, entityJsonSchema: () => ce3, eventJsonSchema: () => ne3, flowConfigJsonSchema: () => Hi, flowJsonSchema: () => _i, loopJsonSchema: () => Pe2, mapJsonSchema: () => Ee2, orderedPropertiesJsonSchema: () => se3, parseConfig: () => qi, parseFlow: () => Wi, partialEventJsonSchema: () => oe2, policyJsonSchema: () => Oe, propertiesJsonSchema: () => ae3, ruleJsonSchema: () => Ie2, rulesJsonSchema: () => Re, safeParseConfig: () => Ni, safeParseFlow: () => Bi, setJsonSchema: () => De2, sourceJsonSchema: () => Vi, sourceTypeJsonSchema: () => le2, storeJsonSchema: () => Ki, transformerJsonSchema: () => Gi, userJsonSchema: () => re3, validateEventsJsonSchema: () => Yi, validateFlowConfig: () => Sn2, valueConfigJsonSchema: () => je2, valueJsonSchema: () => xe, z: () => n3, zodToSchema: () => Bn });
2454
+ r3 = n3.string();
2447
2455
  a3 = n3.number();
2448
- s2 = n3.boolean();
2456
+ s3 = n3.boolean();
2449
2457
  c = n3.string().min(1);
2450
2458
  l2 = n3.number().int().positive();
2451
2459
  d = n3.number().int().nonnegative();
@@ -2477,7 +2485,7 @@ var init_dev = __esm({
2477
2485
  L2 = n3.object({ sources: n3.record(n3.string(), n3.unknown()).describe("Map of source instances") }).partial();
2478
2486
  q2 = n3.object({ destinations: n3.record(n3.string(), n3.unknown()).describe("Map of destination instances") }).partial();
2479
2487
  N3 = {};
2480
- t3(N3, { ConsentSchema: () => Z3, DeepPartialEventSchema: () => ie3, EntitiesSchema: () => Y2, EntitySchema: () => X2, EventSchema: () => ee3, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B3, SourceFieldsSchema: () => K3, SourceSchema: () => Q2, SourceTypeSchema: () => V2, UserSchema: () => G, consentJsonSchema: () => de2, entityJsonSchema: () => ce2, eventJsonSchema: () => ne3, orderedPropertiesJsonSchema: () => se3, partialEventJsonSchema: () => oe2, propertiesJsonSchema: () => ae3, sourceTypeJsonSchema: () => le2, userJsonSchema: () => re3 });
2488
+ t3(N3, { ConsentSchema: () => Z3, DeepPartialEventSchema: () => ie3, EntitiesSchema: () => Y2, EntitySchema: () => X2, EventSchema: () => ee3, OrderedPropertiesSchema: () => H2, PartialEventSchema: () => te3, PropertiesSchema: () => _2, PropertySchema: () => U3, PropertyTypeSchema: () => B3, SourceFieldsSchema: () => K3, SourceSchema: () => Q2, SourceTypeSchema: () => V2, UserSchema: () => G, consentJsonSchema: () => de2, entityJsonSchema: () => ce3, eventJsonSchema: () => ne3, orderedPropertiesJsonSchema: () => se3, partialEventJsonSchema: () => oe2, propertiesJsonSchema: () => ae3, sourceTypeJsonSchema: () => le2, userJsonSchema: () => re3 });
2481
2489
  B3 = n3.lazy(() => n3.union([n3.boolean(), n3.string(), n3.number(), n3.record(n3.string(), U3)])).meta({ id: "WalkerOSPropertyType", title: "WalkerOS.PropertyType", description: "Base property value types (boolean, string, number, or nested Property record)." });
2482
2490
  U3 = n3.lazy(() => n3.union([B3, n3.array(B3)])).meta({ id: "WalkerOSProperty", title: "WalkerOS.Property", description: "PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays." });
2483
2491
  _2 = n3.record(n3.string(), U3.optional()).meta({ id: "WalkerOSProperties", title: "WalkerOS.Properties", description: "Flexible property collection with optional values." }).describe("Flexible property collection with optional values");
@@ -2489,7 +2497,7 @@ var init_dev = __esm({
2489
2497
  Q2 = _2.and(K3).meta({ id: "WalkerOSSource", title: "WalkerOS.Source", description: "Event source information (origin of the event)." }).describe("Event source information");
2490
2498
  X2 = n3.lazy(() => n3.object({ entity: n3.string().describe("Entity name"), data: _2.describe("Entity-specific properties"), nested: n3.array(X2).optional().describe("Nested child entities"), context: H2.optional().describe("Entity context data") })).meta({ id: "WalkerOSEntity", title: "WalkerOS.Entity", description: "Nested entity structure with recursive nesting support." }).describe("Nested entity structure with recursive nesting support");
2491
2499
  Y2 = n3.array(X2).meta({ id: "WalkerOSEntities", title: "WalkerOS.Entities", description: "Array of nested entities." }).describe("Array of nested entities");
2492
- ee3 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: _2.describe("Event-specific properties"), context: H2.describe("Ordered context properties with priorities"), globals: _2.describe("Global properties shared across events"), custom: _2.describe("Custom implementation-specific properties"), user: G.describe("User identification and attributes"), nested: Y2.describe("Related nested entities"), consent: Z3.describe("Consent states at event time"), id: c.describe("W3C span_id, 16 lowercase hex characters"), trigger: r4.describe("Event trigger identifier"), entity: r4.describe("Parsed entity from event name"), action: r4.describe("Parsed action from event name"), timestamp: l2.describe("Unix timestamp in milliseconds since epoch"), timing: a3.describe("Event processing timing information"), source: Q2.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
2500
+ ee3 = n3.object({ name: n3.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: _2.describe("Event-specific properties"), context: H2.describe("Ordered context properties with priorities"), globals: _2.describe("Global properties shared across events"), custom: _2.describe("Custom implementation-specific properties"), user: G.describe("User identification and attributes"), nested: Y2.describe("Related nested entities"), consent: Z3.describe("Consent states at event time"), id: c.describe("W3C span_id, 16 lowercase hex characters"), trigger: r3.describe("Event trigger identifier"), entity: r3.describe("Parsed entity from event name"), action: r3.describe("Parsed action from event name"), timestamp: l2.describe("Unix timestamp in milliseconds since epoch"), timing: a3.describe("Event processing timing information"), source: Q2.describe("Event source information") }).meta({ id: "WalkerOSEvent", title: "WalkerOS.Event", description: "Complete walkerOS event structure." }).describe("Complete walkerOS event structure");
2493
2501
  te3 = ee3.partial().meta({ id: "WalkerOSPartialEvent", title: "WalkerOS.PartialEvent", description: "Partial event structure with all fields optional." }).describe("Partial event structure with all fields optional");
2494
2502
  ie3 = ee3.partial().meta({ id: "WalkerOSDeepPartialEvent", title: "WalkerOS.DeepPartialEvent", description: "Partial event structure with all top-level fields optional." }).describe("Partial event structure with all top-level fields optional");
2495
2503
  ne3 = o2(ee3);
@@ -2497,7 +2505,7 @@ var init_dev = __esm({
2497
2505
  re3 = o2(G);
2498
2506
  ae3 = o2(_2);
2499
2507
  se3 = o2(H2);
2500
- ce2 = o2(X2);
2508
+ ce3 = o2(X2);
2501
2509
  le2 = o2(V2);
2502
2510
  de2 = o2(Z3);
2503
2511
  pe = {};
@@ -2536,9 +2544,9 @@ var init_dev = __esm({
2536
2544
  Ne3 = n3.strictObject({ match: Ae2 });
2537
2545
  We3 = n3.union([ze, Le3, qe, Ne3]);
2538
2546
  Be2 = n3.union([n3.string(), n3.array(n3.lazy(() => Be2)), We3]).meta({ id: "Route", title: "Route", description: "Recursive route: string ID, sequence of routes, or a RouteConfig (next/one/many/gate)." });
2539
- Ue3 = n3.strictObject({ match: Ae2.optional(), next: n3.lazy(() => Ve3) });
2547
+ Ue2 = n3.strictObject({ match: Ae2.optional(), next: n3.lazy(() => Ve3) });
2540
2548
  _e = n3.strictObject({ match: Ae2.optional(), one: n3.array(n3.lazy(() => Ve3)) });
2541
- He3 = n3.union([Ue3, _e, Ne3]);
2549
+ He3 = n3.union([Ue2, _e, Ne3]);
2542
2550
  Ve3 = n3.union([n3.string(), n3.array(n3.lazy(() => Ve3)), He3]).meta({ id: "RouteWithoutMany", title: "RouteWithoutMany", description: "Route variant for post-collector positions (destination.before). Excludes the many operator \u2014 post-collector fan-out uses the destinations map." });
2543
2551
  Ze3 = {};
2544
2552
  t3(Ze3, { CacheRuleSchema: () => Ye3, CacheSchema: () => et3, EventCacheRuleSchema: () => Ge3, EventCacheSchema: () => Ke3, StoreCacheRuleSchema: () => Qe3, StoreCacheSchema: () => Xe2 });
@@ -2591,34 +2599,34 @@ var init_dev = __esm({
2591
2599
  Dt2 = o2(ft2);
2592
2600
  Et3 = o2(yt2);
2593
2601
  Ot3 = {};
2594
- t3(Ot3, { CommandTypeSchema: () => It3, ConfigSchema: () => Rt2, DestinationsSchema: () => $t3, InitConfigSchema: () => Tt3, InstanceSchema: () => At3, PushContextSchema: () => Mt3, SessionDataSchema: () => Jt2, SourcesSchema: () => Ft, commandTypeJsonSchema: () => zt, configJsonSchema: () => Lt2, initConfigJsonSchema: () => Nt2, instanceJsonSchema: () => Bt, pushContextJsonSchema: () => Wt2, sessionDataJsonSchema: () => qt2 });
2602
+ t3(Ot3, { CommandTypeSchema: () => It3, ConfigSchema: () => Rt3, DestinationsSchema: () => $t3, InitConfigSchema: () => Tt3, InstanceSchema: () => At3, PushContextSchema: () => Mt3, SessionDataSchema: () => Jt2, SourcesSchema: () => Ft, commandTypeJsonSchema: () => zt, configJsonSchema: () => Lt2, initConfigJsonSchema: () => Nt2, instanceJsonSchema: () => Bt, pushContextJsonSchema: () => Wt2, sessionDataJsonSchema: () => qt2 });
2595
2603
  It3 = n3.union([n3.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), n3.string()]).meta({ id: "CollectorCommandType", title: "Collector.CommandType", description: "Collector command type identifier (standard or extension string)." }).describe("Collector command type: standard commands or custom string for extensions");
2596
- Rt2 = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: _2.describe("Static global properties that persist across collector runs"), sessionStatic: n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSessionStatic", title: "Collector.SessionStatic", description: "Static session data that persists across collector runs." }).describe("Static session data that persists across collector runs"), logger: nt3.optional().describe("Logger configuration (level, handler)"), queueMax: n3.number().optional().describe("Maximum events retained in collector.queue (late-registration replay). FIFO drop on overflow. Default 1000."), name: n3.string().optional().describe("Flow name; keys this flow's entry in event.source.release and the observer flowId."), release: n3.string().optional().describe("Config release id stamped into event.source.release for this flow.") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger, buffer bounds)." }).describe("Core collector configuration");
2604
+ Rt3 = n3.object({ run: n3.boolean().describe("Whether to run collector automatically on initialization").optional(), globalsStatic: _2.describe("Static global properties that persist across collector runs"), sessionStatic: n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSessionStatic", title: "Collector.SessionStatic", description: "Static session data that persists across collector runs." }).describe("Static session data that persists across collector runs"), logger: nt3.optional().describe("Logger configuration (level, handler)"), queueMax: n3.number().optional().describe("Maximum events retained in collector.queue (late-registration replay). FIFO drop on overflow. Default 1000."), name: n3.string().optional().describe("Flow name; keys this flow's entry in event.source.release and the observer flowId."), release: n3.string().optional().describe("Config release id stamped into event.source.release for this flow.") }).meta({ id: "CollectorConfig", title: "Collector.Config", description: "Core collector configuration (globals/session statics, logger, buffer bounds)." }).describe("Core collector configuration");
2597
2605
  Jt2 = _2.and(n3.object({ isStart: n3.boolean().describe("Whether this is a new session start"), storage: n3.boolean().describe("Whether storage is available"), id: c.describe("Session identifier").optional(), start: l2.describe("Session start timestamp").optional(), marketing: n3.literal(true).optional().describe("Marketing attribution flag"), updated: l2.describe("Last update timestamp").optional(), isNew: n3.boolean().describe("Whether this is a new session").optional(), device: c.describe("Device identifier").optional(), count: d.describe("Event count in session").optional(), runs: d.describe("Number of runs").optional() })).meta({ id: "CollectorSessionData", title: "Collector.SessionData", description: "Session state and tracking data." }).describe("Session state and tracking data");
2598
- Tt3 = Rt2.partial().extend({ consent: Z3.optional().describe("Initial consent state"), user: G.optional().describe("Initial user data"), globals: _2.optional().describe("Initial global properties"), sources: n3.unknown().meta({ id: "CollectorInitSources", title: "Source.InitSources", description: "Source configurations map (id \u2192 InitSource)." }).optional().describe("Source configurations"), destinations: n3.unknown().meta({ id: "CollectorInitDestinations", title: "Destination.InitDestinations", description: "Destination configurations map (id \u2192 Init)." }).optional().describe("Destination configurations"), transformers: n3.unknown().meta({ id: "CollectorInitTransformers", title: "Transformer.Configs", description: "Transformer configurations map (id \u2192 Config)." }).optional().describe("Transformer configurations"), stores: n3.unknown().meta({ id: "CollectorInitStores", title: "Store.Configs", description: "Store configurations map (id \u2192 Config)." }).optional().describe("Store configurations"), custom: _2.optional().describe("Initial custom implementation-specific properties"), hooks: n3.unknown().meta({ id: "CollectorHooks", title: "Collector.Hooks", description: "Pipeline observation hooks." }).optional().describe("Pipeline observation hooks"), observe: n3.union([n3.object({ url: n3.string().describe("Observer base URL"), binding: n3.string().describe("Public project binding the web credential must match") }), n3.object({ url: n3.string().describe("Observer base URL"), sessionId: n3.string().describe("Session id the runtime posts under"), token: n3.string().describe("Ingest bearer token"), level: n3.enum(["off", "standard", "trace"]).optional().describe("Telemetry level"), sample: n3.number().optional().describe("Deterministic sample fraction in [0, 1]") })]).meta({ id: "CollectorObserve", title: "Observe", description: "Observation session connect config: web arm (url + binding) or server arm (url + sessionId + token)." }).optional().describe("Observation session connect config"), observers: n3.unknown().meta({ id: "CollectorObservers", title: "Collector.Observers", description: "Caller-supplied advisory observer functions (runtime objects)." }).optional().describe("Caller-supplied advisory observer functions") }).meta({ id: "CollectorInitConfig", title: "Collector.InitConfig", description: "Collector initialization configuration with initial state (consent, user, globals, components, hooks)." }).describe("Collector initialization configuration with initial state");
2606
+ Tt3 = Rt3.partial().extend({ consent: Z3.optional().describe("Initial consent state"), user: G.optional().describe("Initial user data"), globals: _2.optional().describe("Initial global properties"), sources: n3.unknown().meta({ id: "CollectorInitSources", title: "Source.InitSources", description: "Source configurations map (id \u2192 InitSource)." }).optional().describe("Source configurations"), destinations: n3.unknown().meta({ id: "CollectorInitDestinations", title: "Destination.InitDestinations", description: "Destination configurations map (id \u2192 Init)." }).optional().describe("Destination configurations"), transformers: n3.unknown().meta({ id: "CollectorInitTransformers", title: "Transformer.Configs", description: "Transformer configurations map (id \u2192 Config)." }).optional().describe("Transformer configurations"), stores: n3.unknown().meta({ id: "CollectorInitStores", title: "Store.Configs", description: "Store configurations map (id \u2192 Config)." }).optional().describe("Store configurations"), custom: _2.optional().describe("Initial custom implementation-specific properties"), hooks: n3.unknown().meta({ id: "CollectorHooks", title: "Collector.Hooks", description: "Pipeline observation hooks." }).optional().describe("Pipeline observation hooks"), observe: n3.union([n3.object({ url: n3.string().describe("Observer base URL"), binding: n3.string().describe("Public project binding the web credential must match") }), n3.object({ url: n3.string().describe("Observer base URL"), sessionId: n3.string().describe("Session id the runtime posts under"), token: n3.string().describe("Ingest bearer token"), level: n3.enum(["off", "standard", "trace"]).optional().describe("Telemetry level"), sample: n3.number().optional().describe("Deterministic sample fraction in [0, 1]") })]).meta({ id: "CollectorObserve", title: "Observe", description: "Observation session connect config: web arm (url + binding) or server arm (url + sessionId + token)." }).optional().describe("Observation session connect config"), observers: n3.unknown().meta({ id: "CollectorObservers", title: "Collector.Observers", description: "Caller-supplied advisory observer functions (runtime objects)." }).optional().describe("Caller-supplied advisory observer functions") }).meta({ id: "CollectorInitConfig", title: "Collector.InitConfig", description: "Collector initialization configuration with initial state (consent, user, globals, components, hooks)." }).describe("Collector initialization configuration with initial state");
2599
2607
  Mt3 = n3.object({ mapping: ke2.optional().describe("Source-level mapping configuration") }).meta({ id: "CollectorPushContext", title: "Collector.PushContext", description: "Push context with optional source-level mapping." }).describe("Push context with optional source mapping");
2600
2608
  Ft = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorSources", title: "Collector.Sources", description: "Map of source IDs to runtime source instances." }).describe("Map of source IDs to source instances");
2601
2609
  $t3 = n3.record(n3.string(), n3.unknown()).meta({ id: "CollectorDestinations", title: "Collector.Destinations", description: "Map of destination IDs to runtime destination instances." }).describe("Map of destination IDs to destination instances");
2602
- At3 = n3.object({ push: n3.unknown().describe("Push function for processing events"), command: n3.unknown().describe("Command function for walker commands"), allowed: n3.boolean().describe("Whether event processing is allowed"), config: Rt2.describe("Current collector configuration"), consent: Z3.describe("Current consent state"), custom: _2.describe("Custom implementation-specific properties"), sources: Ft.describe("Registered source instances"), destinations: $t3.describe("Registered destination instances"), globals: _2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(ee3).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([Jt2]).describe("Current session state"), timing: n3.number().describe("Event processing timing information"), user: G.describe("Current user data") }).meta({ id: "CollectorInstance", title: "Collector.Instance", description: "Collector instance (runtime object with push/command + full state and component maps)." }).describe("Collector instance with state and methods");
2610
+ At3 = n3.object({ push: n3.unknown().describe("Push function for processing events"), command: n3.unknown().describe("Command function for walker commands"), allowed: n3.boolean().describe("Whether event processing is allowed"), config: Rt3.describe("Current collector configuration"), consent: Z3.describe("Current consent state"), custom: _2.describe("Custom implementation-specific properties"), sources: Ft.describe("Registered source instances"), destinations: $t3.describe("Registered destination instances"), globals: _2.describe("Current global properties"), hooks: n3.unknown().describe("Lifecycle hook functions"), on: n3.unknown().describe("Event lifecycle configuration"), queue: n3.array(ee3).describe("Queued events awaiting processing"), round: n3.number().describe("Collector run count (increments with each run)"), session: n3.union([Jt2]).describe("Current session state"), timing: n3.number().describe("Event processing timing information"), user: G.describe("Current user data") }).meta({ id: "CollectorInstance", title: "Collector.Instance", description: "Collector instance (runtime object with push/command + full state and component maps)." }).describe("Collector instance with state and methods");
2603
2611
  zt = o2(It3);
2604
- Lt2 = o2(Rt2);
2612
+ Lt2 = o2(Rt3);
2605
2613
  qt2 = o2(Jt2);
2606
2614
  Nt2 = o2(Tt3);
2607
2615
  Wt2 = o2(Mt3);
2608
2616
  Bt = o2(At3);
2609
2617
  Ut = {};
2610
- t3(Ut, { BaseEnvSchema: () => _t3, ConfigSchema: () => Ht, InitSchema: () => Gt2, InitSourceSchema: () => Kt, InitSourcesSchema: () => Qt2, InstanceSchema: () => Zt, PartialConfigSchema: () => Vt2, baseEnvJsonSchema: () => Xt2, configJsonSchema: () => Yt2, initSourceJsonSchema: () => ii, initSourcesJsonSchema: () => ni, instanceJsonSchema: () => ti, partialConfigJsonSchema: () => ei });
2618
+ t3(Ut, { BaseEnvSchema: () => _t3, ConfigSchema: () => Ht, InitSchema: () => Gt, InitSourceSchema: () => Kt, InitSourcesSchema: () => Qt2, InstanceSchema: () => Zt2, PartialConfigSchema: () => Vt2, baseEnvJsonSchema: () => Xt2, configJsonSchema: () => Yt2, initSourceJsonSchema: () => ii, initSourcesJsonSchema: () => ni, instanceJsonSchema: () => ti, partialConfigJsonSchema: () => ei });
2611
2619
  _t3 = n3.object({ push: n3.unknown().meta({ id: "SourcePushFn", title: "Source.PushFn", description: "Collector push function passed to the source via dependency injection." }).describe("Collector push function"), command: n3.unknown().meta({ id: "SourceCommandFn", title: "Source.CommandFn", description: "Collector command function passed to the source." }).describe("Collector command function"), sources: n3.unknown().optional().describe("Map of registered source instances"), elb: n3.unknown().meta({ id: "ElbFn", title: "Elb.Fn", description: "Public `elb(...)` API function alias for collector.push." }).describe("Public API function (alias for collector.push)") }).catchall(n3.unknown()).meta({ id: "SourceBaseEnv", title: "Source.BaseEnv", description: "Base environment for source dependency injection; platform-specific sources extend this." }).describe("Base environment for dependency injection - platform-specific sources extend this");
2612
2620
  Ht = ke2.extend({ settings: n3.any().meta({ id: "SourceSettings", title: "Source.Settings", description: "Implementation-specific configuration (source-defined shape)." }).describe("Implementation-specific configuration").optional(), credentials: n3.any().meta({ id: "SourceCredentials", title: "Source.Credentials", description: "Optional credentials slot (source-defined shape); back it with a managed secret via $secret.NAME (credentials use $secret, not $env). The per-package shape is supplied via mergeConfigSchema." }).describe("Optional credentials (source-defined shape)").optional(), env: _t3.optional().describe("Environment dependencies (platform-specific)"), id: c.describe("Source identifier (defaults to source key)").optional(), primary: n3.boolean().describe("Mark as primary (only one can be primary)").optional(), require: n3.array(n3.string()).optional().describe('Defer source initialization until these collector events fire (e.g., ["consent"])'), logger: nt3.optional().describe("Logger configuration (level, handler) to override the collector defaults"), async: n3.union([n3.boolean(), n3.record(n3.string(), n3.boolean())]).optional().describe('Respond-first acknowledgement for response-producing server sources. When true the source responds 2xx ("accepted") before the event is delivered; when false it waits for delivery to settle and the response reflects the outcome. A record configures this per source-defined key: the express source keys it by HTTP method (GET/POST) and defaults to { GET: false, POST: true }. Browser/dataLayer sources have no HTTP response to defer and ignore it. A 2xx means accepted, not delivered. Defaults are per source type.'), setup: n3.union([n3.boolean(), n3.record(n3.string(), n3.unknown())]).optional().describe("One-time setup options applied during source registration (boolean enables defaults, object configures specifics)"), ingest: n3.union([ue2, me]).optional().describe("Ingest metadata extraction mapping. Extracts values from raw request objects (Express req, Lambda event) using mapping syntax."), disabled: n3.boolean().describe("Completely skip this source (no init, no event capture)").optional(), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), init: n3.boolean().optional().describe("Init lifecycle flag set by collector to true after Instance.init() runs") }).meta({ id: "SourceConfig", title: "Source.Config", description: "Source configuration with mapping, environment, and lifecycle hooks." }).describe("Source configuration with mapping and environment");
2613
2621
  Vt2 = Ht.partial().meta({ id: "SourcePartialConfig", title: "Source.PartialConfig", description: "Partial source configuration with all fields optional." }).describe("Partial source configuration with all fields optional");
2614
- Zt = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Ht.describe("Current source configuration"), push: n3.any().meta({ id: "SourceInstancePushFn", title: "Source.PushFn", description: "Push function \u2014 THE HANDLER (flexible signature for platform compatibility)." }).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: n3.any().meta({ id: "SourceDestroyFn", title: "Source.DestroyFn", description: "Cleanup function called when the source is removed." }).optional().describe("Cleanup function called when source is removed"), on: n3.unknown().optional().describe("Lifecycle hook function for event types") }).meta({ id: "SourceInstance", title: "Source.Instance", description: "Source instance (runtime object with push handler and lifecycle methods)." }).describe("Source instance with push handler and lifecycle methods");
2615
- Gt2 = n3.any().meta({ id: "SourceInit", title: "Source.Init", description: "Source initialization function: (config, env) => Instance | Promise<Instance>." }).describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
2616
- Kt = n3.object({ code: Gt2.describe("Source initialization function"), config: Vt2.optional().describe("Partial configuration overrides"), env: _t3.partial().optional().describe("Partial environment overrides"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
2622
+ Zt2 = n3.object({ type: n3.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Ht.describe("Current source configuration"), push: n3.any().meta({ id: "SourceInstancePushFn", title: "Source.PushFn", description: "Push function \u2014 THE HANDLER (flexible signature for platform compatibility)." }).describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: n3.any().meta({ id: "SourceDestroyFn", title: "Source.DestroyFn", description: "Cleanup function called when the source is removed." }).optional().describe("Cleanup function called when source is removed"), on: n3.unknown().optional().describe("Lifecycle hook function for event types") }).meta({ id: "SourceInstance", title: "Source.Instance", description: "Source instance (runtime object with push handler and lifecycle methods)." }).describe("Source instance with push handler and lifecycle methods");
2623
+ Gt = n3.any().meta({ id: "SourceInit", title: "Source.Init", description: "Source initialization function: (config, env) => Instance | Promise<Instance>." }).describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
2624
+ Kt = n3.object({ code: Gt.describe("Source initialization function"), config: Vt2.optional().describe("Partial configuration overrides"), env: _t3.partial().optional().describe("Partial environment overrides"), state: n3.union([tt3, n3.array(tt3)]).optional().describe("Declarative store get/set operations applied around this source"), primary: n3.boolean().optional().describe("Mark as primary source (only one can be primary)") }).meta({ id: "SourceInitSource", title: "Source.InitSource", description: "Source initialization bundle (init function + config + env + primary flag)." }).describe("Source initialization configuration");
2617
2625
  Qt2 = n3.record(n3.string(), Kt).meta({ id: "SourceInitSources", title: "Source.InitSources", description: "Map of source IDs to initialization configurations." }).describe("Map of source IDs to initialization configurations");
2618
2626
  Xt2 = o2(_t3);
2619
2627
  Yt2 = o2(Ht);
2620
2628
  ei = o2(Vt2);
2621
- ti = o2(Zt);
2629
+ ti = o2(Zt2);
2622
2630
  ii = o2(Kt);
2623
2631
  ni = o2(Qt2);
2624
2632
  oi = {};
@@ -2676,16 +2684,16 @@ var init_dev = __esm({
2676
2684
  an = n3.object({ client_email: n3.string().describe("Service account client email"), private_key: n3.string().describe("Service account private key (PEM)"), project_id: n3.string().optional().describe("GCP project id (derived from environment when omitted)") }).meta({ id: "ServiceAccount", title: "ServiceAccount", description: "Google-style service account credentials (client_email, private_key, optional project_id)." }).describe("Google-style service account credentials");
2677
2685
  sn = n3.union([n3.string(), an]).meta({ id: "Credentials", title: "Credentials", description: "Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed service account object." }).describe("Service account credentials: a JSON string (back it with a managed secret via $secret.NAME) or a parsed object");
2678
2686
  cn = o2(sn);
2679
- dn2 = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
2687
+ dn3 = /* @__PURE__ */ new Set(["description", "examples", "title", "$comment"]);
2680
2688
  pn2 = /* @__PURE__ */ new Set(["additionalItems", "additionalProperties", "contains", "contentSchema", "else", "if", "items", "not", "propertyNames", "then", "unevaluatedItems", "unevaluatedProperties"]);
2681
- un3 = /* @__PURE__ */ new Set(["allOf", "anyOf", "items", "oneOf", "prefixItems"]);
2682
- mn3 = /* @__PURE__ */ new Set(["properties", "patternProperties", "dependentSchemas", "dependentRequired", "dependencies", "$defs", "definitions"]);
2689
+ un2 = /* @__PURE__ */ new Set(["allOf", "anyOf", "items", "oneOf", "prefixItems"]);
2690
+ mn2 = /* @__PURE__ */ new Set(["properties", "patternProperties", "dependentSchemas", "dependentRequired", "dependencies", "$defs", "definitions"]);
2683
2691
  yn = /\$store\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
2684
2692
  wn = /\$env\.([A-Za-z_]\w*)(=[^"}\s]*)?/g;
2685
2693
  kn2 = /\$flow\.([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z0-9_.]+))?/g;
2686
2694
  Cn3 = /\$(var|store|flow|secret):([a-zA-Z_][a-zA-Z0-9_]*)/g;
2687
2695
  xn3 = /\$secret\.([A-Z0-9_]+)/g;
2688
- jn2 = ["@walkeros/server-store-fs", "@walkeros/server-store-s3", "@walkeros/server-store-gcs"];
2696
+ jn3 = ["@walkeros/server-store-fs", "@walkeros/server-store-s3", "@walkeros/server-store-gcs"];
2689
2697
  Pn = "@walkeros/server-transformer-file";
2690
2698
  Dn = /^\$store\.([a-zA-Z_][a-zA-Z0-9_]*)$/;
2691
2699
  Hn2 = { source: Ut.configJsonSchema, destination: Te2.configJsonSchema, store: li.configJsonSchema };
@@ -3130,9 +3138,9 @@ function hasCodeReference(code) {
3130
3138
  }
3131
3139
  function validateReference(type, name, ref) {
3132
3140
  if (type === "Transformer") {
3133
- const r6 = Ir({ ...ref }, "Transformer");
3134
- if (!r6.ok) {
3135
- throw new Error(`Transformer "${name}": ${r6.reason ?? "invalid entry."}`);
3141
+ const r5 = Ir({ ...ref }, "Transformer");
3142
+ if (!r5.ok) {
3143
+ throw new Error(`Transformer "${name}": ${r5.reason ?? "invalid entry."}`);
3136
3144
  }
3137
3145
  return;
3138
3146
  }
@@ -3528,7 +3536,7 @@ async function collectAllSpecs(packages, logger, configDir, overrides = {}, npmC
3528
3536
  const item = queue.shift();
3529
3537
  if (!allSpecs.has(item.name)) allSpecs.set(item.name, []);
3530
3538
  const existing = allSpecs.get(item.name);
3531
- if (!existing.some((s4) => s4.spec === item.spec && s4.from === item.from)) {
3539
+ if (!existing.some((s5) => s5.spec === item.spec && s5.from === item.from)) {
3532
3540
  existing.push({
3533
3541
  spec: item.spec,
3534
3542
  source: item.source,
@@ -3632,12 +3640,12 @@ async function resolveVersionConflicts(allSpecs, logger, npmConfig = {}) {
3632
3640
  );
3633
3641
  return;
3634
3642
  }
3635
- const consumers = activeSpecs.filter((s4) => s4.spec === spec.spec).map((s4) => s4.from);
3643
+ const consumers = activeSpecs.filter((s5) => s5.spec === spec.spec).map((s5) => s5.from);
3636
3644
  nested.push({ name, version: spec.spec, consumers });
3637
3645
  alreadyNested2.add(spec.spec);
3638
3646
  };
3639
3647
  var nestLoser = nestLoser2;
3640
- const localSpec = specs.find((s4) => s4.localPath);
3648
+ const localSpec = specs.find((s5) => s5.localPath);
3641
3649
  if (localSpec) {
3642
3650
  topLevel.set(name, {
3643
3651
  name,
@@ -3646,13 +3654,13 @@ async function resolveVersionConflicts(allSpecs, logger, npmConfig = {}) {
3646
3654
  });
3647
3655
  continue;
3648
3656
  }
3649
- const nonPeerSpecs = specs.filter((s4) => s4.source !== "peerDependency");
3650
- const peerSpecs = specs.filter((s4) => s4.source === "peerDependency");
3657
+ const nonPeerSpecs = specs.filter((s5) => s5.source !== "peerDependency");
3658
+ const peerSpecs = specs.filter((s5) => s5.source === "peerDependency");
3651
3659
  let activeSpecs;
3652
3660
  if (nonPeerSpecs.length > 0) {
3653
3661
  activeSpecs = nonPeerSpecs;
3654
3662
  } else {
3655
- const requiredPeers = peerSpecs.filter((s4) => !s4.optional);
3663
+ const requiredPeers = peerSpecs.filter((s5) => !s5.optional);
3656
3664
  if (requiredPeers.length === 0) {
3657
3665
  logger.debug(`Skipping optional peer dependency: ${name}`);
3658
3666
  continue;
@@ -3662,8 +3670,8 @@ async function resolveVersionConflicts(allSpecs, logger, npmConfig = {}) {
3662
3670
  activeSpecs.sort(
3663
3671
  (a4, b3) => SOURCE_PRIORITY[a4.source] - SOURCE_PRIORITY[b3.source]
3664
3672
  );
3665
- const directSpecs = activeSpecs.filter((s4) => s4.source === "direct");
3666
- const directExact = directSpecs.find((s4) => semver2.valid(s4.spec) !== null);
3673
+ const directSpecs = activeSpecs.filter((s5) => s5.source === "direct");
3674
+ const directExact = directSpecs.find((s5) => semver2.valid(s5.spec) !== null);
3667
3675
  let chosenVersion;
3668
3676
  const alreadyNested = /* @__PURE__ */ new Set();
3669
3677
  if (directExact) {
@@ -3671,14 +3679,14 @@ async function resolveVersionConflicts(allSpecs, logger, npmConfig = {}) {
3671
3679
  } else if (directSpecs.length > 0) {
3672
3680
  chosenVersion = directSpecs[0].spec;
3673
3681
  } else {
3674
- const exactVersions = activeSpecs.filter((s4) => semver2.valid(s4.spec) !== null).map((s4) => s4.spec);
3682
+ const exactVersions = activeSpecs.filter((s5) => semver2.valid(s5.spec) !== null).map((s5) => s5.spec);
3675
3683
  const uniqueExact = [...new Set(exactVersions)];
3676
3684
  if (uniqueExact.length > 1) {
3677
3685
  const sorted = [...uniqueExact].sort(semver2.rcompare);
3678
3686
  chosenVersion = sorted[0];
3679
3687
  for (let i5 = 1; i5 < sorted.length; i5++) {
3680
3688
  const loserVersion = sorted[i5];
3681
- const consumers = activeSpecs.filter((s4) => s4.spec === loserVersion).map((s4) => s4.from);
3689
+ const consumers = activeSpecs.filter((s5) => s5.spec === loserVersion).map((s5) => s5.from);
3682
3690
  nested.push({ name, version: loserVersion, consumers });
3683
3691
  alreadyNested.add(loserVersion);
3684
3692
  }
@@ -3974,8 +3982,8 @@ async function traceAndCopy(opts) {
3974
3982
  const src = path9.join(realBase, file);
3975
3983
  await fs8.mkdir(path9.dirname(dst), { recursive: true });
3976
3984
  await fs8.copyFile(src, dst);
3977
- const s4 = await fs8.stat(src);
3978
- if (s4.mode & 73) await fs8.chmod(dst, s4.mode);
3985
+ const s5 = await fs8.stat(src);
3986
+ if (s5.mode & 73) await fs8.chmod(dst, s5.mode);
3979
3987
  copied++;
3980
3988
  }
3981
3989
  return { fileList: Array.from(fileList), copied, reasons };
@@ -4915,7 +4923,7 @@ async function createEntryPoint(flowSettings, buildOptions, packagePaths, logger
4915
4923
  );
4916
4924
  const importsCode = importStatements.join("\n");
4917
4925
  const hasFlow = Object.values(flowSettings.sources || {}).some(
4918
- (s4) => s4.package || hasCodeReference2(s4.code)
4926
+ (s5) => s5.package || hasCodeReference2(s5.code)
4919
4927
  ) || Object.values(flowSettings.destinations || {}).some(
4920
4928
  (d2) => d2.package || hasCodeReference2(d2.code)
4921
4929
  );
@@ -5642,8 +5650,8 @@ async function bundleCommand(options) {
5642
5650
  }
5643
5651
  }
5644
5652
  const duration = timer.end();
5645
- const successCount = results.filter((r6) => r6.success).length;
5646
- const failureCount = results.filter((r6) => !r6.success).length;
5653
+ const successCount = results.filter((r5) => r5.success).length;
5654
+ const failureCount = results.filter((r5) => !r5.success).length;
5647
5655
  if (options.json) {
5648
5656
  const jsonResult = failureCount === 0 ? createSuccessOutput(
5649
5657
  {
@@ -5895,7 +5903,7 @@ var init_contract = __esm({
5895
5903
  "src/core/contract.ts"() {
5896
5904
  "use strict";
5897
5905
  init_config_file();
5898
- bakedContractVersion = true ? "4.3.0" : PLACEHOLDER;
5906
+ bakedContractVersion = true ? "4.4.0" : PLACEHOLDER;
5899
5907
  }
5900
5908
  });
5901
5909
 
@@ -6261,7 +6269,7 @@ async function createPreview(options) {
6261
6269
  }
6262
6270
  const flow = await getFlow({ projectId: pid, flowId: options.flowId });
6263
6271
  const settings = flow.settings;
6264
- const match = settings?.find((s4) => s4.name === options.flowName);
6272
+ const match = settings?.find((s5) => s5.name === options.flowName);
6265
6273
  if (!match) {
6266
6274
  throw new Error(
6267
6275
  `Flow settings named "${options.flowName}" not found on flow ${options.flowId}`
@@ -6701,7 +6709,7 @@ init_dist();
6701
6709
  init_dist();
6702
6710
  var t2 = { Action: "action", Actions: "actions", Config: "config", Consent: "consent", Context: "context", Custom: "custom", Destination: "destination", Elb: "elb", Globals: "globals", Hook: "hook", Init: "init", Link: "link", On: "on", Prefix: "data-elb", Ready: "ready", Run: "run", Scoped: "_", Session: "session", Shutdown: "shutdown", User: "user", Walker: "walker" };
6703
6711
  var n = { Commands: t2, Utils: { Storage: { Cookie: "cookie", Local: "local", Session: "session" } } };
6704
- function r2(e5, t4) {
6712
+ function s(e5, t4) {
6705
6713
  const n5 = {};
6706
6714
  return Object.entries(t4).forEach(([e6, t5]) => {
6707
6715
  n5[e6] = !!t5;
@@ -6725,25 +6733,25 @@ function z2(e5, t4, n5) {
6725
6733
  if (Array.isArray(e5)) {
6726
6734
  const o5 = [];
6727
6735
  t4.set(e5, o5);
6728
- for (const r7 of e5) o5.push(z2(r7, t4, n5 + 1));
6736
+ for (const s6 of e5) o5.push(z2(s6, t4, n5 + 1));
6729
6737
  return o5;
6730
6738
  }
6731
- const r6 = {};
6732
- t4.set(e5, r6);
6733
- for (const [o5, s4] of Object.entries(e5)) r6[o5] = "function" == typeof s4 ? s4 : z2(s4, t4, n5 + 1);
6734
- return r6;
6739
+ const s5 = {};
6740
+ t4.set(e5, s5);
6741
+ for (const [o5, r5] of Object.entries(e5)) s5[o5] = "function" == typeof r5 ? r5 : z2(r5, t4, n5 + 1);
6742
+ return s5;
6735
6743
  }
6736
6744
  function U2(e5) {
6737
- const t4 = [], n5 = [], { simulation: o4, ...r6 } = e5, s4 = z2(r6, /* @__PURE__ */ new WeakMap(), 0);
6745
+ const t4 = [], n5 = [], { simulation: o4, ...s5 } = e5, r5 = z2(s5, /* @__PURE__ */ new WeakMap(), 0);
6738
6746
  for (const e6 of o4) {
6739
6747
  const o5 = Nn(e6);
6740
6748
  if (0 === o5.length) continue;
6741
- const r7 = o5.join(".");
6749
+ const s6 = o5.join(".");
6742
6750
  if (o5.length - 1 >= 8) {
6743
- n5.push(r7);
6751
+ n5.push(s6);
6744
6752
  continue;
6745
6753
  }
6746
- let a4 = s4, i5 = true;
6754
+ let a4 = r5, i5 = true;
6747
6755
  for (let e7 = 0; e7 < o5.length - 1; e7++) {
6748
6756
  const t5 = a4[o5[e7]];
6749
6757
  if (!R2(t5)) {
@@ -6754,15 +6762,15 @@ function U2(e5) {
6754
6762
  }
6755
6763
  const c2 = o5[o5.length - 1];
6756
6764
  if (!i5 || !(c2 in a4)) {
6757
- n5.push(r7);
6765
+ n5.push(s6);
6758
6766
  continue;
6759
6767
  }
6760
6768
  const u3 = a4[c2];
6761
6769
  "function" == typeof u3 ? a4[c2] = function(...e7) {
6762
- return t4.push({ fn: r7, args: e7, ts: Date.now() }), u3.apply(this, e7);
6763
- } : n5.push(r7);
6770
+ return t4.push({ fn: s6, args: e7, ts: Date.now() }), u3.apply(this, e7);
6771
+ } : n5.push(s6);
6764
6772
  }
6765
- return { wrappedEnv: s4, calls: t4, unresolved: n5 };
6773
+ return { wrappedEnv: r5, calls: t4, unresolved: n5 };
6766
6774
  }
6767
6775
  function K2(e5, t4) {
6768
6776
  try {
@@ -6779,31 +6787,31 @@ function B2(e5) {
6779
6787
  if ("number" == typeof e6) return Number.isFinite(e6) ? e6 : null;
6780
6788
  if ("bigint" == typeof e6) return String(e6);
6781
6789
  if ("object" != typeof e6) return;
6782
- const r6 = e6;
6783
- if (t4.has(r6)) return "[circular]";
6790
+ const s5 = e6;
6791
+ if (t4.has(s5)) return "[circular]";
6784
6792
  if (o4 >= 6) return "[truncated]";
6785
- let s4;
6786
- t4.add(r6);
6793
+ let r5;
6794
+ t4.add(s5);
6787
6795
  try {
6788
- if (Array.isArray(r6)) s4 = r6.map((e7) => n5(e7, o4 + 1));
6796
+ if (Array.isArray(s5)) r5 = s5.map((e7) => n5(e7, o4 + 1));
6789
6797
  else if ((function(e7) {
6790
6798
  const t5 = Object.getPrototypeOf(e7);
6791
6799
  return t5 === Object.prototype || null === t5;
6792
- })(r6)) {
6800
+ })(s5)) {
6793
6801
  const e7 = {};
6794
- for (const t5 of Object.keys(r6)) e7[t5] = n5(K2(r6, t5), o4 + 1);
6795
- s4 = e7;
6796
- } else s4 = (function(e7) {
6802
+ for (const t5 of Object.keys(s5)) e7[t5] = n5(K2(s5, t5), o4 + 1);
6803
+ r5 = e7;
6804
+ } else r5 = (function(e7) {
6797
6805
  try {
6798
6806
  return String(e7);
6799
6807
  } catch {
6800
6808
  return "[object]";
6801
6809
  }
6802
- })(r6);
6810
+ })(s5);
6803
6811
  } catch {
6804
- s4 = "[unreadable]";
6812
+ r5 = "[unreadable]";
6805
6813
  }
6806
- return t4.delete(r6), s4;
6814
+ return t4.delete(s5), r5;
6807
6815
  };
6808
6816
  return e5.map((e6) => n5(e6, 0));
6809
6817
  }
@@ -6813,9 +6821,9 @@ function F2(e5) {
6813
6821
  function V(e5, t4, n5, o4) {
6814
6822
  if (!Number.isFinite(n5.max) || n5.max <= 0) throw new Error(`pushBounded: max must be > 0 (got ${n5.max})`);
6815
6823
  if ("dropNewest" === (n5.onOverflow ?? "dropOldest")) return e5.length >= n5.max ? (o4 && o4([t4]), { appended: false, dropped: 1 }) : (e5.push(t4), { appended: true, dropped: 0 });
6816
- const r6 = [];
6817
- for (; e5.length >= n5.max; ) r6.push(e5.shift());
6818
- return e5.push(t4), r6.length > 0 && o4 && o4(r6), { appended: true, dropped: r6.length };
6824
+ const s5 = [];
6825
+ for (; e5.length >= n5.max; ) s5.push(e5.shift());
6826
+ return e5.push(t4), s5.length > 0 && o4 && o4(s5), { appended: true, dropped: s5.length };
6819
6827
  }
6820
6828
  var N2 = /* @__PURE__ */ new WeakMap();
6821
6829
  function Y(e5, t4, n5, o4) {
@@ -6829,52 +6837,60 @@ var ee2 = () => Date.now();
6829
6837
  function te2(e5) {
6830
6838
  if (void 0 !== e5) return "number" == typeof e5 ? { threshold: e5, cooldown: Z2 } : { threshold: e5.threshold ?? 5, cooldown: e5.cooldown ?? Z2 };
6831
6839
  }
6832
- function ne2(e5, t4, n5, o4, r6) {
6840
+ function ne2(e5, t4, n5, o4, s5) {
6833
6841
  if ("partial" === n5) return;
6834
- const s4 = (function(e6, t5) {
6842
+ const r5 = (function(e6, t5) {
6835
6843
  return e6[t5] || (e6[t5] = { state: "closed", consecutiveFailures: 0 }), e6[t5];
6836
6844
  })(e5, t4);
6837
- return "success" === n5 ? (s4.consecutiveFailures = 0, s4.state = "closed", s4.probing = false, void (s4.openUntil = void 0)) : (s4.consecutiveFailures += 1, "half-open" === s4.state ? (s4.state = "open", s4.probing = false, void (s4.openUntil = ee2() + r6)) : void (s4.consecutiveFailures >= o4 && (s4.state = "open", s4.probing = false, s4.openUntil = ee2() + r6)));
6845
+ return "success" === n5 ? (r5.consecutiveFailures = 0, r5.state = "closed", r5.probing = false, void (r5.openUntil = void 0)) : (r5.consecutiveFailures += 1, "half-open" === r5.state ? (r5.state = "open", r5.probing = false, void (r5.openUntil = ee2() + s5)) : void (r5.consecutiveFailures >= o4 && (r5.state = "open", r5.probing = false, r5.openUntil = ee2() + s5)));
6838
6846
  }
6839
- var re2 = 100;
6840
- function se2(e5, t4) {
6847
+ var se2 = 100;
6848
+ function re2(e5, t4) {
6841
6849
  return e5.status.destinations[t4] || (e5.status.destinations[t4] = { count: 0, failed: 0, duration: 0, queuePushSize: 0, dlqSize: 0 }), e5.status.destinations[t4];
6842
6850
  }
6843
6851
  function ae2(e5, t4, n5, o4) {
6844
6852
  e5.dropped[t4] || (e5.dropped[t4] = {});
6845
- const r6 = e5.dropped[t4];
6846
- return r6[n5] = (r6[n5] ?? 0) + o4, r6[n5];
6853
+ const s5 = e5.dropped[t4];
6854
+ return s5[n5] = (s5[n5] ?? 0) + o4, s5[n5];
6855
+ }
6856
+ function ie2(e5) {
6857
+ const t4 = { error: e5 instanceof Error ? e5.message : String(e5) };
6858
+ if (e5 instanceof Error && e5.name && "Error" !== e5.name && (t4.name = e5.name), "object" == typeof e5 && null !== e5 && "code" in e5) {
6859
+ const n5 = e5;
6860
+ "number" != typeof n5.code && "string" != typeof n5.code || (t4.code = n5.code);
6861
+ }
6862
+ return t4;
6847
6863
  }
6848
- function ie2(e5, t4, n5, o4, r6) {
6849
- const s4 = o(t4, n5);
6864
+ function ce2(e5, t4, n5, o4, s5) {
6865
+ const r5 = o(t4, n5);
6850
6866
  return (t5, a4) => {
6851
6867
  try {
6852
- if (a4) return r6 ? (function(e6, t6, n6, o5, r7, s5) {
6853
- const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ?? re2 }, c2 = V(a5, [o5, r7], i5);
6868
+ if (a4) return s5 ? (function(e6, t6, n6, o5, s6, r6) {
6869
+ const a5 = t6.dlq = t6.dlq || [], i5 = { max: t6.config.dlqMax ?? se2 }, c2 = V(a5, [o5, s6], i5);
6854
6870
  if (c2.dropped > 0) {
6855
6871
  const t7 = ae2(e6.status, o("destination", n6), "dlq", c2.dropped);
6856
- Y(a5, s5, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: n6, cap: i5.max, droppedCount: t7 });
6872
+ Y(a5, r6, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: n6, cap: i5.max, droppedCount: t7 });
6857
6873
  } else a5.length < i5.max && J(a5);
6858
- const u3 = se2(e6, n6);
6874
+ const u3 = re2(e6, n6);
6859
6875
  u3.failed++, u3.dlqSize = a5.length, e6.status.failed++;
6860
6876
  const d2 = te2(t6.config.breaker);
6861
6877
  if (d2) {
6862
6878
  const o6 = t6.config.id || n6;
6863
6879
  ne2(e6.status.breakers, o("destination", o6), "transport-failure", d2.threshold, d2.cooldown);
6864
6880
  }
6865
- })(e5, r6, n5, a4, t5, o4) : e5.status.failed++, void o4.error("report error", { error: t5 instanceof Error ? t5.message : String(t5), event: a4.name });
6866
- e5.status.connectionErrors[s4] = (e5.status.connectionErrors[s4] ?? 0) + 1, o4.error("connection error", { error: t5 instanceof Error ? t5.message : String(t5) });
6881
+ })(e5, s5, n5, a4, t5, o4) : e5.status.failed++, void o4.error("report error", { ...ie2(t5), event: a4.name });
6882
+ e5.status.connectionErrors[r5] = (e5.status.connectionErrors[r5] ?? 0) + 1, o4.error("connection error", ie2(t5));
6867
6883
  } catch {
6868
6884
  }
6869
6885
  };
6870
6886
  }
6871
- function Ue2(e5, t4) {
6887
+ function Ke2(e5, t4) {
6872
6888
  return e5.storeId && t4.stores[e5.storeId] ? t4.stores[e5.storeId] : t4.stores.__cache;
6873
6889
  }
6874
- function Ke2(e5, t4) {
6890
+ function Be(e5, t4) {
6875
6891
  return e5 ? t4.stores[e5] : t4.stores.__cache;
6876
6892
  }
6877
- function Be(e5) {
6893
+ function Fe(e5) {
6878
6894
  const t4 = {};
6879
6895
  for (const [n5, o4] of Object.entries(e5)) {
6880
6896
  const e6 = o4.config?.next;
@@ -6882,116 +6898,116 @@ function Be(e5) {
6882
6898
  }
6883
6899
  return t4;
6884
6900
  }
6885
- function Fe(e5, t4) {
6901
+ function He2(e5, t4) {
6886
6902
  const n5 = e5.config || {}, o4 = e5[t4];
6887
6903
  return void 0 !== o4 ? { config: { ...n5, [t4]: o4 }, chainValue: o4 } : { config: n5, chainValue: void 0 };
6888
6904
  }
6889
- function He2(e5, t4 = {}) {
6905
+ function Ge2(e5, t4 = {}) {
6890
6906
  if (!e5) return [];
6891
6907
  if (Array.isArray(e5)) return e5;
6892
6908
  const n5 = [], o4 = /* @__PURE__ */ new Set();
6893
- let r6 = e5;
6894
- for (; r6 && t4[r6] && !o4.has(r6); ) {
6895
- o4.add(r6), n5.push(r6);
6896
- const e6 = t4[r6].next;
6909
+ let s5 = e5;
6910
+ for (; s5 && t4[s5] && !o4.has(s5); ) {
6911
+ o4.add(s5), n5.push(s5);
6912
+ const e6 = t4[s5].next;
6897
6913
  if (Array.isArray(e6)) {
6898
6914
  n5.push(...e6);
6899
6915
  break;
6900
6916
  }
6901
- r6 = e6;
6917
+ s5 = e6;
6902
6918
  }
6903
6919
  return n5;
6904
6920
  }
6905
- async function Ge2(e5, t4, n5) {
6921
+ async function We2(e5, t4, n5) {
6906
6922
  if (t4.init && !t4.config.init) {
6907
- const o4 = t4.type || "unknown", r6 = e5.logger.scope(`transformer:${o4}`), s4 = { collector: e5, logger: r6, id: n5, ingest: O(n5), config: t4.config, env: Ve2(t4.config.env), reportError: ie2(e5, "transformer", n5, r6) };
6908
- r6.debug("init");
6909
- const a4 = await wt(t4.init, "TransformerInit", e5.hooks, e5.logger)(s4);
6923
+ const o4 = t4.type || "unknown", s5 = e5.logger.scope(`transformer:${o4}`), r5 = { collector: e5, logger: s5, id: n5, ingest: O(n5), config: t4.config, env: Ne2(t4.config.env), reportError: ce2(e5, "transformer", n5, s5) };
6924
+ s5.debug("init");
6925
+ const a4 = await wt(t4.init, "TransformerInit", e5.hooks, e5.logger)(r5);
6910
6926
  if (false === a4) return false;
6911
- t4.config = { ...a4 || t4.config, env: a4?.env || t4.config.env, init: true }, r6.debug("init done");
6927
+ t4.config = { ...a4 || t4.config, env: a4?.env || t4.config.env, init: true }, s5.debug("init done");
6912
6928
  }
6913
6929
  return true;
6914
6930
  }
6915
- async function We2(e5, t4, n5, o4, r6, s4) {
6916
- const a4 = t4.type || "unknown", i5 = e5.logger.scope(`transformer:${a4}`), c2 = { collector: e5, logger: i5, id: n5, ingest: r6, config: t4.config, env: { ...Ve2(t4.config.env), ...s4 ? { respond: s4 } : {} }, reportError: ie2(e5, "transformer", n5, i5) };
6931
+ async function Le2(e5, t4, n5, o4, s5, r5) {
6932
+ const a4 = t4.type || "unknown", i5 = e5.logger.scope(`transformer:${a4}`), c2 = { collector: e5, logger: i5, id: n5, ingest: s5, config: t4.config, env: { ...Ne2(t4.config.env), ...r5 ? { respond: r5 } : {} }, reportError: ce2(e5, "transformer", n5, i5) };
6917
6933
  i5.debug("push", { event: o4.name });
6918
- const u3 = "string" == typeof o4.id ? o4.id : "", { traceId: d2, sourceId: l3, parentEventId: f2 } = T2(o4, r6, e5), p3 = Date.now(), g3 = _(e5, { stepId: o("transformer", n5), stepType: "transformer", phase: "in", eventId: u3, now: p3, traceId: d2, sourceId: l3, parentEventId: f2 });
6934
+ const u3 = "string" == typeof o4.id ? o4.id : "", { traceId: d2, sourceId: l3, parentEventId: f2 } = T2(o4, s5, e5), p3 = Date.now(), g3 = _(e5, { stepId: o("transformer", n5), stepType: "transformer", phase: "in", eventId: u3, now: p3, traceId: d2, sourceId: l3, parentEventId: f2 });
6919
6935
  g3.inEvent = o4, dn(e5, g3);
6920
6936
  try {
6921
- const r7 = await wt(t4.push, "TransformerPush", e5.hooks, e5.logger)(o4, c2), s5 = Date.now(), a5 = _(e5, { stepId: o("transformer", n5), stepType: "transformer", phase: "out", eventId: u3, now: s5, traceId: d2, sourceId: l3, parentEventId: f2 });
6922
- return a5.durationMs = s5 - p3, a5.outEvent = r7, dn(e5, a5), i5.debug("push done"), r7;
6937
+ const s6 = await wt(t4.push, "TransformerPush", e5.hooks, e5.logger)(o4, c2), r6 = Date.now(), a5 = _(e5, { stepId: o("transformer", n5), stepType: "transformer", phase: "out", eventId: u3, now: r6, traceId: d2, sourceId: l3, parentEventId: f2 });
6938
+ return a5.durationMs = r6 - p3, a5.outEvent = s6, dn(e5, a5), i5.debug("push done"), s6;
6923
6939
  } catch (t5) {
6924
- const o5 = Date.now(), r7 = _(e5, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId: u3, now: o5, traceId: d2, sourceId: l3, parentEventId: f2 });
6925
- throw r7.durationMs = o5 - p3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, dn(e5, r7), t5;
6940
+ const o5 = Date.now(), s6 = _(e5, { stepId: o("transformer", n5), stepType: "transformer", phase: "error", eventId: u3, now: o5, traceId: d2, sourceId: l3, parentEventId: f2 });
6941
+ throw s6.durationMs = o5 - p3, s6.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, dn(e5, s6), t5;
6926
6942
  }
6927
6943
  }
6928
- function Le2(e5, t4) {
6944
+ function Qe2(e5, t4) {
6929
6945
  return e5 ? { ...e5, _meta: { ...e5._meta, path: [...e5._meta.path] } } : O(t4);
6930
6946
  }
6931
- async function Qe2(e5, t4, n5, o4, r6, s4, a4) {
6932
- r6 || (r6 = O(n5[0] ?? "chain")), a4 && r6._meta && (r6._meta.chainPath = a4);
6933
- let i5 = o4, c2 = s4;
6947
+ async function Ve2(e5, t4, n5, o4, s5, r5, a4) {
6948
+ s5 || (s5 = O(n5[0] ?? "chain")), a4 && s5._meta && (s5._meta.chainPath = a4);
6949
+ let i5 = o4, c2 = r5;
6934
6950
  for (const o5 of n5) {
6935
- const s5 = t4[o5];
6936
- if (!s5) {
6951
+ const r6 = t4[o5];
6952
+ if (!r6) {
6937
6953
  e5.logger.warn(`Transformer not found: ${o5}`);
6938
6954
  continue;
6939
6955
  }
6940
- if (r6 && r6._meta && r6._meta.path.length > 256) return e5.logger.error(`Max path length exceeded at ${o5}`), { event: null, respond: c2 };
6941
- r6 && r6._meta && (r6._meta.hops++, r6._meta.path.push(o5));
6942
- if (!await tt(Ge2, (t5) => {
6956
+ if (s5 && s5._meta && s5._meta.path.length > 256) return e5.logger.error(`Max path length exceeded at ${o5}`), { event: null, respond: c2 };
6957
+ s5 && s5._meta && (s5._meta.hops++, s5._meta.path.push(o5));
6958
+ if (!await tt(We2, (t5) => {
6943
6959
  if (t5 instanceof nt) throw t5;
6944
- return e5.status.failed++, e5.logger.scope(`transformer:${s5.type || "unknown"}`).error("transformer init failed", { transformer: o5, error: t5 }), false;
6945
- })(e5, s5, o5)) return { event: null, respond: c2 };
6946
- if (a4 && void 0 !== s5.config?.chainMocks?.[a4]) {
6947
- const t5 = s5.config.chainMocks[a4];
6948
- e5.logger.scope(`transformer:${s5.type || "unknown"}`).debug("chainMock", { chain: a4 }), i5 = t5;
6960
+ return e5.status.failed++, e5.logger.scope(`transformer:${r6.type || "unknown"}`).error("transformer init failed", { transformer: o5, ...ie2(t5) }), false;
6961
+ })(e5, r6, o5)) return { event: null, respond: c2 };
6962
+ if (a4 && void 0 !== r6.config?.chainMocks?.[a4]) {
6963
+ const t5 = r6.config.chainMocks[a4];
6964
+ e5.logger.scope(`transformer:${r6.type || "unknown"}`).debug("chainMock", { chain: a4 }), i5 = t5;
6949
6965
  continue;
6950
6966
  }
6951
- if (void 0 !== s5.config?.mock) {
6952
- e5.logger.scope(`transformer:${s5.type || "unknown"}`).debug("mock"), i5 = s5.config.mock;
6967
+ if (void 0 !== r6.config?.mock) {
6968
+ e5.logger.scope(`transformer:${r6.type || "unknown"}`).debug("mock"), i5 = r6.config.mock;
6953
6969
  continue;
6954
6970
  }
6955
- if (s5.config?.disabled) continue;
6956
- const u3 = s5.config?.cache, d2 = u3 ? hr(u3) : void 0, l3 = d2 ? Ue2(d2, e5) : void 0, f2 = s5.config?.state ? wr(s5.config.state) : void 0, p3 = f2?.filter((e6) => "get" === e6.mode), g3 = f2?.filter((e6) => "set" === e6.mode), m3 = async (t5) => g3 && 0 !== g3.length ? kr(g3, (t6) => Ke2(t6, e5), t5, e5) : t5;
6971
+ if (r6.config?.disabled) continue;
6972
+ const u3 = r6.config?.cache, d2 = u3 ? hr(u3) : void 0, l3 = d2 ? Ke2(d2, e5) : void 0, f2 = r6.config?.state ? wr(r6.config.state) : void 0, p3 = f2?.filter((e6) => "get" === e6.mode), g3 = f2?.filter((e6) => "set" === e6.mode), m3 = async (t5) => g3 && 0 !== g3.length ? kr(g3, (t6) => Be(t6, e5), t5, e5) : t5;
6957
6973
  let h2;
6958
6974
  if (d2 && l3) {
6959
- const e6 = gr(r6, i5), t5 = await vr(d2, l3, e6);
6975
+ const e6 = gr(s5, i5), t5 = await vr(d2, l3, e6);
6960
6976
  if ("HIT" === t5?.status && t5.value) {
6961
6977
  if (i5 = t5.value, d2.stop) return { event: i5, respond: c2, stopped: true };
6962
6978
  continue;
6963
6979
  }
6964
6980
  "MISS" === t5?.status && (h2 = { key: t5.key, ttl: t5.rule.ttl });
6965
6981
  }
6966
- const v3 = s5.config.before;
6982
+ const v3 = r6.config.before;
6967
6983
  if (v3) {
6968
- const n6 = er(v3, gr(r6, i5));
6984
+ const n6 = er(v3, gr(s5, i5));
6969
6985
  if (1 === n6.length) {
6970
- const o6 = He2(n6[0], Be(t4));
6986
+ const o6 = Ge2(n6[0], Fe(t4));
6971
6987
  if (o6.length > 0) {
6972
- const n7 = await Qe2(e5, t4, o6, i5, r6, c2, a4);
6988
+ const n7 = await Ve2(e5, t4, o6, i5, s5, c2, a4);
6973
6989
  if (null === n7.event) return { event: null, respond: n7.respond ?? c2 };
6974
6990
  if (n7.stopped) return { event: Array.isArray(n7.event) ? n7.event[0] : n7.event, respond: n7.respond ?? c2, stopped: true };
6975
6991
  n7.respond && (c2 = n7.respond), i5 = Array.isArray(n7.event) ? n7.event[0] : n7.event;
6976
6992
  }
6977
- } else n6.length > 1 && await Promise.all(n6.map((n7) => tt(Qe2, (t5) => (e5.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e5, t4, He2(n7, Be(t4)), i5, Le2(r6, n7), void 0, a4)));
6993
+ } else n6.length > 1 && await Promise.all(n6.map((n7) => tt(Ve2, (t5) => (e5.logger.scope("transformer:many").error(`many branch ${n7} failed`, ie2(t5)), { event: null, respond: void 0 }))(e5, t4, Ge2(n7, Fe(t4)), i5, Qe2(s5, n7), void 0, a4)));
6978
6994
  }
6979
- p3 && p3.length > 0 && (i5 = await kr(p3, (t5) => Ke2(t5, e5), i5, e5));
6980
- const y3 = await tt(We2, (t5) => (e5.logger.scope(`transformer:${s5.type || "unknown"}`).error("Push failed", { error: t5 }), false))(e5, s5, o5, i5, r6, c2);
6995
+ p3 && p3.length > 0 && (i5 = await kr(p3, (t5) => Be(t5, e5), i5, e5));
6996
+ const y3 = await tt(Le2, (t5) => (e5.logger.scope(`transformer:${r6.type || "unknown"}`).error("Push failed", ie2(t5)), false))(e5, r6, o5, i5, s5, c2);
6981
6997
  if (false === y3) return { event: null, respond: c2, droppedBy: o5 };
6982
6998
  if (Array.isArray(y3)) {
6983
- const s6 = n5.slice(n5.indexOf(o5) + 1), u4 = await Promise.all(y3.map(async (n6) => {
6984
- const o6 = await m3(n6.event || i5), u5 = Le2(r6, "unknown");
6999
+ const r7 = n5.slice(n5.indexOf(o5) + 1), u4 = await Promise.all(y3.map(async (n6) => {
7000
+ const o6 = await m3(n6.event || i5), u5 = Qe2(s5, "unknown");
6985
7001
  if (n6.next) {
6986
- const r7 = er(n6.next, gr(u5, o6));
6987
- if (0 === r7.length) return { event: o6, respond: c2 };
6988
- if (1 === r7.length) {
6989
- const n7 = He2(r7[0], Be(t4));
6990
- return n7.length > 0 ? Qe2(e5, t4, n7, o6, u5, c2, a4) : { event: o6, respond: c2 };
7002
+ const s6 = er(n6.next, gr(u5, o6));
7003
+ if (0 === s6.length) return { event: o6, respond: c2 };
7004
+ if (1 === s6.length) {
7005
+ const n7 = Ge2(s6[0], Fe(t4));
7006
+ return n7.length > 0 ? Ve2(e5, t4, n7, o6, u5, c2, a4) : { event: o6, respond: c2 };
6991
7007
  }
6992
- return (await Promise.all(r7.map((n7) => tt(Qe2, (t5) => (e5.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e5, t4, He2(n7, Be(t4)), o6, Le2(u5, n7), void 0, a4)))).map((e6) => ({ event: e6.event, respond: void 0 }));
7008
+ return (await Promise.all(s6.map((n7) => tt(Ve2, (t5) => (e5.logger.scope("transformer:many").error(`many branch ${n7} failed`, ie2(t5)), { event: null, respond: void 0 }))(e5, t4, Ge2(n7, Fe(t4)), o6, Qe2(u5, n7), void 0, a4)))).map((e6) => ({ event: e6.event, respond: void 0 }));
6993
7009
  }
6994
- return s6.length > 0 ? Qe2(e5, t4, s6, o6, u5, c2, a4) : { event: o6, respond: c2 };
7010
+ return r7.length > 0 ? Ve2(e5, t4, r7, o6, u5, c2, a4) : { event: o6, respond: c2 };
6995
7011
  }));
6996
7012
  let d3 = c2;
6997
7013
  const l4 = [];
@@ -7003,68 +7019,68 @@ async function Qe2(e5, t4, n5, o4, r6, s4, a4) {
7003
7019
  return 0 === l4.length ? { event: null, respond: d3 } : 1 === l4.length ? { event: l4[0], respond: d3 } : { event: l4, respond: d3 };
7004
7020
  }
7005
7021
  if (y3 && "object" == typeof y3) {
7006
- const { event: n6, respond: o6, next: s6 } = y3;
7007
- if (o6 && (c2 = o6), void 0 !== s6) {
7008
- const o7 = await m3(n6 || i5), u4 = er(s6, gr(r6, o7));
7022
+ const { event: n6, respond: o6, next: r7 } = y3;
7023
+ if (o6 && (c2 = o6), void 0 !== r7) {
7024
+ const o7 = await m3(n6 || i5), u4 = er(r7, gr(s5, o7));
7009
7025
  if (0 === u4.length) {
7010
7026
  i5 = o7;
7011
7027
  continue;
7012
7028
  }
7013
7029
  if (1 === u4.length) {
7014
- const n7 = He2(u4[0], Be(t4));
7015
- return n7.length > 0 ? Qe2(e5, t4, n7, o7, r6, c2, a4) : (e5.logger.warn(`Branch target not found: ${JSON.stringify(s6)}`), { event: null, respond: c2 });
7030
+ const n7 = Ge2(u4[0], Fe(t4));
7031
+ return n7.length > 0 ? Ve2(e5, t4, n7, o7, s5, c2, a4) : (e5.logger.warn(`Branch target not found: ${JSON.stringify(r7)}`), { event: null, respond: c2 });
7016
7032
  }
7017
- return await Promise.all(u4.map((n7) => tt(Qe2, (t5) => (e5.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e5, t4, He2(n7, Be(t4)), o7, Le2(r6, n7), void 0, a4))), { event: null, respond: void 0 };
7033
+ return await Promise.all(u4.map((n7) => tt(Ve2, (t5) => (e5.logger.scope("transformer:many").error(`many branch ${n7} failed`, ie2(t5)), { event: null, respond: void 0 }))(e5, t4, Ge2(n7, Fe(t4)), o7, Qe2(s5, n7), void 0, a4))), { event: null, respond: void 0 };
7018
7034
  }
7019
7035
  n6 && (i5 = n6);
7020
7036
  }
7021
- g3 && g3.length > 0 && (i5 = await kr(g3, (t5) => Ke2(t5, e5), i5, e5)), h2 && l3 && yr(l3, h2.key, i5, h2.ttl);
7022
- const w3 = s5.config.next, b3 = "string" == typeof w3 || Array.isArray(w3) && w3.every((e6) => "string" == typeof e6), k3 = void 0 !== w3 && !b3;
7037
+ g3 && g3.length > 0 && (i5 = await kr(g3, (t5) => Be(t5, e5), i5, e5)), h2 && l3 && yr(l3, h2.key, i5, h2.ttl);
7038
+ const w3 = r6.config.next, b3 = "string" == typeof w3 || Array.isArray(w3) && w3.every((e6) => "string" == typeof e6), k3 = void 0 !== w3 && !b3;
7023
7039
  if ((!y3 || "object" == typeof y3 && !y3.next) && k3) {
7024
- const n6 = er(s5.config.next, gr(r6, i5));
7040
+ const n6 = er(r6.config.next, gr(s5, i5));
7025
7041
  if (1 === n6.length) {
7026
- const o6 = He2(n6[0], Be(t4));
7027
- return o6.length > 0 ? Qe2(e5, t4, o6, i5, r6, c2, a4) : { event: i5, respond: c2 };
7042
+ const o6 = Ge2(n6[0], Fe(t4));
7043
+ return o6.length > 0 ? Ve2(e5, t4, o6, i5, s5, c2, a4) : { event: i5, respond: c2 };
7028
7044
  }
7029
- return n6.length > 1 ? (await Promise.all(n6.map((n7) => tt(Qe2, (t5) => (e5.logger.scope("transformer:many").error(`many branch ${n7} failed`, { error: t5 }), { event: null, respond: void 0 }))(e5, t4, He2(n7, Be(t4)), i5, Le2(r6, n7), void 0, a4))), { event: null, respond: void 0 }) : { event: i5, respond: c2 };
7045
+ return n6.length > 1 ? (await Promise.all(n6.map((n7) => tt(Ve2, (t5) => (e5.logger.scope("transformer:many").error(`many branch ${n7} failed`, ie2(t5)), { event: null, respond: void 0 }))(e5, t4, Ge2(n7, Fe(t4)), i5, Qe2(s5, n7), void 0, a4))), { event: null, respond: void 0 }) : { event: i5, respond: c2 };
7030
7046
  }
7031
7047
  }
7032
7048
  return { event: i5, respond: c2 };
7033
7049
  }
7034
- function Ve2(e5) {
7050
+ function Ne2(e5) {
7035
7051
  return e5 && ve(e5) ? e5 : {};
7036
7052
  }
7037
- function Ne2(e5) {
7053
+ function Ye2(e5) {
7038
7054
  return "string" == typeof e5 || !(!Array.isArray(e5) || !e5.every((e6) => "string" == typeof e6));
7039
7055
  }
7040
- async function Ye2(e5, t4, n5) {
7056
+ async function Je2(e5, t4, n5) {
7041
7057
  if (!t4.on || !t4.queueOn?.length) return;
7042
7058
  const o4 = t4.queueOn;
7043
7059
  t4.queueOn = [];
7044
- const r6 = n5 || t4.config?.id || "unknown";
7045
- for (const { type: n6, data: s4 } of o4) at(n6) && !lt(e5, t4, n6) || (await tt(t4.on, (t5) => {
7060
+ const s5 = n5 || t4.config?.id || "unknown";
7061
+ for (const { type: n6, data: r5 } of o4) it2(n6) && !ft(e5, t4, n6) || (await tt(t4.on, (t5) => {
7046
7062
  if (t5 instanceof nt) throw t5;
7047
- e5.status.failed++, e5.logger.scope("source").error("source on flush failed", { sourceId: r6, type: n6, error: t5 });
7048
- })(n6, s4), at(n6) && dt(e5, t4, n6));
7063
+ e5.status.failed++, e5.logger.scope("source").error("source on flush failed", { sourceId: s5, type: n6, ...ie2(t5) });
7064
+ })(n6, r5), it2(n6) && lt(e5, t4, n6));
7049
7065
  }
7050
- function Je2(e5) {
7066
+ function Xe(e5) {
7051
7067
  return Boolean(e5.config.init) && !e5.config.require?.length;
7052
7068
  }
7053
- async function Xe(e5, t4, n5) {
7054
- const { code: o4, config: r6 = {}, env: s4 = {}, primary: a4, next: i5, before: c2, cache: u3, terminus: d2 } = n5, l3 = r6.state ?? n5.state, f2 = l3 ? wr(l3) : void 0, p3 = u3, g3 = p3 ? hr({ ...p3, stop: p3.stop ?? true }) : void 0, m3 = Ne2(i5) ? He2(i5, Be(e5.transformers)) : void 0, h2 = Ne2(c2) ? He2(c2, Be(e5.transformers)) : void 0, v3 = d2 ?? e5.push, y3 = Boolean(d2), w3 = async (n6, o5, s5) => {
7069
+ async function Ze2(e5, t4, n5) {
7070
+ const { code: o4, config: s5 = {}, env: r5 = {}, primary: a4, next: i5, before: c2, cache: u3, terminus: d2 } = n5, l3 = s5.state ?? n5.state, f2 = l3 ? wr(l3) : void 0, p3 = u3, g3 = p3 ? hr({ ...p3, stop: p3.stop ?? true }) : void 0, m3 = Ye2(i5) ? Ge2(i5, Fe(e5.transformers)) : void 0, h2 = Ye2(c2) ? Ge2(c2, Fe(e5.transformers)) : void 0, v3 = d2 ?? e5.push, y3 = Boolean(d2), w3 = async (n6, o5, r6) => {
7055
7071
  if (y3) return v3(n6);
7056
7072
  let a5;
7057
7073
  const u4 = "string" == typeof n6.id && "" !== n6.id ? n6 : { ...n6, id: Pe() }, d3 = h2 ?? (void 0 !== c2 ? (() => {
7058
- const t5 = er(c2, gr(s5.ingest));
7074
+ const t5 = er(c2, gr(r6.ingest));
7059
7075
  if (0 === t5.length) return [];
7060
- return He2(1 === t5.length ? t5[0] : t5, Be(e5.transformers));
7076
+ return Ge2(1 === t5.length ? t5[0] : t5, Fe(e5.transformers));
7061
7077
  })() : []);
7062
7078
  let l4 = [u4];
7063
7079
  if (d3.length > 0 && e5.transformers && Object.keys(e5.transformers).length > 0) {
7064
- const n7 = await Qe2(e5, e5.transformers, d3, u4, s5.ingest, s5.respond, `source.${t4}.before`);
7080
+ const n7 = await Ve2(e5, e5.transformers, d3, u4, r6.ingest, r6.respond, `source.${t4}.before`);
7065
7081
  if (null === n7.event) return { ok: true };
7066
- if (n7.stopped) return n7.respond && (s5.respond = n7.respond), { ok: true };
7067
- n7.respond && (s5.respond = n7.respond);
7082
+ if (n7.stopped) return n7.respond && (r6.respond = n7.respond), { ok: true };
7083
+ n7.respond && (r6.respond = n7.respond);
7068
7084
  const o6 = "string" == typeof u4.id ? u4.id : "";
7069
7085
  if (Array.isArray(n7.event)) l4 = n7.event.map((e6) => "" !== o6 && e6.id === o6 ? { ...e6, id: Pe() } : e6);
7070
7086
  else {
@@ -7073,61 +7089,61 @@ async function Xe(e5, t4, n5) {
7073
7089
  }
7074
7090
  }
7075
7091
  if (g3) {
7076
- const t5 = Ue2(g3, e5);
7092
+ const t5 = Ke2(g3, e5);
7077
7093
  if (t5) {
7078
- const n7 = gr(s5.ingest), o6 = await vr(g3, t5, n7);
7094
+ const n7 = gr(r6.ingest), o6 = await vr(g3, t5, n7);
7079
7095
  if (o6) {
7080
7096
  if ("HIT" === o6.status && void 0 !== o6.value && g3.stop) {
7081
7097
  let t6 = o6.value;
7082
- return o6.rule.update && (t6 = await br(t6, o6.rule.update, { ...n7, cache: { status: "HIT" } }, e5)), s5.respond?.(t6), { ok: true };
7098
+ return o6.rule.update && (t6 = await br(t6, o6.rule.update, { ...n7, cache: { status: "HIT" } }, e5)), r6.respond?.(t6), { ok: true };
7083
7099
  }
7084
- if ("MISS" === o6.status && g3.stop && s5.respond) {
7085
- const r7 = s5.respond, i6 = o6.rule.update, c3 = { ...n7, cache: { status: "MISS" } }, u5 = o6.key, d4 = o6.rule.ttl, l5 = (n8) => {
7100
+ if ("MISS" === o6.status && g3.stop && r6.respond) {
7101
+ const s6 = r6.respond, i6 = o6.rule.update, c3 = { ...n7, cache: { status: "MISS" } }, u5 = o6.key, d4 = o6.rule.ttl, l5 = (n8) => {
7086
7102
  yr(t5, u5, n8, d4), i6 ? a5 = (async () => {
7087
7103
  const t6 = await br(n8, i6, c3, e5);
7088
- r7(t6);
7089
- })() : r7(n8);
7104
+ s6(t6);
7105
+ })() : s6(n8);
7090
7106
  };
7091
- s5.respond = l5;
7107
+ r6.respond = l5;
7092
7108
  }
7093
7109
  "MISS" !== o6.status || g3.stop || yr(t5, o6.key, true, o6.rule.ttl);
7094
7110
  }
7095
7111
  }
7096
7112
  }
7097
7113
  const p4 = m3 ? { kind: "single", preChain: m3 } : void 0 !== i5 ? (() => {
7098
- const t5 = er(i5, gr(s5.ingest));
7099
- return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain: He2(t5[0], Be(e5.transformers)) } : { kind: "many", branches: t5.map((t6) => He2(t6, Be(e5.transformers))) };
7114
+ const t5 = er(i5, gr(r6.ingest));
7115
+ return 0 === t5.length ? { kind: "single", preChain: [] } : 1 === t5.length ? { kind: "single", preChain: Ge2(t5[0], Fe(e5.transformers)) } : { kind: "many", branches: t5.map((t6) => Ge2(t6, Fe(e5.transformers))) };
7100
7116
  })() : { kind: "single", preChain: [] };
7101
- f2 && f2.length > 0 && (l4 = await Promise.all(l4.map((t5) => kr(f2, (t6) => Ke2(t6, e5), t5, e5))));
7117
+ f2 && f2.length > 0 && (l4 = await Promise.all(l4.map((t5) => kr(f2, (t6) => Be(t6, e5), t5, e5))));
7102
7118
  let w4 = { ok: true };
7103
- for (const n7 of l4) "many" === p4.kind ? (await Promise.all(p4.branches.map((a6, i6) => tt(async () => v3(n7, { ...o5, id: t4, ingest: Le2(s5.ingest, `${t4}.${i6}`), respond: void 0, mapping: r6, preChain: a6 }), (t5) => (e5.logger.scope("source:many").error(`many branch ${i6} failed`, { error: t5 }), { ok: true }))())), w4 = { ok: true }) : w4 = await v3(n7, { ...o5, id: t4, ingest: s5.ingest, respond: s5.respond, mapping: r6, preChain: p4.preChain });
7119
+ for (const n7 of l4) "many" === p4.kind ? (await Promise.all(p4.branches.map((a6, i6) => tt(async () => v3(n7, { ...o5, id: t4, ingest: Qe2(r6.ingest, `${t4}.${i6}`), respond: void 0, mapping: s5, preChain: a6 }), (t5) => (e5.logger.scope("source:many").error(`many branch ${i6} failed`, ie2(t5)), { ok: true }))())), w4 = { ok: true }) : w4 = await v3(n7, { ...o5, id: t4, ingest: r6.ingest, respond: r6.respond, mapping: s5, preChain: p4.preChain });
7104
7120
  return a5 && await a5, w4;
7105
7121
  }, b3 = async (n6) => {
7106
- const o5 = O(t4), s5 = De(qn(n6) ? n6?.headers?.traceparent : void 0);
7107
- if (s5 && (o5._meta.trace = s5.trace, o5._meta.parentEventId = s5.parentSpan), !r6.ingest || void 0 === n6) return o5;
7108
- const a5 = await ot(n6, r6.ingest, { collector: e5 });
7122
+ const o5 = O(t4), r6 = De(qn(n6) ? n6?.headers?.traceparent : void 0);
7123
+ if (r6 && (o5._meta.trace = r6.trace, o5._meta.parentEventId = r6.parentSpan), !s5.ingest || void 0 === n6) return o5;
7124
+ const a5 = await ot(n6, s5.ingest, { collector: e5 });
7109
7125
  return { ...o5, ...a5, _meta: o5._meta };
7110
- }, k3 = e5.logger.scope("source").scope(t4), I2 = { ...s4, push: async (e6, n6 = {}) => {
7126
+ }, k3 = e5.logger.scope("source").scope(t4), I2 = { ...r5, push: async (e6, n6 = {}) => {
7111
7127
  const o5 = { ingest: O(t4), respond: void 0 };
7112
7128
  return w3(e6, n6, o5);
7113
- }, command: e5.command, sources: e5.sources, elb: e5.elb, logger: k3 }, C3 = { collector: e5, logger: k3, id: t4, config: r6, env: I2, withScope: async (e6, t5, n6) => {
7129
+ }, command: e5.command, sources: e5.sources, elb: e5.elb, logger: k3 }, C3 = { collector: e5, logger: k3, id: t4, config: s5, env: I2, withScope: async (e6, t5, n6) => {
7114
7130
  const o5 = { ingest: await b3(e6), respond: t5 };
7115
7131
  return n6({ ...I2, push: (e7, t6 = {}) => w3(e7, t6, o5), ingest: o5.ingest, respond: o5.respond });
7116
- }, reportError: ie2(e5, "source", t4, k3) }, E2 = await tt(o4, (n6) => {
7132
+ }, reportError: ce2(e5, "source", t4, k3) }, E2 = await tt(o4, (n6) => {
7117
7133
  if (n6 instanceof nt) throw n6;
7118
- e5.status.failed++, e5.logger.scope("source").error("source factory failed", { sourceId: t4, error: n6 });
7134
+ e5.status.failed++, e5.logger.scope("source").error("source factory failed", { sourceId: t4, ...ie2(n6) });
7119
7135
  })(C3);
7120
7136
  if (!E2) return;
7121
7137
  const S2 = E2.type || "unknown", q3 = e5.logger.scope(S2).scope(t4);
7122
7138
  return I2.logger = q3, a4 && (E2.config = { ...E2.config, primary: a4 }), E2;
7123
7139
  }
7124
- async function Ze2(e5, t4 = {}) {
7140
+ async function et2(e5, t4 = {}) {
7125
7141
  const n5 = {};
7126
- for (const [o4, r6] of Object.entries(t4)) {
7127
- const t5 = await Xe(e5, o4, r6);
7142
+ for (const [o4, s5] of Object.entries(t4)) {
7143
+ const t5 = await Ze2(e5, o4, s5);
7128
7144
  if (!t5) continue;
7129
- const s4 = r6.config?.require;
7130
- t5.config = { ...t5.config, init: false, ...s4 ? { require: [...s4] } : {} }, n5[o4] = t5;
7145
+ const r5 = s5.config?.require;
7146
+ t5.config = { ...t5.config, init: false, ...r5 ? { require: [...r5] } : {} }, n5[o4] = t5;
7131
7147
  }
7132
7148
  Object.assign(e5.sources, n5);
7133
7149
  for (const t5 of Object.keys(n5)) {
@@ -7135,49 +7151,49 @@ async function Ze2(e5, t4 = {}) {
7135
7151
  let o4 = false;
7136
7152
  n6.init && await tt(n6.init.bind(n6), (n7) => {
7137
7153
  if (n7 instanceof nt) throw n7;
7138
- o4 = true, e5.status.failed++, e5.logger.scope("source").error("source init failed", { sourceId: t5, error: n7 });
7139
- })(), o4 || (n6.config.init = true, Je2(n6) && await Ye2(e5, n6, t5));
7154
+ o4 = true, e5.status.failed++, e5.logger.scope("source").error("source init failed", { sourceId: t5, ...ie2(n7) });
7155
+ })(), o4 || (n6.config.init = true, Xe(n6) && await Je2(e5, n6, t5));
7140
7156
  }
7141
- return await et2(e5), n5;
7157
+ return await tt2(e5), n5;
7142
7158
  }
7143
- async function et2(e5) {
7159
+ async function tt2(e5) {
7144
7160
  for (const [t4, n5] of Object.entries(e5.sources)) {
7145
- if (Je2(n5)) continue;
7161
+ if (Xe(n5)) continue;
7146
7162
  const o4 = n5.config.require;
7147
7163
  if (!o4?.length) continue;
7148
- const r6 = o4.filter((t5) => !ct(e5, t5));
7149
- r6.length !== o4.length && (n5.config.require = r6, Je2(n5) && await Ye2(e5, n5, t4));
7164
+ const s5 = o4.filter((t5) => !ut(e5, t5));
7165
+ s5.length !== o4.length && (n5.config.require = s5, Xe(n5) && await Je2(e5, n5, t4));
7150
7166
  }
7151
7167
  for (const [t4, n5] of Object.entries(e5.pending.destinations)) {
7152
7168
  if (!e5.pending.destinations[t4] || e5.destinations[t4]) continue;
7153
7169
  const o4 = n5.config?.require;
7154
7170
  if (!o4) continue;
7155
- const r6 = o4.filter((t5) => !ct(e5, t5));
7156
- if (n5.config && (n5.config.require = r6), r6.length > 0) continue;
7171
+ const s5 = o4.filter((t5) => !ut(e5, t5));
7172
+ if (n5.config && (n5.config.require = s5), s5.length > 0) continue;
7157
7173
  delete e5.pending.destinations[t4];
7158
- const s4 = Tt2(n5);
7159
- false !== s4.config.queue && (s4.queuePush = [...e5.queue]), e5.destinations[t4] = s4;
7174
+ const r5 = _t2(n5);
7175
+ false !== r5.config.queue && (r5.queuePush = [...e5.queue]), e5.destinations[t4] = r5;
7160
7176
  }
7161
7177
  }
7162
- function tt2(e5) {
7178
+ function nt2(e5) {
7163
7179
  if ("object" != typeof e5 || null === e5) return false;
7164
7180
  if (!("logger" in e5)) return false;
7165
7181
  const t4 = e5.logger;
7166
7182
  return "object" == typeof t4 && null !== t4 && ("scope" in t4 && "function" == typeof t4.scope);
7167
7183
  }
7168
- var nt2 = false;
7169
- function ot2() {
7170
- nt2 || (nt2 = true, "undefined" != typeof console && "function" == typeof console.warn && console.warn("walkerOS: ignored an on-dispatch call with a non-collector argument"));
7184
+ var ot2 = false;
7185
+ function st2() {
7186
+ ot2 || (ot2 = true, "undefined" != typeof console && "function" == typeof console.warn && console.warn("walkerOS: ignored an on-dispatch call with a non-collector argument"));
7171
7187
  }
7172
7188
  function rt2(e5, t4, n5, o4) {
7173
7189
  if (n5 instanceof nt) throw n5;
7174
- e5.logger.scope("on").error("on callback failed", { kind: t4, ...o4, error: n5 });
7190
+ e5.logger.scope("on").error("on callback failed", { kind: t4, ...o4, ...ie2(n5) });
7175
7191
  }
7176
- var st2 = [n.Commands.Consent, n.Commands.User, n.Commands.Globals, n.Commands.Custom];
7177
- function at(e5) {
7178
- return st2.includes(e5);
7192
+ var at = [n.Commands.Consent, n.Commands.User, n.Commands.Globals, n.Commands.Custom];
7193
+ function it2(e5) {
7194
+ return at.includes(e5);
7179
7195
  }
7180
- function it2(e5, t4) {
7196
+ function ct(e5, t4) {
7181
7197
  switch (t4) {
7182
7198
  case n.Commands.Consent:
7183
7199
  return Object.keys(e5.consent).length > 0;
@@ -7191,13 +7207,13 @@ function it2(e5, t4) {
7191
7207
  return false;
7192
7208
  }
7193
7209
  }
7194
- function ct(e5, t4) {
7210
+ function ut(e5, t4) {
7195
7211
  switch (t4) {
7196
7212
  case n.Commands.Consent:
7197
7213
  case n.Commands.User:
7198
7214
  case n.Commands.Globals:
7199
7215
  case n.Commands.Custom:
7200
- return it2(e5, t4);
7216
+ return ct(e5, t4);
7201
7217
  case n.Commands.Run:
7202
7218
  case n.Commands.Ready:
7203
7219
  return true === e5.allowed;
@@ -7205,66 +7221,66 @@ function ct(e5, t4) {
7205
7221
  return e5.seenEvents.has(String(t4));
7206
7222
  }
7207
7223
  }
7208
- function ut(e5, t4) {
7224
+ function dt(e5, t4) {
7209
7225
  return e5.cellVersion[String(t4)] ?? 0;
7210
7226
  }
7211
- function dt(e5, t4, n5) {
7227
+ function lt(e5, t4, n5) {
7212
7228
  let o4 = e5.delivery.get(t4);
7213
- o4 || (o4 = {}, e5.delivery.set(t4, o4)), o4[String(n5)] = ut(e5, n5);
7229
+ o4 || (o4 = {}, e5.delivery.set(t4, o4)), o4[String(n5)] = dt(e5, n5);
7214
7230
  }
7215
- function lt(e5, t4, n5) {
7216
- return e5.allowed && ut(e5, n5) > (function(e6, t5, n6) {
7217
- const o4 = e6.delivery.get(t5), r6 = o4?.[String(n6)];
7218
- return void 0 === r6 ? -1 : r6;
7231
+ function ft(e5, t4, n5) {
7232
+ return e5.allowed && dt(e5, n5) > (function(e6, t5, n6) {
7233
+ const o4 = e6.delivery.get(t5), s5 = o4?.[String(n6)];
7234
+ return void 0 === s5 ? -1 : s5;
7219
7235
  })(e5, t4, n5);
7220
7236
  }
7221
- function ft(e5) {
7237
+ function pt(e5) {
7222
7238
  return e5.cascade ? () => {
7223
7239
  } : (e5.cascade = { counts: /* @__PURE__ */ new WeakMap() }, () => {
7224
7240
  e5.cascade = void 0;
7225
7241
  });
7226
7242
  }
7227
- function pt(e5, t4, n5) {
7243
+ function gt2(e5, t4, n5) {
7228
7244
  const o4 = e5.cascade;
7229
7245
  if (!o4) return true;
7230
- let r6 = o4.counts.get(t4);
7231
- r6 || (r6 = {}, o4.counts.set(t4, r6));
7232
- const s4 = String(n5), a4 = (r6[s4] || 0) + 1;
7233
- return r6[s4] = a4, a4 <= 8 || (9 === a4 && e5.logger.error("state delivery did not converge", { type: s4 }), false);
7246
+ let s5 = o4.counts.get(t4);
7247
+ s5 || (s5 = {}, o4.counts.set(t4, s5));
7248
+ const r5 = String(n5), a4 = (s5[r5] || 0) + 1;
7249
+ return s5[r5] = a4, a4 <= 8 || (9 === a4 && e5.logger.error("state delivery did not converge", { type: r5 }), false);
7234
7250
  }
7235
- function gt2(e5, t4) {
7251
+ function mt(e5, t4) {
7236
7252
  return { collector: e5, logger: e5.logger.scope("on").scope(String(t4)) };
7237
7253
  }
7238
- async function mt(e5, t4, n5) {
7239
- if (!tt2(e5)) return void ot2();
7240
- const o4 = e5.on, r6 = o4[t4] || [], s4 = ue(n5) ? n5 : [n5];
7241
- s4.forEach((e6) => {
7242
- r6.push(e6);
7243
- }), o4[t4] = r6, vt(e5, t4, s4);
7254
+ async function ht2(e5, t4, n5) {
7255
+ if (!nt2(e5)) return void st2();
7256
+ const o4 = e5.on, s5 = o4[t4] || [], r5 = ue(n5) ? n5 : [n5];
7257
+ r5.forEach((e6) => {
7258
+ s5.push(e6);
7259
+ }), o4[t4] = s5, yt(e5, t4, r5);
7244
7260
  }
7245
- function ht2(e5, t4, n5, o4, r6) {
7261
+ function vt(e5, t4, n5, o4, s5) {
7246
7262
  if (!t4.on) return;
7247
- const s4 = t4.type || "unknown", a4 = e5.logger.scope(s4).scope("on").scope(o4), i5 = { collector: e5, logger: a4, id: n5, config: t4.config, data: r6, env: Pt(t4.env, t4.config.env), reportError: ie2(e5, "destination", n5, a4, t4) };
7263
+ const r5 = t4.type || "unknown", a4 = e5.logger.scope(r5).scope("on").scope(o4), i5 = { collector: e5, logger: a4, id: n5, config: t4.config, data: s5, env: Rt2(t4.env, t4.config.env), reportError: ce2(e5, "destination", n5, a4, t4) };
7248
7264
  et(t4.on, (t5) => rt2(e5, "destination", t5, { destId: n5, type: o4 }))(o4, i5);
7249
7265
  }
7250
- function vt(e5, t4, o4, r6) {
7251
- if (!tt2(e5)) return void ot2();
7252
- const s4 = yt(e5, t4, r6);
7266
+ function yt(e5, t4, o4, s5) {
7267
+ if (!nt2(e5)) return void st2();
7268
+ const r5 = wt2(e5, t4, s5);
7253
7269
  if (o4.length) switch (t4) {
7254
7270
  case n.Commands.Consent:
7255
7271
  !(function(e6, t5, o5) {
7256
- const r7 = o5 || e6.consent, s5 = gt2(e6, n.Commands.Consent);
7272
+ const s6 = o5 || e6.consent, r6 = mt(e6, n.Commands.Consent);
7257
7273
  t5.forEach((t6) => {
7258
- lt(e6, t6, n.Commands.Consent) && pt(e6, t6, n.Commands.Consent) && (Object.keys(r7).filter((e7) => e7 in t6).forEach((n5) => {
7259
- et(t6[n5], (t7) => rt2(e6, "consent", t7, { key: n5 }))(r7, s5);
7260
- }), dt(e6, t6, n.Commands.Consent));
7274
+ ft(e6, t6, n.Commands.Consent) && gt2(e6, t6, n.Commands.Consent) && (Object.keys(s6).filter((e7) => e7 in t6).forEach((n5) => {
7275
+ et(t6[n5], (t7) => rt2(e6, "consent", t7, { key: n5 }))(s6, r6);
7276
+ }), lt(e6, t6, n.Commands.Consent));
7261
7277
  });
7262
- })(e5, o4, r6);
7278
+ })(e5, o4, s5);
7263
7279
  break;
7264
7280
  case n.Commands.Ready:
7265
7281
  !(function(e6, t5) {
7266
7282
  if (!e6.allowed) return;
7267
- const o5 = gt2(e6, n.Commands.Ready);
7283
+ const o5 = mt(e6, n.Commands.Ready);
7268
7284
  t5.forEach((t6) => {
7269
7285
  et(t6, (t7) => rt2(e6, "ready", t7))(void 0, o5);
7270
7286
  });
@@ -7273,7 +7289,7 @@ function vt(e5, t4, o4, r6) {
7273
7289
  case n.Commands.Run:
7274
7290
  !(function(e6, t5) {
7275
7291
  if (!e6.allowed) return;
7276
- const o5 = gt2(e6, n.Commands.Run);
7292
+ const o5 = mt(e6, n.Commands.Run);
7277
7293
  t5.forEach((t6) => {
7278
7294
  et(t6, (t7) => rt2(e6, "run", t7))(void 0, o5);
7279
7295
  });
@@ -7282,22 +7298,22 @@ function vt(e5, t4, o4, r6) {
7282
7298
  case n.Commands.Session:
7283
7299
  !(function(e6, t5) {
7284
7300
  if (!e6.session) return;
7285
- const o5 = gt2(e6, n.Commands.Session);
7301
+ const o5 = mt(e6, n.Commands.Session);
7286
7302
  t5.forEach((t6) => {
7287
7303
  et(t6, (t7) => rt2(e6, "session", t7))(e6.session, o5);
7288
7304
  });
7289
7305
  })(e5, o4);
7290
7306
  break;
7291
7307
  default: {
7292
- const n5 = gt2(e5, t4), r7 = at(t4);
7308
+ const n5 = mt(e5, t4), s6 = it2(t4);
7293
7309
  o4.forEach((o5) => {
7294
- "function" == typeof o5 && (r7 && !lt(e5, o5, t4) || r7 && !pt(e5, o5, t4) || (et(o5, (n6) => rt2(e5, "generic", n6, { type: t4 }))(s4, n5), r7 && dt(e5, o5, t4)));
7310
+ "function" == typeof o5 && (s6 && !ft(e5, o5, t4) || s6 && !gt2(e5, o5, t4) || (et(o5, (n6) => rt2(e5, "generic", n6, { type: t4 }))(r5, n5), s6 && lt(e5, o5, t4)));
7295
7311
  });
7296
7312
  break;
7297
7313
  }
7298
7314
  }
7299
7315
  }
7300
- function yt(e5, t4, o4) {
7316
+ function wt2(e5, t4, o4) {
7301
7317
  switch (t4) {
7302
7318
  case n.Commands.Consent:
7303
7319
  return o4 || e5.consent;
@@ -7315,100 +7331,100 @@ function yt(e5, t4, o4) {
7315
7331
  return;
7316
7332
  }
7317
7333
  }
7318
- async function wt2(e5, t4, n5, o4, r6) {
7334
+ async function bt2(e5, t4, n5, o4, s5) {
7319
7335
  if (!t4.on) return false;
7320
- if (at(o4) && !lt(e5, t4, o4)) return false;
7321
- if (at(o4) && !pt(e5, t4, o4)) return false;
7322
- const s4 = await tt(t4.on, (t5) => rt2(e5, "source", t5, { sourceId: n5, type: o4 }))(o4, r6);
7323
- return at(o4) && dt(e5, t4, o4), false === s4;
7324
- }
7325
- async function bt2(e5) {
7326
- if (tt2(e5)) for (const t4 of st2) {
7327
- if (!it2(e5, t4)) continue;
7328
- const n5 = yt(e5, t4);
7329
- vt(e5, t4, e5.on[t4] || []);
7330
- for (const [o4, r6] of Object.entries(e5.sources)) Je2(r6) && await wt2(e5, r6, o4, t4, n5);
7331
- }
7332
- else ot2();
7333
- }
7334
- async function kt2(e5, t4, n5, o4) {
7335
- if (!tt2(e5)) return ot2(), true;
7336
+ if (it2(o4) && !ft(e5, t4, o4)) return false;
7337
+ if (it2(o4) && !gt2(e5, t4, o4)) return false;
7338
+ const r5 = await tt(t4.on, (t5) => rt2(e5, "source", t5, { sourceId: n5, type: o4 }))(o4, s5);
7339
+ return it2(o4) && lt(e5, t4, o4), false === r5;
7340
+ }
7341
+ async function kt2(e5) {
7342
+ if (nt2(e5)) for (const t4 of at) {
7343
+ if (!ct(e5, t4)) continue;
7344
+ const n5 = wt2(e5, t4);
7345
+ yt(e5, t4, e5.on[t4] || []);
7346
+ for (const [o4, s5] of Object.entries(e5.sources)) Xe(s5) && await bt2(e5, s5, o4, t4, n5);
7347
+ }
7348
+ else st2();
7349
+ }
7350
+ async function It2(e5, t4, n5, o4) {
7351
+ if (!nt2(e5)) return st2(), true;
7336
7352
  e5.seenEvents.add(String(t4));
7337
- let r6 = n5 || [];
7338
- n5 || (r6 = e5.on[t4] || []);
7339
- const s4 = yt(e5, t4, o4);
7353
+ let s5 = n5 || [];
7354
+ n5 || (s5 = e5.on[t4] || []);
7355
+ const r5 = wt2(e5, t4, o4);
7340
7356
  let a4 = false;
7341
7357
  for (const [n6, o5] of Object.entries(e5.sources)) {
7342
7358
  if (o5.config.require?.length) {
7343
7359
  const e6 = o5.config.require.indexOf(t4);
7344
7360
  -1 !== e6 && o5.config.require.splice(e6, 1);
7345
7361
  }
7346
- if (o5.on) if (Je2(o5)) {
7347
- await wt2(e5, o5, n6, t4, s4) && (a4 = true);
7348
- } else o5.queueOn = o5.queueOn || [], o5.queueOn.push({ type: t4, data: s4 });
7362
+ if (o5.on) if (Xe(o5)) {
7363
+ await bt2(e5, o5, n6, t4, r5) && (a4 = true);
7364
+ } else o5.queueOn = o5.queueOn || [], o5.queueOn.push({ type: t4, data: r5 });
7349
7365
  }
7350
7366
  Object.entries(e5.destinations).forEach(([n6, o5]) => {
7351
7367
  if (o5.on) {
7352
- if (!o5.config.init) return o5.queueOn = o5.queueOn || [], void o5.queueOn.push({ type: t4, data: s4 });
7353
- ht2(e5, o5, n6, t4, s4);
7368
+ if (!o5.config.init) return o5.queueOn = o5.queueOn || [], void o5.queueOn.push({ type: t4, data: r5 });
7369
+ vt(e5, o5, n6, t4, r5);
7354
7370
  }
7355
7371
  });
7356
- for (const [t5, n6] of Object.entries(e5.sources)) Je2(n6) && n6.queueOn?.length && await Ye2(e5, n6, t5);
7357
- const i5 = Object.values(e5.sources).some((e6) => !Je2(e6) && e6.config.require?.length);
7358
- return (Object.keys(e5.pending.destinations).length > 0 || i5) && await et2(e5), vt(e5, t4, r6, o4), !a4;
7372
+ for (const [t5, n6] of Object.entries(e5.sources)) Xe(n6) && n6.queueOn?.length && await Je2(e5, n6, t5);
7373
+ const i5 = Object.values(e5.sources).some((e6) => !Xe(e6) && e6.config.require?.length);
7374
+ return (Object.keys(e5.pending.destinations).length > 0 || i5) && await tt2(e5), yt(e5, t4, s5, o4), !a4;
7359
7375
  }
7360
- function It2(e5) {
7376
+ function Ct2(e5) {
7361
7377
  return "number" == typeof e5 && e5 > 0 ? e5 : 1e4;
7362
7378
  }
7363
- var Ct2 = class extends Error {
7379
+ var Et2 = class extends Error {
7364
7380
  constructor(e5) {
7365
7381
  super(e5), this.name = "DestinationTimeoutError";
7366
7382
  }
7367
7383
  };
7368
- function Et2(e5, t4, n5) {
7384
+ function St(e5, t4, n5) {
7369
7385
  let o4;
7370
- const r6 = new Promise((e6, r7) => {
7371
- o4 = setTimeout(() => r7(new Ct2(n5)), t4);
7386
+ const s5 = new Promise((e6, s6) => {
7387
+ o4 = setTimeout(() => s6(new Et2(n5)), t4);
7372
7388
  });
7373
- return Promise.race([e5, r6]).finally(() => {
7389
+ return Promise.race([e5, s5]).finally(() => {
7374
7390
  o4 && clearTimeout(o4);
7375
7391
  });
7376
7392
  }
7377
- var St = Object.freeze({ batched: true });
7378
- function qt(e5) {
7379
- return e5 === St;
7380
- }
7393
+ var qt = Object.freeze({ batched: true });
7381
7394
  function xt2(e5) {
7395
+ return e5 === qt;
7396
+ }
7397
+ function Ot2(e5) {
7382
7398
  return void 0 === e5 ? {} : "number" == typeof e5 ? { wait: e5 } : { wait: e5.wait, size: e5.size, age: e5.age };
7383
7399
  }
7384
- function Ot2(e5, t4, n5) {
7400
+ function jt2(e5, t4, n5) {
7385
7401
  if (!e5) return [];
7386
- if (Array.isArray(e5) && e5.every((e6) => "string" == typeof e6)) return He2(e5, t4);
7387
- if ("string" == typeof e5) return He2(e5, t4);
7402
+ if (Array.isArray(e5) && e5.every((e6) => "string" == typeof e6)) return Ge2(e5, t4);
7403
+ if ("string" == typeof e5) return Ge2(e5, t4);
7388
7404
  const o4 = er(e5, gr(n5));
7389
- return 0 === o4.length ? [] : 1 === o4.length ? He2(o4[0], t4) : He2(o4, t4);
7405
+ return 0 === o4.length ? [] : 1 === o4.length ? Ge2(o4[0], t4) : Ge2(o4, t4);
7390
7406
  }
7391
- async function jt2(e5, t4) {
7392
- const { code: n5, config: o4 = {}, env: r6 = {}, before: s4, next: a4, cache: i5, state: c2 } = t4;
7393
- if (!ge(n5.push)) return Mt2({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
7407
+ async function $t2(e5, t4) {
7408
+ const { code: n5, config: o4 = {}, env: s5 = {}, before: r5, next: a4, cache: i5, state: c2 } = t4;
7409
+ if (!ge(n5.push)) return Tt2({ ok: false, failed: { invalid: { type: "invalid", error: "Destination code must have a push method" } } });
7394
7410
  const u3 = o4 || { init: false };
7395
- let d2 = s4 ? { ...u3, before: s4 } : { ...u3 };
7411
+ let d2 = r5 ? { ...u3, before: r5 } : { ...u3 };
7396
7412
  a4 && (d2 = { ...d2, next: a4 }), i5 && (d2 = { ...d2, cache: i5 }), void 0 !== c2 && void 0 === d2.state && (d2 = { ...d2, state: c2 });
7397
7413
  let l3 = d2.id;
7398
7414
  if (!l3) do {
7399
7415
  l3 = Me(5, "abcdefghijklmnopqrstuvwxyz");
7400
7416
  } while (e5.destinations[l3] || e5.pending.destinations[l3]);
7401
7417
  if (d2.require?.length) {
7402
- e5.pending.destinations[l3] = t4, await et2(e5);
7418
+ e5.pending.destinations[l3] = t4, await tt2(e5);
7403
7419
  const n6 = e5.destinations[l3];
7404
- return n6 ? $t2(e5, void 0, {}, { [l3]: n6 }) : Mt2({ ok: true });
7420
+ return n6 ? At2(e5, void 0, {}, { [l3]: n6 }) : Tt2({ ok: true });
7405
7421
  }
7406
- const f2 = { ...n5, config: d2, env: Pt(n5.env, r6) };
7407
- return e5.destinations[l3] = f2, false !== f2.config.queue && (f2.queuePush = [...e5.queue]), $t2(e5, void 0, {}, { [l3]: f2 });
7422
+ const f2 = { ...n5, config: d2, env: Rt2(n5.env, s5) };
7423
+ return e5.destinations[l3] = f2, false !== f2.config.queue && (f2.queuePush = [...e5.queue]), At2(e5, void 0, {}, { [l3]: f2 });
7408
7424
  }
7409
- async function $t2(e5, t4, n5 = {}, o4) {
7410
- const { allowed: r6, consent: s4, user: a4 } = e5;
7411
- if (!r6) return Mt2({ ok: false });
7425
+ async function At2(e5, t4, n5 = {}, o4) {
7426
+ const { allowed: s5, consent: r5, user: a4 } = e5;
7427
+ if (!s5) return Tt2({ ok: false });
7412
7428
  if (t4) {
7413
7429
  const n6 = e5.config.queueMax;
7414
7430
  if (void 0 === n6) throw new Error("Collector.Config.queueMax is undefined; defaults must be seeded by collector()");
@@ -7420,16 +7436,16 @@ async function $t2(e5, t4, n5 = {}, o4) {
7420
7436
  e5.status.in++;
7421
7437
  }
7422
7438
  o4 || (o4 = e5.destinations);
7423
- const i5 = e5.transformers ? Be(e5.transformers) : {}, c2 = await Promise.all(Object.entries(o4 || {}).map(async ([o5, r7]) => {
7424
- if (r7.config.disabled) return { id: o5, destination: r7, skipped: true };
7425
- const c3 = r7.config.id || o5, u4 = o("destination", c3), d3 = te2(r7.config.breaker);
7439
+ const i5 = e5.transformers ? Fe(e5.transformers) : {}, c2 = await Promise.all(Object.entries(o4 || {}).map(async ([o5, s6]) => {
7440
+ if (s6.config.disabled) return { id: o5, destination: s6, skipped: true };
7441
+ const c3 = s6.config.id || o5, u4 = o("destination", c3), d3 = te2(s6.config.breaker);
7426
7442
  if (d3 && (function(e6, t5, n6) {
7427
7443
  const o6 = e6[t5];
7428
7444
  if (!o6 || "closed" === o6.state) return false;
7429
7445
  if ("half-open" === o6.state) return true === o6.probing;
7430
- const r8 = ee2();
7431
- return void 0 !== o6.openUntil && r8 < o6.openUntil || (o6.state = "half-open", o6.probing = true, o6.openUntil = r8 + n6, false);
7432
- })(e5.status.breakers, u4, d3.cooldown)) return { id: o5, destination: r7, skipped: true };
7446
+ const s7 = ee2();
7447
+ return void 0 !== o6.openUntil && s7 < o6.openUntil || (o6.state = "half-open", o6.probing = true, o6.openUntil = s7 + n6, false);
7448
+ })(e5.status.breakers, u4, d3.cooldown)) return { id: o5, destination: s6, skipped: true };
7433
7449
  const y4 = (t5) => {
7434
7450
  d3 && ne2(e5.status.breakers, u4, t5, d3.threshold, d3.cooldown);
7435
7451
  }, b3 = () => {
@@ -7438,200 +7454,200 @@ async function $t2(e5, t4, n5 = {}, o4) {
7438
7454
  n6 && "half-open" === n6.state && true === n6.probing && (n6.state = "open", n6.probing = false);
7439
7455
  })(e5.status.breakers, u4);
7440
7456
  };
7441
- let I2 = (r7.queuePush || []).map((e6) => ({ ...e6, consent: s4 }));
7442
- r7.queuePush = [], t4 && I2.push(we(t4));
7457
+ let I2 = (s6.queuePush || []).map((e6) => ({ ...e6, consent: r5 }));
7458
+ s6.queuePush = [], t4 && I2.push(we(t4));
7443
7459
  const C3 = n5.ingest ? { ...n5.ingest, _meta: { ...n5.ingest._meta, path: [...n5.ingest._meta.path] } } : O("unknown");
7444
- if (!I2.length && !r7.queueOn?.length) return b3(), { id: o5, destination: r7, skipped: true };
7445
- if (!I2.length && r7.queueOn?.length) {
7446
- if (!Ee(r7.config.consent, s4)) return b3(), { id: o5, destination: r7, skipped: true };
7460
+ if (!I2.length && !s6.queueOn?.length) return b3(), { id: o5, destination: s6, skipped: true };
7461
+ if (!I2.length && s6.queueOn?.length) {
7462
+ if (!Ee(s6.config.consent, r5)) return b3(), { id: o5, destination: s6, skipped: true };
7447
7463
  let t5 = false;
7448
7464
  try {
7449
- t5 = await At2(e5, r7, o5, true);
7465
+ t5 = await Dt(e5, s6, o5, true);
7450
7466
  } catch (t6) {
7451
7467
  e5.status.failed++;
7452
- const n6 = r7.type || "unknown";
7468
+ const n6 = s6.type || "unknown";
7453
7469
  e5.logger.scope(n6).error("destination init failed", { error: t6 instanceof Error ? t6.message : String(t6) }), y4("transport-failure");
7454
7470
  }
7455
- return b3(), { id: o5, destination: r7, skipped: !t5 };
7471
+ return b3(), { id: o5, destination: s6, skipped: !t5 };
7456
7472
  }
7457
7473
  const E2 = [], S2 = I2.filter((t5) => {
7458
- const n6 = Ee(r7.config.consent, s4, t5.consent);
7474
+ const n6 = Ee(s6.config.consent, r5, t5.consent);
7459
7475
  if (n6) return t5.consent = n6, E2.push(t5), false;
7460
7476
  const a5 = _(e5, { stepId: o("destination", o5), stepType: "destination", phase: "skip", eventId: "string" == typeof t5.id ? t5.id : "", now: Date.now(), ...T2(t5, C3, e5) });
7461
- return a5.skipReason = "consent", s4 && (a5.consent = { ...s4 }), r7.config.consent && (a5.meta = { required: { ...r7.config.consent } }), dn(e5, a5), true;
7477
+ return a5.skipReason = "consent", r5 && (a5.consent = { ...r5 }), s6.config.consent && (a5.meta = { required: { ...s6.config.consent } }), dn(e5, a5), true;
7462
7478
  });
7463
7479
  if (S2.length > 0) {
7464
- const t5 = r7.queuePush, n6 = r7.config.id || o5, s5 = { max: r7.config.queueMax ?? 1e3 };
7480
+ const t5 = s6.queuePush, n6 = s6.config.id || o5, r6 = { max: s6.config.queueMax ?? 1e3 };
7465
7481
  let a5 = 0;
7466
7482
  for (const e6 of S2) {
7467
- a5 += V(t5, e6, s5).dropped;
7483
+ a5 += V(t5, e6, r6).dropped;
7468
7484
  }
7469
7485
  if (a5 > 0) {
7470
- se2(e5, n6);
7486
+ re2(e5, n6);
7471
7487
  const o6 = ae2(e5.status, o("destination", n6), "queue", a5);
7472
- Y(t5, e5.logger.scope(r7.type || "unknown"), "destination.queuePush overflow; oldest events dropped", { buffer: "queuePush", destination: n6, cap: s5.max, droppedCount: o6 });
7473
- } else t5.length < s5.max && J(t5);
7488
+ Y(t5, e5.logger.scope(s6.type || "unknown"), "destination.queuePush overflow; oldest events dropped", { buffer: "queuePush", destination: n6, cap: r6.max, droppedCount: o6 });
7489
+ } else t5.length < r6.max && J(t5);
7474
7490
  }
7475
- if (!E2.length) return b3(), { id: o5, destination: r7, queue: I2 };
7491
+ if (!E2.length) return b3(), { id: o5, destination: s6, queue: I2 };
7476
7492
  let q3, x2, $2 = false;
7477
7493
  try {
7478
- $2 = await At2(e5, r7, o5, true);
7494
+ $2 = await Dt(e5, s6, o5, true);
7479
7495
  } catch (t5) {
7480
7496
  e5.status.failed++;
7481
- const n6 = r7.type || "unknown";
7497
+ const n6 = s6.type || "unknown";
7482
7498
  e5.logger.scope(n6).error("destination init failed", { error: t5 instanceof Error ? t5.message : String(t5) }), y4("transport-failure");
7483
7499
  }
7484
- if (!$2) return b3(), { id: o5, destination: r7, queue: I2 };
7485
- r7.dlq || (r7.dlq = []);
7486
- const M2 = Ot2(r7.config.before, i5, C3), P3 = r7.config.next, R4 = r7.config?.cache, z5 = R4 ? hr(R4) : void 0, U4 = z5 ? Ue2(z5, e5) : void 0, K4 = r7.config?.state ? wr(r7.config.state) : void 0, B4 = K4?.filter((e6) => "get" === e6.mode), F4 = K4?.filter((e6) => "set" === e6.mode);
7500
+ if (!$2) return b3(), { id: o5, destination: s6, queue: I2 };
7501
+ s6.dlq || (s6.dlq = []);
7502
+ const M2 = jt2(s6.config.before, i5, C3), P3 = s6.config.next, R4 = s6.config?.cache, z5 = R4 ? hr(R4) : void 0, U4 = z5 ? Ke2(z5, e5) : void 0, K4 = s6.config?.state ? wr(s6.config.state) : void 0, B4 = K4?.filter((e6) => "get" === e6.mode), F4 = K4?.filter((e6) => "set" === e6.mode);
7487
7503
  let H3 = 0, G2 = 0, W3 = 0;
7488
7504
  return await Promise.all(E2.map(async (t5) => {
7489
- let s5, c4;
7505
+ let r6, c4;
7490
7506
  if (t5.user = ce(a4, t5.user), z5?.stop && U4) {
7491
7507
  const e6 = gr(C3, t5), n6 = await vr(z5, U4, e6);
7492
7508
  if ("HIT" === n6?.status) return t5;
7493
- "MISS" === n6?.status && (s5 = { key: n6.key, ttl: n6.rule.ttl });
7509
+ "MISS" === n6?.status && (r6 = { key: n6.key, ttl: n6.rule.ttl });
7494
7510
  }
7495
7511
  let u5 = [t5], d4 = n5.respond;
7496
7512
  if (M2.length > 0 && e5.transformers && Object.keys(e5.transformers).length > 0) {
7497
- const r8 = await Qe2(e5, e5.transformers, M2, t5, C3, n5.respond, `destination.${o5}.before`);
7498
- if (null === r8.event) return t5;
7499
- r8.respond && (d4 = r8.respond), u5 = Array.isArray(r8.event) ? r8.event : [r8.event];
7513
+ const s7 = await Ve2(e5, e5.transformers, M2, t5, C3, n5.respond, `destination.${o5}.before`);
7514
+ if (null === s7.event) return t5;
7515
+ s7.respond && (d4 = s7.respond), u5 = Array.isArray(s7.event) ? s7.event : [s7.event];
7500
7516
  }
7501
7517
  const p3 = async (t6, n6) => {
7502
- let s6 = n6, a5 = false;
7518
+ let r7 = n6, a5 = false;
7503
7519
  if (z5 && !z5.stop && U4) {
7504
7520
  const e6 = gr(C3, t6), n7 = await vr(z5, U4, e6);
7505
7521
  if ("HIT" === n7?.status) return false;
7506
- "MISS" === n7?.status && (s6 = { key: n7.key, ttl: n7.rule.ttl }, a5 = true);
7522
+ "MISS" === n7?.status && (r7 = { key: n7.key, ttl: n7.rule.ttl }, a5 = true);
7507
7523
  }
7508
- B4 && B4.length > 0 && t6 && (t6 = await kr(B4, (t7) => Ke2(t7, e5), t6, e5));
7524
+ B4 && B4.length > 0 && t6 && (t6 = await kr(B4, (t7) => Be(t7, e5), t6, e5));
7509
7525
  const u6 = Date.now();
7510
7526
  let l3 = false;
7511
- const p4 = await tt(Dt, (n7) => {
7512
- const s7 = r7.type || "unknown";
7513
- e5.logger.scope(s7).error("Push failed", { error: n7, event: t6.name }), q3 = n7, l3 = true;
7514
- const a6 = r7.dlq, i6 = r7.config.id || o5, c5 = { max: r7.config.dlqMax ?? re2 }, u7 = V(a6, [t6, n7], c5);
7527
+ const p4 = await tt(Mt2, (n7) => {
7528
+ const r8 = s6.type || "unknown";
7529
+ e5.logger.scope(r8).error("Push failed", { ...ie2(n7), event: t6.name }), q3 = n7, l3 = true;
7530
+ const a6 = s6.dlq, i6 = s6.config.id || o5, c5 = { max: s6.config.dlqMax ?? se2 }, u7 = V(a6, [t6, n7], c5);
7515
7531
  if (u7.dropped > 0) {
7516
- se2(e5, i6);
7532
+ re2(e5, i6);
7517
7533
  const t7 = ae2(e5.status, o("destination", i6), "dlq", u7.dropped);
7518
- Y(a6, e5.logger.scope(r7.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: i6, cap: c5.max, droppedCount: t7 });
7534
+ Y(a6, e5.logger.scope(s6.type || "unknown"), "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: i6, cap: c5.max, droppedCount: t7 });
7519
7535
  } else a6.length < c5.max && J(a6);
7520
- })(e5, r7, o5, t6, C3, d4);
7521
- if (H3 += Date.now() - u6, s6 && U4 && void 0 === r7.config.mock && (a5 ? yr(U4, s6.key, p4 ?? true, s6.ttl) : void 0 === c4 && (c4 = p4 ?? true)), !l3 && !qt(p4) && F4 && F4.length > 0 && t6 && (t6 = await kr(F4, (t7) => Ke2(t7, e5), t6, e5)), void 0 === p4 || qt(p4) || (x2 = p4), qt(p4) && G2++, !l3 && P3) {
7536
+ })(e5, s6, o5, t6, C3, d4);
7537
+ if (H3 += Date.now() - u6, r7 && U4 && void 0 === s6.config.mock && (a5 ? yr(U4, r7.key, p4 ?? true, r7.ttl) : void 0 === c4 && (c4 = p4 ?? true)), !l3 && !xt2(p4) && F4 && F4.length > 0 && t6 && (t6 = await kr(F4, (t7) => Be(t7, e5), t6, e5)), void 0 === p4 || xt2(p4) || (x2 = p4), xt2(p4) && G2++, !l3 && P3) {
7522
7538
  void 0 !== p4 && (C3._response = p4);
7523
- const n7 = Ot2(P3, i5, C3);
7539
+ const n7 = jt2(P3, i5, C3);
7524
7540
  if (n7.length > 0 && e5.transformers && Object.keys(e5.transformers).length > 0) {
7525
- const r8 = await Qe2(e5, e5.transformers, n7, t6, C3, d4, `destination.${o5}.next`);
7526
- r8.respond && (d4 = r8.respond);
7541
+ const s7 = await Ve2(e5, e5.transformers, n7, t6, C3, d4, `destination.${o5}.next`);
7542
+ s7.respond && (d4 = s7.respond);
7527
7543
  }
7528
7544
  }
7529
7545
  return true;
7530
7546
  };
7531
- for (const e6 of u5) await p3(e6, s5) && W3++;
7532
- return s5 && U4 && void 0 !== c4 && void 0 === r7.config.mock && yr(U4, s5.key, c4, s5.ttl), t5;
7533
- })), { id: o5, destination: r7, error: q3, response: x2, totalDuration: H3, batchedCount: G2, allowedCount: E2.length, pushedCount: W3, canonicalId: c3, breakerConfig: d3 };
7547
+ for (const e6 of u5) await p3(e6, r6) && W3++;
7548
+ return r6 && U4 && void 0 !== c4 && void 0 === s6.config.mock && yr(U4, r6.key, c4, r6.ttl), t5;
7549
+ })), { id: o5, destination: s6, error: q3, response: x2, totalDuration: H3, batchedCount: G2, allowedCount: E2.length, pushedCount: W3, canonicalId: c3, breakerConfig: d3 };
7534
7550
  })), u3 = {}, d2 = {}, y3 = {};
7535
7551
  for (const t5 of c2) {
7536
7552
  if (t5.skipped) continue;
7537
7553
  const n6 = t5.destination, o5 = { type: n6.type || "unknown", data: t5.response };
7538
- se2(e5, t5.id);
7539
- const r7 = e5.status.destinations[t5.id], s5 = Date.now();
7540
- r7.queuePushSize = n6.queuePush?.length ?? 0, r7.dlqSize = n6.dlq?.length ?? 0;
7554
+ re2(e5, t5.id);
7555
+ const s6 = e5.status.destinations[t5.id], r6 = Date.now();
7556
+ s6.queuePushSize = n6.queuePush?.length ?? 0, s6.dlqSize = n6.dlq?.length ?? 0;
7541
7557
  const a5 = t5.breakerConfig, i6 = t5.canonicalId ? o("destination", t5.canonicalId) : void 0, c3 = (t6) => {
7542
7558
  a5 && i6 && ne2(e5.status.breakers, i6, t6, a5.threshold, a5.cooldown);
7543
7559
  };
7544
- if (t5.error) o5.error = t5.error, y3[t5.id] = o5, r7.failed++, r7.lastAt = s5, r7.duration += t5.totalDuration || 0, e5.status.failed++, c3("transport-failure");
7560
+ if (t5.error) o5.error = t5.error, y3[t5.id] = o5, s6.failed++, s6.lastAt = r6, s6.duration += t5.totalDuration || 0, e5.status.failed++, c3("transport-failure");
7545
7561
  else if (t5.queue && t5.queue.length) d2[t5.id] = o5;
7546
7562
  else {
7547
7563
  const n7 = t5.batchedCount ?? 0, a6 = t5.allowedCount ?? 0, i7 = t5.pushedCount ?? a6;
7548
- (Math.max(0, i7 - n7) > 0 || 0 === a6) && (u3[t5.id] = o5, r7.count++, r7.lastAt = s5, r7.duration += t5.totalDuration || 0, e5.status.out++, c3("success"));
7564
+ (Math.max(0, i7 - n7) > 0 || 0 === a6) && (u3[t5.id] = o5, s6.count++, s6.lastAt = r6, s6.duration += t5.totalDuration || 0, e5.status.out++, c3("success"));
7549
7565
  }
7550
7566
  }
7551
- return Mt2({ event: t4, ...Object.keys(u3).length && { done: u3 }, ...Object.keys(d2).length && { queued: d2 }, ...Object.keys(y3).length && { failed: y3 } });
7567
+ return Tt2({ event: t4, ...Object.keys(u3).length && { done: u3 }, ...Object.keys(d2).length && { queued: d2 }, ...Object.keys(y3).length && { failed: y3 } });
7552
7568
  }
7553
- async function At2(e5, t4, n5, o4 = false) {
7569
+ async function Dt(e5, t4, n5, o4 = false) {
7554
7570
  if (t4.init && !t4.config.init) {
7555
7571
  if (!o4 && (function(e6) {
7556
7572
  const t5 = e6.config.consent;
7557
7573
  return !!t5 && Object.keys(t5).length > 0;
7558
7574
  })(t4)) return e5.logger.scope(t4.type || "unknown").debug("init blocked: consent gate not cleared"), false;
7559
- const r6 = t4.type || "unknown", s4 = e5.logger.scope(r6), a4 = { collector: e5, logger: s4, id: n5, config: t4.config, env: Pt(t4.env, t4.config.env), reportError: ie2(e5, "destination", n5, s4, t4) };
7560
- s4.debug("init");
7575
+ const s5 = t4.type || "unknown", r5 = e5.logger.scope(s5), a4 = { collector: e5, logger: r5, id: n5, config: t4.config, env: Rt2(t4.env, t4.config.env), reportError: ce2(e5, "destination", n5, r5, t4) };
7576
+ r5.debug("init");
7561
7577
  const i5 = Date.now();
7562
7578
  let c2;
7563
7579
  dn(e5, _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "init", eventId: "", now: i5 }));
7564
7580
  try {
7565
7581
  c2 = await wt(t4.init, "DestinationInit", e5.hooks, e5.logger)(a4);
7566
7582
  } catch (t5) {
7567
- const o5 = Date.now(), r7 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o5 });
7568
- throw r7.durationMs = o5 - i5, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, dn(e5, r7), t5;
7583
+ const o5 = Date.now(), s6 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: "", now: o5 });
7584
+ throw s6.durationMs = o5 - i5, s6.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, dn(e5, s6), t5;
7569
7585
  }
7570
7586
  if (false === c2) return c2;
7571
7587
  if (t4.config = { ...c2 || t4.config, init: true }, t4.queueOn?.length) {
7572
7588
  const o5 = t4.queueOn;
7573
7589
  t4.queueOn = [];
7574
- for (const { type: r7, data: s5 } of o5) ht2(e5, t4, n5, r7, s5);
7590
+ for (const { type: s6, data: r6 } of o5) vt(e5, t4, n5, s6, r6);
7575
7591
  }
7576
- s4.debug("init done");
7592
+ r5.debug("init done");
7577
7593
  }
7578
7594
  return true;
7579
7595
  }
7580
- async function Dt(e5, t4, n5, o4, r6, s4) {
7596
+ async function Mt2(e5, t4, n5, o4, s5, r5) {
7581
7597
  const { config: a4 } = t4, i5 = await it(o4, a4, e5);
7582
7598
  if (i5.ignore) return false;
7583
- const c2 = t4.type || "unknown", u3 = e5.logger.scope(c2), d2 = { collector: e5, logger: u3, id: n5, config: a4, data: i5.data, rule: i5.mapping, ingest: r6, env: { ...Pt(t4.env, a4.env), ...s4 ? { respond: s4 } : {} }, reportError: ie2(e5, "destination", n5, u3, t4) };
7599
+ const c2 = t4.type || "unknown", u3 = e5.logger.scope(c2), d2 = { collector: e5, logger: u3, id: n5, config: a4, data: i5.data, rule: i5.mapping, ingest: s5, env: { ...Rt2(t4.env, a4.env), ...r5 ? { respond: r5 } : {} }, reportError: ce2(e5, "destination", n5, u3, t4) };
7584
7600
  if (void 0 !== a4.mock) return u3.debug("mock", { event: i5.event.name }), a4.mock;
7585
7601
  const l3 = i5.mapping, f2 = void 0 !== l3?.batch, p3 = f2 ? i5.mappingKey || "* *" : " batch-all";
7586
7602
  if ((f2 || void 0 !== a4.batch) && t4.pushBatch && void 0 === a4.mock) {
7587
7603
  if (t4.batches = t4.batches || {}, !t4.batches[p3]) {
7588
- const o5 = { key: p3, entries: [], events: [], data: [] }, r7 = xt2(l3?.batch), s5 = xt2(a4.batch), i6 = r7.wait ?? s5.wait ?? 3e4, c4 = r7.size ?? s5.size ?? 1e3, d4 = r7.age ?? s5.age ?? 3e4, g4 = Pt(t4.env, a4.env), m4 = We(async () => {
7589
- const o6 = t4.batches[p3], r8 = o6.batched;
7590
- if (0 === r8.entries.length) return;
7591
- const s6 = { key: r8.key, entries: r8.entries, events: r8.events, data: r8.data };
7592
- r8.entries = [], r8.events = [], r8.data = [];
7593
- const i7 = s6.entries[0], c5 = { collector: e5, logger: u3, id: n5, config: a4, data: void 0, rule: o6.isDefault ? void 0 : i7.rule, ingest: i7.ingest, env: { ...g4, ...i7.respond ? { respond: i7.respond } : {} }, reportError: ie2(e5, "destination", n5, u3, t4) };
7594
- u3.debug("push batch", { events: s6.entries.length });
7595
- const d5 = t4.config.id || n5, l4 = se2(e5, d5), f3 = te2(t4.config.breaker), m5 = o("destination", d5), h3 = (t5) => {
7604
+ const o5 = { key: p3, entries: [], events: [], data: [] }, s6 = Ot2(l3?.batch), r6 = Ot2(a4.batch), i6 = s6.wait ?? r6.wait ?? 3e4, c4 = s6.size ?? r6.size ?? 1e3, d4 = s6.age ?? r6.age ?? 3e4, g4 = Rt2(t4.env, a4.env), m4 = We(async () => {
7605
+ const o6 = t4.batches[p3], s7 = o6.batched;
7606
+ if (0 === s7.entries.length) return;
7607
+ const r7 = { key: s7.key, entries: s7.entries, events: s7.events, data: s7.data };
7608
+ s7.entries = [], s7.events = [], s7.data = [];
7609
+ const i7 = r7.entries[0], c5 = { collector: e5, logger: u3, id: n5, config: a4, data: void 0, rule: o6.isDefault ? void 0 : i7.rule, ingest: i7.ingest, env: { ...g4, ...i7.respond ? { respond: i7.respond } : {} }, reportError: ce2(e5, "destination", n5, u3, t4) };
7610
+ u3.debug("push batch", { events: r7.entries.length });
7611
+ const d5 = t4.config.id || n5, l4 = re2(e5, d5), f3 = te2(t4.config.breaker), m5 = o("destination", d5), h3 = (t5) => {
7596
7612
  f3 && ne2(e5.status.breakers, m5, t5, f3.threshold, f3.cooldown);
7597
7613
  }, v4 = Date.now(), y3 = /* @__PURE__ */ new Map();
7598
7614
  let b4, k4 = false;
7599
7615
  const I2 = (n6) => {
7600
- const o7 = t4.dlq = t4.dlq || [], r9 = { max: t4.config.dlqMax ?? re2 };
7601
- let s7 = 0;
7616
+ const o7 = t4.dlq = t4.dlq || [], s8 = { max: t4.config.dlqMax ?? se2 };
7617
+ let r8 = 0;
7602
7618
  for (const e6 of n6) {
7603
- s7 += V(o7, e6, r9).dropped;
7619
+ r8 += V(o7, e6, s8).dropped;
7604
7620
  }
7605
- if (s7 > 0) {
7606
- const t5 = ae2(e5.status, o("destination", d5), "dlq", s7);
7607
- Y(o7, u3, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: d5, cap: r9.max, droppedCount: t5 });
7608
- } else o7.length < r9.max && J(o7);
7621
+ if (r8 > 0) {
7622
+ const t5 = ae2(e5.status, o("destination", d5), "dlq", r8);
7623
+ Y(o7, u3, "destination.dlq overflow; oldest entries dropped", { buffer: "dlq", destination: d5, cap: s8.max, droppedCount: t5 });
7624
+ } else o7.length < s8.max && J(o7);
7609
7625
  l4.failed += n6.length, l4.dlqSize = o7.length, e5.status.failed += n6.length;
7610
7626
  };
7611
- let C3 = s6.entries.length;
7612
- const E2 = It2(a4.timeout), q3 = await tt((o7, r9) => Et2(Promise.resolve(wt(t4.pushBatch, "DestinationPushBatch", e5.hooks, e5.logger)(o7, r9)), E2, `Destination "${n5}" batch delivery timed out after ${E2}ms`), (e6) => {
7613
- C3 = 0, k4 = true, b4 = e6, I2(s6.entries.map((t5) => [t5.event, e6])), h3("transport-failure"), u3.error("Push batch failed", { error: e6 instanceof Error ? e6.message : String(e6), entries: s6.entries.length });
7614
- })(s6, c5);
7627
+ let C3 = r7.entries.length;
7628
+ const E2 = Ct2(a4.timeout), q3 = await tt((o7, s8) => St(Promise.resolve(wt(t4.pushBatch, "DestinationPushBatch", e5.hooks, e5.logger)(o7, s8)), E2, `Destination "${n5}" batch delivery timed out after ${E2}ms`), (e6) => {
7629
+ C3 = 0, k4 = true, b4 = e6, I2(r7.entries.map((t5) => [t5.event, e6])), h3("transport-failure"), u3.error("Push batch failed", { error: e6 instanceof Error ? e6.message : String(e6), entries: r7.entries.length });
7630
+ })(r7, c5);
7615
7631
  if (ve(x2 = q3) && Array.isArray(x2.failed) && q3.failed.length > 0) {
7616
7632
  const e6 = [];
7617
7633
  for (const t5 of q3.failed) {
7618
- const n6 = s6.entries[t5.index];
7634
+ const n6 = r7.entries[t5.index];
7619
7635
  if (!n6 || y3.has(t5.index)) continue;
7620
7636
  const o7 = t5.error ?? new Error(`Push batch entry ${t5.index} failed (no per-row error provided)`);
7621
7637
  y3.set(t5.index, o7), e6.push([n6.event, o7]);
7622
7638
  }
7623
- e6.length > 0 && (I2(e6), C3 = Math.max(0, s6.entries.length - e6.length), u3.error("Push batch partial failure", { failed: e6.length, delivered: C3, entries: s6.entries.length }));
7639
+ e6.length > 0 && (I2(e6), C3 = Math.max(0, r7.entries.length - e6.length), u3.error("Push batch partial failure", { failed: e6.length, delivered: C3, entries: r7.entries.length }));
7624
7640
  }
7625
7641
  var x2;
7626
7642
  const A2 = Date.now();
7627
- s6.entries.forEach((t5, o7) => {
7628
- const r9 = k4 || y3.has(o7), a5 = T2(t5.event, t5.ingest, e5), i8 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: r9 ? "error" : "flush", eventId: "string" == typeof t5.event.id ? t5.event.id : "", now: A2, traceId: a5.traceId, sourceId: a5.sourceId, parentEventId: a5.parentEventId });
7629
- if (i8.batch = { size: s6.entries.length, index: o7 }, i8.durationMs = A2 - v4, r9) {
7643
+ r7.entries.forEach((t5, o7) => {
7644
+ const s8 = k4 || y3.has(o7), a5 = T2(t5.event, t5.ingest, e5), i8 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: s8 ? "error" : "flush", eventId: "string" == typeof t5.event.id ? t5.event.id : "", now: A2, traceId: a5.traceId, sourceId: a5.sourceId, parentEventId: a5.parentEventId });
7645
+ if (i8.batch = { size: r7.entries.length, index: o7 }, i8.durationMs = A2 - v4, s8) {
7630
7646
  const e6 = k4 ? b4 : y3.get(o7);
7631
7647
  i8.error = e6 instanceof Error ? { name: e6.name, message: e6.message } : { message: String(e6) };
7632
7648
  }
7633
7649
  dn(e5, i8);
7634
- }), u3.debug("push batch done"), l4.inFlightBatch = Math.max(0, (l4.inFlightBatch ?? 0) - s6.entries.length), C3 > 0 && (l4.count += C3, l4.lastAt = Date.now(), e5.status.out += C3, h3("success"));
7650
+ }), u3.debug("push batch done"), l4.inFlightBatch = Math.max(0, (l4.inFlightBatch ?? 0) - r7.entries.length), C3 > 0 && (l4.count += C3, l4.lastAt = Date.now(), e5.status.out += C3, h3("success"));
7635
7651
  }, { wait: i6, size: c4, age: d4 });
7636
7652
  t4.batches[p3] = { batched: o5, isDefault: !f2, batchFn: () => {
7637
7653
  m4();
@@ -7640,81 +7656,81 @@ async function Dt(e5, t4, n5, o4, r6, s4) {
7640
7656
  } };
7641
7657
  }
7642
7658
  const c3 = t4.batches[p3];
7643
- c3.batched.entries.push({ event: i5.event, ingest: r6, respond: s4, rule: l3, data: i5.data }), c3.batched.events.push(i5.event), de(i5.data) && c3.batched.data.push(i5.data);
7644
- const d3 = "string" == typeof i5.event.id ? i5.event.id : "", g3 = T2(o4, r6, e5), m3 = Date.now(), h2 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: d3, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
7659
+ c3.batched.entries.push({ event: i5.event, ingest: s5, respond: r5, rule: l3, data: i5.data }), c3.batched.events.push(i5.event), de(i5.data) && c3.batched.data.push(i5.data);
7660
+ const d3 = "string" == typeof i5.event.id ? i5.event.id : "", g3 = T2(o4, s5, e5), m3 = Date.now(), h2 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: d3, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
7645
7661
  i5.mappingKey && (h2.mappingKey = i5.mappingKey), i5.event.consent && (h2.consent = { ...i5.event.consent }), h2.inEvent = i5.event, dn(e5, h2);
7646
7662
  const v3 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: d3, now: m3, traceId: g3.traceId, sourceId: g3.sourceId, parentEventId: g3.parentEventId });
7647
7663
  i5.mappingKey && (v3.mappingKey = i5.mappingKey), v3.outEvent = i5.event, v3.batch = { size: c3.batched.entries.length, index: c3.batched.entries.length - 1 }, dn(e5, v3);
7648
- const b3 = t4.config.id || n5, k3 = se2(e5, b3);
7649
- return k3.inFlightBatch = (k3.inFlightBatch ?? 0) + 1, c3.batchFn(), St;
7664
+ const b3 = t4.config.id || n5, k3 = re2(e5, b3);
7665
+ return k3.inFlightBatch = (k3.inFlightBatch ?? 0) + 1, c3.batchFn(), qt;
7650
7666
  }
7651
7667
  {
7652
- let s5;
7668
+ let r6;
7653
7669
  if (u3.debug("push", { event: i5.event.name }), "trace" === e5.observeLevel?.() && Array.isArray(t4.calls) && t4.calls.length > 0) {
7654
7670
  const e6 = U2({ ...d2.env, simulation: t4.calls });
7655
- d2.env = e6.wrappedEnv, s5 = e6.calls, e6.unresolved.length > 0 && (e6.wrappedEnv[On] = { paths: e6.unresolved, record: (t5, n6) => e6.calls.push({ fn: t5, args: n6, ts: Date.now() }) });
7671
+ d2.env = e6.wrappedEnv, r6 = e6.calls, e6.unresolved.length > 0 && (e6.wrappedEnv[On] = { paths: e6.unresolved, record: (t5, n6) => e6.calls.push({ fn: t5, args: n6, ts: Date.now() }) });
7656
7672
  }
7657
- const c3 = "string" == typeof i5.event.id ? i5.event.id : "", { traceId: l4, sourceId: f3, parentEventId: p4 } = T2(o4, r6, e5), g3 = Date.now(), m3 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: c3, now: g3, traceId: l4, sourceId: f3, parentEventId: p4 });
7673
+ const c3 = "string" == typeof i5.event.id ? i5.event.id : "", { traceId: l4, sourceId: f3, parentEventId: p4 } = T2(o4, s5, e5), g3 = Date.now(), m3 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "in", eventId: c3, now: g3, traceId: l4, sourceId: f3, parentEventId: p4 });
7658
7674
  i5.mappingKey && (m3.mappingKey = i5.mappingKey), i5.event.consent && (m3.consent = { ...i5.event.consent }), m3.inEvent = i5.event, dn(e5, m3);
7659
7675
  try {
7660
- const o5 = It2(a4.timeout), r7 = await Et2(Promise.resolve(wt(t4.push, "DestinationPush", e5.hooks, e5.logger)(i5.event, d2)), o5, `Destination "${n5}" delivery timed out after ${o5}ms`), m4 = Date.now(), h2 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: c3, now: m4, traceId: l4, sourceId: f3, parentEventId: p4 });
7661
- return h2.durationMs = m4 - g3, h2.outEvent = i5.event, s5 && s5.length > 0 && (h2.calls = F2(s5)), de(r7) && (h2.meta = { ...h2.meta, response: r7 }), i5.mappingKey && (h2.mappingKey = i5.mappingKey), dn(e5, h2), u3.debug("push done"), r7;
7676
+ const o5 = Ct2(a4.timeout), s6 = await St(Promise.resolve(wt(t4.push, "DestinationPush", e5.hooks, e5.logger)(i5.event, d2)), o5, `Destination "${n5}" delivery timed out after ${o5}ms`), m4 = Date.now(), h2 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "out", eventId: c3, now: m4, traceId: l4, sourceId: f3, parentEventId: p4 });
7677
+ return h2.durationMs = m4 - g3, h2.outEvent = i5.event, r6 && r6.length > 0 && (h2.calls = F2(r6)), de(s6) && (h2.meta = { ...h2.meta, response: s6 }), i5.mappingKey && (h2.mappingKey = i5.mappingKey), dn(e5, h2), u3.debug("push done"), s6;
7662
7678
  } catch (t5) {
7663
- const o5 = Date.now(), r7 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: c3, now: o5, traceId: l4, sourceId: f3, parentEventId: p4 });
7664
- throw r7.durationMs = o5 - g3, r7.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, s5 && s5.length > 0 && (r7.calls = F2(s5)), i5.mappingKey && (r7.mappingKey = i5.mappingKey), dn(e5, r7), t5;
7679
+ const o5 = Date.now(), s6 = _(e5, { stepId: o("destination", n5), stepType: "destination", phase: "error", eventId: c3, now: o5, traceId: l4, sourceId: f3, parentEventId: p4 });
7680
+ throw s6.durationMs = o5 - g3, s6.error = t5 instanceof Error ? { name: t5.name, message: t5.message } : { message: String(t5) }, r6 && r6.length > 0 && (s6.calls = F2(r6)), i5.mappingKey && (s6.mappingKey = i5.mappingKey), dn(e5, s6), t5;
7665
7681
  }
7666
7682
  }
7667
7683
  }
7668
- function Mt2(e5) {
7684
+ function Tt2(e5) {
7669
7685
  return { ok: !e5?.failed, ...e5 };
7670
7686
  }
7671
- function Tt2(e5) {
7672
- const { code: t4, config: n5 = {}, env: o4 = {}, cache: r6, state: s4 } = e5, { config: a4 } = Fe(e5, "before"), { config: i5 } = Fe({ ...e5, config: a4 }, "next"), c2 = { ...t4.config, ...n5, ...i5 };
7673
- r6 && (c2.cache = r6), void 0 !== s4 && void 0 === c2.state && (c2.state = s4);
7674
- const u3 = Pt(t4.env, o4);
7687
+ function _t2(e5) {
7688
+ const { code: t4, config: n5 = {}, env: o4 = {}, cache: s5, state: r5 } = e5, { config: a4 } = He2(e5, "before"), { config: i5 } = He2({ ...e5, config: a4 }, "next"), c2 = { ...t4.config, ...n5, ...i5 };
7689
+ s5 && (c2.cache = s5), void 0 !== r5 && void 0 === c2.state && (c2.state = r5);
7690
+ const u3 = Rt2(t4.env, o4);
7675
7691
  return { ...t4, config: c2, env: u3 };
7676
7692
  }
7677
- async function _t2(e5, t4 = {}) {
7693
+ async function Pt(e5, t4 = {}) {
7678
7694
  const n5 = {};
7679
- for (const [o4, r6] of Object.entries(t4)) r6.config?.require?.length ? e5.pending.destinations[o4] = r6 : n5[o4] = Tt2(r6);
7695
+ for (const [o4, s5] of Object.entries(t4)) s5.config?.require?.length ? e5.pending.destinations[o4] = s5 : n5[o4] = _t2(s5);
7680
7696
  return n5;
7681
7697
  }
7682
- function Pt(e5, t4) {
7698
+ function Rt2(e5, t4) {
7683
7699
  return e5 || t4 ? t4 ? e5 && ve(e5) && ve(t4) ? { ...e5, ...t4 } : t4 : e5 : {};
7684
7700
  }
7685
- var Gt = 5e3;
7686
- async function Wt(e5) {
7701
+ var Wt = 5e3;
7702
+ async function Lt(e5) {
7687
7703
  const t4 = e5.logger;
7688
- await Lt(e5.sources, "source", t4), await (async function(e6, t5) {
7704
+ await Qt(e5.sources, "source", t4), await (async function(e6, t5) {
7689
7705
  const n5 = Object.entries(e6).flatMap(([e7, n6]) => {
7690
7706
  const o4 = n6.batches;
7691
7707
  if (!o4) return [];
7692
- const r6 = t5.scope(n6.type || "destination");
7708
+ const s5 = t5.scope(n6.type || "destination");
7693
7709
  return Object.values(o4).map(async (t6) => {
7694
7710
  let n7;
7695
7711
  try {
7696
7712
  await Promise.race([t6.flush(), new Promise((t7, o5) => {
7697
- n7 = setTimeout(() => o5(new Error(`destination '${e7}' batch flush timed out`)), Gt);
7713
+ n7 = setTimeout(() => o5(new Error(`destination '${e7}' batch flush timed out`)), Wt);
7698
7714
  })]);
7699
7715
  } catch (t7) {
7700
- r6.error(`destination '${e7}' batch flush failed: ${t7}`);
7716
+ s5.error(`destination '${e7}' batch flush failed: ${t7}`);
7701
7717
  } finally {
7702
7718
  n7 && clearTimeout(n7);
7703
7719
  }
7704
7720
  });
7705
7721
  });
7706
7722
  await Promise.allSettled(n5);
7707
- })(e5.destinations, t4), await Lt(e5.destinations, "destination", t4), await Lt(e5.transformers, "transformer", t4), await Lt(e5.stores, "store", t4);
7723
+ })(e5.destinations, t4), await Qt(e5.destinations, "destination", t4), await Qt(e5.transformers, "transformer", t4), await Qt(e5.stores, "store", t4);
7708
7724
  }
7709
- async function Lt(e5, t4, n5) {
7725
+ async function Qt(e5, t4, n5) {
7710
7726
  const o4 = Object.entries(e5).map(async ([e6, o5]) => {
7711
- const r6 = o5.destroy;
7712
- if (!r6) return;
7713
- const s4 = o5.type || "unknown", a4 = n5.scope(s4), i5 = { id: e6, config: o5.config, env: o5.env ?? {}, logger: a4 };
7727
+ const s5 = o5.destroy;
7728
+ if (!s5) return;
7729
+ const r5 = o5.type || "unknown", a4 = n5.scope(r5), i5 = { id: e6, config: o5.config, env: o5.env ?? {}, logger: a4 };
7714
7730
  let c2;
7715
7731
  try {
7716
- await Promise.race([r6(i5), new Promise((n6, o6) => {
7717
- c2 = setTimeout(() => o6(new Error(`${t4} '${e6}' destroy timed out`)), Gt);
7732
+ await Promise.race([s5(i5), new Promise((n6, o6) => {
7733
+ c2 = setTimeout(() => o6(new Error(`${t4} '${e6}' destroy timed out`)), Wt);
7718
7734
  })]);
7719
7735
  } catch (n6) {
7720
7736
  a4.error(`${t4} '${e6}' destroy failed: ${n6}`);
@@ -7724,12 +7740,12 @@ async function Lt(e5, t4, n5) {
7724
7740
  });
7725
7741
  await Promise.allSettled(o4);
7726
7742
  }
7727
- function Qt(e5, t4) {
7743
+ function Vt(e5, t4) {
7728
7744
  e5.stateVersion++, e5.cellVersion[t4] = e5.stateVersion;
7729
7745
  }
7730
- async function Vt(e5, t4, o4) {
7731
- let s4, a4, i5 = false;
7732
- const c2 = ft(e5);
7746
+ async function Nt(e5, t4, o4) {
7747
+ let r5, a4, i5 = false;
7748
+ const c2 = pt(e5);
7733
7749
  try {
7734
7750
  return await (async function() {
7735
7751
  switch (t4) {
@@ -7738,18 +7754,18 @@ async function Vt(e5, t4, o4) {
7738
7754
  break;
7739
7755
  case n.Commands.Consent:
7740
7756
  if (ve(o4)) {
7741
- const { update: t5 } = r2(e5, o4);
7742
- Qt(e5, n.Commands.Consent), a4 = t5, i5 = true;
7757
+ const { update: t5 } = s(e5, o4);
7758
+ Vt(e5, n.Commands.Consent), a4 = t5, i5 = true;
7743
7759
  }
7744
7760
  break;
7745
7761
  case n.Commands.Custom:
7746
- ve(o4) && (e5.custom = ce(e5.custom, o4), Qt(e5, n.Commands.Custom), a4 = o4, i5 = true);
7762
+ ve(o4) && (e5.custom = ce(e5.custom, o4), Vt(e5, n.Commands.Custom), a4 = o4, i5 = true);
7747
7763
  break;
7748
7764
  case n.Commands.Destination:
7749
- ve(o4) && "code" in o4 && ve(o4.code) && (s4 = await jt2(e5, o4));
7765
+ ve(o4) && "code" in o4 && ve(o4.code) && (r5 = await $t2(e5, o4));
7750
7766
  break;
7751
7767
  case n.Commands.Globals:
7752
- ve(o4) && (e5.globals = ce(e5.globals, o4), Qt(e5, n.Commands.Globals), a4 = o4, i5 = true);
7768
+ ve(o4) && (e5.globals = ce(e5.globals, o4), Vt(e5, n.Commands.Globals), a4 = o4, i5 = true);
7753
7769
  break;
7754
7770
  case n.Commands.Hook:
7755
7771
  if (ve(o4) && be(o4.name) && ge(o4.fn)) {
@@ -7760,129 +7776,129 @@ async function Vt(e5, t4, o4) {
7760
7776
  case n.Commands.On:
7761
7777
  if (ve(o4) && be(o4.type)) {
7762
7778
  const { type: t5, rules: n5 } = o4;
7763
- await mt(e5, t5, n5);
7779
+ await ht2(e5, t5, n5);
7764
7780
  }
7765
7781
  break;
7766
7782
  case n.Commands.Ready:
7767
7783
  i5 = true;
7768
7784
  break;
7769
7785
  case n.Commands.Run:
7770
- s4 = await Xt(e5, o4), i5 = true;
7786
+ r5 = await Zt(e5, o4), i5 = true;
7771
7787
  break;
7772
7788
  case n.Commands.Session:
7773
7789
  i5 = true;
7774
7790
  break;
7775
7791
  case n.Commands.Shutdown:
7776
- e5.hasShutdown || (e5.hasShutdown = true, await Wt(e5));
7792
+ e5.hasShutdown || (e5.hasShutdown = true, await Lt(e5));
7777
7793
  break;
7778
7794
  case n.Commands.User:
7779
- ve(o4) && (ce(e5.user, o4, { shallow: false }), Qt(e5, n.Commands.User), a4 = o4, i5 = true);
7795
+ ve(o4) && (ce(e5.user, o4, { shallow: false }), Vt(e5, n.Commands.User), a4 = o4, i5 = true);
7780
7796
  break;
7781
7797
  default:
7782
- return e5.logger.warn("unknown command", { command: t4 }), Mt2({ ok: false });
7798
+ return e5.logger.warn("unknown command", { command: t4 }), Tt2({ ok: false });
7783
7799
  }
7784
7800
  if (i5) {
7785
- await kt2(e5, t4, void 0, a4);
7786
- const n5 = await $t2(e5);
7787
- if (s4 && false === s4.ok) {
7788
- const e6 = { ...n5.failed ?? {}, ...s4.failed ?? {} };
7789
- s4 = { ...n5, ok: false, ...Object.keys(e6).length > 0 ? { failed: e6 } : {} };
7790
- } else s4 = n5;
7791
- }
7792
- return s4 || Mt2({ ok: true });
7801
+ await It2(e5, t4, void 0, a4);
7802
+ const n5 = await At2(e5);
7803
+ if (r5 && false === r5.ok) {
7804
+ const e6 = { ...n5.failed ?? {}, ...r5.failed ?? {} };
7805
+ r5 = { ...n5, ok: false, ...Object.keys(e6).length > 0 ? { failed: e6 } : {} };
7806
+ } else r5 = n5;
7807
+ }
7808
+ return r5 || Tt2({ ok: true });
7793
7809
  })();
7794
7810
  } finally {
7795
7811
  c2();
7796
7812
  }
7797
7813
  }
7798
- function Nt(e5, t4) {
7814
+ function Yt(e5, t4) {
7799
7815
  return { timing: Math.round((Date.now() - e5.timing) / 10) / 100, source: { type: "collector", schema: "4" }, ...t4 };
7800
7816
  }
7801
- function Yt(e5, t4, n5) {
7817
+ function Jt(e5, t4, n5) {
7802
7818
  const o4 = t4.name;
7803
7819
  if ("string" != typeof o4) throw new bt(void 0 === o4 ? "Event name is required" : "Event name is invalid");
7804
7820
  if (!o4) throw new bt("Event name is required");
7805
- const [r6, s4] = o4.split(" ");
7806
- if (!r6 || !s4) throw new bt("Event name is invalid");
7807
- const { timestamp: a4 = Date.now(), name: i5 = `${r6} ${s4}`, data: c2 = {}, context: u3 = {}, globals: d2 = {}, custom: l3 = {}, user: f2 = e5.user, nested: p3 = [], consent: g3 = e5.consent, id: m3 = Pe(), trigger: h2 = "", entity: v3 = r6, action: y3 = s4, timing: w3 = 0, source: b3 = { type: "collector", schema: "4" } } = t4, k3 = b3 ?? { type: "collector", schema: "4" }, I2 = k3.count ?? (e5.count += 1), C3 = k3.trace ?? n5?._meta.trace ?? e5.trace, E2 = { ...k3, count: I2 };
7821
+ const [s5, r5] = o4.split(" ");
7822
+ if (!s5 || !r5) throw new bt("Event name is invalid");
7823
+ const { timestamp: a4 = Date.now(), name: i5 = `${s5} ${r5}`, data: c2 = {}, context: u3 = {}, globals: d2 = {}, custom: l3 = {}, user: f2 = e5.user, nested: p3 = [], consent: g3 = e5.consent, id: m3 = Pe(), trigger: h2 = "", entity: v3 = s5, action: y3 = r5, timing: w3 = 0, source: b3 = { type: "collector", schema: "4" } } = t4, k3 = b3 ?? { type: "collector", schema: "4" }, I2 = k3.count ?? (e5.count += 1), C3 = k3.trace ?? n5?._meta.trace ?? e5.trace, E2 = { ...k3, count: I2 };
7808
7824
  void 0 !== C3 && (E2.trace = C3);
7809
- const S2 = e5.name ?? k3.platform ?? "default", q3 = e5.release ?? "4.5.0";
7825
+ const S2 = e5.name ?? k3.platform ?? "default", q3 = e5.release ?? "4.5.1-next-1788726985928";
7810
7826
  E2.release = { ...k3.release, [S2]: q3 };
7811
7827
  return { name: i5, data: c2, context: u3, globals: ce(e5.globals, d2), custom: l3, user: f2, nested: p3, consent: g3, id: m3, trigger: h2, entity: v3, action: y3, timestamp: a4, timing: w3, source: E2 };
7812
7828
  }
7813
- function Jt(e5, t4, n5) {
7814
- return Yt(e5, Nt(e5, t4), n5);
7829
+ function Xt(e5, t4, n5) {
7830
+ return Jt(e5, Yt(e5, t4), n5);
7815
7831
  }
7816
- async function Xt(e5, t4) {
7817
- e5.allowed = true, e5.timing = Date.now(), e5.trace = Ue(), e5.count = 0, t4 && (t4.consent && (e5.consent = ce(e5.consent, t4.consent), Qt(e5, n.Commands.Consent)), t4.user && (e5.user = ce(e5.user, t4.user), Qt(e5, n.Commands.User)), t4.globals && (e5.globals = ce(e5.config.globalsStatic || {}, t4.globals), Qt(e5, n.Commands.Globals)), t4.custom && (e5.custom = ce(e5.custom, t4.custom), Qt(e5, n.Commands.Custom))), Object.values(e5.destinations).forEach((e6) => {
7832
+ async function Zt(e5, t4) {
7833
+ e5.allowed = true, e5.timing = Date.now(), e5.trace = Ue(), e5.count = 0, t4 && (t4.consent && (e5.consent = ce(e5.consent, t4.consent), Vt(e5, n.Commands.Consent)), t4.user && (e5.user = ce(e5.user, t4.user), Vt(e5, n.Commands.User)), t4.globals && (e5.globals = ce(e5.config.globalsStatic || {}, t4.globals), Vt(e5, n.Commands.Globals)), t4.custom && (e5.custom = ce(e5.custom, t4.custom), Vt(e5, n.Commands.Custom))), Object.values(e5.destinations).forEach((e6) => {
7818
7834
  e6.queuePush = [];
7819
- }), e5.queue = [], e5.round++, await et2(e5), await bt2(e5);
7835
+ }), e5.queue = [], e5.round++, await tt2(e5), await kt2(e5);
7820
7836
  let o4 = true;
7821
- const r6 = {};
7837
+ const s5 = {};
7822
7838
  if (e5.preRunQueue.length) {
7823
7839
  const t5 = e5.preRunQueue.splice(0);
7824
7840
  e5.logger.debug("replaying pre-run events", { count: t5.length });
7825
- for (const { event: n5, options: s5 } of t5) {
7826
- const t6 = await e5.push(n5, s5);
7827
- false === t6.ok && (o4 = false), t6.failed && Object.assign(r6, t6.failed);
7841
+ for (const { event: n5, options: r6 } of t5) {
7842
+ const t6 = await e5.push(n5, r6);
7843
+ false === t6.ok && (o4 = false), t6.failed && Object.assign(s5, t6.failed);
7828
7844
  }
7829
7845
  }
7830
- const s4 = await $t2(e5);
7831
- if (o4) return s4;
7832
- const a4 = { ...s4.failed ?? {}, ...r6 };
7833
- return { ...s4, ok: false, ...Object.keys(a4).length > 0 ? { failed: a4 } : {} };
7846
+ const r5 = await At2(e5);
7847
+ if (o4) return r5;
7848
+ const a4 = { ...r5.failed ?? {}, ...s5 };
7849
+ return { ...r5, ok: false, ...Object.keys(a4).length > 0 ? { failed: a4 } : {} };
7834
7850
  }
7835
- function un2(e5, t4) {
7851
+ function dn2(e5, t4) {
7836
7852
  const n5 = wt(async (n6, o4 = {}) => await tt(async () => {
7837
7853
  if (!e5.allowed) {
7838
7854
  const t5 = e5.config.queueMax;
7839
7855
  if (void 0 === t5) throw new Error("Collector.Config.queueMax is undefined; defaults must be seeded by collector()");
7840
- const r7 = V(e5.preRunQueue, { event: n6, options: o4 }, { max: t5 });
7841
- if (r7.dropped > 0) {
7842
- const n7 = ae2(e5.status, "collector.preRun", "queue", r7.dropped);
7856
+ const s6 = V(e5.preRunQueue, { event: n6, options: o4 }, { max: t5 });
7857
+ if (s6.dropped > 0) {
7858
+ const n7 = ae2(e5.status, "collector.preRun", "queue", s6.dropped);
7843
7859
  Y(e5.preRunQueue, e5.logger, "collector.preRunQueue overflow; oldest events dropped", { buffer: "queue", cap: t5, droppedCount: n7 });
7844
7860
  } else e5.preRunQueue.length < t5 && J(e5.preRunQueue);
7845
- return e5.logger.debug("event held until run", { name: n6.name, dropped: r7.dropped }), Mt2({ ok: true });
7861
+ return e5.logger.debug("event held until run", { name: n6.name, dropped: s6.dropped }), Tt2({ ok: true });
7846
7862
  }
7847
- const r6 = Date.now(), { id: s4, ingest: a4, respond: i5, mapping: c2, preChain: u3, include: d2, exclude: l3 } = o4;
7863
+ const s5 = Date.now(), { id: r5, ingest: a4, respond: i5, mapping: c2, preChain: u3, include: d2, exclude: l3 } = o4;
7848
7864
  let f2 = i5, p3 = n6;
7849
7865
  const g3 = d2 || l3 ? (function(e6, t5, n7) {
7850
7866
  let o5 = e6;
7851
7867
  return t5 && (o5 = Object.fromEntries(Object.entries(o5).filter(([e7]) => t5.includes(e7)))), n7 && (o5 = Object.fromEntries(Object.entries(o5).filter(([e7]) => !n7.includes(e7)))), o5;
7852
- })(e5.destinations, d2, l3) : void 0, m3 = a4 ?? O(s4 || "unknown");
7868
+ })(e5.destinations, d2, l3) : void 0, m3 = a4 ?? O(r5 || "unknown");
7853
7869
  if (c2) {
7854
7870
  const t5 = await it(p3, c2, e5);
7855
- if (t5.ignore) return Mt2({ ok: true });
7871
+ if (t5.ignore) return Tt2({ ok: true });
7856
7872
  if (c2.consent) {
7857
- if (!Ee(c2.consent, e5.consent, t5.event.consent)) return Mt2({ ok: true });
7873
+ if (!Ee(c2.consent, e5.consent, t5.event.consent)) return Tt2({ ok: true });
7858
7874
  }
7859
7875
  p3 = t5.event;
7860
7876
  }
7861
7877
  if (u3?.length && e5.transformers && Object.keys(e5.transformers).length > 0) {
7862
- const n7 = await Qe2(e5, e5.transformers, u3, p3, m3, f2, s4 ? `source.${s4}.next` : void 0);
7863
- if (null === n7.event) return e5.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")), Mt2({ ok: true, dropped: true });
7864
- if (n7.stopped) return n7.respond && (f2 = n7.respond), Mt2({ ok: true });
7878
+ const n7 = await Ve2(e5, e5.transformers, u3, p3, m3, f2, r5 ? `source.${r5}.next` : void 0);
7879
+ if (null === n7.event) return e5.logger.debug("Event dropped by transformer chain" + (n7.droppedBy ? ` (${n7.droppedBy})` : "")), Tt2({ ok: true, dropped: true });
7880
+ if (n7.stopped) return n7.respond && (f2 = n7.respond), Tt2({ ok: true });
7865
7881
  n7.respond && (f2 = n7.respond);
7866
7882
  const o5 = "string" == typeof p3.id ? p3.id : "";
7867
7883
  if (Array.isArray(n7.event)) {
7868
7884
  const a5 = await Promise.all(n7.event.map(async (n8) => {
7869
- const r7 = "" !== o5 && n8.id === o5 ? { ...n8, id: Pe() } : n8, a6 = t4(r7), i6 = Yt(e5, a6, m3);
7870
- return $t2(e5, i6, { id: s4, ingest: m3, respond: f2 }, g3);
7885
+ const s6 = "" !== o5 && n8.id === o5 ? { ...n8, id: Pe() } : n8, a6 = t4(s6), i6 = Jt(e5, a6, m3);
7886
+ return At2(e5, i6, { id: r5, ingest: m3, respond: f2 }, g3);
7871
7887
  }));
7872
- if (s4) {
7873
- e5.status.sources[s4] || (e5.status.sources[s4] = { count: 0, duration: 0 });
7874
- const t5 = e5.status.sources[s4];
7875
- t5.count += n7.event.length, t5.lastAt = Date.now(), t5.duration += Date.now() - r6;
7888
+ if (r5) {
7889
+ e5.status.sources[r5] || (e5.status.sources[r5] = { count: 0, duration: 0 });
7890
+ const t5 = e5.status.sources[r5];
7891
+ t5.count += n7.event.length, t5.lastAt = Date.now(), t5.duration += Date.now() - s5;
7876
7892
  }
7877
- return a5[0] ?? Mt2({ ok: true });
7893
+ return a5[0] ?? Tt2({ ok: true });
7878
7894
  }
7879
7895
  p3 = "" === o5 || "string" == typeof n7.event.id && "" !== n7.event.id ? n7.event : { ...n7.event, id: o5 };
7880
7896
  }
7881
- const h2 = Jt(e5, p3, m3), v3 = await $t2(e5, h2, { id: s4, ingest: m3, respond: f2 }, g3);
7882
- if (s4) {
7883
- e5.status.sources[s4] || (e5.status.sources[s4] = { count: 0, duration: 0 });
7884
- const t5 = e5.status.sources[s4];
7885
- t5.count++, t5.lastAt = Date.now(), t5.duration += Date.now() - r6;
7897
+ const h2 = Xt(e5, p3, m3), v3 = await At2(e5, h2, { id: r5, ingest: m3, respond: f2 }, g3);
7898
+ if (r5) {
7899
+ e5.status.sources[r5] || (e5.status.sources[r5] = { count: 0, duration: 0 });
7900
+ const t5 = e5.status.sources[r5];
7901
+ t5.count++, t5.lastAt = Date.now(), t5.duration += Date.now() - s5;
7886
7902
  }
7887
7903
  return v3;
7888
7904
  }, (t5) => {
@@ -7894,61 +7910,61 @@ function un2(e5, t4) {
7894
7910
  const t6 = e5.status.sources[n7];
7895
7911
  t6.rejected = (t6.rejected ?? 0) + 1;
7896
7912
  }
7897
- return e5.logger.warn("invalid event rejected", { error: t5.message }), Mt2({ ok: false, invalid: true, error: t5.message });
7913
+ return e5.logger.warn("invalid event rejected", { error: t5.message }), Tt2({ ok: false, invalid: true, error: t5.message });
7898
7914
  }
7899
- return e5.status.failed++, e5.logger.error("push failed", { event: n6, ingest: o4.ingest, error: t5 }), Mt2({ ok: false });
7915
+ return e5.status.failed++, e5.logger.error("push failed", { ...ie2(t5), event: n6.name }), Tt2({ ok: false });
7900
7916
  })(), "Push", e5.hooks, e5.logger);
7901
7917
  return async (t5, o4) => {
7902
- const r6 = "string" == typeof t5.id && "" !== t5.id ? t5 : { ...t5, id: Pe() }, s4 = "string" == typeof r6.id ? r6.id : "", { traceId: a4, sourceId: i5, parentEventId: c2 } = T2(r6, o4?.ingest, e5), u3 = Date.now(), d2 = _(e5, { stepId: "collector.push", stepType: "collector", phase: "in", eventId: s4, now: u3, traceId: a4, sourceId: i5, parentEventId: c2 });
7903
- d2.inEvent = r6, dn(e5, d2);
7918
+ const s5 = "string" == typeof t5.id && "" !== t5.id ? t5 : { ...t5, id: Pe() }, r5 = "string" == typeof s5.id ? s5.id : "", { traceId: a4, sourceId: i5, parentEventId: c2 } = T2(s5, o4?.ingest, e5), u3 = Date.now(), d2 = _(e5, { stepId: "collector.push", stepType: "collector", phase: "in", eventId: r5, now: u3, traceId: a4, sourceId: i5, parentEventId: c2 });
7919
+ d2.inEvent = s5, dn(e5, d2);
7904
7920
  try {
7905
- const t6 = await n5(r6, o4), d3 = Date.now(), l3 = _(e5, { stepId: "collector.push", stepType: "collector", phase: "out", eventId: s4, now: d3, traceId: a4, sourceId: i5, parentEventId: c2 });
7921
+ const t6 = await n5(s5, o4), d3 = Date.now(), l3 = _(e5, { stepId: "collector.push", stepType: "collector", phase: "out", eventId: r5, now: d3, traceId: a4, sourceId: i5, parentEventId: c2 });
7906
7922
  return l3.durationMs = d3 - u3, l3.outEvent = t6, dn(e5, l3), t6;
7907
7923
  } catch (t6) {
7908
- const n6 = Date.now(), o5 = _(e5, { stepId: "collector.push", stepType: "collector", phase: "error", eventId: s4, now: n6, traceId: a4, sourceId: i5, parentEventId: c2 });
7924
+ const n6 = Date.now(), o5 = _(e5, { stepId: "collector.push", stepType: "collector", phase: "error", eventId: r5, now: n6, traceId: a4, sourceId: i5, parentEventId: c2 });
7909
7925
  throw o5.durationMs = n6 - u3, o5.error = t6 instanceof Error ? { name: t6.name, message: t6.message } : { message: String(t6) }, dn(e5, o5), t6;
7910
7926
  }
7911
7927
  };
7912
7928
  }
7913
- function mn2(e5 = {}) {
7914
- const t4 = e5.maxEntries ?? 1e4, n5 = e5.lowWaterMark ?? 0.8, o4 = e5.sweepIntervalMs ?? 6e4, r6 = Math.floor(t4 * n5), s4 = /* @__PURE__ */ new Map(), a4 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, evictions_entries: 0, evictions_ttl: 0 };
7929
+ function hn(e5 = {}) {
7930
+ const t4 = e5.maxEntries ?? 1e4, n5 = e5.lowWaterMark ?? 0.8, o4 = e5.sweepIntervalMs ?? 6e4, s5 = Math.floor(t4 * n5), r5 = /* @__PURE__ */ new Map(), a4 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, evictions_entries: 0, evictions_ttl: 0 };
7915
7931
  let i5;
7916
7932
  o4 > 0 && (i5 = setInterval(function() {
7917
7933
  const e6 = Date.now();
7918
7934
  let t5 = 0;
7919
- for (const [n6, o5] of s4) void 0 !== o5.expires && o5.expires <= e6 && (s4.delete(n6), t5++);
7935
+ for (const [n6, o5] of r5) void 0 !== o5.expires && o5.expires <= e6 && (r5.delete(n6), t5++);
7920
7936
  a4.evictions_ttl += t5;
7921
7937
  }, o4), i5 && "function" == typeof i5.unref && i5.unref());
7922
7938
  return { type: "memory", config: {}, get(e6) {
7923
- const t5 = s4.get(e6);
7924
- if (t5) return void 0 !== t5.expires && t5.expires <= Date.now() ? (s4.delete(e6), a4.evictions_ttl++, void a4.misses++) : (s4.delete(e6), s4.set(e6, t5), a4.hits++, t5.value);
7939
+ const t5 = r5.get(e6);
7940
+ if (t5) return void 0 !== t5.expires && t5.expires <= Date.now() ? (r5.delete(e6), a4.evictions_ttl++, void a4.misses++) : (r5.delete(e6), r5.set(e6, t5), a4.hits++, t5.value);
7925
7941
  a4.misses++;
7926
7942
  }, set(e6, n6, o5) {
7927
- const i6 = !s4.has(e6);
7928
- i6 || s4.delete(e6), s4.set(e6, { value: n6, expires: void 0 !== o5 ? Date.now() + o5 : void 0 }), a4.writes++, i6 && a4.populates++, s4.size > t4 && (function() {
7929
- if (s4.size <= t4) return;
7930
- const e7 = s4.size - r6;
7943
+ const i6 = !r5.has(e6);
7944
+ i6 || r5.delete(e6), r5.set(e6, { value: n6, expires: void 0 !== o5 ? Date.now() + o5 : void 0 }), a4.writes++, i6 && a4.populates++, r5.size > t4 && (function() {
7945
+ if (r5.size <= t4) return;
7946
+ const e7 = r5.size - s5;
7931
7947
  let n7 = 0;
7932
- for (const t5 of s4.keys()) {
7948
+ for (const t5 of r5.keys()) {
7933
7949
  if (n7 >= e7) break;
7934
- s4.delete(t5), n7++;
7950
+ r5.delete(t5), n7++;
7935
7951
  }
7936
7952
  a4.evictions_entries += n7;
7937
7953
  })();
7938
7954
  }, delete(e6) {
7939
- s4.delete(e6) && a4.deletes++;
7955
+ r5.delete(e6) && a4.deletes++;
7940
7956
  }, get counters() {
7941
7957
  return { ...a4 };
7942
7958
  }, destroy() {
7943
- void 0 !== i5 && (clearInterval(i5), i5 = void 0), s4.clear();
7959
+ void 0 !== i5 && (clearInterval(i5), i5 = void 0), r5.clear();
7944
7960
  } };
7945
7961
  }
7946
- function bn(e5, t4) {
7947
- const { cacheConfig: n5, cacheStore: o4, namespace: r6, logger: s4, storeId: a4, collector: i5 } = t4, c2 = (e6, t5) => {
7962
+ function kn(e5, t4) {
7963
+ const { cacheConfig: n5, cacheStore: o4, namespace: s5, logger: r5, storeId: a4, collector: i5 } = t4, c2 = (e6, t5) => {
7948
7964
  if (!i5) return;
7949
7965
  const n6 = _(i5, { stepId: `store.${a4}`, stepType: "store", phase: "in", eventId: "", now: Date.now() });
7950
7966
  n6.meta = { op: "cache", cached: "hit" === t5, status: t5, key: e6 }, dn(i5, n6);
7951
- }, u3 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, d2 = n5.rules.map((e6) => ({ match: e6.match ? Hn(e6.match) : () => true, ttl: e6.ttl })), l3 = (e6) => `${r6}:${e6}`;
7967
+ }, u3 = { hits: 0, misses: 0, populates: 0, writes: 0, deletes: 0, inflight_dedups: 0 }, d2 = n5.rules.map((e6) => ({ match: e6.match ? Hn(e6.match) : () => true, ttl: e6.ttl })), l3 = (e6) => `${s5}:${e6}`;
7952
7968
  function f2(e6, t5) {
7953
7969
  const n6 = void 0 === t5 ? { key: e6 } : { key: e6, value: t5 };
7954
7970
  return d2.find((e7) => e7.match(n6));
@@ -7957,9 +7973,9 @@ function bn(e5, t4) {
7957
7973
  return { type: e5.type, config: e5.config, setup: e5.setup, get counters() {
7958
7974
  return { ...u3 };
7959
7975
  }, async get(t5) {
7960
- const n6 = l3(t5), r7 = await o4.get(n6), s5 = sr(r7);
7961
- if (void 0 !== s5) {
7962
- if (!("expired" in s5)) return u3.hits++, c2(t5, "hit"), s5.value;
7976
+ const n6 = l3(t5), s6 = await o4.get(n6), r6 = sr(s6);
7977
+ if (void 0 !== r6) {
7978
+ if (!("expired" in r6)) return u3.hits++, c2(t5, "hit"), r6.value;
7963
7979
  try {
7964
7980
  await o4.delete(n6);
7965
7981
  } catch (e6) {
@@ -7971,26 +7987,26 @@ function bn(e5, t4) {
7971
7987
  u3.misses++, c2(t5, "miss");
7972
7988
  const i6 = (async () => {
7973
7989
  try {
7974
- const r8 = await e5.get(t5);
7975
- if (void 0 === r8) return;
7976
- const s6 = f2(t5, r8);
7977
- if (s6) try {
7978
- const e6 = 1e3 * s6.ttl;
7979
- await o4.set(n6, or(r8, e6), e6), u3.populates++;
7990
+ const s7 = await e5.get(t5);
7991
+ if (void 0 === s7) return;
7992
+ const r7 = f2(t5, s7);
7993
+ if (r7) try {
7994
+ const e6 = 1e3 * r7.ttl;
7995
+ await o4.set(n6, or(s7, e6), e6), u3.populates++;
7980
7996
  } catch (e6) {
7981
7997
  g3("set", t5, e6);
7982
7998
  }
7983
- return r8;
7999
+ return s7;
7984
8000
  } finally {
7985
8001
  p3.delete(n6);
7986
8002
  }
7987
8003
  })();
7988
8004
  return p3.set(n6, i6), i6;
7989
- }, async set(t5, n6, r7) {
7990
- u3.writes++, await e5.set(t5, n6, r7);
7991
- const s5 = f2(t5, n6);
7992
- if (s5) try {
7993
- const e6 = 1e3 * s5.ttl;
8005
+ }, async set(t5, n6, s6) {
8006
+ u3.writes++, await e5.set(t5, n6, s6);
8007
+ const r6 = f2(t5, n6);
8008
+ if (r6) try {
8009
+ const e6 = 1e3 * r6.ttl;
7994
8010
  await o4.set(l3(t5), or(n6, e6), e6);
7995
8011
  } catch (e6) {
7996
8012
  g3("set", t5, e6);
@@ -8005,93 +8021,93 @@ function bn(e5, t4) {
8005
8021
  } };
8006
8022
  function g3(e6, t5, n6) {
8007
8023
  const o5 = `store-cache(${a4}): cache ${e6} failed for "${t5}"; backing succeeded, continuing`;
8008
- s4 ? s4.warn(o5, { error: n6 }) : console.warn(o5, n6);
8024
+ r5 ? r5.warn(o5, ie2(n6)) : console.warn(o5, n6);
8009
8025
  }
8010
8026
  }
8011
- function kn(e5, t4, n5) {
8012
- const o4 = `store.${n5}`, r6 = wt(t4.get, "StoreGet", e5.hooks, e5.logger), s4 = wt(t4.set, "StoreSet", e5.hooks, e5.logger), a4 = wt(t4.delete, "StoreDelete", e5.hooks, e5.logger);
8027
+ function In2(e5, t4, n5) {
8028
+ const o4 = `store.${n5}`, s5 = wt(t4.get, "StoreGet", e5.hooks, e5.logger), r5 = wt(t4.set, "StoreSet", e5.hooks, e5.logger), a4 = wt(t4.delete, "StoreDelete", e5.hooks, e5.logger);
8013
8029
  t4.get = async (t5) => {
8014
- const n6 = Date.now(), s5 = _(e5, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
8015
- s5.meta = { op: "get", key: t5 }, dn(e5, s5);
8030
+ const n6 = Date.now(), r6 = _(e5, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
8031
+ r6.meta = { op: "get", key: t5 }, dn(e5, r6);
8016
8032
  try {
8017
- const s6 = await r6(t5), a5 = Date.now(), i5 = _(e5, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: a5 });
8018
- return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 }, dn(e5, i5), s6;
8019
- } catch (r7) {
8020
- const s6 = Date.now(), a5 = _(e5, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s6 });
8021
- throw a5.durationMs = s6 - n6, a5.meta = { op: "get", key: t5 }, a5.error = r7 instanceof Error ? { name: r7.name, message: r7.message } : { message: String(r7) }, dn(e5, a5), r7;
8033
+ const r7 = await s5(t5), a5 = Date.now(), i5 = _(e5, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: a5 });
8034
+ return i5.durationMs = a5 - n6, i5.meta = { op: "get", key: t5 }, dn(e5, i5), r7;
8035
+ } catch (s6) {
8036
+ const r7 = Date.now(), a5 = _(e5, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: r7 });
8037
+ throw a5.durationMs = r7 - n6, a5.meta = { op: "get", key: t5 }, a5.error = s6 instanceof Error ? { name: s6.name, message: s6.message } : { message: String(s6) }, dn(e5, a5), s6;
8022
8038
  }
8023
- }, t4.set = async (t5, n6, r7) => {
8039
+ }, t4.set = async (t5, n6, s6) => {
8024
8040
  const a5 = Date.now(), i5 = _(e5, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: a5 });
8025
8041
  i5.meta = { op: "set", key: t5 }, dn(e5, i5);
8026
8042
  try {
8027
- await s4(t5, n6, r7);
8043
+ await r5(t5, n6, s6);
8028
8044
  const i6 = Date.now(), c2 = _(e5, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: i6 });
8029
8045
  c2.durationMs = i6 - a5, c2.meta = { op: "set", key: t5 }, dn(e5, c2);
8030
8046
  } catch (n7) {
8031
- const r8 = Date.now(), s5 = _(e5, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: r8 });
8032
- throw s5.durationMs = r8 - a5, s5.meta = { op: "set", key: t5 }, s5.error = n7 instanceof Error ? { name: n7.name, message: n7.message } : { message: String(n7) }, dn(e5, s5), n7;
8047
+ const s7 = Date.now(), r6 = _(e5, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s7 });
8048
+ throw r6.durationMs = s7 - a5, r6.meta = { op: "set", key: t5 }, r6.error = n7 instanceof Error ? { name: n7.name, message: n7.message } : { message: String(n7) }, dn(e5, r6), n7;
8033
8049
  }
8034
8050
  }, t4.delete = async (t5) => {
8035
- const n6 = Date.now(), r7 = _(e5, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
8036
- r7.meta = { op: "delete", key: t5 }, dn(e5, r7);
8051
+ const n6 = Date.now(), s6 = _(e5, { stepId: o4, stepType: "store", phase: "in", eventId: "", now: n6 });
8052
+ s6.meta = { op: "delete", key: t5 }, dn(e5, s6);
8037
8053
  try {
8038
8054
  await a4(t5);
8039
- const r8 = Date.now(), s5 = _(e5, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: r8 });
8040
- s5.durationMs = r8 - n6, s5.meta = { op: "delete", key: t5 }, dn(e5, s5);
8041
- } catch (r8) {
8042
- const s5 = Date.now(), a5 = _(e5, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: s5 });
8043
- throw a5.durationMs = s5 - n6, a5.meta = { op: "delete", key: t5 }, a5.error = r8 instanceof Error ? { name: r8.name, message: r8.message } : { message: String(r8) }, dn(e5, a5), r8;
8055
+ const s7 = Date.now(), r6 = _(e5, { stepId: o4, stepType: "store", phase: "out", eventId: "", now: s7 });
8056
+ r6.durationMs = s7 - n6, r6.meta = { op: "delete", key: t5 }, dn(e5, r6);
8057
+ } catch (s7) {
8058
+ const r6 = Date.now(), a5 = _(e5, { stepId: o4, stepType: "store", phase: "error", eventId: "", now: r6 });
8059
+ throw a5.durationMs = r6 - n6, a5.meta = { op: "delete", key: t5 }, a5.error = s7 instanceof Error ? { name: s7.name, message: s7.message } : { message: String(s7) }, dn(e5, a5), s7;
8044
8060
  }
8045
8061
  };
8046
8062
  }
8047
- async function In2(e5, t4 = {}) {
8063
+ async function Cn2(e5, t4 = {}) {
8048
8064
  const n5 = {};
8049
- for (const [o5, r7] of Object.entries(t4)) {
8050
- const { code: t5, config: s4 = {}, env: a4 = {} } = r7, i5 = e5.logger.scope("store").scope(o5), c2 = { collector: e5, logger: i5, id: o5, config: s4, env: a4, reportError: ie2(e5, "store", o5, i5) }, u3 = await t5(c2);
8065
+ for (const [o5, s6] of Object.entries(t4)) {
8066
+ const { code: t5, config: r5 = {}, env: a4 = {} } = s6, i5 = e5.logger.scope("store").scope(o5), c2 = { collector: e5, logger: i5, id: o5, config: r5, env: a4, reportError: ce2(e5, "store", o5, i5) }, u3 = await t5(c2);
8051
8067
  n5[o5] = u3;
8052
8068
  }
8053
- const o4 = t4, r6 = (function(e6) {
8069
+ const o4 = t4, s5 = (function(e6) {
8054
8070
  const t5 = {};
8055
8071
  for (const n7 of Object.keys(e6)) t5[n7] = "WHITE";
8056
8072
  const n6 = [], o5 = [];
8057
- function r7(s4) {
8058
- const a4 = t5[s4];
8073
+ function s6(r5) {
8074
+ const a4 = t5[r5];
8059
8075
  if ("BLACK" === a4) return;
8060
8076
  if ("GRAY" === a4) {
8061
- const e7 = o5.indexOf(s4), t6 = o5.slice(-1 === e7 ? 0 : e7).concat(s4).join(" -> ");
8077
+ const e7 = o5.indexOf(r5), t6 = o5.slice(-1 === e7 ? 0 : e7).concat(r5).join(" -> ");
8062
8078
  throw new Error(`Cycle in cache.store chain: ${t6}`);
8063
8079
  }
8064
- t5[s4] = "GRAY", o5.push(s4);
8065
- const i5 = e6[s4].cache?.store;
8080
+ t5[r5] = "GRAY", o5.push(r5);
8081
+ const i5 = e6[r5].cache?.store;
8066
8082
  if (void 0 !== i5) {
8067
- if (!(i5 in e6)) throw new Error(`Store "${s4}" cache.store references "${i5}", which is not declared in flow.stores`);
8068
- r7(i5);
8083
+ if (!(i5 in e6)) throw new Error(`Store "${r5}" cache.store references "${i5}", which is not declared in flow.stores`);
8084
+ s6(i5);
8069
8085
  }
8070
- o5.pop(), t5[s4] = "BLACK", n6.push(s4);
8086
+ o5.pop(), t5[r5] = "BLACK", n6.push(r5);
8071
8087
  }
8072
- for (const n7 of Object.keys(e6)) "WHITE" === t5[n7] && r7(n7);
8088
+ for (const n7 of Object.keys(e6)) "WHITE" === t5[n7] && s6(n7);
8073
8089
  return n6;
8074
8090
  })(o4);
8075
- for (const t5 of r6) {
8076
- const r7 = o4[t5].cache;
8077
- if (!r7) continue;
8078
- let s4, a4;
8079
- void 0 !== r7.store ? (s4 = n5[r7.store], a4 = r7.store) : (n5.__cache || (n5.__cache = mn2()), s4 = n5.__cache, a4 = "__cache");
8080
- const i5 = r7.namespace ?? t5;
8081
- e5.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i5}:" via ${a4}`), n5[t5] = bn(n5[t5], { storeId: t5, cacheConfig: r7, cacheStore: s4, namespace: i5, logger: e5.logger.scope("store-cache").scope(t5), collector: e5 });
8082
- }
8083
- for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 && kn(e5, o5, t5);
8091
+ for (const t5 of s5) {
8092
+ const s6 = o4[t5].cache;
8093
+ if (!s6) continue;
8094
+ let r5, a4;
8095
+ void 0 !== s6.store ? (r5 = n5[s6.store], a4 = s6.store) : (n5.__cache || (n5.__cache = hn()), r5 = n5.__cache, a4 = "__cache");
8096
+ const i5 = s6.namespace ?? t5;
8097
+ e5.logger.scope("store-cache").scope(t5).info(`store "${t5}" caches with namespace "${i5}:" via ${a4}`), n5[t5] = kn(n5[t5], { storeId: t5, cacheConfig: s6, cacheStore: r5, namespace: i5, logger: e5.logger.scope("store-cache").scope(t5), collector: e5 });
8098
+ }
8099
+ for (const [t5, o5] of Object.entries(n5)) "__cache" !== t5 && In2(e5, o5, t5);
8084
8100
  return n5;
8085
8101
  }
8086
- async function Cn2(e5) {
8087
- const t4 = ce({ globalsStatic: {}, sessionStatic: {}, run: true, queueMax: 1e3 }, e5, { merge: false, extend: false }), n5 = { level: e5.logger?.level, handler: e5.logger?.handler }, o4 = Je(n5), r6 = { ...t4.globalsStatic, ...e5.globals }, s4 = { allowed: false, config: t4, consent: e5.consent || {}, custom: e5.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: r6, hooks: e5.hooks || {}, observers: /* @__PURE__ */ new Set(), logger: o4, on: {}, queue: [], preRunQueue: [], round: 0, count: 0, stateVersion: 0, cellVersion: {}, delivery: /* @__PURE__ */ new WeakMap(), session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {}, dropped: {}, connectionErrors: {}, breakers: {} }, timing: Date.now(), user: e5.user || {}, sources: {}, pending: { destinations: {} }, hasShutdown: false, seenEvents: /* @__PURE__ */ new Set(), push: void 0, command: void 0, elb: void 0 };
8088
- void 0 !== e5.name && (s4.name = e5.name), void 0 !== e5.release && (s4.release = e5.release), s4.push = un2(s4, (e6) => Nt(s4, e6)), s4.command = (function(e6, t5) {
8089
- return wt(async (n6, o5, r7) => await tt(async () => await t5(e6, n6, o5, r7), (t6) => {
8102
+ async function En2(e5) {
8103
+ const t4 = ce({ globalsStatic: {}, sessionStatic: {}, run: true, queueMax: 1e3 }, e5, { merge: false, extend: false }), n5 = { level: e5.logger?.level, handler: e5.logger?.handler }, o4 = Je(n5), s5 = { ...t4.globalsStatic, ...e5.globals }, r5 = { allowed: false, config: t4, consent: e5.consent || {}, custom: e5.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s5, hooks: e5.hooks || {}, observers: /* @__PURE__ */ new Set(), logger: o4, on: {}, queue: [], preRunQueue: [], round: 0, count: 0, stateVersion: 0, cellVersion: {}, delivery: /* @__PURE__ */ new WeakMap(), session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {}, dropped: {}, connectionErrors: {}, breakers: {} }, timing: Date.now(), user: e5.user || {}, sources: {}, pending: { destinations: {} }, hasShutdown: false, seenEvents: /* @__PURE__ */ new Set(), push: void 0, command: void 0, elb: void 0 };
8104
+ void 0 !== e5.name && (r5.name = e5.name), void 0 !== e5.release && (r5.release = e5.release), r5.push = dn2(r5, (e6) => Yt(r5, e6)), r5.command = (function(e6, t5) {
8105
+ return wt(async (n6, o5, s6) => await tt(async () => await t5(e6, n6, o5, s6), (t6) => {
8090
8106
  if (t6 instanceof nt) throw t6;
8091
- return e6.status.failed++, e6.logger.error("command failed", { command: n6, data: o5, error: t6 }), Mt2({ ok: false });
8107
+ return e6.status.failed++, e6.logger.error("command failed", { ...ie2(t6), command: n6 }), Tt2({ ok: false });
8092
8108
  })(), "Command", e6.hooks, e6.logger);
8093
- })(s4, Vt), s4.elb = /* @__PURE__ */ (function(e6) {
8094
- return async (t5, n6, o5, r7, s5) => {
8109
+ })(r5, Nt), r5.elb = /* @__PURE__ */ (function(e6) {
8110
+ return async (t5, n6, o5, s6, r6) => {
8095
8111
  if ("string" == typeof t5 && t5.startsWith("walker ")) {
8096
8112
  const o6 = t5.replace("walker ", "");
8097
8113
  return e6.command(o6, n6);
@@ -8099,43 +8115,43 @@ async function Cn2(e5) {
8099
8115
  let a5;
8100
8116
  if ("string" == typeof t5) a5 = { name: t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = n6);
8101
8117
  else {
8102
- if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return Mt2({ ok: false });
8118
+ if (!t5 || "object" != typeof t5 || Array.isArray(t5)) return Tt2({ ok: false });
8103
8119
  a5 = { ...t5 }, n6 && "object" == typeof n6 && !Array.isArray(n6) && (a5.data = { ...a5.data || {}, ...n6 });
8104
8120
  }
8105
- return o5 && "object" == typeof o5 && (a5.context = o5), r7 && Array.isArray(r7) && (a5.nested = r7), s5 && "object" == typeof s5 && (a5.custom = s5), e6.push(a5);
8121
+ return o5 && "object" == typeof o5 && (a5.context = o5), s6 && Array.isArray(s6) && (a5.nested = s6), r6 && "object" == typeof r6 && (a5.custom = r6), e6.push(a5);
8106
8122
  };
8107
- })(s4);
8123
+ })(r5);
8108
8124
  const a4 = e5.stores || {};
8109
- return s4.stores = await In2(s4, a4), (function(e6, t5, n6) {
8125
+ return r5.stores = await Cn2(r5, a4), (function(e6, t5, n6) {
8110
8126
  const o5 = /* @__PURE__ */ new Map();
8111
- for (const [n7, r8] of Object.entries(e6)) t5[n7] && o5.set(r8, t5[n7]);
8127
+ for (const [n7, s7] of Object.entries(e6)) t5[n7] && o5.set(s7, t5[n7]);
8112
8128
  if (0 !== o5.size) {
8113
- for (const e7 of [n6.transformers, n6.destinations, n6.sources]) if (e7) for (const t6 of Object.values(e7)) r7(t6.env);
8129
+ for (const e7 of [n6.transformers, n6.destinations, n6.sources]) if (e7) for (const t6 of Object.values(e7)) s6(t6.env);
8114
8130
  }
8115
- function r7(e7) {
8131
+ function s6(e7) {
8116
8132
  if (e7) {
8117
8133
  for (const [t6, n7] of Object.entries(e7)) if ("object" == typeof n7 && null !== n7) {
8118
- const r8 = o5.get(n7);
8119
- r8 && (e7[t6] = r8);
8134
+ const s7 = o5.get(n7);
8135
+ s7 && (e7[t6] = s7);
8120
8136
  }
8121
8137
  }
8122
8138
  }
8123
- })(a4, s4.stores, e5), s4.stores.__cache || (s4.stores.__cache = mn2()), s4.destinations = await _t2(s4, e5.destinations || {}), s4.transformers = await (async function(e6, t5 = {}) {
8139
+ })(a4, r5.stores, e5), r5.stores.__cache || (r5.stores.__cache = hn()), r5.destinations = await Pt(r5, e5.destinations || {}), r5.transformers = await (async function(e6, t5 = {}) {
8124
8140
  const n6 = {};
8125
- for (const [o5, r7] of Object.entries(t5)) {
8126
- const { code: t6, env: s5 = {} } = r7, a5 = Ir(r7, "Transformer");
8141
+ for (const [o5, s6] of Object.entries(t5)) {
8142
+ const { code: t6, env: r6 = {} } = s6, a5 = Ir(s6, "Transformer");
8127
8143
  if (!a5.ok) {
8128
8144
  e6.logger.warn(`Transformer ${o5} invalid (${a5.code}): ${a5.reason}. Skipping.`);
8129
8145
  continue;
8130
8146
  }
8131
- const { config: i5 } = Fe(r7, "before"), { config: c2 } = Fe({ ...r7, config: i5 }, "next"), u3 = Object.keys(s5).length > 0 ? { ...c2, env: s5 } : c2, { cache: d2 } = r7, l3 = d2 ? { ...u3, cache: d2 } : u3, f2 = r7.config?.state ?? r7.state, p3 = void 0 !== f2 && void 0 === l3.state ? { ...l3, state: f2 } : l3, g3 = e6.logger.scope("transformer").scope(o5), m3 = { collector: e6, logger: g3, id: o5, ingest: O(o5), config: p3, env: s5, reportError: ie2(e6, "transformer", o5, g3) }, h2 = t6 ?? ((e7) => {
8132
- const t7 = r7.mapping;
8147
+ const { config: i5 } = He2(s6, "before"), { config: c2 } = He2({ ...s6, config: i5 }, "next"), u3 = Object.keys(r6).length > 0 ? { ...c2, env: r6 } : c2, { cache: d2 } = s6, l3 = d2 ? { ...u3, cache: d2 } : u3, f2 = s6.config?.state ?? s6.state, p3 = void 0 !== f2 && void 0 === l3.state ? { ...l3, state: f2 } : l3, g3 = e6.logger.scope("transformer").scope(o5), m3 = { collector: e6, logger: g3, id: o5, ingest: O(o5), config: p3, env: r6, reportError: ce2(e6, "transformer", o5, g3) }, h2 = t6 ?? ((e7) => {
8148
+ const t7 = s6.mapping;
8133
8149
  if (t7) {
8134
8150
  const n7 = [];
8135
8151
  if (void 0 !== t7.data && n7.push("data"), t7.mapping) {
8136
- for (const [e8, o6] of Object.entries(t7.mapping)) if ("object" == typeof o6 && null !== o6) for (const [t8, r8] of Object.entries(o6)) {
8137
- if ("object" != typeof r8 || null === r8) continue;
8138
- const o7 = r8;
8152
+ for (const [e8, o6] of Object.entries(t7.mapping)) if ("object" == typeof o6 && null !== o6) for (const [t8, s7] of Object.entries(o6)) {
8153
+ if ("object" != typeof s7 || null === s7) continue;
8154
+ const o7 = s7;
8139
8155
  void 0 !== o7.data && n7.push(`mapping[${e8}][${t8}].data`), void 0 !== o7.silent && n7.push(`mapping[${e8}][${t8}].silent`);
8140
8156
  }
8141
8157
  }
@@ -8146,31 +8162,31 @@ async function Cn2(e5) {
8146
8162
  }
8147
8163
  return { type: "pass", config: e7.config, push: (e8) => ({ event: e8 }) };
8148
8164
  }), v3 = await h2(m3);
8149
- void 0 !== r7.before && void 0 === v3.config?.before && (v3.config = { ...v3.config ?? {}, before: r7.before }), void 0 !== r7.next && void 0 === v3.config?.next && (v3.config = { ...v3.config ?? {}, next: r7.next }), void 0 !== f2 && void 0 === v3.config?.state && (v3.config = { ...v3.config ?? {}, state: f2 }), n6[o5] = v3;
8165
+ void 0 !== s6.before && void 0 === v3.config?.before && (v3.config = { ...v3.config ?? {}, before: s6.before }), void 0 !== s6.next && void 0 === v3.config?.next && (v3.config = { ...v3.config ?? {}, next: s6.next }), void 0 !== f2 && void 0 === v3.config?.state && (v3.config = { ...v3.config ?? {}, state: f2 }), n6[o5] = v3;
8150
8166
  }
8151
8167
  return n6;
8152
- })(s4, e5.transformers || {}), s4;
8168
+ })(r5, e5.transformers || {}), r5;
8153
8169
  }
8154
- var En2 = globalThis;
8155
- function Sn(e5) {
8170
+ var Sn = globalThis;
8171
+ function qn2(e5) {
8156
8172
  try {
8157
- const t4 = En2.window;
8173
+ const t4 = Sn.window;
8158
8174
  if (!t4) return;
8159
8175
  t4.localStorage.getItem(Rt) === e5 && t4.localStorage.removeItem(Rt);
8160
8176
  } catch {
8161
8177
  }
8162
8178
  }
8163
- function qn2(e5, t4) {
8179
+ function xn2(e5, t4) {
8164
8180
  return void 0 === t4 ? e5 : (n5) => e5({ ...n5, release: t4 });
8165
8181
  }
8166
- function xn2(e5, t4) {
8182
+ function On2(e5, t4) {
8167
8183
  if (t4.observers) for (const n6 of t4.observers) e5.observers.add(n6);
8168
8184
  const n5 = t4.observe;
8169
8185
  if (!n5) return;
8170
8186
  const o4 = e5.name ?? "default";
8171
8187
  if ("binding" in n5) {
8172
8188
  const t5 = (function() {
8173
- const e6 = En2.window, t6 = En2.URLSearchParams;
8189
+ const e6 = Sn.window, t6 = Sn.URLSearchParams;
8174
8190
  if (!e6 || !t6) return null;
8175
8191
  try {
8176
8192
  const n6 = new t6(e6.location.search.replace(/^\?/, "")).getAll(Rt);
@@ -8178,52 +8194,52 @@ function xn2(e5, t4) {
8178
8194
  } catch {
8179
8195
  return null;
8180
8196
  }
8181
- })(), r7 = t5 ?? (function() {
8197
+ })(), s6 = t5 ?? (function() {
8182
8198
  try {
8183
- return En2.window?.localStorage.getItem(Rt) ?? null;
8199
+ return Sn.window?.localStorage.getItem(Rt) ?? null;
8184
8200
  } catch {
8185
8201
  return null;
8186
8202
  }
8187
8203
  })();
8188
- if (!r7) return;
8189
- const u3 = Cn(r7);
8190
- if (!u3) return void (null === t5 ? (e5.logger.warn("observe: malformed stored credential cleared"), Sn(r7)) : e5.logger.warn("observe: malformed credential ignored"));
8204
+ if (!s6) return;
8205
+ const u3 = Cn(s6);
8206
+ if (!u3) return void (null === t5 ? (e5.logger.warn("observe: malformed stored credential cleared"), qn2(s6)) : e5.logger.warn("observe: malformed credential ignored"));
8191
8207
  if (u3.pb !== n5.binding) return void e5.logger.warn("observe: credential binding mismatch, credential ignored");
8192
8208
  let d2;
8193
8209
  !(function(e6) {
8194
8210
  try {
8195
- En2.window?.localStorage.setItem(Rt, e6);
8211
+ Sn.window?.localStorage.setItem(Rt, e6);
8196
8212
  } catch {
8197
8213
  }
8198
- })(r7), null !== t5 && (function() {
8199
- const e6 = En2.window, t6 = En2.URLSearchParams;
8214
+ })(s6), null !== t5 && (function() {
8215
+ const e6 = Sn.window, t6 = Sn.URLSearchParams;
8200
8216
  if (e6 && t6) try {
8201
- const n6 = e6.location.href, o5 = n6.indexOf("#"), r8 = o5 >= 0 ? n6.slice(o5) : "", a4 = o5 >= 0 ? n6.slice(0, o5) : n6, i5 = a4.indexOf("?"), c2 = i5 >= 0 ? a4.slice(0, i5) : a4, u4 = new t6(i5 >= 0 ? a4.slice(i5 + 1) : "");
8217
+ const n6 = e6.location.href, o5 = n6.indexOf("#"), s7 = o5 >= 0 ? n6.slice(o5) : "", a4 = o5 >= 0 ? n6.slice(0, o5) : n6, i5 = a4.indexOf("?"), c2 = i5 >= 0 ? a4.slice(0, i5) : a4, u4 = new t6(i5 >= 0 ? a4.slice(i5 + 1) : "");
8202
8218
  u4.delete(Rt);
8203
8219
  const d3 = u4.toString();
8204
- e6.history.replaceState({}, "", `${c2}${d3 ? `?${d3}` : ""}${r8}`);
8220
+ e6.history.replaceState({}, "", `${c2}${d3 ? `?${d3}` : ""}${s7}`);
8205
8221
  } catch {
8206
8222
  }
8207
8223
  })();
8208
8224
  const l3 = mn({ url: `${n5.url}/ingest/${u3.ses}`, token: u3.secret, headers: { "X-Walkeros-Binding": n5.binding }, onStatus: (t6) => {
8209
- 401 === t6 && (Sn(r7), d2 && e5.observers.delete(d2));
8225
+ 401 === t6 && (qn2(s6), d2 && e5.observers.delete(d2));
8210
8226
  } });
8211
8227
  d2 = $t(/* @__PURE__ */ (function(e6, t6) {
8212
8228
  return void 0 === t6 ? e6 : (n6) => e6({ ...n6, flowId: t6 });
8213
- })(qn2(l3, e5.release), n5.flowId), { flowId: n5.flowId ?? o4, ...void 0 !== n5.level ? { level: n5.level } : {}, ...void 0 !== n5.sample ? { sample: n5.sample } : {} }), e5.observers.add(d2);
8229
+ })(xn2(l3, e5.release), n5.flowId), { flowId: n5.flowId ?? o4, ...void 0 !== n5.level ? { level: n5.level } : {}, ...void 0 !== n5.sample ? { sample: n5.sample } : {} }), e5.observers.add(d2);
8214
8230
  const f2 = n5.level;
8215
8231
  return void (void 0 !== f2 && (e5.observeLevel = () => f2));
8216
8232
  }
8217
8233
  if ("off" === n5.level) return;
8218
- const r6 = n5.level;
8219
- void 0 !== r6 && (e5.observeLevel = () => r6), e5.observers.add($t(qn2(mn({ url: `${n5.url}/ingest/${n5.sessionId}`, token: n5.token }), e5.release), { flowId: o4, level: n5.level, sample: n5.sample }));
8234
+ const s5 = n5.level;
8235
+ void 0 !== s5 && (e5.observeLevel = () => s5), e5.observers.add($t(xn2(mn({ url: `${n5.url}/ingest/${n5.sessionId}`, token: n5.token }), e5.release), { flowId: o4, level: n5.level, sample: n5.sample }));
8220
8236
  }
8221
- async function On2(e5) {
8237
+ async function jn2(e5) {
8222
8238
  e5 = e5 || {};
8223
- const t4 = await Cn2(e5);
8224
- xn2(t4, e5), await Ze2(t4, e5.sources || {});
8225
- const { consent: n5, user: o4, globals: r6, custom: s4 } = e5;
8226
- n5 && await t4.command("consent", n5), o4 && await t4.command("user", o4), r6 && await t4.command("globals", r6), s4 && await t4.command("custom", s4), t4.config.run && await t4.command("run");
8239
+ const t4 = await En2(e5);
8240
+ On2(t4, e5), await et2(t4, e5.sources || {});
8241
+ const { consent: n5, user: o4, globals: s5, custom: r5 } = e5;
8242
+ n5 && await t4.command("consent", n5), o4 && await t4.command("user", o4), s5 && await t4.command("globals", s5), r5 && await t4.command("custom", r5), t4.config.run && await t4.command("run");
8227
8243
  let a4 = t4.elb;
8228
8244
  const i5 = Object.values(t4.sources), c2 = i5.find((e6) => e6.config.primary);
8229
8245
  return c2 ? a4 = c2.push : i5.length > 0 && (a4 = i5[0].push), { collector: t4, elb: a4 };
@@ -8378,7 +8394,7 @@ async function createEmitter(opts) {
8378
8394
  }
8379
8395
  }
8380
8396
  };
8381
- const { elb } = await On2(collectorConfig);
8397
+ const { elb } = await jn2(collectorConfig);
8382
8398
  elbFn = elb;
8383
8399
  return elbFn;
8384
8400
  }
@@ -9170,7 +9186,7 @@ async function runPushCommand(options) {
9170
9186
  async function runDestinationSimulationLoop(config, event, destinationIds, options) {
9171
9187
  const startTime = Date.now();
9172
9188
  for (const destinationId of destinationIds) {
9173
- const r6 = await simulateDestination(config, event, {
9189
+ const r5 = await simulateDestination(config, event, {
9174
9190
  destinationId,
9175
9191
  flow: options.flow,
9176
9192
  mock: options.mock,
@@ -9178,11 +9194,11 @@ async function runDestinationSimulationLoop(config, event, destinationIds, optio
9178
9194
  verbose: options.verbose,
9179
9195
  snapshot: options.snapshot
9180
9196
  });
9181
- if (r6.error) {
9197
+ if (r5.error) {
9182
9198
  return {
9183
9199
  success: false,
9184
9200
  duration: Date.now() - startTime,
9185
- error: `simulate destination.${destinationId}: ${r6.error.message}`
9201
+ error: `simulate destination.${destinationId}: ${r5.error.message}`
9186
9202
  };
9187
9203
  }
9188
9204
  }
@@ -9482,8 +9498,8 @@ function collectFailedDestinations(collector) {
9482
9498
  const destStatus = view.status?.destinations;
9483
9499
  if (!destStatus) return [];
9484
9500
  const failed = [];
9485
- for (const [id, s4] of Object.entries(destStatus)) {
9486
- if (s4 && typeof s4.failed === "number" && s4.failed > 0) failed.push(id);
9501
+ for (const [id, s5] of Object.entries(destStatus)) {
9502
+ if (s5 && typeof s5.failed === "number" && s5.failed > 0) failed.push(id);
9487
9503
  }
9488
9504
  return failed;
9489
9505
  }
@@ -9679,7 +9695,7 @@ async function simulateTransformer(configOrPath, event, options) {
9679
9695
  `Transformer "${options.transformerId}" not found in collector. Available: ${Object.keys(collector.transformers || {}).join(", ") || "none"}`
9680
9696
  );
9681
9697
  }
9682
- const initialized = await Ge2(
9698
+ const initialized = await We2(
9683
9699
  collector,
9684
9700
  transformer,
9685
9701
  options.transformerId
@@ -9706,7 +9722,7 @@ async function simulateTransformer(configOrPath, event, options) {
9706
9722
  processedEvent
9707
9723
  );
9708
9724
  if (beforeChainIds.length > 0) {
9709
- const beforeResult = await Qe2(
9725
+ const beforeResult = await Ve2(
9710
9726
  collector,
9711
9727
  collector.transformers,
9712
9728
  beforeChainIds,
@@ -9728,7 +9744,7 @@ async function simulateTransformer(configOrPath, event, options) {
9728
9744
  processedEvent = Array.isArray(beforeResult) ? beforeResult[0] : beforeResult;
9729
9745
  }
9730
9746
  }
9731
- const pushResult = await We2(
9747
+ const pushResult = await Le2(
9732
9748
  collector,
9733
9749
  transformer,
9734
9750
  options.transformerId,
@@ -9738,9 +9754,9 @@ async function simulateTransformer(configOrPath, event, options) {
9738
9754
  if (pushResult === false) {
9739
9755
  captured.push({ event: null, timestamp: Date.now() });
9740
9756
  } else if (Array.isArray(pushResult)) {
9741
- for (const r6 of pushResult) {
9757
+ for (const r5 of pushResult) {
9742
9758
  captured.push({
9743
- event: r6.event || processedEvent,
9759
+ event: r5.event || processedEvent,
9744
9760
  timestamp: Date.now()
9745
9761
  });
9746
9762
  }
@@ -9851,7 +9867,7 @@ async function simulateCollector(configOrPath, event, options) {
9851
9867
  if (options.state.timing !== void 0)
9852
9868
  collector.timing = options.state.timing;
9853
9869
  }
9854
- const enriched = Jt(collector, event);
9870
+ const enriched = Xt(collector, event);
9855
9871
  const captured = [{ event: enriched, timestamp: Date.now() }];
9856
9872
  await collector.command("shutdown");
9857
9873
  return buildSimulationResult({
@@ -12631,8 +12647,8 @@ var EMAIL = (input) => {
12631
12647
  var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
12632
12648
  var IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
12633
12649
  var DURATION = (input) => input.length > 1 && input.length < 80 && (/^P\d+([.,]\d+)?W$/.test(input) || /^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) && /^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input));
12634
- function bind(r6) {
12635
- return r6.test.bind(r6);
12650
+ function bind(r5) {
12651
+ return r5.test.bind(r5);
12636
12652
  }
12637
12653
  var format = {
12638
12654
  date,
@@ -12706,16 +12722,16 @@ var OutputFormat;
12706
12722
  })(OutputFormat || (OutputFormat = {}));
12707
12723
 
12708
12724
  // ../../node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js
12709
- function ucs2length(s4) {
12725
+ function ucs2length(s5) {
12710
12726
  let result = 0;
12711
- let length = s4.length;
12727
+ let length = s5.length;
12712
12728
  let index = 0;
12713
12729
  let charCode;
12714
12730
  while (index < length) {
12715
12731
  result++;
12716
- charCode = s4.charCodeAt(index++);
12732
+ charCode = s5.charCodeAt(index++);
12717
12733
  if (charCode >= 55296 && charCode <= 56319 && index < length) {
12718
- charCode = s4.charCodeAt(index);
12734
+ charCode = s5.charCodeAt(index);
12719
12735
  if ((charCode & 64512) == 56320) {
12720
12736
  index++;
12721
12737
  }
@@ -13506,34 +13522,34 @@ var Validator = class {
13506
13522
  };
13507
13523
 
13508
13524
  // ../transformers/validate/dist/index.mjs
13509
- var r5 = Object.freeze({ $schema: "http://json-schema.org/draft-07/schema#", description: "Partial event structure with all fields optional", allOf: [{ $ref: "#/definitions/WalkerOSPartialEvent" }], definitions: { WalkerOSProperty: { title: "WalkerOS.Property", description: "PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays.", anyOf: [{ $ref: "#/definitions/WalkerOSPropertyType" }, { type: "array", items: { $ref: "#/definitions/WalkerOSPropertyType" } }] }, WalkerOSPropertyType: { title: "WalkerOS.PropertyType", description: "Base property value types (boolean, string, number, or nested Property record).", anyOf: [{ type: "boolean" }, { type: "string" }, { type: "number" }, { type: "object", propertyNames: { type: "string" }, additionalProperties: { $ref: "#/definitions/WalkerOSProperty" } }] }, WalkerOSProperties: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Flexible property collection with optional values." }, WalkerOSOrderedProperties: { type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "array", items: [{ $ref: "#/definitions/WalkerOSProperty" }, { type: "number" }] }, title: "WalkerOS.OrderedProperties", description: "Ordered properties with [value, order] tuples for priority control." }, WalkerOSUser: { allOf: [{ description: "Flexible property collection with optional values", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, { type: "object", properties: { id: { description: "User identifier", type: "string" }, device: { description: "Device identifier", type: "string" }, session: { description: "Session identifier", type: "string" }, hash: { description: "Hashed identifier", type: "string" }, address: { description: "User address", type: "string" }, email: { description: "User email address", type: "string", format: "email", pattern: "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, phone: { description: "User phone number", type: "string" }, userAgent: { description: "Browser user agent string", type: "string" }, browser: { description: "Browser name", type: "string" }, browserVersion: { description: "Browser version", type: "string" }, deviceType: { description: "Device type (mobile, desktop, tablet)", type: "string" }, os: { description: "Operating system", type: "string" }, osVersion: { description: "Operating system version", type: "string" }, screenSize: { description: "Screen dimensions", type: "string" }, language: { description: "User language", type: "string" }, country: { description: "User country", type: "string" }, region: { description: "User region/state", type: "string" }, city: { description: "User city", type: "string" }, zip: { description: "User postal code", type: "string" }, timezone: { description: "User timezone", type: "string" }, ip: { description: "User IP address", type: "string" }, internal: { description: "Internal user flag (employee, test user)", type: "boolean" } }, additionalProperties: false }], title: "WalkerOS.User", description: "User identification and attributes." }, __schema0: { description: "Nested entity structure with recursive nesting support", $ref: "#/definitions/WalkerOSEntity" }, WalkerOSEntity: { title: "WalkerOS.Entity", description: "Nested entity structure with recursive nesting support.", type: "object", properties: { entity: { type: "string", description: "Entity name" }, data: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Entity-specific properties", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, nested: { description: "Nested child entities", type: "array", items: { $ref: "#/definitions/__schema0" } }, context: { description: "Entity context data", allOf: [{ $ref: "#/definitions/WalkerOSOrderedProperties" }] } }, required: ["entity", "data"], additionalProperties: false }, WalkerOSEntities: { type: "array", items: { $ref: "#/definitions/__schema0" }, title: "WalkerOS.Entities", description: "Array of nested entities." }, WalkerOSConsent: { type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "boolean" }, title: "WalkerOS.Consent", description: "Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied." }, WalkerOSSource: { allOf: [{ description: "Flexible property collection with optional values", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, { type: "object", properties: { type: { type: "string", description: "Source kind (browser, dataLayer, gtag, ...)" }, platform: { description: "Runtime platform (web, server, app, ios, android, terminal, ...)", type: "string" }, version: { description: "Deployment version of the source emitter", type: "string" }, schema: { description: 'Event model spec version (collector defaults to "4")', type: "string" }, count: { description: "Emission sequence per run", type: "integer", minimum: 0, maximum: 9007199254740991 }, trace: { description: "Trace id shared by every event of a run (W3C trace-id shape)", type: "string" }, release: { description: "Per-flow config release map, keyed by flow name; accumulates across walkerOS crossings", type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "string" } }, url: { type: "string" }, referrer: { type: "string" }, tool: { type: "string" }, command: { type: "string" } }, required: ["type"], additionalProperties: false }], title: "WalkerOS.Source", description: "Event source information (origin of the event)." }, WalkerOSPartialEvent: { type: "object", properties: { name: { type: "string", description: 'Event name in "entity action" format (e.g., "page view", "product add")' }, data: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Event-specific properties", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, context: { type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "array", items: [{ $ref: "#/definitions/WalkerOSProperty" }, { type: "number" }] }, title: "WalkerOS.OrderedProperties", description: "Ordered context properties with priorities", allOf: [{ $ref: "#/definitions/WalkerOSOrderedProperties" }] }, globals: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Global properties shared across events", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, custom: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Custom implementation-specific properties", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, user: { allOf: [{ description: "Flexible property collection with optional values", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, { type: "object", properties: { id: { description: "User identifier", type: "string" }, device: { description: "Device identifier", type: "string" }, session: { description: "Session identifier", type: "string" }, hash: { description: "Hashed identifier", type: "string" }, address: { description: "User address", type: "string" }, email: { description: "User email address", type: "string", format: "email", pattern: "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, phone: { description: "User phone number", type: "string" }, userAgent: { description: "Browser user agent string", type: "string" }, browser: { description: "Browser name", type: "string" }, browserVersion: { description: "Browser version", type: "string" }, deviceType: { description: "Device type (mobile, desktop, tablet)", type: "string" }, os: { description: "Operating system", type: "string" }, osVersion: { description: "Operating system version", type: "string" }, screenSize: { description: "Screen dimensions", type: "string" }, language: { description: "User language", type: "string" }, country: { description: "User country", type: "string" }, region: { description: "User region/state", type: "string" }, city: { description: "User city", type: "string" }, zip: { description: "User postal code", type: "string" }, timezone: { description: "User timezone", type: "string" }, ip: { description: "User IP address", type: "string" }, internal: { description: "Internal user flag (employee, test user)", type: "boolean" } }, additionalProperties: false }], title: "WalkerOS.User", description: "User identification and attributes" }, nested: { type: "array", items: { $ref: "#/definitions/__schema0" }, title: "WalkerOS.Entities", description: "Related nested entities", allOf: [{ $ref: "#/definitions/WalkerOSEntities" }] }, consent: { type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "boolean" }, title: "WalkerOS.Consent", description: "Consent states at event time", allOf: [{ $ref: "#/definitions/WalkerOSConsent" }] }, id: { type: "string", minLength: 1, description: "W3C span_id, 16 lowercase hex characters" }, trigger: { type: "string", description: "Event trigger identifier" }, entity: { type: "string", description: "Parsed entity from event name" }, action: { type: "string", description: "Parsed action from event name" }, timestamp: { type: "integer", exclusiveMinimum: 0, maximum: 9007199254740991, description: "Unix timestamp in milliseconds since epoch" }, timing: { type: "number", description: "Event processing timing information" }, source: { allOf: [{ description: "Flexible property collection with optional values", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, { type: "object", properties: { type: { type: "string", description: "Source kind (browser, dataLayer, gtag, ...)" }, platform: { description: "Runtime platform (web, server, app, ios, android, terminal, ...)", type: "string" }, version: { description: "Deployment version of the source emitter", type: "string" }, schema: { description: 'Event model spec version (collector defaults to "4")', type: "string" }, count: { description: "Emission sequence per run", type: "integer", minimum: 0, maximum: 9007199254740991 }, trace: { description: "Trace id shared by every event of a run (W3C trace-id shape)", type: "string" }, release: { description: "Per-flow config release map, keyed by flow name; accumulates across walkerOS crossings", type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "string" } }, url: { type: "string" }, referrer: { type: "string" }, tool: { type: "string" }, command: { type: "string" } }, required: ["type"], additionalProperties: false }], title: "WalkerOS.Source", description: "Event source information" } }, additionalProperties: false, title: "WalkerOS.PartialEvent", description: "Partial event structure with all fields optional." } } });
13525
+ var r4 = Object.freeze({ $schema: "http://json-schema.org/draft-07/schema#", description: "Partial event structure with all fields optional", allOf: [{ $ref: "#/definitions/WalkerOSPartialEvent" }], definitions: { WalkerOSProperty: { title: "WalkerOS.Property", description: "PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays.", anyOf: [{ $ref: "#/definitions/WalkerOSPropertyType" }, { type: "array", items: { $ref: "#/definitions/WalkerOSPropertyType" } }] }, WalkerOSPropertyType: { title: "WalkerOS.PropertyType", description: "Base property value types (boolean, string, number, or nested Property record).", anyOf: [{ type: "boolean" }, { type: "string" }, { type: "number" }, { type: "object", propertyNames: { type: "string" }, additionalProperties: { $ref: "#/definitions/WalkerOSProperty" } }] }, WalkerOSProperties: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Flexible property collection with optional values." }, WalkerOSOrderedProperties: { type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "array", items: [{ $ref: "#/definitions/WalkerOSProperty" }, { type: "number" }] }, title: "WalkerOS.OrderedProperties", description: "Ordered properties with [value, order] tuples for priority control." }, WalkerOSUser: { allOf: [{ description: "Flexible property collection with optional values", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, { type: "object", properties: { id: { description: "User identifier", type: "string" }, device: { description: "Device identifier", type: "string" }, session: { description: "Session identifier", type: "string" }, hash: { description: "Hashed identifier", type: "string" }, address: { description: "User address", type: "string" }, email: { description: "User email address", type: "string", format: "email", pattern: "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, phone: { description: "User phone number", type: "string" }, userAgent: { description: "Browser user agent string", type: "string" }, browser: { description: "Browser name", type: "string" }, browserVersion: { description: "Browser version", type: "string" }, deviceType: { description: "Device type (mobile, desktop, tablet)", type: "string" }, os: { description: "Operating system", type: "string" }, osVersion: { description: "Operating system version", type: "string" }, screenSize: { description: "Screen dimensions", type: "string" }, language: { description: "User language", type: "string" }, country: { description: "User country", type: "string" }, region: { description: "User region/state", type: "string" }, city: { description: "User city", type: "string" }, zip: { description: "User postal code", type: "string" }, timezone: { description: "User timezone", type: "string" }, ip: { description: "User IP address", type: "string" }, internal: { description: "Internal user flag (employee, test user)", type: "boolean" } }, additionalProperties: false }], title: "WalkerOS.User", description: "User identification and attributes." }, __schema0: { description: "Nested entity structure with recursive nesting support", $ref: "#/definitions/WalkerOSEntity" }, WalkerOSEntity: { title: "WalkerOS.Entity", description: "Nested entity structure with recursive nesting support.", type: "object", properties: { entity: { type: "string", description: "Entity name" }, data: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Entity-specific properties", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, nested: { description: "Nested child entities", type: "array", items: { $ref: "#/definitions/__schema0" } }, context: { description: "Entity context data", allOf: [{ $ref: "#/definitions/WalkerOSOrderedProperties" }] } }, required: ["entity", "data"], additionalProperties: false }, WalkerOSEntities: { type: "array", items: { $ref: "#/definitions/__schema0" }, title: "WalkerOS.Entities", description: "Array of nested entities." }, WalkerOSConsent: { type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "boolean" }, title: "WalkerOS.Consent", description: "Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied." }, WalkerOSSource: { allOf: [{ description: "Flexible property collection with optional values", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, { type: "object", properties: { type: { type: "string", description: "Source kind (browser, dataLayer, gtag, ...)" }, platform: { description: "Runtime platform (web, server, app, ios, android, terminal, ...)", type: "string" }, version: { description: "Deployment version of the source emitter", type: "string" }, schema: { description: 'Event model spec version (collector defaults to "4")', type: "string" }, count: { description: "Emission sequence per run", type: "integer", minimum: 0, maximum: 9007199254740991 }, trace: { description: "Trace id shared by every event of a run (W3C trace-id shape)", type: "string" }, release: { description: "Per-flow config release map, keyed by flow name; accumulates across walkerOS crossings", type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "string" } }, url: { type: "string" }, referrer: { type: "string" }, tool: { type: "string" }, command: { type: "string" } }, required: ["type"], additionalProperties: false }], title: "WalkerOS.Source", description: "Event source information (origin of the event)." }, WalkerOSPartialEvent: { type: "object", properties: { name: { type: "string", description: 'Event name in "entity action" format (e.g., "page view", "product add")' }, data: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Event-specific properties", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, context: { type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "array", items: [{ $ref: "#/definitions/WalkerOSProperty" }, { type: "number" }] }, title: "WalkerOS.OrderedProperties", description: "Ordered context properties with priorities", allOf: [{ $ref: "#/definitions/WalkerOSOrderedProperties" }] }, globals: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Global properties shared across events", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, custom: { type: "object", propertyNames: { type: "string" }, additionalProperties: { allOf: [{ $ref: "#/definitions/WalkerOSProperty" }] }, title: "WalkerOS.Properties", description: "Custom implementation-specific properties", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, user: { allOf: [{ description: "Flexible property collection with optional values", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, { type: "object", properties: { id: { description: "User identifier", type: "string" }, device: { description: "Device identifier", type: "string" }, session: { description: "Session identifier", type: "string" }, hash: { description: "Hashed identifier", type: "string" }, address: { description: "User address", type: "string" }, email: { description: "User email address", type: "string", format: "email", pattern: "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, phone: { description: "User phone number", type: "string" }, userAgent: { description: "Browser user agent string", type: "string" }, browser: { description: "Browser name", type: "string" }, browserVersion: { description: "Browser version", type: "string" }, deviceType: { description: "Device type (mobile, desktop, tablet)", type: "string" }, os: { description: "Operating system", type: "string" }, osVersion: { description: "Operating system version", type: "string" }, screenSize: { description: "Screen dimensions", type: "string" }, language: { description: "User language", type: "string" }, country: { description: "User country", type: "string" }, region: { description: "User region/state", type: "string" }, city: { description: "User city", type: "string" }, zip: { description: "User postal code", type: "string" }, timezone: { description: "User timezone", type: "string" }, ip: { description: "User IP address", type: "string" }, internal: { description: "Internal user flag (employee, test user)", type: "boolean" } }, additionalProperties: false }], title: "WalkerOS.User", description: "User identification and attributes" }, nested: { type: "array", items: { $ref: "#/definitions/__schema0" }, title: "WalkerOS.Entities", description: "Related nested entities", allOf: [{ $ref: "#/definitions/WalkerOSEntities" }] }, consent: { type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "boolean" }, title: "WalkerOS.Consent", description: "Consent states at event time", allOf: [{ $ref: "#/definitions/WalkerOSConsent" }] }, id: { type: "string", minLength: 1, description: "W3C span_id, 16 lowercase hex characters" }, trigger: { type: "string", description: "Event trigger identifier" }, entity: { type: "string", description: "Parsed entity from event name" }, action: { type: "string", description: "Parsed action from event name" }, timestamp: { type: "integer", exclusiveMinimum: 0, maximum: 9007199254740991, description: "Unix timestamp in milliseconds since epoch" }, timing: { type: "number", description: "Event processing timing information" }, source: { allOf: [{ description: "Flexible property collection with optional values", allOf: [{ $ref: "#/definitions/WalkerOSProperties" }] }, { type: "object", properties: { type: { type: "string", description: "Source kind (browser, dataLayer, gtag, ...)" }, platform: { description: "Runtime platform (web, server, app, ios, android, terminal, ...)", type: "string" }, version: { description: "Deployment version of the source emitter", type: "string" }, schema: { description: 'Event model spec version (collector defaults to "4")', type: "string" }, count: { description: "Emission sequence per run", type: "integer", minimum: 0, maximum: 9007199254740991 }, trace: { description: "Trace id shared by every event of a run (W3C trace-id shape)", type: "string" }, release: { description: "Per-flow config release map, keyed by flow name; accumulates across walkerOS crossings", type: "object", propertyNames: { type: "string" }, additionalProperties: { type: "string" } }, url: { type: "string" }, referrer: { type: "string" }, tool: { type: "string" }, command: { type: "string" } }, required: ["type"], additionalProperties: false }], title: "WalkerOS.Source", description: "Event source information" } }, additionalProperties: false, title: "WalkerOS.PartialEvent", description: "Partial event structure with all fields optional." } } });
13510
13526
  var i4 = /* @__PURE__ */ new Map();
13511
- function s3(e5) {
13512
- const r6 = JSON.stringify(e5), s4 = i4.get(r6);
13513
- if (s4) return s4;
13514
- const n5 = JSON.parse(r6), o4 = new Validator(n5, "2020-12");
13515
- return i4.set(r6, o4), o4;
13527
+ function s4(e5) {
13528
+ const r5 = JSON.stringify(e5), s5 = i4.get(r5);
13529
+ if (s5) return s5;
13530
+ const n5 = JSON.parse(r5), o4 = new Validator(n5, "2020-12");
13531
+ return i4.set(r5, o4), o4;
13516
13532
  }
13517
13533
  function n4(e5) {
13518
13534
  if ("object" != typeof e5 || null === e5) return false;
13519
13535
  return "events" in e5 && "object" == typeof e5.events && null !== e5.events || "schema" in e5;
13520
13536
  }
13521
- function o3(e5, t4, r6) {
13522
- return e5[t4]?.[r6] ?? e5[t4]?.["*"] ?? e5["*"]?.[r6] ?? e5["*"]?.["*"];
13537
+ function o3(e5, t4, r5) {
13538
+ return e5[t4]?.[r5] ?? e5[t4]?.["*"] ?? e5["*"]?.[r5] ?? e5["*"]?.["*"];
13523
13539
  }
13524
13540
  function p2(e5, t4, i5) {
13525
13541
  const p3 = (function(e6, t5) {
13526
13542
  const i6 = [];
13527
- t5.format && i6.push(r5);
13528
- for (const r6 of t5.contracts ?? []) if (n4(r6)) {
13529
- const t6 = "string" == typeof e6.entity ? e6.entity : "", s4 = "string" == typeof e6.action ? e6.action : "", n5 = o3(r6.events ?? {}, t6, s4);
13530
- n5 && i6.push(n5), r6.schema && i6.push(r6.schema);
13531
- } else i6.push(r6);
13543
+ t5.format && i6.push(r4);
13544
+ for (const r5 of t5.contracts ?? []) if (n4(r5)) {
13545
+ const t6 = "string" == typeof e6.entity ? e6.entity : "", s5 = "string" == typeof e6.action ? e6.action : "", n5 = o3(r5.events ?? {}, t6, s5);
13546
+ n5 && i6.push(n5), r5.schema && i6.push(r5.schema);
13547
+ } else i6.push(r5);
13532
13548
  return i6;
13533
13549
  })(e5, i5), a4 = [];
13534
13550
  for (const t5 of p3) {
13535
- const r6 = s3(t5).validate(e5);
13536
- if (!r6.valid) for (const e6 of r6.errors) a4.push({ path: e6.instanceLocation, message: e6.error, level: "error" });
13551
+ const r5 = s4(t5).validate(e5);
13552
+ if (!r5.valid) for (const e6 of r5.errors) a4.push({ path: e6.instanceLocation, message: e6.error, level: "error" });
13537
13553
  }
13538
13554
  return { isValid: 0 === a4.length, errors: a4 };
13539
13555
  }
@@ -13771,7 +13787,7 @@ function flattenRouteTargets(spec) {
13771
13787
  }
13772
13788
  if (spec.length === 0) return [];
13773
13789
  if (typeof spec[0] === "string") {
13774
- return spec.filter((s4) => typeof s4 === "string");
13790
+ return spec.filter((s5) => typeof s5 === "string");
13775
13791
  }
13776
13792
  return Array.from(new Set(spec.flatMap(flattenRouteTargets)));
13777
13793
  }
@@ -14033,7 +14049,7 @@ function validateMapping(input) {
14033
14049
  });
14034
14050
  }
14035
14051
  const rule = mapping[pattern];
14036
- const isValidRule = Array.isArray(rule) ? rule.every((r6) => typeof r6 === "object" && r6 !== null) : typeof rule === "object" && rule !== null;
14052
+ const isValidRule = Array.isArray(rule) ? rule.every((r5) => typeof r5 === "object" && r5 !== null) : typeof rule === "object" && rule !== null;
14037
14053
  if (!isValidRule) {
14038
14054
  errors.push({
14039
14055
  path: pattern,
@@ -14054,7 +14070,7 @@ function validateMapping(input) {
14054
14070
  // src/commands/validate/validators/entry.ts
14055
14071
  init_dist();
14056
14072
  import Ajv from "ajv";
14057
- var CLIENT_HEADER = "walkeros-cli/4.5.0";
14073
+ var CLIENT_HEADER = "walkeros-cli/4.5.1-next-1788726985928";
14058
14074
  var SECTIONS = ["destinations", "sources", "transformers"];
14059
14075
  function resolveEntry(path20, flowConfig) {
14060
14076
  const flows = flowConfig.flows;
@@ -14426,7 +14442,7 @@ async function pollForToken(deviceCode, options = {}) {
14426
14442
  let intervalMs = options.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
14427
14443
  const deadline = Date.now() + timeoutMs;
14428
14444
  while (Date.now() < deadline) {
14429
- await new Promise((r6) => setTimeout(r6, intervalMs));
14445
+ await new Promise((r5) => setTimeout(r5, intervalMs));
14430
14446
  if (Date.now() >= deadline) break;
14431
14447
  const remaining = Math.max(1, deadline - Date.now());
14432
14448
  const controller = new AbortController();
@@ -14551,7 +14567,7 @@ async function login(options = {}) {
14551
14567
  const deadline = Date.now() + timeoutMs;
14552
14568
  while (Date.now() < deadline && attempts < options.maxPollAttempts) {
14553
14569
  attempts++;
14554
- await new Promise((r6) => setTimeout(r6, pollInterval));
14570
+ await new Promise((r5) => setTimeout(r5, pollInterval));
14555
14571
  const remaining = Math.max(1, deadline - Date.now());
14556
14572
  const controller = new AbortController();
14557
14573
  const timeoutHandle = setTimeout(() => controller.abort(), remaining);
@@ -14884,18 +14900,18 @@ async function deployCommand(flowId, options) {
14884
14900
  await writeResult(JSON.stringify(result, null, 2), options);
14885
14901
  return;
14886
14902
  }
14887
- const r6 = result;
14888
- if (r6.status === "published") {
14889
- log.info(`Published: ${r6.publicUrl}`);
14890
- } else if (r6.status === "active") {
14891
- log.info(`Active: ${r6.containerUrl}`);
14892
- } else if (r6.status === "failed") {
14893
- log.error(`Failed: ${r6.errorMessage || "Unknown error"}`);
14903
+ const r5 = result;
14904
+ if (r5.status === "published") {
14905
+ log.info(`Published: ${r5.publicUrl}`);
14906
+ } else if (r5.status === "active") {
14907
+ log.info(`Active: ${r5.containerUrl}`);
14908
+ } else if (r5.status === "failed") {
14909
+ log.error(`Failed: ${r5.errorMessage || "Unknown error"}`);
14894
14910
  process.exit(1);
14895
- } else if (r6.status === "deploying") {
14896
- log.info(`Deployment started: ${r6.deploymentId} (${r6.type})`);
14911
+ } else if (r5.status === "deploying") {
14912
+ log.info(`Deployment started: ${r5.deploymentId} (${r5.type})`);
14897
14913
  } else {
14898
- log.info(`Status: ${r6.status}`);
14914
+ log.info(`Status: ${r5.status}`);
14899
14915
  }
14900
14916
  } catch (err) {
14901
14917
  handleCliError(err);