@opencxh/domain 1.128.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 Y(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 _(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 I = 36e5, T = 864e5;
139
- function K(e, t, n) {
140
- const r = n === "hour" ? I : T, a = [];
141
- for (let s = _(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 S = [
145
+ const L = [
146
146
  { id: "resource", label: "Resource", labelSource: "raw" },
147
147
  { id: "origin", label: "Herkomst", labelSource: "raw" }
148
- ], M = S.map((e) => e.id);
149
- function D(e, t) {
150
- return `${e}.usage.${t}`;
151
- }
152
- function q(e, t) {
153
- return t.map((n) => ({
154
- id: D(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
- ...M,
162
- ...n.extraDimensions ?? [],
161
+ ...R,
162
+ ...t.extraDimensions ?? [],
163
163
  "time"
164
164
  ]
165
165
  }));
166
166
  }
167
- function X(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 z = [
170
+ const pe = [
171
171
  { name: "text", type: "string" },
172
172
  { name: "subject", type: "string" },
173
173
  { name: "from", type: "string" },
@@ -182,12 +182,15 @@ const z = [
182
182
  // Alleen gevuld bij INTERACTION_STATUS_CHANGED; een filter als
183
183
  // `trigger.toStatus == "closed"` is de trigger voor "onthoud dit bij afsluiten".
184
184
  { name: "fromStatus", type: "string" },
185
- { name: "toStatus", type: "string" }
186
- // Bewust GEEN `contactId`. Een interactie draagt geen contact-id; dat zou per run een
187
- // lookup via `remoteParty` naar de contactenlijst kosten, en dan hangt geheugen op
188
- // klantniveau aan een gok in plaats van aan een vastgelegde identiteit. Zodra partijen
189
- // wél in de database staan (party/CRM) komt dit terug als een echt veld.
190
- ], J = {
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 = {
191
194
  topics: [
192
195
  { name: "topic", type: "string" },
193
196
  { name: "confidence", type: "number" }
@@ -198,7 +201,7 @@ const z = [
198
201
  ],
199
202
  extract: []
200
203
  };
201
- function N(e) {
204
+ function k(e) {
202
205
  switch (e.kind) {
203
206
  case "user":
204
207
  return `user:${e.userId}`;
@@ -208,22 +211,22 @@ function N(e) {
208
211
  return "org";
209
212
  }
210
213
  }
211
- function Q(e) {
214
+ function ge(e) {
212
215
  if (typeof e != "string") return;
213
- const t = e.trim();
214
- if (t === "org") return { kind: "org" };
215
- const n = t.indexOf(":");
216
- if (n <= 0) return;
217
- 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();
218
221
  if (a) {
219
222
  if (r === "user") return { kind: "user", userId: a };
220
223
  if (r === "team") return { kind: "team", teamId: a };
221
224
  }
222
225
  }
223
- function R(e) {
224
- return N(e);
226
+ function x(e) {
227
+ return k(e);
225
228
  }
226
- function Z(e) {
229
+ function Ee(e) {
227
230
  switch (e.kind) {
228
231
  case "personal":
229
232
  return { kind: "user", userId: e.userId };
@@ -233,20 +236,20 @@ function Z(e) {
233
236
  return { kind: "org" };
234
237
  }
235
238
  }
236
- function ee(e) {
237
- return R(e);
239
+ function me(e) {
240
+ return x(e);
238
241
  }
239
- const O = ["done", "escalated", "failed", "timed_out", "stopped"], h = ["awaiting_approval", "awaiting_reply"];
240
- function L(e) {
241
- return O.includes(e);
242
+ const U = ["done", "escalated", "failed", "timed_out", "stopped"], P = ["awaiting_approval", "awaiting_reply"];
243
+ function $(e) {
244
+ return U.includes(e);
242
245
  }
243
- function te(e) {
244
- return L(e);
246
+ function be(e) {
247
+ return $(e);
245
248
  }
246
- function ne(e) {
247
- return h.includes(e);
249
+ function Ie(e) {
250
+ return P.includes(e);
248
251
  }
249
- const g = [
252
+ const _ = [
250
253
  {
251
254
  id: "openai",
252
255
  label: "OpenAI",
@@ -334,47 +337,239 @@ const g = [
334
337
  defaultModel: "default"
335
338
  }
336
339
  ];
337
- function c(e) {
338
- return g.find((t) => t.id === e);
340
+ function d(e) {
341
+ return _.find((n) => n.id === e);
339
342
  }
340
- function re(e) {
341
- return c(e)?.label ?? e;
343
+ function Ae(e) {
344
+ return d(e)?.label ?? e;
342
345
  }
343
- function ae(e, t = "gpt-5-mini") {
344
- return c(e)?.defaultModel ?? t;
346
+ function _e(e, n = "gpt-5-mini") {
347
+ return d(e)?.defaultModel ?? n;
345
348
  }
346
- function se(e) {
347
- return g.filter((t) => t.capabilities.includes(e));
349
+ function Me(e) {
350
+ return _.filter((n) => n.capabilities.includes(e));
348
351
  }
349
- function oe(e) {
350
- const t = c(e);
351
- return !!t && !t.baseUrl;
352
+ function Se(e) {
353
+ const n = d(e);
354
+ return !!n && !n.baseUrl;
352
355
  }
353
- const ie = /* @__PURE__ */ new Set(["mail", "message"]);
354
- function y(e, t) {
355
- const n = e.settings?.signatures?.[t];
356
- 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;
357
360
  }
358
- function le(e, t, n, r = "html") {
359
- if (!e) return n;
360
- const a = y(e, t);
361
- 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" ? `
362
365
 
363
- ` : t === "mail" ? "<br><br>-- <br>" : "<br><br>"}${a.body}` : n;
366
+ ` : n === "mail" ? "<br><br>-- <br>" : "<br><br>"}${a.body}` : t;
364
367
  }
365
- function ce(e) {
368
+ function De(e) {
366
369
  return e.endpoints ?? [];
367
370
  }
368
- 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) => ({
369
372
  urgent: 10,
370
373
  high: 5,
371
374
  normal: 2,
372
375
  low: 1
373
- })[e.priority] || 0, Ee = (e, t = 30) => e.title?.length <= t ? e.title : `${e.title.substring(0, t)}...`;
374
- function ge(e, t) {
375
- 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);
471
+ }
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;
376
571
  }
377
- const fe = 2e3, be = 500, Ae = 12e3, me = 4e3, C = [
572
+ const Y = [
378
573
  /<blockquote/i,
379
574
  /class="?gmail_quote/i,
380
575
  // Gmail quote container
@@ -387,107 +582,107 @@ const fe = 2e3, be = 500, Ae = 12e3, me = 4e3, C = [
387
582
  // Outlook underscore separator before "From:"
388
583
  /\bOn\b[\s\S]{0,200}?\bwrote:/i
389
584
  // Gmail "On <date> <name> wrote:"
390
- ], 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;
391
- function k(e) {
392
- 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(`
393
588
  `);
394
- for (let n = 0; n < t.length; n++)
395
- if (U.test(t[n]) || u.test(t[n]) && t.slice(n + 1, n + 4).some((r) => u.test(r)))
396
- 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(`
397
592
  `).trim();
398
593
  return e;
399
594
  }
400
- function d(e) {
401
- let t = e;
402
- return t = t.replace(/<(script|style)[\s\S]*?<\/\1>/gi, ""), t = t.replace(/<br\s*\/?>/gi, `
403
- `), t = t.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi, `
404
- `), 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;
405
600
  }
406
- function p(e) {
407
- 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, "&");
408
603
  }
409
- function E(e) {
604
+ function A(e) {
410
605
  return e.replace(/\r/g, "").replace(/[ \t]+/g, " ").replace(/ *\n */g, `
411
606
  `).replace(/\n{3,}/g, `
412
607
 
413
608
  `).trim();
414
609
  }
415
- function _e(e) {
610
+ function Fe(e) {
416
611
  if (typeof e != "string" || !e) return "";
417
- let t = e.length;
418
- for (const s of C) {
419
- const o = e.search(s);
420
- 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);
421
616
  }
422
- const n = e.slice(0, t);
423
- let r = E(p(d(n)));
424
- 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;
425
620
  }
426
- 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;
427
- function Ie(e, t) {
428
- 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));
429
624
  }
430
- const G = 3, V = 600;
431
- function Te(e, t) {
432
- return e >= G || t >= V;
625
+ const Q = 3, Z = 600;
626
+ function We(e, n) {
627
+ return e >= Q || n >= Z;
433
628
  }
434
- function w(e, t) {
435
- 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]));
436
631
  if (!e.extraIntents || e.extraIntents.length === 0) return a;
437
- const s = new Set(a.map((o) => o.intent));
438
- for (const o of e.extraIntents)
439
- 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));
440
635
  return a;
441
636
  }
442
- function H(e, t) {
443
- const n = {};
637
+ function ne(e, n) {
638
+ const t = {};
444
639
  for (const r of e.intents) {
445
640
  if (!r.togglable) continue;
446
- const a = t?.[r.intent];
447
- n[r.intent] = a ?? r.defaultEnabled ?? !0;
641
+ const a = n?.[r.intent];
642
+ t[r.intent] = a ?? r.defaultEnabled ?? !0;
448
643
  }
449
- return n;
644
+ return t;
450
645
  }
451
- function Se(e, t) {
452
- const n = H(e, t);
453
- 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);
454
649
  }
455
- function x(e, t) {
456
- return t ? {
457
- intent: t.intent ?? e.intent,
458
- targetSchemes: t.targetSchemes ?? e.targetSchemes,
459
- 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
460
655
  } : e;
461
656
  }
462
- function Me(e, t) {
463
- const n = [];
657
+ function Ke(e, n) {
658
+ const t = [];
464
659
  for (const r of e) {
465
660
  if (!r.enabled) continue;
466
- const a = t[r.providerId];
661
+ const a = n[r.providerId];
467
662
  if (a)
468
- for (const s of w(r, a))
469
- 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 });
470
665
  }
471
- return n;
666
+ return t;
472
667
  }
473
- function De(e, t) {
474
- return t.filter((n) => n.capability.intent === e);
668
+ function Ye(e, n) {
669
+ return n.filter((t) => t.capability.intent === e);
475
670
  }
476
- function B(e, t) {
477
- return t.filter((n) => n.capability.targetSchemes.includes(e));
671
+ function re(e, n) {
672
+ return n.filter((t) => t.capability.targetSchemes.includes(e));
478
673
  }
479
- function Ne(e, t) {
480
- return B(e.scheme, t);
674
+ function ze(e, n) {
675
+ return re(e.scheme, n);
481
676
  }
482
- function Re(e, t, n) {
677
+ function qe(e, n, t) {
483
678
  const r = [];
484
679
  for (const a of e)
485
- for (const s of n)
486
- 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 });
487
682
  return r;
488
683
  }
489
- 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 || {});
490
- const Oe = "message_window", he = "message_templates", Le = {
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 = {
491
686
  // E-mail
492
687
  FROM: "from",
493
688
  TO: "to",
@@ -504,73 +699,87 @@ const Oe = "message_window", he = "message_templates", Le = {
504
699
  // Voice/conference
505
700
  HOST: "host",
506
701
  PARTICIPANT: "participant"
507
- }, ye = (e, t) => ({ intent: e, ...t }), Ce = "folder_management", Ue = "remote_search", ke = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, Pe = 9e4, $e = "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";
508
703
  export {
509
- g as AI_VENDORS,
510
- J as CLASSIFY_VARS,
511
- W as CORE_DIMENSIONS,
512
- F as CommunicationScheme,
513
- me as DEFAULT_MEMORY_BUDGET,
514
- Ce as FEATURE_FOLDER_MANAGEMENT,
515
- Ue as FEATURE_REMOTE_SEARCH,
516
- $e as INSTALLATION_HEADER,
517
- Le as InteractionParticipantRole,
518
- Ae as MAX_MEMORY_BUDGET,
519
- fe as MAX_MEMORY_CHARS,
520
- be as MIN_MEMORY_BUDGET,
521
- h as PAUSED_RUN_STATUSES,
522
- Pe as PRESENCE_ONLINE_WINDOW_MS,
523
- he as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
524
- Oe as PROVIDER_FEATURE_MESSAGE_WINDOW,
525
- ie as SIGNATURE_INTENTS,
526
- V as SUMMARY_MIN_LAST_CHARS,
527
- G as SUMMARY_MIN_MESSAGES,
528
- O as TERMINAL_RUN_STATUSES,
529
- z as TRIGGER_VARS,
530
- ke as UNSUPPORTED,
531
- S as USAGE_DIMENSIONS,
532
- M as USAGE_DIMENSION_IDS,
533
- R as actingIdentityKey,
534
- ee as actorKey,
535
- ae as aiVendorDefaultModel,
536
- re as aiVendorLabel,
537
- oe as aiVendorNeedsBaseUrl,
538
- se as aiVendorsWith,
539
- le as applySignature,
540
- j as buildActivityPreview,
541
- Me as buildChannelIntents,
542
- _e as cleanMessageText,
543
- ye as defineIntent,
544
- Se as disabledIntentsFromCapabilities,
545
- Ne as filterByEndpoint,
546
- De as filterByIntent,
547
- B as filterByTargetScheme,
548
- c as findAiVendor,
549
- Y as flattenLocales,
550
- _ as floorToPeriod,
551
- N as formatActingIdentity,
552
- m as formatPeriod,
553
- v as getActivitySeenUserIds,
554
- ce as getContactEndpoints,
555
- Ee as getShortTitle,
556
- pe as getUrgencyScore,
557
- X as humanizeAction,
558
- ue as isAssigned,
559
- de as isClosed,
560
- ge as isInteractionUnseen,
561
- Ie as isLikelyBulk,
562
- ne as isPaused,
563
- te as isRetryable,
564
- L as isTerminal,
565
- Te as isThreadLongEnough,
566
- Re as matchContactToIntents,
567
- Q as parseActingIdentity,
568
- K as periodsInRange,
569
- Z as playbookActor,
570
- H as resolveAccountCapabilities,
571
- w as resolveChannelIntents,
572
- y as resolveSignature,
573
- f as stripHtml,
574
- D as usageMetricId,
575
- q 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
576
785
  };