@opencxh/domain 1.127.0 → 1.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
- function f(e) {
1
+ function S(e) {
2
2
  return e.replace(/<style[\s\S]*?<\/style>/gi, " ").replace(/<script[\s\S]*?<\/script>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/\s+/g, " ").trim();
3
3
  }
4
- function b(e) {
5
- const t = e.trim();
6
- return t.length <= 140 ? t : t.slice(0, 139).trimEnd() + "…";
4
+ function T(e) {
5
+ const n = e.trim();
6
+ return n.length <= 140 ? n : n.slice(0, 139).trimEnd() + "…";
7
7
  }
8
- function i(e) {
8
+ function c(e) {
9
9
  if (!e || e < 0) return "";
10
- const t = Math.floor(e / 60), n = Math.floor(e % 60);
11
- return `${t}:${n.toString().padStart(2, "0")}`;
10
+ const n = Math.floor(e / 60), t = Math.floor(e % 60);
11
+ return `${n}:${t.toString().padStart(2, "0")}`;
12
12
  }
13
- function A(e) {
13
+ function h(e) {
14
14
  switch (e.type) {
15
15
  case "EMAIL_RECEIVED":
16
16
  case "EMAIL_SENT": {
17
- const t = e.payload, n = t.bodySnippet?.trim() || f(t.body ?? "");
18
- return t.subject ? `${t.subject} — ${n}` : n;
17
+ const n = e.payload, t = n.bodySnippet?.trim() || S(n.body ?? "");
18
+ return n.subject ? `${n.subject} — ${t}` : t;
19
19
  }
20
20
  case "CHAT_MESSAGE_SENT":
21
21
  case "CHAT_MESSAGE_RECEIVED":
@@ -23,13 +23,13 @@ function A(e) {
23
23
  case "CHAT_RENAMED":
24
24
  return `Hernoemd naar "${e.payload.newName}"`;
25
25
  case "CHAT_MEMBER_JOINED":
26
- return `${e.payload.members.map((t) => t.name).join(", ")} toegevoegd`;
26
+ return `${e.payload.members.map((n) => n.name).join(", ")} toegevoegd`;
27
27
  case "CHAT_MEMBER_LEFT":
28
- return `${e.payload.members.map((t) => t.name).join(", ")} verlaten`;
28
+ return `${e.payload.members.map((n) => n.name).join(", ")} verlaten`;
29
29
  case "CHAT_CALL_STARTED":
30
30
  return "Gesprek gestart";
31
31
  case "CHAT_CALL_ENDED":
32
- return `Gesprek beëindigd${e.payload.duration ? ` (${i(e.payload.duration)})` : ""}`;
32
+ return `Gesprek beëindigd${e.payload.duration ? ` (${c(e.payload.duration)})` : ""}`;
33
33
  case "CHAT_EVENT":
34
34
  return e.payload.text ?? e.payload.eventType;
35
35
  case "VOICE_CALL_STARTED":
@@ -46,7 +46,7 @@ function A(e) {
46
46
  return "Hervat";
47
47
  case "VOICE_CALL_ENDED":
48
48
  case "VIDEO_CALL_ENDED":
49
- return `Gesprek beëindigd${e.payload.duration ? ` (${i(e.payload.duration)})` : ""}`;
49
+ return `Gesprek beëindigd${e.payload.duration ? ` (${c(e.payload.duration)})` : ""}`;
50
50
  case "VOICE_CALL_MISSED":
51
51
  case "VIDEO_CALL_MISSED":
52
52
  return "Gemiste oproep";
@@ -56,7 +56,7 @@ function A(e) {
56
56
  case "VOICE_CALL_VOICEMAIL":
57
57
  return e.payload.transcription?.trim() ? e.payload.transcription : "Voicemail ontvangen";
58
58
  case "TRANSCRIPT_ADDED":
59
- return (e.payload.segments ?? []).map((t) => t.text).join(" ");
59
+ return (e.payload.segments ?? []).map((n) => n.text).join(" ");
60
60
  case "AI_MESSAGE_ADDED":
61
61
  return e.payload.output?.text ?? e.payload.input?.text ?? "";
62
62
  case "AI_ACTION_PROPOSED":
@@ -72,7 +72,7 @@ function A(e) {
72
72
  case "MEETING_STARTED":
73
73
  return `Vergadering gestart: ${e.payload.title}`;
74
74
  case "MEETING_ENDED":
75
- return `Vergadering beëindigd${e.payload.duration ? ` (${i(e.payload.duration)})` : ""}`;
75
+ return `Vergadering beëindigd${e.payload.duration ? ` (${c(e.payload.duration)})` : ""}`;
76
76
  case "MEETING_PARTICIPANT_JOINED":
77
77
  return `${e.payload.name} deelgenomen`;
78
78
  case "MEETING_PARTICIPANT_LEFT":
@@ -91,23 +91,23 @@ function A(e) {
91
91
  return "";
92
92
  }
93
93
  }
94
- function j(e) {
94
+ function ie(e) {
95
95
  return {
96
96
  activityId: e.id,
97
97
  type: e.type,
98
- snippet: b(A(e)),
98
+ snippet: T(h(e)),
99
99
  authorName: e.author?.name ?? "",
100
100
  direction: e.direction,
101
101
  createdAt: e.createdAt ?? Date.now()
102
102
  };
103
103
  }
104
- function v(e, t, n = []) {
104
+ function se(e, n, t = []) {
105
105
  const r = e.createdAt;
106
106
  if (!r) return [];
107
- const a = new Set(n);
108
- return e.author.type === "user" && e.author.id && a.add(e.author.id), Object.entries(t).filter(([s, o]) => o >= r && !a.has(s)).map(([s]) => s);
107
+ const a = new Set(t);
108
+ return e.author.type === "user" && e.author.id && a.add(e.author.id), Object.entries(n).filter(([i, s]) => s >= r && !a.has(i)).map(([i]) => i);
109
109
  }
110
- const W = [
110
+ const oe = [
111
111
  { id: "agent", label: "Agent", labelSource: "user" },
112
112
  { id: "team", label: "Team", labelSource: "team" },
113
113
  { id: "inbox", label: "Inbox", labelSource: "inbox" },
@@ -117,57 +117,57 @@ const W = [
117
117
  { id: "handledBy", label: "Afhandelaar", labelSource: "raw" },
118
118
  { id: "time", label: "Tijd", labelSource: "raw" }
119
119
  ];
120
- function K(e) {
121
- const t = [];
122
- for (const n of Object.keys(e))
123
- for (const r of Object.keys(e[n]))
124
- t.push({ lang: n, key: r, value: e[n][r] });
125
- return t;
120
+ function le(e) {
121
+ const n = [];
122
+ for (const t of Object.keys(e))
123
+ for (const r of Object.keys(e[t]))
124
+ n.push({ lang: t, key: r, value: e[t][r] });
125
+ return n;
126
126
  }
127
- function l(e) {
127
+ function u(e) {
128
128
  return e < 10 ? `0${e}` : `${e}`;
129
129
  }
130
- function m(e, t) {
131
- const n = new Date(e), r = `${n.getUTCFullYear()}-${l(n.getUTCMonth() + 1)}-${l(n.getUTCDate())}`;
132
- return t === "day" ? r : `${r}T${l(n.getUTCHours())}`;
130
+ function D(e, n) {
131
+ const t = new Date(e), r = `${t.getUTCFullYear()}-${u(t.getUTCMonth() + 1)}-${u(t.getUTCDate())}`;
132
+ return n === "day" ? r : `${r}T${u(t.getUTCHours())}`;
133
133
  }
134
- function I(e, t) {
135
- const n = new Date(e);
136
- return n.setUTCMinutes(0, 0, 0), t === "day" && n.setUTCHours(0), n.getTime();
134
+ function C(e, n) {
135
+ const t = new Date(e);
136
+ return t.setUTCMinutes(0, 0, 0), n === "day" && t.setUTCHours(0), t.getTime();
137
137
  }
138
- const _ = 36e5, S = 864e5;
139
- function q(e, t, n) {
140
- const r = n === "hour" ? _ : S, a = [];
141
- for (let s = I(e, n); s <= t; s += r)
142
- a.push(m(s, n));
138
+ const O = 36e5, N = 864e5;
139
+ function ce(e, n, t) {
140
+ const r = t === "hour" ? O : N, a = [];
141
+ for (let i = C(e, t); i <= n; i += r)
142
+ a.push(D(i, t));
143
143
  return a;
144
144
  }
145
- const T = [
145
+ const L = [
146
146
  { id: "resource", label: "Resource", labelSource: "raw" },
147
147
  { id: "origin", label: "Herkomst", labelSource: "raw" }
148
- ], D = T.map((e) => e.id);
149
- function N(e, t) {
150
- return `${e}.usage.${t}`;
151
- }
152
- function Y(e, t) {
153
- return t.map((n) => ({
154
- id: N(e, n.unit),
155
- label: n.label,
148
+ ], R = L.map((e) => e.id);
149
+ function y(e, n) {
150
+ return `${e}.usage.${n}`;
151
+ }
152
+ function ue(e, n) {
153
+ return n.map((t) => ({
154
+ id: y(e, t.unit),
155
+ label: t.label,
156
156
  category: "Verbruik",
157
- valueType: n.valueType ?? "count",
157
+ valueType: t.valueType ?? "count",
158
158
  aggregation: "sum",
159
159
  supportedDimensions: [
160
160
  "provider",
161
- ...D,
162
- ...n.extraDimensions ?? [],
161
+ ...R,
162
+ ...t.extraDimensions ?? [],
163
163
  "time"
164
164
  ]
165
165
  }));
166
166
  }
167
- function z(e) {
167
+ function de(e) {
168
168
  return (e.startsWith("tool:") ? e.slice(5) : e).replace(/__/g, " · ").replace(/\./g, " · ").replace(/_/g, " ");
169
169
  }
170
- const X = [
170
+ const pe = [
171
171
  { name: "text", type: "string" },
172
172
  { name: "subject", type: "string" },
173
173
  { name: "from", type: "string" },
@@ -178,8 +178,19 @@ const X = [
178
178
  { name: "activityId", type: "string" },
179
179
  { name: "authorType", type: "string" },
180
180
  { name: "authorName", type: "string" },
181
- { name: "textRaw", type: "string" }
182
- ], J = {
181
+ { name: "textRaw", type: "string" },
182
+ // Alleen gevuld bij INTERACTION_STATUS_CHANGED; een filter als
183
+ // `trigger.toStatus == "closed"` is de trigger voor "onthoud dit bij afsluiten".
184
+ { name: "fromStatus", type: "string" },
185
+ { name: "toStatus", type: "string" },
186
+ // Met wie is dit gesprek. Dit stond hier eerder expliciet NIET, omdat het toen een gok via
187
+ // `remoteParty` zou zijn geweest; nu legt de identiteitslaag de resolutie vast als
188
+ // `contact:<id>`/`company:<id>` in `Interaction.partyKeys`, dus dit is een vastgelegd feit.
189
+ // Leeg zolang de identiteit niet is opgelost (een onbekend nummer, een eerste bericht van
190
+ // een nieuw adres) — een stap die hierop leunt hoort dus een `condition` te hebben.
191
+ { name: "contactId", type: "string" },
192
+ { name: "companyId", type: "string" }
193
+ ], fe = {
183
194
  topics: [
184
195
  { name: "topic", type: "string" },
185
196
  { name: "confidence", type: "number" }
@@ -190,7 +201,7 @@ const X = [
190
201
  ],
191
202
  extract: []
192
203
  };
193
- function h(e) {
204
+ function k(e) {
194
205
  switch (e.kind) {
195
206
  case "user":
196
207
  return `user:${e.userId}`;
@@ -200,22 +211,22 @@ function h(e) {
200
211
  return "org";
201
212
  }
202
213
  }
203
- function Q(e) {
214
+ function ge(e) {
204
215
  if (typeof e != "string") return;
205
- const t = e.trim();
206
- if (t === "org") return { kind: "org" };
207
- const n = t.indexOf(":");
208
- if (n <= 0) return;
209
- const r = t.slice(0, n), a = t.slice(n + 1).trim();
216
+ const n = e.trim();
217
+ if (n === "org") return { kind: "org" };
218
+ const t = n.indexOf(":");
219
+ if (t <= 0) return;
220
+ const r = n.slice(0, t), a = n.slice(t + 1).trim();
210
221
  if (a) {
211
222
  if (r === "user") return { kind: "user", userId: a };
212
223
  if (r === "team") return { kind: "team", teamId: a };
213
224
  }
214
225
  }
215
- function M(e) {
216
- return h(e);
226
+ function x(e) {
227
+ return k(e);
217
228
  }
218
- function Z(e) {
229
+ function Ee(e) {
219
230
  switch (e.kind) {
220
231
  case "personal":
221
232
  return { kind: "user", userId: e.userId };
@@ -225,20 +236,20 @@ function Z(e) {
225
236
  return { kind: "org" };
226
237
  }
227
238
  }
228
- function ee(e) {
229
- return M(e);
239
+ function me(e) {
240
+ return x(e);
230
241
  }
231
- const R = ["done", "escalated", "failed", "timed_out", "stopped"], O = ["awaiting_approval", "awaiting_reply"];
232
- function L(e) {
233
- return R.includes(e);
242
+ const U = ["done", "escalated", "failed", "timed_out", "stopped"], P = ["awaiting_approval", "awaiting_reply"];
243
+ function $(e) {
244
+ return U.includes(e);
234
245
  }
235
- function te(e) {
236
- return L(e);
246
+ function be(e) {
247
+ return $(e);
237
248
  }
238
- function ne(e) {
239
- return O.includes(e);
249
+ function Ie(e) {
250
+ return P.includes(e);
240
251
  }
241
- const g = [
252
+ const _ = [
242
253
  {
243
254
  id: "openai",
244
255
  label: "OpenAI",
@@ -326,47 +337,239 @@ const g = [
326
337
  defaultModel: "default"
327
338
  }
328
339
  ];
329
- function c(e) {
330
- return g.find((t) => t.id === e);
340
+ function d(e) {
341
+ return _.find((n) => n.id === e);
331
342
  }
332
- function re(e) {
333
- return c(e)?.label ?? e;
343
+ function Ae(e) {
344
+ return d(e)?.label ?? e;
334
345
  }
335
- function ae(e, t = "gpt-5-mini") {
336
- return c(e)?.defaultModel ?? t;
346
+ function _e(e, n = "gpt-5-mini") {
347
+ return d(e)?.defaultModel ?? n;
337
348
  }
338
- function se(e) {
339
- return g.filter((t) => t.capabilities.includes(e));
349
+ function Me(e) {
350
+ return _.filter((n) => n.capabilities.includes(e));
340
351
  }
341
- function oe(e) {
342
- const t = c(e);
343
- return !!t && !t.baseUrl;
352
+ function Se(e) {
353
+ const n = d(e);
354
+ return !!n && !n.baseUrl;
344
355
  }
345
- const ie = /* @__PURE__ */ new Set(["mail", "message"]);
346
- function y(e, t) {
347
- const n = e.settings?.signatures?.[t];
348
- return !n || !n.enabled || !n.body || n.body.trim() === "" ? null : n;
356
+ const Te = /* @__PURE__ */ new Set(["mail", "message"]);
357
+ function w(e, n) {
358
+ const t = e.settings?.signatures?.[n];
359
+ return !t || !t.enabled || !t.body || t.body.trim() === "" ? null : t;
349
360
  }
350
- function le(e, t, n, r = "html") {
351
- if (!e) return n;
352
- const a = y(e, t);
353
- return a ? `${n}${r === "text" ? `
361
+ function he(e, n, t, r = "html") {
362
+ if (!e) return t;
363
+ const a = w(e, n);
364
+ return a ? `${t}${r === "text" ? `
354
365
 
355
- ` : t === "mail" ? "<br><br>-- <br>" : "<br><br>"}${a.body}` : n;
366
+ ` : n === "mail" ? "<br><br>-- <br>" : "<br><br>"}${a.body}` : t;
356
367
  }
357
- function ce(e) {
368
+ function De(e) {
358
369
  return e.endpoints ?? [];
359
370
  }
360
- const ue = (e) => !!e.assignedUserId || !!e.assignedInboxId, de = (e) => e.status === "closed", pe = (e) => ({
371
+ const Ce = (e) => !!e.assignedUserId || !!e.assignedInboxId, Oe = (e) => e.status === "closed", Ne = (e) => ({
361
372
  urgent: 10,
362
373
  high: 5,
363
374
  normal: 2,
364
375
  low: 1
365
- })[e.priority] || 0, Ee = (e, t = 30) => e.title?.length <= t ? e.title : `${e.title.substring(0, t)}...`;
366
- function ge(e, t) {
367
- return e.lastActivityAt ? !(e.seenBy ?? []).includes(t) : !1;
376
+ })[e.priority] || 0, Le = (e, n = 30) => e.title?.length <= n ? e.title : `${e.title.substring(0, n)}...`;
377
+ function Re(e, n) {
378
+ return e.lastActivityAt ? !(e.seenBy ?? []).includes(n) : !1;
379
+ }
380
+ const ye = 2e3, ke = 500, xe = 12e3, Ue = 4e3, G = ["contact", "company"];
381
+ function Pe(e) {
382
+ if (!e) return !1;
383
+ const n = e.slice(0, e.indexOf(":"));
384
+ return G.includes(n);
385
+ }
386
+ const p = {
387
+ // The lower bounds are deliberately generous: service ranges (0800/0900) are
388
+ // shorter than geographic numbers, and a too-strict minimum silently drops them.
389
+ // An over-permissive key is harmless — it simply matches nothing.
390
+ NL: { callingCode: "31", trunkPrefix: "0", nsnMin: 7, nsnMax: 9 },
391
+ BE: { callingCode: "32", trunkPrefix: "0", nsnMin: 8, nsnMax: 9 },
392
+ LU: { callingCode: "352", nsnMin: 6, nsnMax: 9 },
393
+ DE: { callingCode: "49", trunkPrefix: "0", nsnMin: 6, nsnMax: 13 },
394
+ FR: { callingCode: "33", trunkPrefix: "0", nsnMin: 9, nsnMax: 9 },
395
+ GB: { callingCode: "44", trunkPrefix: "0", nsnMin: 9, nsnMax: 10 },
396
+ IE: { callingCode: "353", trunkPrefix: "0", nsnMin: 7, nsnMax: 9 },
397
+ ES: { callingCode: "34", nsnMin: 9, nsnMax: 9 },
398
+ PT: { callingCode: "351", nsnMin: 9, nsnMax: 9 },
399
+ IT: { callingCode: "39", nsnMin: 6, nsnMax: 11 },
400
+ AT: { callingCode: "43", trunkPrefix: "0", nsnMin: 7, nsnMax: 13 },
401
+ CH: { callingCode: "41", trunkPrefix: "0", nsnMin: 9, nsnMax: 9 },
402
+ DK: { callingCode: "45", nsnMin: 8, nsnMax: 8 },
403
+ SE: { callingCode: "46", trunkPrefix: "0", nsnMin: 7, nsnMax: 13 },
404
+ NO: { callingCode: "47", nsnMin: 8, nsnMax: 8 },
405
+ FI: { callingCode: "358", trunkPrefix: "0", nsnMin: 5, nsnMax: 12 },
406
+ PL: { callingCode: "48", nsnMin: 9, nsnMax: 9 },
407
+ US: { callingCode: "1", nsnMin: 10, nsnMax: 10 },
408
+ CA: { callingCode: "1", nsnMin: 10, nsnMax: 10 }
409
+ }, V = "NL", H = 15, B = 8, F = Array.from(
410
+ new Set(Object.values(p).map((e) => e.callingCode))
411
+ ).sort((e, n) => n.length - e.length);
412
+ function f(e) {
413
+ if (e)
414
+ return p[e.trim().toUpperCase()];
415
+ }
416
+ function l(e, n) {
417
+ return e.length >= n.nsnMin && e.length <= n.nsnMax;
418
+ }
419
+ function g(e) {
420
+ if (e.length > H) return null;
421
+ for (const n of F) {
422
+ if (!e.startsWith(n)) continue;
423
+ const t = e.slice(n.length);
424
+ for (const r of Object.values(p)) {
425
+ if (r.callingCode !== n) continue;
426
+ const a = r.trunkPrefix, i = a && t.startsWith(a) ? t.slice(a.length) : t;
427
+ if (l(i, r)) return `+${n}${i}`;
428
+ }
429
+ return null;
430
+ }
431
+ return e.length < B ? null : `+${e}`;
432
+ }
433
+ function v(e) {
434
+ let n = e.trim();
435
+ const t = n.match(/^(sips?|tel|whatsapp):/i);
436
+ t && (n = n.slice(t[0].length));
437
+ const r = n.indexOf("@");
438
+ return r >= 0 && (n = n.slice(0, r)), n.trim();
439
+ }
440
+ function $e(e) {
441
+ if (!e) return !1;
442
+ const n = e.indexOf("@");
443
+ if (n <= 0) return !1;
444
+ const t = e.slice(0, n).trim();
445
+ return !/^[+\d\s().-]+$/.test(t);
446
+ }
447
+ function E(e, n) {
448
+ if (!e) return null;
449
+ const t = v(e);
450
+ if (!t) return null;
451
+ const r = t.startsWith("+"), a = t.replace(/\D/g, "");
452
+ if (!a) return null;
453
+ if (r) return g(a);
454
+ if (a.startsWith("00")) return g(a.slice(2));
455
+ const i = f(n) ?? f(V);
456
+ if (!i) return null;
457
+ const s = i.trunkPrefix;
458
+ if (s && a.startsWith(s)) {
459
+ const o = a.slice(s.length);
460
+ return l(o, i) ? `+${i.callingCode}${o}` : null;
461
+ }
462
+ if (a.startsWith(i.callingCode)) {
463
+ const o = a.slice(i.callingCode.length);
464
+ if (l(o, i)) return `+${i.callingCode}${o}`;
465
+ }
466
+ return !s && l(a, i) ? `+${i.callingCode}${a}` : null;
467
+ }
468
+ function we(e, n = 9) {
469
+ const t = (e ?? "").replace(/\D/g, "");
470
+ return t.length < n ? null : t.slice(-n);
368
471
  }
369
- const C = [
472
+ function M(e) {
473
+ if (!e) return null;
474
+ const n = e.trim().toLowerCase(), t = n.lastIndexOf("@");
475
+ if (t <= 0 || t === n.length - 1) return null;
476
+ const r = n.slice(0, t).split("+")[0], a = n.slice(t + 1);
477
+ return !r || !a.includes(".") ? null : `${r}@${a}`;
478
+ }
479
+ function Ge(e) {
480
+ const n = M(e);
481
+ return n ? n.slice(n.lastIndexOf("@") + 1) : null;
482
+ }
483
+ const W = /* @__PURE__ */ new Set([
484
+ "co.uk",
485
+ "org.uk",
486
+ "gov.uk",
487
+ "ac.uk",
488
+ "com.au",
489
+ "co.nz",
490
+ "com.br",
491
+ "co.za"
492
+ ]);
493
+ function j(e) {
494
+ if (!e) return null;
495
+ const n = e.trim().toLowerCase().replace(/\.$/, "").split(".").filter(Boolean);
496
+ if (n.length < 2) return null;
497
+ const t = n.slice(-2).join(".");
498
+ return W.has(t) && n.length >= 3 ? n.slice(-3).join(".") : t;
499
+ }
500
+ const K = /* @__PURE__ */ new Set([
501
+ "gmail.com",
502
+ "googlemail.com",
503
+ "outlook.com",
504
+ "hotmail.com",
505
+ "hotmail.nl",
506
+ "hotmail.be",
507
+ "hotmail.co.uk",
508
+ "live.com",
509
+ "live.nl",
510
+ "live.be",
511
+ "msn.com",
512
+ "yahoo.com",
513
+ "yahoo.co.uk",
514
+ "ymail.com",
515
+ "icloud.com",
516
+ "me.com",
517
+ "mac.com",
518
+ "aol.com",
519
+ "gmx.net",
520
+ "gmx.de",
521
+ "web.de",
522
+ "protonmail.com",
523
+ "proton.me",
524
+ "pm.me",
525
+ "tutanota.com",
526
+ "zoho.com",
527
+ "mail.com",
528
+ "ziggo.nl",
529
+ "kpnmail.nl",
530
+ "planet.nl",
531
+ "home.nl",
532
+ "casema.nl",
533
+ "chello.nl",
534
+ "xs4all.nl",
535
+ "telfort.nl",
536
+ "hetnet.nl",
537
+ "zonnet.nl",
538
+ "upcmail.nl",
539
+ "quicknet.nl",
540
+ "telenet.be",
541
+ "skynet.be",
542
+ "proximus.be",
543
+ "scarlet.be"
544
+ ]);
545
+ function Ve(e) {
546
+ const n = j(e);
547
+ return n ? K.has(n) : !1;
548
+ }
549
+ function He(e) {
550
+ if (!e) return !1;
551
+ const n = e.trim().toLowerCase();
552
+ return n === "tel" || n === "sms" || n === "whatsapp" || n === "fax";
553
+ }
554
+ function Be(e, n, t) {
555
+ if (!e || !n) return null;
556
+ const r = e.trim().toLowerCase();
557
+ if (r === "tel" || r === "sms" || r === "whatsapp") {
558
+ const i = E(n, t);
559
+ return i ? `tel:${i}` : null;
560
+ }
561
+ if (r === "fax") {
562
+ const i = E(n, t);
563
+ return i ? `fax:${i}` : null;
564
+ }
565
+ if (r === "mailto" || r === "email") {
566
+ const i = M(n);
567
+ return i ? `mailto:${i}` : null;
568
+ }
569
+ const a = n.trim().toLowerCase();
570
+ return a ? `${r}:${a}` : null;
571
+ }
572
+ const Y = [
370
573
  /<blockquote/i,
371
574
  /class="?gmail_quote/i,
372
575
  // Gmail quote container
@@ -379,107 +582,107 @@ const C = [
379
582
  // Outlook underscore separator before "From:"
380
583
  /\bOn\b[\s\S]{0,200}?\bwrote:/i
381
584
  // Gmail "On <date> <name> wrote:"
382
- ], u = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, U = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
383
- function k(e) {
384
- const t = e.split(`
585
+ ], m = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, z = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
586
+ function q(e) {
587
+ const n = e.split(`
385
588
  `);
386
- for (let n = 0; n < t.length; n++)
387
- if (U.test(t[n]) || u.test(t[n]) && t.slice(n + 1, n + 4).some((r) => u.test(r)))
388
- return t.slice(0, n).join(`
589
+ for (let t = 0; t < n.length; t++)
590
+ if (z.test(n[t]) || m.test(n[t]) && n.slice(t + 1, t + 4).some((r) => m.test(r)))
591
+ return n.slice(0, t).join(`
389
592
  `).trim();
390
593
  return e;
391
594
  }
392
- function d(e) {
393
- let t = e;
394
- return t = t.replace(/<(script|style)[\s\S]*?<\/\1>/gi, ""), t = t.replace(/<br\s*\/?>/gi, `
395
- `), t = t.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi, `
396
- `), t = t.replace(/<[^>]+>/g, ""), t = t.replace(/<[^>]*$/, ""), t;
595
+ function b(e) {
596
+ let n = e;
597
+ return n = n.replace(/<(script|style)[\s\S]*?<\/\1>/gi, ""), n = n.replace(/<br\s*\/?>/gi, `
598
+ `), n = n.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi, `
599
+ `), n = n.replace(/<[^>]+>/g, ""), n = n.replace(/<[^>]*$/, ""), n;
397
600
  }
398
- function p(e) {
399
- return e.replace(/&nbsp;/gi, " ").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#39;/gi, "'").replace(/&#(\d+);/g, (t, n) => String.fromCharCode(Number(n))).replace(/&amp;/gi, "&");
601
+ function I(e) {
602
+ return e.replace(/&nbsp;/gi, " ").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#39;/gi, "'").replace(/&#(\d+);/g, (n, t) => String.fromCharCode(Number(t))).replace(/&amp;/gi, "&");
400
603
  }
401
- function E(e) {
604
+ function A(e) {
402
605
  return e.replace(/\r/g, "").replace(/[ \t]+/g, " ").replace(/ *\n */g, `
403
606
  `).replace(/\n{3,}/g, `
404
607
 
405
608
  `).trim();
406
609
  }
407
- function fe(e) {
610
+ function Fe(e) {
408
611
  if (typeof e != "string" || !e) return "";
409
- let t = e.length;
410
- for (const s of C) {
411
- const o = e.search(s);
412
- o >= 0 && o < t && (t = o);
612
+ let n = e.length;
613
+ for (const i of Y) {
614
+ const s = e.search(i);
615
+ s >= 0 && s < n && (n = s);
413
616
  }
414
- const n = e.slice(0, t);
415
- let r = E(p(d(n)));
416
- return r || (r = E(p(d(e)))), k(r) || r;
617
+ const t = e.slice(0, n);
618
+ let r = A(I(b(t)));
619
+ return r || (r = A(I(b(e)))), q(r) || r;
417
620
  }
418
- const P = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, $ = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
419
- function be(e, t) {
420
- return !!(e && P.test(e) || t && $.test(t));
621
+ const X = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, J = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
622
+ function ve(e, n) {
623
+ return !!(e && X.test(e) || n && J.test(n));
421
624
  }
422
- const V = 3, G = 600;
423
- function Ae(e, t) {
424
- return e >= V || t >= G;
625
+ const Q = 3, Z = 600;
626
+ function We(e, n) {
627
+ return e >= Q || n >= Z;
425
628
  }
426
- function w(e, t) {
427
- const n = new Set(e.disabledIntents ?? []), r = e.intentOverrides ?? {}, a = t.intents.filter((o) => !n.has(o.intent)).map((o) => x(o, r[o.intent]));
629
+ function ee(e, n) {
630
+ const t = new Set(e.disabledIntents ?? []), r = e.intentOverrides ?? {}, a = n.intents.filter((s) => !t.has(s.intent)).map((s) => te(s, r[s.intent]));
428
631
  if (!e.extraIntents || e.extraIntents.length === 0) return a;
429
- const s = new Set(a.map((o) => o.intent));
430
- for (const o of e.extraIntents)
431
- s.has(o.intent) || (a.push(o), s.add(o.intent));
632
+ const i = new Set(a.map((s) => s.intent));
633
+ for (const s of e.extraIntents)
634
+ i.has(s.intent) || (a.push(s), i.add(s.intent));
432
635
  return a;
433
636
  }
434
- function H(e, t) {
435
- const n = {};
637
+ function ne(e, n) {
638
+ const t = {};
436
639
  for (const r of e.intents) {
437
640
  if (!r.togglable) continue;
438
- const a = t?.[r.intent];
439
- n[r.intent] = a ?? r.defaultEnabled ?? !0;
641
+ const a = n?.[r.intent];
642
+ t[r.intent] = a ?? r.defaultEnabled ?? !0;
440
643
  }
441
- return n;
644
+ return t;
442
645
  }
443
- function me(e, t) {
444
- const n = H(e, t);
445
- return Object.entries(n).filter(([, r]) => !r).map(([r]) => r);
646
+ function je(e, n) {
647
+ const t = ne(e, n);
648
+ return Object.entries(t).filter(([, r]) => !r).map(([r]) => r);
446
649
  }
447
- function x(e, t) {
448
- return t ? {
449
- intent: t.intent ?? e.intent,
450
- targetSchemes: t.targetSchemes ?? e.targetSchemes,
451
- transport: t.transport ?? e.transport
650
+ function te(e, n) {
651
+ return n ? {
652
+ intent: n.intent ?? e.intent,
653
+ targetSchemes: n.targetSchemes ?? e.targetSchemes,
654
+ transport: n.transport ?? e.transport
452
655
  } : e;
453
656
  }
454
- function Ie(e, t) {
455
- const n = [];
657
+ function Ke(e, n) {
658
+ const t = [];
456
659
  for (const r of e) {
457
660
  if (!r.enabled) continue;
458
- const a = t[r.providerId];
661
+ const a = n[r.providerId];
459
662
  if (a)
460
- for (const s of w(r, a))
461
- n.push({ channel: r, description: a, capability: s });
663
+ for (const i of ee(r, a))
664
+ t.push({ channel: r, description: a, capability: i });
462
665
  }
463
- return n;
666
+ return t;
464
667
  }
465
- function _e(e, t) {
466
- return t.filter((n) => n.capability.intent === e);
668
+ function Ye(e, n) {
669
+ return n.filter((t) => t.capability.intent === e);
467
670
  }
468
- function B(e, t) {
469
- return t.filter((n) => n.capability.targetSchemes.includes(e));
671
+ function re(e, n) {
672
+ return n.filter((t) => t.capability.targetSchemes.includes(e));
470
673
  }
471
- function Se(e, t) {
472
- return B(e.scheme, t);
674
+ function ze(e, n) {
675
+ return re(e.scheme, n);
473
676
  }
474
- function Te(e, t, n) {
677
+ function qe(e, n, t) {
475
678
  const r = [];
476
679
  for (const a of e)
477
- for (const s of n)
478
- s.capability.intent === t && s.capability.targetSchemes.includes(a.scheme) && r.push({ channelIntent: s, endpoint: a });
680
+ for (const i of t)
681
+ i.capability.intent === n && i.capability.targetSchemes.includes(a.scheme) && r.push({ channelIntent: i, endpoint: a });
479
682
  return r;
480
683
  }
481
- var F = /* @__PURE__ */ ((e) => (e.MAILTO = "mailto", e.SIP = "sip", e.TEL = "tel", e.WEBHOOK = "webhook", e.USERNAME = "username", e.ID = "id", e.CUSTOM = "custom", e.URL = "url", e.TELEGRAM = "telegram", e.WHATSAPP = "whatsapp", e.MESSENGER = "messenger", e.INSTAGRAM = "instagram", e.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(F || {});
482
- const De = "message_window", Ne = "message_templates", he = {
684
+ var ae = /* @__PURE__ */ ((e) => (e.MAILTO = "mailto", e.SIP = "sip", e.TEL = "tel", e.WEBHOOK = "webhook", e.USERNAME = "username", e.ID = "id", e.CUSTOM = "custom", e.URL = "url", e.TELEGRAM = "telegram", e.WHATSAPP = "whatsapp", e.MESSENGER = "messenger", e.INSTAGRAM = "instagram", e.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(ae || {});
685
+ const Xe = "message_window", Je = "message_templates", Qe = {
483
686
  // E-mail
484
687
  FROM: "from",
485
688
  TO: "to",
@@ -496,69 +699,87 @@ const De = "message_window", Ne = "message_templates", he = {
496
699
  // Voice/conference
497
700
  HOST: "host",
498
701
  PARTICIPANT: "participant"
499
- }, Me = (e, t) => ({ intent: e, ...t }), Re = "folder_management", Oe = "remote_search", Le = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, ye = 9e4, Ce = "installation-id";
702
+ }, Ze = (e, n) => ({ intent: e, ...n }), en = "folder_management", nn = "remote_search", tn = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, rn = 9e4, an = "installation-id";
500
703
  export {
501
- g as AI_VENDORS,
502
- J as CLASSIFY_VARS,
503
- W as CORE_DIMENSIONS,
504
- F as CommunicationScheme,
505
- Re as FEATURE_FOLDER_MANAGEMENT,
506
- Oe as FEATURE_REMOTE_SEARCH,
507
- Ce as INSTALLATION_HEADER,
508
- he as InteractionParticipantRole,
509
- O as PAUSED_RUN_STATUSES,
510
- ye as PRESENCE_ONLINE_WINDOW_MS,
511
- Ne as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
512
- De as PROVIDER_FEATURE_MESSAGE_WINDOW,
513
- ie as SIGNATURE_INTENTS,
514
- G as SUMMARY_MIN_LAST_CHARS,
515
- V as SUMMARY_MIN_MESSAGES,
516
- R as TERMINAL_RUN_STATUSES,
517
- X as TRIGGER_VARS,
518
- Le as UNSUPPORTED,
519
- T as USAGE_DIMENSIONS,
520
- D as USAGE_DIMENSION_IDS,
521
- M as actingIdentityKey,
522
- ee as actorKey,
523
- ae as aiVendorDefaultModel,
524
- re as aiVendorLabel,
525
- oe as aiVendorNeedsBaseUrl,
526
- se as aiVendorsWith,
527
- le as applySignature,
528
- j as buildActivityPreview,
529
- Ie as buildChannelIntents,
530
- fe as cleanMessageText,
531
- Me as defineIntent,
532
- me as disabledIntentsFromCapabilities,
533
- Se as filterByEndpoint,
534
- _e as filterByIntent,
535
- B as filterByTargetScheme,
536
- c as findAiVendor,
537
- K as flattenLocales,
538
- I as floorToPeriod,
539
- h as formatActingIdentity,
540
- m as formatPeriod,
541
- v as getActivitySeenUserIds,
542
- ce as getContactEndpoints,
543
- Ee as getShortTitle,
544
- pe as getUrgencyScore,
545
- z as humanizeAction,
546
- ue as isAssigned,
547
- de as isClosed,
548
- ge as isInteractionUnseen,
549
- be as isLikelyBulk,
550
- ne as isPaused,
551
- te as isRetryable,
552
- L as isTerminal,
553
- Ae as isThreadLongEnough,
554
- Te as matchContactToIntents,
555
- Q as parseActingIdentity,
556
- q as periodsInRange,
557
- Z as playbookActor,
558
- H as resolveAccountCapabilities,
559
- w as resolveChannelIntents,
560
- y as resolveSignature,
561
- f as stripHtml,
562
- N as usageMetricId,
563
- Y as usageMetrics
704
+ _ as AI_VENDORS,
705
+ fe as CLASSIFY_VARS,
706
+ oe as CORE_DIMENSIONS,
707
+ ae as CommunicationScheme,
708
+ Ue as DEFAULT_MEMORY_BUDGET,
709
+ V as DEFAULT_PHONE_REGION,
710
+ en as FEATURE_FOLDER_MANAGEMENT,
711
+ nn as FEATURE_REMOTE_SEARCH,
712
+ an as INSTALLATION_HEADER,
713
+ Qe as InteractionParticipantRole,
714
+ xe as MAX_MEMORY_BUDGET,
715
+ ye as MAX_MEMORY_CHARS,
716
+ ke as MIN_MEMORY_BUDGET,
717
+ P as PAUSED_RUN_STATUSES,
718
+ p as PHONE_REGIONS,
719
+ rn as PRESENCE_ONLINE_WINDOW_MS,
720
+ Je as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
721
+ Xe as PROVIDER_FEATURE_MESSAGE_WINDOW,
722
+ K as PUBLIC_EMAIL_DOMAINS,
723
+ G as RELATED_SUBJECT_KINDS,
724
+ Te as SIGNATURE_INTENTS,
725
+ Z as SUMMARY_MIN_LAST_CHARS,
726
+ Q as SUMMARY_MIN_MESSAGES,
727
+ U as TERMINAL_RUN_STATUSES,
728
+ pe as TRIGGER_VARS,
729
+ tn as UNSUPPORTED,
730
+ L as USAGE_DIMENSIONS,
731
+ R as USAGE_DIMENSION_IDS,
732
+ x as actingIdentityKey,
733
+ me as actorKey,
734
+ _e as aiVendorDefaultModel,
735
+ Ae as aiVendorLabel,
736
+ Se as aiVendorNeedsBaseUrl,
737
+ Me as aiVendorsWith,
738
+ he as applySignature,
739
+ ie as buildActivityPreview,
740
+ Ke as buildChannelIntents,
741
+ Fe as cleanMessageText,
742
+ Ze as defineIntent,
743
+ je as disabledIntentsFromCapabilities,
744
+ Ge as emailDomain,
745
+ Be as endpointKey,
746
+ ze as filterByEndpoint,
747
+ Ye as filterByIntent,
748
+ re as filterByTargetScheme,
749
+ d as findAiVendor,
750
+ le as flattenLocales,
751
+ C as floorToPeriod,
752
+ k as formatActingIdentity,
753
+ D as formatPeriod,
754
+ se as getActivitySeenUserIds,
755
+ De as getContactEndpoints,
756
+ Le as getShortTitle,
757
+ Ne as getUrgencyScore,
758
+ de as humanizeAction,
759
+ Ce as isAssigned,
760
+ Oe as isClosed,
761
+ Re as isInteractionUnseen,
762
+ ve as isLikelyBulk,
763
+ Ie as isPaused,
764
+ Ve as isPublicEmailDomain,
765
+ be as isRetryable,
766
+ $ as isTerminal,
767
+ We as isThreadLongEnough,
768
+ $e as looksLikeEmail,
769
+ qe as matchContactToIntents,
770
+ He as needsPhoneRegion,
771
+ M as normalizeEmail,
772
+ ge as parseActingIdentity,
773
+ ce as periodsInRange,
774
+ we as phoneSuffix,
775
+ Ee as playbookActor,
776
+ j as registrableDomain,
777
+ Pe as relatedByDefault,
778
+ ne as resolveAccountCapabilities,
779
+ ee as resolveChannelIntents,
780
+ w as resolveSignature,
781
+ S as stripHtml,
782
+ E as toE164,
783
+ y as usageMetricId,
784
+ ue as usageMetrics
564
785
  };