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