@opencxh/domain 1.136.0 → 1.137.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/entities/artifact/blocks.d.ts +168 -0
- package/dist/entities/artifact/blocks.test.d.ts +1 -0
- package/dist/entities/artifact/index.d.ts +3 -0
- package/dist/entities/artifact/markdown.d.ts +7 -0
- package/dist/entities/artifact/markdown.test.d.ts +1 -0
- package/dist/entities/artifact/types.d.ts +128 -0
- package/dist/index.cjs +14 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +745 -417
- package/dist/platform/ai-tools.d.ts +25 -0
- package/package.json +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* De blokken waaruit een artefact is opgebouwd.
|
|
3
|
+
*
|
|
4
|
+
* Dit is een **document**-vocabulaire, niet het rij-vocabulaire van de tijdlijn
|
|
5
|
+
* (`../activity/blocks.ts`). Die twee lijken op elkaar en zijn het bewust niet:
|
|
6
|
+
* een tijdlijnrij staat tussen tientallen andere en mag daarom maar tien blokken
|
|
7
|
+
* tellen, kent geen alinea's of koppen, en zijn tekstknopen zijn *paden* in een
|
|
8
|
+
* activity. Een artefact is een document — het heeft koppen, alinea's, een tabel
|
|
9
|
+
* en een KPI-rij, en zijn tekst is gewoon tekst.
|
|
10
|
+
*
|
|
11
|
+
* Wat wél overgenomen is, is de *discipline* van dat bestand, omdat die zich
|
|
12
|
+
* bewezen heeft:
|
|
13
|
+
*
|
|
14
|
+
* - een optionele `block_id`, zodat een blok aan te wijzen is zonder het hele
|
|
15
|
+
* document te herschrijven;
|
|
16
|
+
* - {@link normalizeArtifactBlocks} **snoeit in plaats van te weigeren** — één
|
|
17
|
+
* slecht blok mag geen heel document laten verdwijnen — en meldt élke drop,
|
|
18
|
+
* want stil snoeien maakt "waarom staat mijn tabel er niet?" onbeantwoordbaar;
|
|
19
|
+
* - onbekende bloktypes worden overgeslagen, zodat een nieuwere schrijver naast
|
|
20
|
+
* een oudere renderer kan bestaan;
|
|
21
|
+
* - alleen semantische tonen, geen vrije kleuren, zodat dark mode blijft kloppen.
|
|
22
|
+
*
|
|
23
|
+
* ## De inerte grens
|
|
24
|
+
*
|
|
25
|
+
* Een artefact is opgeslagen data, geen programma. Dat is hier een eigenschap van
|
|
26
|
+
* het *model* en niet de uitkomst van een filter achteraf:
|
|
27
|
+
*
|
|
28
|
+
* - Blokteksten zijn **markdown, nooit HTML**. De renderer geeft ze aan ui-kit's
|
|
29
|
+
* `RichText` met `as="markdown"`, en die tak (react-markdown + remark-gfm) emit
|
|
30
|
+
* geen rauwe HTML. Een `<script>` in de tekst komt dus als letterlijke tekens op
|
|
31
|
+
* het scherm. Daarom strippen we hier géén tags: dat zou "a < b" slopen zonder
|
|
32
|
+
* iets te winnen.
|
|
33
|
+
* - Wat we wél strippen is het enige dat markdown zélf gevaarlijk maakt: een link
|
|
34
|
+
* naar een schema buiten {@link ALLOWED_LINK_SCHEMES}, en inline afbeeldingen.
|
|
35
|
+
* Zie {@link sanitizeInline}.
|
|
36
|
+
*/
|
|
37
|
+
/** Semantische kleur. Geen vrije kleuren, zodat dark mode en de tokens kloppen. */
|
|
38
|
+
export type ArtifactTone = "info" | "success" | "warning" | "destructive";
|
|
39
|
+
/**
|
|
40
|
+
* Een regel in een opsomming.
|
|
41
|
+
*
|
|
42
|
+
* `lead` bestaat omdat een bevindingenlijst zijn kern vetgedrukt vooropzet
|
|
43
|
+
* ("**Yealink-storingen domineren.** 14 van de 184 gesprekken..."). Zonder eigen
|
|
44
|
+
* veld moet de schrijver daar markdown-sterretjes voor verzinnen op een plek waar
|
|
45
|
+
* de opmaak juist vastligt — en dan is het aan de tekst te zien of iemand het
|
|
46
|
+
* vergeten is.
|
|
47
|
+
*/
|
|
48
|
+
export interface ArtifactListItem {
|
|
49
|
+
lead?: string;
|
|
50
|
+
text: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ArtifactTableColumn {
|
|
53
|
+
label: string;
|
|
54
|
+
/** Getallen rechts. Default links. */
|
|
55
|
+
align?: "left" | "right";
|
|
56
|
+
}
|
|
57
|
+
export interface ArtifactKpiItem {
|
|
58
|
+
/** Al opgemaakt door de schrijver ("1u 12m", "184", "-12%"). */
|
|
59
|
+
value: string;
|
|
60
|
+
label: string;
|
|
61
|
+
/** Alleen zetten als dit getal opvalt; een tint op elke tegel is behang. */
|
|
62
|
+
tone?: ArtifactTone;
|
|
63
|
+
}
|
|
64
|
+
export type ArtifactBlock = {
|
|
65
|
+
block_id?: string;
|
|
66
|
+
type: "heading";
|
|
67
|
+
level: 1 | 2 | 3;
|
|
68
|
+
text: string;
|
|
69
|
+
} | {
|
|
70
|
+
block_id?: string;
|
|
71
|
+
type: "paragraph";
|
|
72
|
+
text: string;
|
|
73
|
+
} | {
|
|
74
|
+
block_id?: string;
|
|
75
|
+
type: "list";
|
|
76
|
+
style: "bulleted" | "numbered";
|
|
77
|
+
items: ArtifactListItem[];
|
|
78
|
+
} | {
|
|
79
|
+
block_id?: string;
|
|
80
|
+
type: "quote";
|
|
81
|
+
text: string;
|
|
82
|
+
} | {
|
|
83
|
+
block_id?: string;
|
|
84
|
+
type: "code";
|
|
85
|
+
lang?: string;
|
|
86
|
+
text: string;
|
|
87
|
+
} | {
|
|
88
|
+
block_id?: string;
|
|
89
|
+
type: "divider";
|
|
90
|
+
} | {
|
|
91
|
+
block_id?: string;
|
|
92
|
+
type: "table";
|
|
93
|
+
columns: ArtifactTableColumn[];
|
|
94
|
+
rows: string[][];
|
|
95
|
+
caption?: string;
|
|
96
|
+
} | {
|
|
97
|
+
block_id?: string;
|
|
98
|
+
type: "kpi";
|
|
99
|
+
items: ArtifactKpiItem[];
|
|
100
|
+
} | {
|
|
101
|
+
block_id?: string;
|
|
102
|
+
type: "callout";
|
|
103
|
+
tone: ArtifactTone;
|
|
104
|
+
title?: string;
|
|
105
|
+
text: string;
|
|
106
|
+
};
|
|
107
|
+
export type ArtifactBlockType = ArtifactBlock["type"];
|
|
108
|
+
/**
|
|
109
|
+
* Plafonds. Ruimer dan de tijdlijn (die staat op 10 blokken) omdat dit een
|
|
110
|
+
* document is, maar niet ongelimiteerd: de body reist als JSON door hetzelfde
|
|
111
|
+
* invoke-kanaal als al het andere en staat straks in één kolom.
|
|
112
|
+
*/
|
|
113
|
+
export declare const ARTIFACT_MAX_BLOCKS = 200;
|
|
114
|
+
export declare const ARTIFACT_MAX_LIST_ITEMS = 100;
|
|
115
|
+
export declare const ARTIFACT_MAX_TABLE_ROWS = 200;
|
|
116
|
+
export declare const ARTIFACT_MAX_TABLE_COLUMNS = 12;
|
|
117
|
+
export declare const ARTIFACT_MAX_KPI_ITEMS = 4;
|
|
118
|
+
export declare const ARTIFACT_MAX_TEXT_LEN = 4000;
|
|
119
|
+
export declare const ARTIFACT_MAX_CELL_LEN = 500;
|
|
120
|
+
/** Harde bovengrens op de geserialiseerde body. */
|
|
121
|
+
export declare const ARTIFACT_MAX_BODY_BYTES: number;
|
|
122
|
+
/**
|
|
123
|
+
* Schema's die een link in een artefact mag dragen.
|
|
124
|
+
*
|
|
125
|
+
* `javascript:` en `data:` staan er niet bij, en dat is de hele reden dat deze
|
|
126
|
+
* lijst bestaat: die twee zijn de enige manier waarop markdown iets uitvoerbaars
|
|
127
|
+
* het document in krijgt.
|
|
128
|
+
*/
|
|
129
|
+
export declare const ALLOWED_LINK_SCHEMES: readonly ["http:", "https:", "mailto:", "tel:"];
|
|
130
|
+
/**
|
|
131
|
+
* Maakt één stuk inline markdown veilig en houdt hem leesbaar.
|
|
132
|
+
*
|
|
133
|
+
* Drie ingrepen, in deze volgorde:
|
|
134
|
+
*
|
|
135
|
+
* 1. **Inline afbeeldingen verdwijnen**, met hun alt-tekst als vervanging. Er is
|
|
136
|
+
* in deze versie geen `image`-blok, juist omdat dit product geen publiek
|
|
137
|
+
* laadbare URL kent (bytes komen als base64 door het invoke-kanaal). Een
|
|
138
|
+
* inline `` zou dat gat langs de achterdeur openzetten en bovendien een
|
|
139
|
+
* externe host laten weten wie het document opent.
|
|
140
|
+
* 2. **Links naar een verboden schema worden platte tekst** — het label blijft
|
|
141
|
+
* staan. Weggooien van het label zou de zin stukmaken om de link.
|
|
142
|
+
* 3. **Referentiedefinities naar een verboden schema verdwijnen.** Zonder deze
|
|
143
|
+
* stap ontsnapt `[klik][x]` met `[x]: javascript:…` eronder aan stap 2.
|
|
144
|
+
*/
|
|
145
|
+
export declare function sanitizeInline(text: string): string;
|
|
146
|
+
/**
|
|
147
|
+
* Snoeit een geschreven blokkenlijst tot iets wat een renderer veilig kan tekenen.
|
|
148
|
+
*
|
|
149
|
+
* Geeft altijd **nieuwe** objecten terug: de invoer komt van een model of van een
|
|
150
|
+
* API-client, en de gesaniteerde tekst hoort niet in het origineel terug te
|
|
151
|
+
* lekken.
|
|
152
|
+
*
|
|
153
|
+
* `onDrop` hoort te loggen of terug te koppelen aan de schrijver — een tool die
|
|
154
|
+
* zijn tabel kwijtraakt omdat hij nul kolommen meestuurde, moet dat kunnen horen.
|
|
155
|
+
*/
|
|
156
|
+
export declare function normalizeArtifactBlocks(blocks: unknown, onDrop?: (reason: string) => void): ArtifactBlock[];
|
|
157
|
+
/** Hoeveel bytes deze body op de wire kost. */
|
|
158
|
+
export declare function artifactBodyBytes(blocks: ArtifactBlock[]): number;
|
|
159
|
+
/**
|
|
160
|
+
* Een korte samenvatting van wat erin zit, voor de miniatuur op een kaart en voor
|
|
161
|
+
* wat de assistent te zien krijgt als hij een artefact wil bijwerken zonder de
|
|
162
|
+
* hele body te lezen.
|
|
163
|
+
*/
|
|
164
|
+
export declare function artifactOutline(blocks: ArtifactBlock[]): {
|
|
165
|
+
blocks: number;
|
|
166
|
+
types: ArtifactBlockType[];
|
|
167
|
+
headings: string[];
|
|
168
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ArtifactBlock } from './blocks';
|
|
2
|
+
/**
|
|
3
|
+
* Het hele document als markdown. `title` komt er als H1 boven te staan wanneer
|
|
4
|
+
* de blokken er zelf geen dragen — een export zonder titel is niet terug te
|
|
5
|
+
* vinden in een downloadmap.
|
|
6
|
+
*/
|
|
7
|
+
export declare function artifactToMarkdown(blocks: ArtifactBlock[], title?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { ToolSource } from '../../platform/ai-tools';
|
|
2
|
+
import { OwnerScope } from '../contact/types';
|
|
3
|
+
import { ArtifactBlock } from './blocks';
|
|
4
|
+
/**
|
|
5
|
+
* Een artefact: een afgerond, deelbaar snapshot-document dat de assistent maakt
|
|
6
|
+
* terwijl hij het platform bevraagt.
|
|
7
|
+
*
|
|
8
|
+
* De veiligheidsredenering waar dit hele model op rust, in één zin: **de AI
|
|
9
|
+
* gebruikt tools tijdens het genereren, het artefact gebruikt geen tools tijdens
|
|
10
|
+
* het bekijken.** Alle tooltoegang zit aan de generatiekant, in de agent die we
|
|
11
|
+
* al draaien en al vertrouwen. Wat bij de kijker landt is data. Daarom is delen
|
|
12
|
+
* veilig zonder cross-user-executierisico, en daarom hoeft er voor dit genre
|
|
13
|
+
* geen sandbox te zijn.
|
|
14
|
+
*/
|
|
15
|
+
/** Waar het artefact in de nav onder valt en welk glyph hij krijgt. */
|
|
16
|
+
export type ArtifactKind = "document" | "table" | "summary";
|
|
17
|
+
/**
|
|
18
|
+
* Wat een gedeelde ontvanger mag.
|
|
19
|
+
*
|
|
20
|
+
* `commenter` leest en mag het gekoppelde assistent-gesprek voeren — hij kan dus
|
|
21
|
+
* wél een nieuwe versie láten maken, maar niet zelf de titel of het deelmodel
|
|
22
|
+
* omzetten. Dat is bewust: het gesprek is de manier waarop je met een artefact
|
|
23
|
+
* werkt, en dat afknijpen zou de feature halveren voor iedereen behalve de
|
|
24
|
+
* eigenaar.
|
|
25
|
+
*/
|
|
26
|
+
export type ArtifactShareRole = "viewer" | "commenter" | "owner";
|
|
27
|
+
export interface ArtifactShare {
|
|
28
|
+
kind: "user" | "team";
|
|
29
|
+
id: string;
|
|
30
|
+
role: ArtifactShareRole;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `"blocks"` nu; `"html"` in de fase waarin de assistent vrije, gesaniteerde
|
|
34
|
+
* opmaak mag schrijven.
|
|
35
|
+
*/
|
|
36
|
+
export type ArtifactFormat = "blocks" | "html";
|
|
37
|
+
/**
|
|
38
|
+
* De sandbox-naad, en de enige plek waar het inerte en het latere interactieve
|
|
39
|
+
* pad uit elkaar lopen.
|
|
40
|
+
*
|
|
41
|
+
* Generatie, opslag, deelmodel en de Drive-omgeving zijn voor beide identiek —
|
|
42
|
+
* alleen de laatste stap in de renderlaag verschilt: gesaniteerde inerte inhoud
|
|
43
|
+
* in onze eigen DOM, of levende code binnen een iframe-grens. De renderer weigert
|
|
44
|
+
* vandaag alles wat niet `"inert"` is, zodat een rij die ooit iets anders draagt
|
|
45
|
+
* niet stilzwijgend als veilig getekend wordt.
|
|
46
|
+
*/
|
|
47
|
+
export type ArtifactRuntime = "inert" | "sandboxed";
|
|
48
|
+
export interface Artifact {
|
|
49
|
+
id: string;
|
|
50
|
+
organizationId: string;
|
|
51
|
+
title: string;
|
|
52
|
+
kind: ArtifactKind;
|
|
53
|
+
ownerScope: OwnerScope;
|
|
54
|
+
/** Wie hem expliciet mag zien, náást de scope. */
|
|
55
|
+
shares: ArtifactShare[];
|
|
56
|
+
/**
|
|
57
|
+
* Platgeslagen spiegel van {@link shares} (`user:<id>` / `team:<id>`).
|
|
58
|
+
*
|
|
59
|
+
* Geen duplicatie maar de enige manier om erop te kunnen zoeken: je kunt niet
|
|
60
|
+
* in een array van objecten queryen. Dezelfde vorm als `Contact.keys` en
|
|
61
|
+
* `Interaction.partyKeys` — platslaan bij het schrijven, één `$in` bij het
|
|
62
|
+
* lezen. Bouw hem altijd met {@link buildShareKeys}, nooit met de hand.
|
|
63
|
+
*/
|
|
64
|
+
shareKeys: string[];
|
|
65
|
+
currentVersion: number;
|
|
66
|
+
/**
|
|
67
|
+
* De soorten bronnen die de huidige versie raadpleegde ("interaction",
|
|
68
|
+
* "analytics", "memory"), ontdubbeld.
|
|
69
|
+
*
|
|
70
|
+
* Afgeleid en meegeschreven bij elke versie, om dezelfde reden als
|
|
71
|
+
* {@link Artifact.shareKeys}: de lijstpagina wil ze als chips tonen en laadt
|
|
72
|
+
* geen versies. Zonder dit veld zou die kolom altijd leeg zijn, of zou elke
|
|
73
|
+
* lijstweergave een versie-fetch per rij kosten.
|
|
74
|
+
*/
|
|
75
|
+
sourceKinds?: string[];
|
|
76
|
+
createdBy: string;
|
|
77
|
+
/** Het assistent-gesprek waaruit hij ontstond, als hij zo ontstaan is. */
|
|
78
|
+
conversationId?: string;
|
|
79
|
+
/** Dossiersleutels: `interaction:<id>`, `company:<id>`, `contact:<id>`. */
|
|
80
|
+
keys?: string[];
|
|
81
|
+
createdAt?: number;
|
|
82
|
+
updatedAt?: number;
|
|
83
|
+
}
|
|
84
|
+
export interface ArtifactVersion {
|
|
85
|
+
id: string;
|
|
86
|
+
organizationId: string;
|
|
87
|
+
artifactId: string;
|
|
88
|
+
/** 1, 2, 3… — oplopend, nooit hergebruikt. */
|
|
89
|
+
n: number;
|
|
90
|
+
/** Waarom deze versie bestaat: "Eerste generatie", "Ingekort op verzoek". */
|
|
91
|
+
label: string;
|
|
92
|
+
format: ArtifactFormat;
|
|
93
|
+
runtime: ArtifactRuntime;
|
|
94
|
+
/** De inhoud zelf, als `format === "blocks"`. */
|
|
95
|
+
body?: ArtifactBlock[];
|
|
96
|
+
/** De naad naar de storage-provider, als `format === "html"`. Nu altijd leeg. */
|
|
97
|
+
storageRef?: {
|
|
98
|
+
fileId: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Wat de assistent raadpleegde toen hij dit schreef.
|
|
102
|
+
*
|
|
103
|
+
* Hergebruikt {@link ToolSource} uit het tool-contract, want het is precies
|
|
104
|
+
* hetzelfde begrip: geraadpleegd, niet geciteerd. Een generatie die vijf
|
|
105
|
+
* gesprekken las noemt er vijf, ook als de tekst er één gebruikte.
|
|
106
|
+
*/
|
|
107
|
+
sources?: ToolSource[];
|
|
108
|
+
createdBy: string;
|
|
109
|
+
createdAt?: number;
|
|
110
|
+
}
|
|
111
|
+
/** Wat een detailpagina in één keer nodig heeft. */
|
|
112
|
+
export interface ArtifactWithVersion {
|
|
113
|
+
artifact: Artifact;
|
|
114
|
+
version: ArtifactVersion;
|
|
115
|
+
}
|
|
116
|
+
export declare const shareKeyForUser: (userId: string) => string;
|
|
117
|
+
export declare const shareKeyForTeam: (teamId: string) => string;
|
|
118
|
+
/**
|
|
119
|
+
* De platte, doorzoekbare vorm van een deellijst.
|
|
120
|
+
*
|
|
121
|
+
* Gedupliceerd en gesorteerd zodat twee gelijke deellijsten dezelfde sleutels
|
|
122
|
+
* geven — anders lijkt een opslag zonder wijziging toch een wijziging.
|
|
123
|
+
*/
|
|
124
|
+
export declare function buildShareKeys(shares: ArtifactShare[] | undefined): string[];
|
|
125
|
+
/** De sleutels waarmee deze gebruiker gedeelde artefacten kan vinden. */
|
|
126
|
+
export declare function shareKeysForViewer(userId: string, teamIds: string[]): string[];
|
|
127
|
+
/** De ontdubbelde bronsoorten, in de volgorde waarin ze voorkwamen. */
|
|
128
|
+
export declare function toolSourceKinds(sources: ToolSource[] | undefined): string[];
|
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=10,f=10,g=10,E=5,fe=new Set(["header","section","context","divider","image","list","actions","attachments"]);function b(e){if(typeof e=="string")return e.length>0;if(!e||typeof e!="object")return!1;const t=e;return typeof t.key=="string"||typeof t.value=="string"}function ge(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const i of e){if(n.length>=S){t("more than "+S+" blocks; the rest was dropped");break}if(!i||typeof i!="object")continue;const a=i;if(!fe.has(a.type)){t("unknown block type "+String(a.type));continue}switch(a.type){case"header":if(!b(a.text)){t("a header without text");continue}break;case"context":if(!b(a.text)){t("a context block without text");continue}break;case"image":if(!a.url||!a.alt){t("an image without url or alt");continue}break;case"section":Array.isArray(a.fields)&&a.fields.length>f&&(t("more than "+f+" fields in a section"),a.fields=a.fields.slice(0,f));break;case"list":if(!Array.isArray(a.items)||a.items.length===0){t("a list without items");continue}a.items.length>g&&(t("more than "+g+" list items"),a.items=a.items.slice(0,g));break;case"actions":{const r=Array.isArray(a.elements)?a.elements:[],o=r.filter(l=>l&&l.action_id&&l.invoke&&b(l.text));if(o.length!==r.length&&t("an action without action_id, invoke or text"),o.length===0)continue;o.length>E&&t("more than "+E+" actions"),a.elements=o.slice(0,E);break}}n.push(a)}return n}function V(e){return e.replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim()}function d(e){if(!e||e<0)return"";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function v(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function T(e){return e?.split("@")?.[0]||e||""}function m(e){return e.map(t=>t.name).join(", ")}function R(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const c={VOICE_CALL_STARTED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek gestart",timeline:e=>e.direction==="inbound"?`Inbound call started — ${T(e.payload.from)}`:`Outbound call started — ${T(e.payload.to)}`},VOICE_CALL_ANSWERED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek aangenomen",timeline:(e,t)=>`Call answered — ${t}`},VOICE_CALL_HOLD:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"In de wacht",timeline:(e,t)=>`Call on hold — ${t}`},VOICE_CALL_UNHOLD:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Hervat"},VOICE_CALL_ENDED:{shape:"event",channelKind:"voice",icon:"phone",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${d(e.payload.duration)})`:""}`,timeline:e=>`Call ended${v(e.payload.duration)}`},VOICE_CALL_MISSED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gemiste oproep",timeline:e=>`Missed call — ${T(e.payload.from)}`},VOICE_CALL_FAILED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek mislukt",timeline:()=>"Call failed"},VOICE_CALL_VOICEMAIL:{shape:"artifact",channelKind:"voice",icon:"phone",snippet:e=>e.payload.transcription?.trim()?e.payload.transcription:"Voicemail ontvangen"},VIDEO_CALL_STARTED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek gestart",timeline:()=>"Video call started"},VIDEO_CALL_ANSWERED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek aangenomen",timeline:()=>"Video call answered"},VIDEO_CALL_HOLD:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"In de wacht"},VIDEO_CALL_UNHOLD:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Hervat"},VIDEO_CALL_ENDED:{shape:"event",channelKind:"video",icon:"video",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${d(e.payload.duration)})`:""}`,timeline:()=>"Video call ended"},VIDEO_CALL_MISSED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gemiste oproep",timeline:()=>"Missed video call"},VIDEO_CALL_FAILED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek mislukt",timeline:()=>"Video call failed"},EMAIL_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.EMAIL_RECEIVED",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:O},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:O},CHAT_MESSAGE_SENT:{shape:"message",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:e=>e.payload.text??""},CHAT_MESSAGE_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.CHAT_MESSAGE_RECEIVED",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:e=>e.payload.text??""},CHAT_MEMBER_JOINED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${m(e.payload.members)} toegevoegd`,timeline:e=>{const t=m(e.payload.members)||"Someone",n=e.payload.initiator?.name?` · added by ${e.payload.initiator.name}`:"";return`${t} joined the chat${n}`}},CHAT_MEMBER_LEFT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${m(e.payload.members)} verlaten`,timeline:e=>{const t=m(e.payload.members)||"Someone",n=e.payload.initiator?.name?` · removed by ${e.payload.initiator.name}`:"";return`${t} left the chat${n}`}},CHAT_RENAMED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`Hernoemd naar "${e.payload.newName}"`,timeline:e=>`Chat renamed to "${e.payload.newName}"${e.payload.initiator?` by ${e.payload.initiator.name}`:""}`},CHAT_CALL_STARTED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:()=>"Gesprek gestart",timeline:e=>`${R(e.payload.callType)} started${e.payload.initiator?` by ${e.payload.initiator.name}`:""}`,joinUrl:e=>e.payload.joinUrl},CHAT_CALL_ENDED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${d(e.payload.duration)})`:""}`,timeline:e=>`${R(e.payload.callType)} ended${v(e.payload.duration)}`,joinUrl:e=>e.payload.joinUrl},CHAT_EVENT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>e.payload.text??e.payload.eventType,timeline:e=>e.payload.text||e.payload.eventType},TRANSCRIPT_ADDED:{shape:"artifact",triggerable:!0,displayNameKey:"communication:activity.TRANSCRIPT_ADDED",component:"communication:TranscriptionActivity",icon:"captions",carriesText:!0,snippet:e=>(e.payload.segments??[]).map(t=>t.text).join(" ")},COMMENT_ADDED:{shape:"note",component:"communication:CommentActivity",icon:"sticky-note",carriesText:!0,snippet:e=>e.payload.text??""},FILE_UPLOADED:{shape:"artifact",component:"communication:FileActivity",icon:"paperclip",snippet:e=>`Bestand: ${e.payload.fileName}`},AI_MESSAGE_ADDED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.AI_MESSAGE_ADDED",icon:"circle",snippet:e=>e.payload.output?.text??e.payload.input?.text??"",timeline:()=>"AI message added"},AI_ACTION_PROPOSED:{shape:"event",component:"communication:ProposedActionCard",icon:"circle",playbookAuthored:!0,snippet:e=>`Voorstel wacht op goedkeuring (${e.payload.actions?.length??0} actie(s))`},PLAYBOOK_STARTED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:e=>`Playbook gestart${e.payload.playbookName?`: ${e.payload.playbookName}`:""}`,timeline:e=>`Playbook gestart${e.payload.playbookName?` — ${e.payload.playbookName}`:""}`},PLAYBOOK_COMPLETED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook afgerond",timeline:()=>"Playbook afgerond"},PLAYBOOK_ESCALATED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook geëscaleerd naar een mens",timeline:()=>"Playbook geëscaleerd naar een mens"},MEETING_SCHEDULED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gepland: ${e.payload.title}`,timeline:()=>"Meeting scheduled",joinUrl:e=>e.payload.joinUrl},MEETING_STARTED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gestart: ${e.payload.title}`,timeline:()=>"Meeting started",joinUrl:e=>e.payload.joinUrl},MEETING_ENDED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering beëindigd${e.payload.duration?` (${d(e.payload.duration)})`:""}`,timeline:()=>"Meeting ended"},MEETING_PARTICIPANT_JOINED:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} deelgenomen`,timeline:(e,t)=>`${t} joined the meeting`},MEETING_PARTICIPANT_LEFT:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} verlaten`,timeline:(e,t)=>`${t} left the meeting`},INTERACTION_CREATED:{shape:"event",icon:"circle",snippet:()=>"Interactie aangemaakt",timeline:(e,t)=>`Interaction started by ${t}`},INTERACTION_STATUS_CHANGED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.INTERACTION_STATUS_CHANGED",icon:"circle-dot",snippet:e=>`Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`,timeline:(e,t)=>`Status changed to ${e.payload.toStatus} by ${t}`},INTERACTION_ASSIGNED:{shape:"event",icon:"user",snippet:()=>"Interactie toegewezen",timeline:(e,t)=>`Assigned by ${t}`}};function O(e){const t=e.payload,n=t.bodySnippet?.trim()||V(t.body??"");return t.subject?`${t.subject} — ${n}`:n}function s(e){return c[e]}function Ee(e){return s(e)?.icon??"circle"}function he(e){return s(e)?.channelKind}function Ae(e){const t=s(e)?.shape;return t==="message"||t==="note"}function ye(e){return s(e)?.replyable===!0}function _e(e){return s(e)?.carriesText===!0}function be(e){return s(e)?.countsAs}function Te(e){return s(e)?.playbookAuthored===!0}function H(e){const t=s(e.type)?.snippet;return t?t(e):""}function Ie(e,t){const n=s(e.type)?.timeline;return n?n(e,t):e.type.replace(/_/g," ").toLowerCase()}function Se(e){const t=s(e.type)?.joinUrl;return t?t(e):void 0}function A(e,t){let n=e;for(const i of t.split(".")){if(n==null||typeof n!="object")return"";n=n[i]}return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):""}function y(e,t,n){if(e===void 0)return null;if(typeof e=="string")return e||null;if("value"in e)return A(t,e.value)||null;const i={};for(const[r,o]of Object.entries(e.params??{}))i[r]=A(t,o);const a=n(e.key,i);return a===e.key?null:a}function B(e,t){if(!e||typeof e=="string"||"value"in e)return null;const n={};for(const[i,a]of Object.entries(e.params??{}))n[i]=A(t,a);return{key:e.key,params:n}}const Me=e=>e;function D(e){const t=c[e];return{type:e,shape:t.shape,channelKind:t.channelKind,icon:t.icon,replyable:t.replyable===!0,countsAs:t.countsAs,carriesText:t.carriesText===!0,triggerable:t.triggerable===!0,component:t.component,builtIn:!0,displayNameKey:t.displayNameKey}}function L(e){return{type:e.type,shape:e.shape,channelKind:e.channelKind,icon:e.icon||"circle",replyable:e.replyable===!0,countsAs:e.countsAs,carriesText:e.carriesText===!0,triggerable:e.triggerable===!0,component:e.component,builtIn:!1,displayNameKey:e.displayNameKey}}class j{constructor(t=[],n=Me){this.translate=n;for(const i of t)i?.type&&(i.type in c||this.declared.has(i.type)||this.declared.set(i.type,i))}declared=new Map;get(t){if(t in c)return D(t);const n=this.declared.get(t);return n?L(n):void 0}triggerable(){const t=Object.keys(c).filter(i=>c[i].triggerable).map(D),n=[...this.declared.values()].map(L).filter(i=>i.triggerable);return[...t,...n]}timelineText(t,n){const i=c[t.type];if(i?.timeline)return i.timeline(t,n);const a=this.declared.get(t.type);return y(a?.text,t,this.translate)??t.type.replace(/_/g," ").toLowerCase()}snippet(t){const n=c[t.type];if(n?.snippet)return n.snippet(t);const i=this.declared.get(t.type);return y(i?.text,t,this.translate)??""}descriptor(t){return this.declared.get(t)}blocks(t){const n=this.declared.get(t)?.render;return n?.length?n:void 0}get translator(){return this.translate}}const Ne=new j,k=140;function Ce(e){const t=e.trim();return t.length<=k?t:t.slice(0,k-1).trimEnd()+"…"}function ve(e,t){const n=B(t?.text,e),i=t?y(t.text,e,a=>a):null;return{activityId:e.id,type:e.type,snippet:Ce(i??H(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...n?{snippetKey:n.key,snippetParams:n.params}:{}}}function Re(e,t,n=[]){const i=e.createdAt;if(!i)return[];const a=new Set(n);return e.author.type==="user"&&e.author.id&&a.add(e.author.id),Object.entries(t).filter(([r,o])=>o>=i&&!a.has(r)).map(([r])=>r)}function Oe(e){return e.createdAt??0}const De=[{id:"agent",label:"Agent",labelSource:"user"},{id:"team",label:"Team",labelSource:"team"},{id:"inbox",label:"Inbox",labelSource:"inbox"},{id:"channel",label:"Kanaal",labelSource:"channel"},{id:"provider",label:"Provider",labelSource:"raw"},{id:"status",label:"Status",labelSource:"raw"},{id:"handledBy",label:"Afhandelaar",labelSource:"raw"},{id:"time",label:"Tijd",labelSource:"raw"}];function Le(e){const t=[];for(const n of Object.keys(e))for(const i of Object.keys(e[n]))t.push({lang:n,key:i,value:e[n][i]});return t}function I(e){return e<10?`0${e}`:`${e}`}function F(e,t){const n=new Date(e),i=`${n.getUTCFullYear()}-${I(n.getUTCMonth()+1)}-${I(n.getUTCDate())}`;return t==="day"?i:`${i}T${I(n.getUTCHours())}`}function W(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const ke=36e5,Ue=864e5;function xe(e,t,n){const i=n==="hour"?ke:Ue,a=[];for(let r=W(e,n);r<=t;r+=i)a.push(F(r,n));return a}const Y=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],X=Y.map(e=>e.id);function z(e,t){return`${e}.usage.${t}`}function $e(e,t){return t.map(n=>({id:z(e,n.unit),label:n.label,category:"Verbruik",valueType:n.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...X,...n.extraDimensions??[],"time"]}))}function Pe(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const Ke=[{name:"text",type:"string"},{name:"subject",type:"string"},{name:"from",type:"string"},{name:"type",type:"string"},{name:"direction",type:"string"},{name:"channelId",type:"string"},{name:"interactionId",type:"string"},{name:"activityId",type:"string"},{name:"authorType",type:"string"},{name:"authorName",type:"string"},{name:"textRaw",type:"string"},{name:"fromStatus",type:"string"},{name:"toStatus",type:"string"},{name:"contactId",type:"string"},{name:"companyId",type:"string"}],Ge={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function q(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function we(e){if(typeof e!="string")return;const t=e.trim();if(t==="org")return{kind:"org"};const n=t.indexOf(":");if(n<=0)return;const i=t.slice(0,n),a=t.slice(n+1).trim();if(a){if(i==="user")return{kind:"user",userId:a};if(i==="team")return{kind:"team",teamId:a}}}function J(e){return q(e)}function Ve(e){switch(e.kind){case"personal":return{kind:"user",userId:e.userId};case"team":return{kind:"team",teamId:e.teamId};case"org":return{kind:"org"}}}function He(e){return J(e)}const Q=["done","escalated","failed","timed_out","stopped"],Z=["awaiting_approval","awaiting_reply"];function ee(e){return Q.includes(e)}function Be(e){return ee(e)}function je(e){return Z.includes(e)}const N=[{id:"openai",attachmentKinds:["image","pdf"],label:"OpenAI",capabilities:["chat","transcription","embedding"],defaultModel:"gpt-5-mini",baseUrl:"https://api.openai.com/v1"},{id:"gemini",attachmentKinds:["image","pdf"],label:"Google Gemini",capabilities:["chat","transcription","embedding"],defaultModel:"gemini-3.5-flash",baseUrl:"https://generativelanguage.googleapis.com/v1beta"},{id:"anthropic",attachmentKinds:["image","pdf"],label:"Anthropic",capabilities:["chat"],defaultModel:"claude-haiku-4-5",baseUrl:"https://api.anthropic.com/v1"},{id:"elevenlabs",label:"ElevenLabs",capabilities:["transcription"],baseUrl:"https://api.elevenlabs.io/v1"},{id:"moonshot",label:"Moonshot (Kimi)",capabilities:["chat"],defaultModel:"kimi-k3",baseUrl:"https://api.moonshot.ai/v1"},{id:"deepseek",label:"DeepSeek",capabilities:["chat"],defaultModel:"deepseek-v4-flash",baseUrl:"https://api.deepseek.com/v1"},{id:"groq",label:"Groq",capabilities:["chat"],defaultModel:"openai/gpt-oss-120b",baseUrl:"https://api.groq.com/openai/v1"},{id:"mistral",label:"Mistral",capabilities:["chat"],defaultModel:"mistral-large-latest",baseUrl:"https://api.mistral.ai/v1"},{id:"openrouter",label:"OpenRouter",capabilities:["chat"],defaultModel:"openrouter/auto",baseUrl:"https://openrouter.ai/api/v1"},{id:"ollama",label:"Ollama (self-hosted)",capabilities:["chat"],defaultModel:"llama3.3"},{id:"openai-compatible",label:"OpenAI-compatible (eigen endpoint)",capabilities:["chat"],defaultModel:"default"}];function u(e){return N.find(t=>t.id===e)}function Fe(e){return u(e)?.label??e}function We(e,t="gpt-5-mini"){return u(e)?.defaultModel??t}function Ye(e){return N.filter(t=>t.capabilities.includes(e))}function Xe(e){const t=u(e);return!!t&&!t.baseUrl}function ze(e,t){return t==="text"?!0:u(e)?.attachmentKinds?.includes(t)===!0}const qe=new Set(["mail","message"]);function te(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function Je(e,t,n,i="html"){if(!e)return n;const a=te(e,t);return a?`${n}${i==="text"?`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=10,_=10,T=10,b=5,Pe=new Set(["header","section","context","divider","image","list","actions","attachments"]);function O(e){if(typeof e=="string")return e.length>0;if(!e||typeof e!="object")return!1;const t=e;return typeof t.key=="string"||typeof t.value=="string"}function Ke(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const a of e){if(n.length>=k){t("more than "+k+" blocks; the rest was dropped");break}if(!a||typeof a!="object")continue;const i=a;if(!Pe.has(i.type)){t("unknown block type "+String(i.type));continue}switch(i.type){case"header":if(!O(i.text)){t("a header without text");continue}break;case"context":if(!O(i.text)){t("a context block without text");continue}break;case"image":if(!i.url||!i.alt){t("an image without url or alt");continue}break;case"section":Array.isArray(i.fields)&&i.fields.length>_&&(t("more than "+_+" fields in a section"),i.fields=i.fields.slice(0,_));break;case"list":if(!Array.isArray(i.items)||i.items.length===0){t("a list without items");continue}i.items.length>T&&(t("more than "+T+" list items"),i.items=i.items.slice(0,T));break;case"actions":{const r=Array.isArray(i.elements)?i.elements:[],o=r.filter(s=>s&&s.action_id&&s.invoke&&O(s.text));if(o.length!==r.length&&t("an action without action_id, invoke or text"),o.length===0)continue;o.length>b&&t("more than "+b+" actions"),i.elements=o.slice(0,b);break}}n.push(i)}return n}function oe(e){return e.replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim()}function E(e){if(!e||e<0)return"";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function H(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function v(e){return e?.split("@")?.[0]||e||""}function y(e){return e.map(t=>t.name).join(", ")}function j(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const f={VOICE_CALL_STARTED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek gestart",timeline:e=>e.direction==="inbound"?`Inbound call started — ${v(e.payload.from)}`:`Outbound call started — ${v(e.payload.to)}`},VOICE_CALL_ANSWERED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek aangenomen",timeline:(e,t)=>`Call answered — ${t}`},VOICE_CALL_HOLD:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"In de wacht",timeline:(e,t)=>`Call on hold — ${t}`},VOICE_CALL_UNHOLD:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Hervat"},VOICE_CALL_ENDED:{shape:"event",channelKind:"voice",icon:"phone",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${E(e.payload.duration)})`:""}`,timeline:e=>`Call ended${H(e.payload.duration)}`},VOICE_CALL_MISSED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gemiste oproep",timeline:e=>`Missed call — ${v(e.payload.from)}`},VOICE_CALL_FAILED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek mislukt",timeline:()=>"Call failed"},VOICE_CALL_VOICEMAIL:{shape:"artifact",channelKind:"voice",icon:"phone",snippet:e=>e.payload.transcription?.trim()?e.payload.transcription:"Voicemail ontvangen"},VIDEO_CALL_STARTED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek gestart",timeline:()=>"Video call started"},VIDEO_CALL_ANSWERED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek aangenomen",timeline:()=>"Video call answered"},VIDEO_CALL_HOLD:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"In de wacht"},VIDEO_CALL_UNHOLD:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Hervat"},VIDEO_CALL_ENDED:{shape:"event",channelKind:"video",icon:"video",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${E(e.payload.duration)})`:""}`,timeline:()=>"Video call ended"},VIDEO_CALL_MISSED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gemiste oproep",timeline:()=>"Missed video call"},VIDEO_CALL_FAILED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek mislukt",timeline:()=>"Video call failed"},EMAIL_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.EMAIL_RECEIVED",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:X},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:X},CHAT_MESSAGE_SENT:{shape:"message",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:e=>e.payload.text??""},CHAT_MESSAGE_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.CHAT_MESSAGE_RECEIVED",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:e=>e.payload.text??""},CHAT_MEMBER_JOINED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${y(e.payload.members)} toegevoegd`,timeline:e=>{const t=y(e.payload.members)||"Someone",n=e.payload.initiator?.name?` · added by ${e.payload.initiator.name}`:"";return`${t} joined the chat${n}`}},CHAT_MEMBER_LEFT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${y(e.payload.members)} verlaten`,timeline:e=>{const t=y(e.payload.members)||"Someone",n=e.payload.initiator?.name?` · removed by ${e.payload.initiator.name}`:"";return`${t} left the chat${n}`}},CHAT_RENAMED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`Hernoemd naar "${e.payload.newName}"`,timeline:e=>`Chat renamed to "${e.payload.newName}"${e.payload.initiator?` by ${e.payload.initiator.name}`:""}`},CHAT_CALL_STARTED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:()=>"Gesprek gestart",timeline:e=>`${j(e.payload.callType)} started${e.payload.initiator?` by ${e.payload.initiator.name}`:""}`,joinUrl:e=>e.payload.joinUrl},CHAT_CALL_ENDED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${E(e.payload.duration)})`:""}`,timeline:e=>`${j(e.payload.callType)} ended${H(e.payload.duration)}`,joinUrl:e=>e.payload.joinUrl},CHAT_EVENT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>e.payload.text??e.payload.eventType,timeline:e=>e.payload.text||e.payload.eventType},TRANSCRIPT_ADDED:{shape:"artifact",triggerable:!0,displayNameKey:"communication:activity.TRANSCRIPT_ADDED",component:"communication:TranscriptionActivity",icon:"captions",carriesText:!0,snippet:e=>(e.payload.segments??[]).map(t=>t.text).join(" ")},COMMENT_ADDED:{shape:"note",component:"communication:CommentActivity",icon:"sticky-note",carriesText:!0,snippet:e=>e.payload.text??""},FILE_UPLOADED:{shape:"artifact",component:"communication:FileActivity",icon:"paperclip",snippet:e=>`Bestand: ${e.payload.fileName}`},AI_MESSAGE_ADDED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.AI_MESSAGE_ADDED",icon:"circle",snippet:e=>e.payload.output?.text??e.payload.input?.text??"",timeline:()=>"AI message added"},AI_ACTION_PROPOSED:{shape:"event",component:"communication:ProposedActionCard",icon:"circle",playbookAuthored:!0,snippet:e=>`Voorstel wacht op goedkeuring (${e.payload.actions?.length??0} actie(s))`},PLAYBOOK_STARTED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:e=>`Playbook gestart${e.payload.playbookName?`: ${e.payload.playbookName}`:""}`,timeline:e=>`Playbook gestart${e.payload.playbookName?` — ${e.payload.playbookName}`:""}`},PLAYBOOK_COMPLETED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook afgerond",timeline:()=>"Playbook afgerond"},PLAYBOOK_ESCALATED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook geëscaleerd naar een mens",timeline:()=>"Playbook geëscaleerd naar een mens"},MEETING_SCHEDULED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gepland: ${e.payload.title}`,timeline:()=>"Meeting scheduled",joinUrl:e=>e.payload.joinUrl},MEETING_STARTED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gestart: ${e.payload.title}`,timeline:()=>"Meeting started",joinUrl:e=>e.payload.joinUrl},MEETING_ENDED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering beëindigd${e.payload.duration?` (${E(e.payload.duration)})`:""}`,timeline:()=>"Meeting ended"},MEETING_PARTICIPANT_JOINED:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} deelgenomen`,timeline:(e,t)=>`${t} joined the meeting`},MEETING_PARTICIPANT_LEFT:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} verlaten`,timeline:(e,t)=>`${t} left the meeting`},INTERACTION_CREATED:{shape:"event",icon:"circle",snippet:()=>"Interactie aangemaakt",timeline:(e,t)=>`Interaction started by ${t}`},INTERACTION_STATUS_CHANGED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.INTERACTION_STATUS_CHANGED",icon:"circle-dot",snippet:e=>`Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`,timeline:(e,t)=>`Status changed to ${e.payload.toStatus} by ${t}`},INTERACTION_ASSIGNED:{shape:"event",icon:"user",snippet:()=>"Interactie toegewezen",timeline:(e,t)=>`Assigned by ${t}`}};function X(e){const t=e.payload,n=t.bodySnippet?.trim()||oe(t.body??"");return t.subject?`${t.subject} — ${n}`:n}function u(e){return f[e]}function Ge(e){return u(e)?.icon??"circle"}function Be(e){return u(e)?.channelKind}function Fe(e){const t=u(e)?.shape;return t==="message"||t==="note"}function Ve(e){return u(e)?.replyable===!0}function He(e){return u(e)?.carriesText===!0}function je(e){return u(e)?.countsAs}function Xe(e){return u(e)?.playbookAuthored===!0}function se(e){const t=u(e.type)?.snippet;return t?t(e):""}function We(e,t){const n=u(e.type)?.timeline;return n?n(e,t):e.type.replace(/_/g," ").toLowerCase()}function Ye(e){const t=u(e.type)?.joinUrl;return t?t(e):void 0}function M(e,t){let n=e;for(const a of t.split(".")){if(n==null||typeof n!="object")return"";n=n[a]}return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):""}function N(e,t,n){if(e===void 0)return null;if(typeof e=="string")return e||null;if("value"in e)return M(t,e.value)||null;const a={};for(const[r,o]of Object.entries(e.params??{}))a[r]=M(t,o);const i=n(e.key,a);return i===e.key?null:i}function le(e,t){if(!e||typeof e=="string"||"value"in e)return null;const n={};for(const[a,i]of Object.entries(e.params??{}))n[a]=M(t,i);return{key:e.key,params:n}}const ze=e=>e;function W(e){const t=f[e];return{type:e,shape:t.shape,channelKind:t.channelKind,icon:t.icon,replyable:t.replyable===!0,countsAs:t.countsAs,carriesText:t.carriesText===!0,triggerable:t.triggerable===!0,component:t.component,builtIn:!0,displayNameKey:t.displayNameKey}}function Y(e){return{type:e.type,shape:e.shape,channelKind:e.channelKind,icon:e.icon||"circle",replyable:e.replyable===!0,countsAs:e.countsAs,carriesText:e.carriesText===!0,triggerable:e.triggerable===!0,component:e.component,builtIn:!1,displayNameKey:e.displayNameKey}}class ce{constructor(t=[],n=ze){this.translate=n;for(const a of t)a?.type&&(a.type in f||this.declared.has(a.type)||this.declared.set(a.type,a))}declared=new Map;get(t){if(t in f)return W(t);const n=this.declared.get(t);return n?Y(n):void 0}triggerable(){const t=Object.keys(f).filter(a=>f[a].triggerable).map(W),n=[...this.declared.values()].map(Y).filter(a=>a.triggerable);return[...t,...n]}timelineText(t,n){const a=f[t.type];if(a?.timeline)return a.timeline(t,n);const i=this.declared.get(t.type);return N(i?.text,t,this.translate)??t.type.replace(/_/g," ").toLowerCase()}snippet(t){const n=f[t.type];if(n?.snippet)return n.snippet(t);const a=this.declared.get(t.type);return N(a?.text,t,this.translate)??""}descriptor(t){return this.declared.get(t)}blocks(t){const n=this.declared.get(t)?.render;return n?.length?n:void 0}get translator(){return this.translate}}const qe=new ce,z=140;function Je(e){const t=e.trim();return t.length<=z?t:t.slice(0,z-1).trimEnd()+"…"}function Qe(e,t){const n=le(t?.text,e),a=t?N(t.text,e,i=>i):null;return{activityId:e.id,type:e.type,snippet:Je(a??se(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...n?{snippetKey:n.key,snippetParams:n.params}:{}}}function Ze(e,t,n=[]){const a=e.createdAt;if(!a)return[];const i=new Set(n);return e.author.type==="user"&&e.author.id&&i.add(e.author.id),Object.entries(t).filter(([r,o])=>o>=a&&!i.has(r)).map(([r])=>r)}function et(e){return e.createdAt??0}const tt=[{id:"agent",label:"Agent",labelSource:"user"},{id:"team",label:"Team",labelSource:"team"},{id:"inbox",label:"Inbox",labelSource:"inbox"},{id:"channel",label:"Kanaal",labelSource:"channel"},{id:"provider",label:"Provider",labelSource:"raw"},{id:"status",label:"Status",labelSource:"raw"},{id:"handledBy",label:"Afhandelaar",labelSource:"raw"},{id:"time",label:"Tijd",labelSource:"raw"}];function nt(e){const t=[];for(const n of Object.keys(e))for(const a of Object.keys(e[n]))t.push({lang:n,key:a,value:e[n][a]});return t}function L(e){return e<10?`0${e}`:`${e}`}function ue(e,t){const n=new Date(e),a=`${n.getUTCFullYear()}-${L(n.getUTCMonth()+1)}-${L(n.getUTCDate())}`;return t==="day"?a:`${a}T${L(n.getUTCHours())}`}function pe(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const it=36e5,at=864e5;function rt(e,t,n){const a=n==="hour"?it:at,i=[];for(let r=pe(e,n);r<=t;r+=a)i.push(ue(r,n));return i}const de=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],me=de.map(e=>e.id);function fe(e,t){return`${e}.usage.${t}`}function ot(e,t){return t.map(n=>({id:fe(e,n.unit),label:n.label,category:"Verbruik",valueType:n.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...me,...n.extraDimensions??[],"time"]}))}const ge=new Set(["info","success","warning","destructive"]),x=200,D=100,$=200,U=12,w=4,K=4e3,I=500,st=256*1024,lt=new Set(["heading","paragraph","list","quote","code","divider","table","kpi","callout"]),he=["http:","https:","mailto:","tel:"],ct=/^[a-z][a-z0-9+.-]*:/i;function Ae(e){const t=e.trim().replace(/^<|>$/g,"");if(!t)return!1;const n=ct.exec(t)?.[0];return n?he.includes(n.toLowerCase()):!t.startsWith("//")}const ut=/^[ \t]{0,3}\[([^\]]+)\]:[ \t]*(\S+).*$/gm;function pt(e){let t="",n=0;for(;n<e.length;){const a=e[n]==="!"&&e[n+1]==="[";if(e[n]!=="["&&!a){t+=e[n],n+=1;continue}const i=n+(a?2:1),r=q(e,i,"[","]");if(r<0||e[r+1]!=="("){t+=e[n],n+=1;continue}const o=q(e,r+2,"(",")");if(o<0){t+=e[n],n+=1;continue}const s=e.slice(i,r),m=e.slice(r+2,o).trim().split(/\s+/)[0]??"";t+=a||!Ae(m)?s:e.slice(n,o+1),n=o+1}return t}function q(e,t,n,a){let i=1;for(let r=t;r<e.length;r+=1){if(e[r]==="\\"){r+=1;continue}if(e[r]===n)i+=1;else if(e[r]===a&&(i-=1,i===0))return r}return-1}function Ee(e){return pt(e).replace(ut,(t,n,a)=>Ae(a)?t:"")}function c(e,t=K){return typeof e=="string"?Ee(e).slice(0,t):""}function dt(e,t=K){return typeof e=="string"?e.slice(0,t):""}function mt(e,t="info"){return typeof e=="string"&&ge.has(e)?e:t}function ft(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const a of e){if(n.length>=x){t("more than "+x+" blocks; the rest was dropped");break}if(!a||typeof a!="object")continue;const i=a;if(!lt.has(i.type)){t("unknown block type "+String(i.type));continue}const r=typeof i.block_id=="string"?{block_id:i.block_id}:{};switch(i.type){case"heading":{const o=c(i.text);if(!o){t("a heading without text");continue}const s=i.level===2||i.level===3?i.level:1;n.push({...r,type:"heading",level:s,text:o});break}case"paragraph":{const o=c(i.text);if(!o){t("a paragraph without text");continue}n.push({...r,type:"paragraph",text:o});break}case"quote":{const o=c(i.text);if(!o){t("a quote without text");continue}n.push({...r,type:"quote",text:o});break}case"code":{const o=dt(i.text);if(!o){t("a code block without text");continue}const s=typeof i.lang=="string"?{lang:i.lang.slice(0,32)}:{};n.push({...r,type:"code",...s,text:o});break}case"divider":n.push({...r,type:"divider"});break;case"list":{const o=Array.isArray(i.items)?i.items:[],s=[];for(const p of o){if(s.length>=D){t("more than "+D+" list items");break}const d=c(p?.text);if(!d)continue;const l=c(p?.lead,200);s.push(l?{lead:l,text:d}:{text:d})}if(s.length===0){t("a list without usable items");continue}const m=i.style==="numbered"?"numbered":"bulleted";n.push({...r,type:"list",style:m,items:s});break}case"table":{const o=Array.isArray(i.columns)?i.columns:[],s=[];for(const l of o){if(s.length>=U){t("more than "+U+" table columns");break}const A=c(l?.label,I),R=l?.align==="right"?"right":void 0;s.push(R?{label:A,align:R}:{label:A})}if(s.length===0){t("a table without columns");continue}const m=Array.isArray(i.rows)?i.rows:[],p=[];for(const l of m){if(p.length>=$){t("more than "+$+" table rows");break}const A=Array.isArray(l)?l:[];p.push(s.map((R,we)=>c(A[we],I)))}const d=c(i.caption,I);n.push({...r,type:"table",columns:s,rows:p,...d?{caption:d}:{}});break}case"kpi":{const o=Array.isArray(i.items)?i.items:[],s=[];for(const m of o){if(s.length>=w){t("more than "+w+" kpi items");break}const p=c(m?.value,40),d=c(m?.label,80);if(!p||!d)continue;const l=m?.tone;s.push(typeof l=="string"&&ge.has(l)?{value:p,label:d,tone:l}:{value:p,label:d})}if(s.length===0){t("a kpi block without usable items");continue}n.push({...r,type:"kpi",items:s});break}case"callout":{const o=c(i.text);if(!o){t("a callout without text");continue}const s=c(i.title,200);n.push({...r,type:"callout",tone:mt(i.tone),...s?{title:s}:{},text:o});break}}}return n}function gt(e){return JSON.stringify(e).length}function ht(e){return{blocks:e.length,types:e.map(t=>t.type),headings:e.flatMap(t=>t.type==="heading"?[t.text]:[])}}function J(e){return e.replace(/\|/g,"\\|").replace(/\r?\n/g," ").trim()}function Q(e,t,n){const a=e.map((i,r)=>n?.[r]==="right"?"---:":"---");return[`| ${e.map(J).join(" | ")} |`,`| ${a.join(" | ")} |`,...t.map(i=>`| ${i.map(J).join(" | ")} |`)]}function At(e){switch(e.type){case"heading":return[`${"#".repeat(e.level)} ${e.text}`];case"paragraph":return[e.text];case"quote":return e.text.split(/\r?\n/).map(t=>`> ${t}`);case"code":return[`\`\`\`${e.lang??""}`,e.text,"```"];case"divider":return["---"];case"list":return e.items.map((t,n)=>{const a=e.style==="numbered"?`${n+1}.`:"-";return t.lead?`${a} **${t.lead}** ${t.text}`:`${a} ${t.text}`});case"table":{const t=Q(e.columns.map(n=>n.label),e.rows,e.columns.map(n=>n.align??"left"));return e.caption?[...t,"",`*${e.caption}*`]:t}case"kpi":return Q(e.items.map(t=>t.value),[e.items.map(t=>t.label)]);case"callout":return(e.title?`**${e.title}** ${e.text}`:e.text).split(/\r?\n/).map(n=>`> ${n}`)}}function Et(e,t){const n=[],a=e.some(i=>i.type==="heading"&&i.level===1);t&&!a&&n.push(`# ${t}`);for(const i of e){const r=At(i);r.length>0&&n.push(r.join(`
|
|
2
|
+
`))}return`${n.join(`
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
`)}
|
|
5
|
+
`}const G=e=>`user:${e}`,B=e=>`team:${e}`;function yt(e){const t=new Set;for(const n of e??[])n?.id&&(n.kind==="user"&&t.add(G(n.id)),n.kind==="team"&&t.add(B(n.id)));return[...t].sort()}function _t(e,t){return[G(e),...t.map(B)]}function Tt(e){const t=new Set;for(const n of e??[])n?.kind&&t.add(n.kind);return[...t]}function bt(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const It=[{name:"text",type:"string"},{name:"subject",type:"string"},{name:"from",type:"string"},{name:"type",type:"string"},{name:"direction",type:"string"},{name:"channelId",type:"string"},{name:"interactionId",type:"string"},{name:"activityId",type:"string"},{name:"authorType",type:"string"},{name:"authorName",type:"string"},{name:"textRaw",type:"string"},{name:"fromStatus",type:"string"},{name:"toStatus",type:"string"},{name:"contactId",type:"string"},{name:"companyId",type:"string"}],St={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function ye(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function Mt(e){if(typeof e!="string")return;const t=e.trim();if(t==="org")return{kind:"org"};const n=t.indexOf(":");if(n<=0)return;const a=t.slice(0,n),i=t.slice(n+1).trim();if(i){if(a==="user")return{kind:"user",userId:i};if(a==="team")return{kind:"team",teamId:i}}}function _e(e){return ye(e)}function Nt(e){switch(e.kind){case"personal":return{kind:"user",userId:e.userId};case"team":return{kind:"team",teamId:e.teamId};case"org":return{kind:"org"}}}function Ct(e){return _e(e)}const Te=["done","escalated","failed","timed_out","stopped"],be=["awaiting_approval","awaiting_reply"];function Ie(e){return Te.includes(e)}function Rt(e){return Ie(e)}function Ot(e){return be.includes(e)}const F=[{id:"openai",attachmentKinds:["image","pdf"],label:"OpenAI",capabilities:["chat","transcription","embedding"],defaultModel:"gpt-5-mini",baseUrl:"https://api.openai.com/v1"},{id:"gemini",attachmentKinds:["image","pdf"],label:"Google Gemini",capabilities:["chat","transcription","embedding"],defaultModel:"gemini-3.5-flash",baseUrl:"https://generativelanguage.googleapis.com/v1beta"},{id:"anthropic",attachmentKinds:["image","pdf"],label:"Anthropic",capabilities:["chat"],defaultModel:"claude-haiku-4-5",baseUrl:"https://api.anthropic.com/v1"},{id:"elevenlabs",label:"ElevenLabs",capabilities:["transcription"],baseUrl:"https://api.elevenlabs.io/v1"},{id:"moonshot",label:"Moonshot (Kimi)",capabilities:["chat"],defaultModel:"kimi-k3",baseUrl:"https://api.moonshot.ai/v1"},{id:"deepseek",label:"DeepSeek",capabilities:["chat"],defaultModel:"deepseek-v4-flash",baseUrl:"https://api.deepseek.com/v1"},{id:"groq",label:"Groq",capabilities:["chat"],defaultModel:"openai/gpt-oss-120b",baseUrl:"https://api.groq.com/openai/v1"},{id:"mistral",label:"Mistral",capabilities:["chat"],defaultModel:"mistral-large-latest",baseUrl:"https://api.mistral.ai/v1"},{id:"openrouter",label:"OpenRouter",capabilities:["chat"],defaultModel:"openrouter/auto",baseUrl:"https://openrouter.ai/api/v1"},{id:"ollama",label:"Ollama (self-hosted)",capabilities:["chat"],defaultModel:"llama3.3"},{id:"openai-compatible",label:"OpenAI-compatible (eigen endpoint)",capabilities:["chat"],defaultModel:"default"}];function h(e){return F.find(t=>t.id===e)}function vt(e){return h(e)?.label??e}function Lt(e,t="gpt-5-mini"){return h(e)?.defaultModel??t}function kt(e){return F.filter(t=>t.capabilities.includes(e))}function xt(e){const t=h(e);return!!t&&!t.baseUrl}function Dt(e,t){return t==="text"?!0:h(e)?.attachmentKinds?.includes(t)===!0}const $t=new Set(["mail","message"]);function Se(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function Ut(e,t,n,a="html"){if(!e)return n;const i=Se(e,t);return i?`${n}${a==="text"?`
|
|
6
|
+
|
|
7
|
+
`:t==="mail"?"<br><br>-- <br>":"<br><br>"}${i.body}`:n}function wt(e){return e.endpoints??[]}const Pt=e=>!!e.assignedUserId||!!e.assignedInboxId,Kt=e=>e.status==="closed",Gt=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,Bt=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function Ft(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const Vt=2e3,Ht=500,jt=12e3,Xt=4e3,Me=["contact","company"];function Wt(e){if(!e)return!1;const t=e.slice(0,e.indexOf(":"));return Me.includes(t)}const C={NL:{callingCode:"31",trunkPrefix:"0",nsnMin:7,nsnMax:9},BE:{callingCode:"32",trunkPrefix:"0",nsnMin:8,nsnMax:9},LU:{callingCode:"352",nsnMin:6,nsnMax:9},DE:{callingCode:"49",trunkPrefix:"0",nsnMin:6,nsnMax:13},FR:{callingCode:"33",trunkPrefix:"0",nsnMin:9,nsnMax:9},GB:{callingCode:"44",trunkPrefix:"0",nsnMin:9,nsnMax:10},IE:{callingCode:"353",trunkPrefix:"0",nsnMin:7,nsnMax:9},ES:{callingCode:"34",nsnMin:9,nsnMax:9},PT:{callingCode:"351",nsnMin:9,nsnMax:9},IT:{callingCode:"39",nsnMin:6,nsnMax:11},AT:{callingCode:"43",trunkPrefix:"0",nsnMin:7,nsnMax:13},CH:{callingCode:"41",trunkPrefix:"0",nsnMin:9,nsnMax:9},DK:{callingCode:"45",nsnMin:8,nsnMax:8},SE:{callingCode:"46",trunkPrefix:"0",nsnMin:7,nsnMax:13},NO:{callingCode:"47",nsnMin:8,nsnMax:8},FI:{callingCode:"358",trunkPrefix:"0",nsnMin:5,nsnMax:12},PL:{callingCode:"48",nsnMin:9,nsnMax:9},US:{callingCode:"1",nsnMin:10,nsnMax:10},CA:{callingCode:"1",nsnMin:10,nsnMax:10}},Ne="NL",Yt=15,zt=8,qt=Array.from(new Set(Object.values(C).map(e=>e.callingCode))).sort((e,t)=>t.length-e.length);function Z(e){if(e)return C[e.trim().toUpperCase()]}function S(e,t){return e.length>=t.nsnMin&&e.length<=t.nsnMax}function ee(e){if(e.length>Yt)return null;for(const t of qt){if(!e.startsWith(t))continue;const n=e.slice(t.length);for(const a of Object.values(C)){if(a.callingCode!==t)continue;const i=a.trunkPrefix,r=i&&n.startsWith(i)?n.slice(i.length):n;if(S(r,a))return`+${t}${r}`}return null}return e.length<zt?null:`+${e}`}function Jt(e){let t=e.trim();const n=t.match(/^(sips?|tel|whatsapp):/i);n&&(t=t.slice(n[0].length));const a=t.indexOf("@");return a>=0&&(t=t.slice(0,a)),t.trim()}function Qt(e){if(!e)return!1;const t=e.indexOf("@");if(t<=0)return!1;const n=e.slice(0,t).trim();return!/^[+\d\s().-]+$/.test(n)}function P(e,t){if(!e)return null;const n=Jt(e);if(!n)return null;const a=n.startsWith("+"),i=n.replace(/\D/g,"");if(!i)return null;if(a)return ee(i);if(i.startsWith("00"))return ee(i.slice(2));const r=Z(t)??Z(Ne);if(!r)return null;const o=r.trunkPrefix;if(o&&i.startsWith(o)){const s=i.slice(o.length);return S(s,r)?`+${r.callingCode}${s}`:null}if(i.startsWith(r.callingCode)){const s=i.slice(r.callingCode.length);if(S(s,r))return`+${r.callingCode}${s}`}return!o&&S(i,r)?`+${r.callingCode}${i}`:null}function Zt(e,t=9){const n=(e??"").replace(/\D/g,"");return n.length<t?null:n.slice(-t)}function V(e){if(!e)return null;const t=e.trim().toLowerCase(),n=t.lastIndexOf("@");if(n<=0||n===t.length-1)return null;const a=t.slice(0,n).split("+")[0],i=t.slice(n+1);return!a||!i.includes(".")?null:`${a}@${i}`}function en(e){const t=V(e);return t?t.slice(t.lastIndexOf("@")+1):null}const tn=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function Ce(e){if(!e)return null;const t=e.trim().toLowerCase().replace(/\.$/,"").split(".").filter(Boolean);if(t.length<2)return null;const n=t.slice(-2).join(".");return tn.has(n)&&t.length>=3?t.slice(-3).join("."):n}const Re=new Set(["gmail.com","googlemail.com","outlook.com","hotmail.com","hotmail.nl","hotmail.be","hotmail.co.uk","live.com","live.nl","live.be","msn.com","yahoo.com","yahoo.co.uk","ymail.com","icloud.com","me.com","mac.com","aol.com","gmx.net","gmx.de","web.de","protonmail.com","proton.me","pm.me","tutanota.com","zoho.com","mail.com","ziggo.nl","kpnmail.nl","planet.nl","home.nl","casema.nl","chello.nl","xs4all.nl","telfort.nl","hetnet.nl","zonnet.nl","upcmail.nl","quicknet.nl","telenet.be","skynet.be","proximus.be","scarlet.be"]);function nn(e){const t=Ce(e);return t?Re.has(t):!1}function an(e){if(!e)return!1;const t=e.trim().toLowerCase();return t==="tel"||t==="sms"||t==="whatsapp"||t==="fax"}function rn(e,t,n){if(!e||!t)return null;const a=e.trim().toLowerCase();if(a==="tel"||a==="sms"||a==="whatsapp"){const r=P(t,n);return r?`tel:${r}`:null}if(a==="fax"){const r=P(t,n);return r?`fax:${r}`:null}if(a==="mailto"||a==="email"){const r=V(t);return r?`mailto:${r}`:null}const i=t.trim().toLowerCase();return i?`${a}:${i}`:null}const on=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,sn=/(\*|_)(?=\S)([^*_\n]*?\S)\1/g;function ln(e){if(typeof e!="string"||!e)return"";let t=e;return t=t.replace(/```[a-z]*\n?/gi,"").replace(/~~~[a-z]*\n?/gi,""),t=t.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/\[([^\]]*)\]\[[^\]]*\]/g,"$1"),t=t.replace(/<((?:https?|mailto):[^>\s]+)>/gi,"$1"),t=t.split(`
|
|
4
8
|
`).map(n=>n.replace(/^\s{0,3}#{1,6}\s+/,"").replace(/^\s{0,3}>\s?/,"").replace(/^\s*[-*+]\s+/,"").replace(/^\s*\d+[.)]\s+/,"").replace(/^\s*(?:[-*_]\s*){3,}$/,"")).join(`
|
|
5
|
-
`),t=t.replace(
|
|
6
|
-
`);for(let n=0;n<t.length;n++)if(
|
|
7
|
-
`).trim();return e}function
|
|
8
|
-
`),t=t.replace(/<\/(p|
|
|
9
|
-
|
|
9
|
+
`),t=t.replace(on,"$2"),t=t.replace(sn,"$2"),t=t.replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1"),t=t.replace(/`([^`\n]+)`/g,"$1"),t.replace(/\s+/g," ").trim()}const cn=[/<blockquote/i,/class="?gmail_quote/i,/id="?[^"]*divRplyFwdMsg/i,/id="?[^"]*mail-editor-reference-message-container/i,/-{3,}\s*Original Message\s*-{3,}/i,/\n_{5,}\s*\n/,/\bOn\b[\s\S]{0,200}?\bwrote:/i],te=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,un=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function pn(e){const t=e.split(`
|
|
10
|
+
`);for(let n=0;n<t.length;n++)if(un.test(t[n])||te.test(t[n])&&t.slice(n+1,n+4).some(a=>te.test(a)))return t.slice(0,n).join(`
|
|
11
|
+
`).trim();return e}function ne(e){let t=e;return t=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),t=t.replace(/<br\s*\/?>/gi,`
|
|
12
|
+
`),t=t.replace(/<\/(p|h[1-6]|ul|ol|table|blockquote)>/gi,`
|
|
13
|
+
|
|
14
|
+
`),t=t.replace(/<\/(div|li|tr)>/gi,`
|
|
15
|
+
`),t=t.replace(/<\/(td|th)>/gi," "),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function ie(e){return!Number.isInteger(e)||e<0||e>1114111?null:String.fromCodePoint(e)}function ae(e){return e.replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/&#(\d+);/g,(t,n)=>ie(Number(n))??t).replace(/&#x([0-9a-f]+);/gi,(t,n)=>ie(parseInt(n,16))??t).replace(/&/gi,"&")}function re(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
|
|
10
16
|
`).replace(/\n{3,}/g,`
|
|
11
17
|
|
|
12
|
-
`).trim()}function
|
|
18
|
+
`).trim()}function dn(e){if(typeof e!="string"||!e)return"";let t=e.length;for(const r of cn){const o=e.search(r);o>=0&&o<t&&(t=o)}const n=e.slice(0,t);let a=re(ae(ne(n)));return a||(a=re(ae(ne(e)))),pn(a)||a}const mn=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,fn=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function gn(e,t){return!!(e&&mn.test(e)||t&&fn.test(t))}const Oe=3,ve=600;function hn(e,t){return e>=Oe||t>=ve}const An=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/webp"]),En=new Set(["text/plain","text/markdown","text/csv","application/json","text/html","application/xml","text/xml"]);function Le(e){const t=(e??"").trim().toLowerCase().split(";")[0];return t?An.has(t)?"image":t==="application/pdf"?"pdf":En.has(t)?"text":t.startsWith("audio/")?"audio":"unsupported":"unsupported"}const g=1024*1024,ke={image:5*g,pdf:20*g,text:1*g,audio:20*g},yn=25*g,_n=5;function Tn(e,t){const n=Le(e);return n==="unsupported"?"unsupported":t>ke[n]?"too-large":null}function xe(e,t){const n=new Set(e.disabledIntents??[]),a=e.intentOverrides??{},i=t.intents.filter(o=>!n.has(o.intent)).map(o=>In(o,a[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return i;const r=new Set(i.map(o=>o.intent));for(const o of e.extraIntents)r.has(o.intent)||(i.push(o),r.add(o.intent));return i}function De(e,t){const n={};for(const a of e.intents){if(!a.togglable)continue;const i=t?.[a.intent];n[a.intent]=i??a.defaultEnabled??!0}return n}function bn(e,t){const n=De(e,t);return Object.entries(n).filter(([,a])=>!a).map(([a])=>a)}function In(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function Sn(e,t){const n=[];for(const a of e){if(!a.enabled)continue;const i=t[a.providerId];if(i)for(const r of xe(a,i))n.push({channel:a,description:i,capability:r})}return n}function Mn(e,t){return t.filter(n=>n.capability.intent===e)}function $e(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function Nn(e,t){return $e(e.scheme,t)}function Cn(e,t,n){const a=[];for(const i of e)for(const r of n)r.capability.intent===t&&r.capability.targetSchemes.includes(i.scheme)&&a.push({channelIntent:r,endpoint:i});return a}var Ue=(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))(Ue||{});const Rn={mailto:"mail",sip:"tel",tel:"tel",fax:"tel",sms:"chat",teams:"chat",telegram:"chat",messenger:"chat",instagram:"chat",viber:"chat",whatsapp:"wa",webhook:"note",url:"note",calendar:"note",username:"note",id:"note",custom:"note"};function On(e){return e?Rn[e]??"note":"note"}const vn="message_window",Ln="message_templates",kn={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},xn=(e,t)=>({intent:e,...t}),Dn="folder_management",$n="remote_search",Un={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},wn=9e4,Pn="installation-id";exports.ACTIVITY_CATALOG=f;exports.AI_ATTACHMENT_LIMITS=ke;exports.AI_ATTACHMENT_MAX_PER_TURN=_n;exports.AI_ATTACHMENT_TURN_BUDGET=yn;exports.AI_VENDORS=F;exports.ALLOWED_LINK_SCHEMES=he;exports.ARTIFACT_MAX_BLOCKS=x;exports.ARTIFACT_MAX_BODY_BYTES=st;exports.ARTIFACT_MAX_CELL_LEN=I;exports.ARTIFACT_MAX_KPI_ITEMS=w;exports.ARTIFACT_MAX_LIST_ITEMS=D;exports.ARTIFACT_MAX_TABLE_COLUMNS=U;exports.ARTIFACT_MAX_TABLE_ROWS=$;exports.ARTIFACT_MAX_TEXT_LEN=K;exports.ActivityTypeRegistry=ce;exports.BUILT_IN_ONLY=qe;exports.CLASSIFY_VARS=St;exports.CORE_DIMENSIONS=tt;exports.CommunicationScheme=Ue;exports.DEFAULT_MEMORY_BUDGET=Xt;exports.DEFAULT_PHONE_REGION=Ne;exports.FEATURE_FOLDER_MANAGEMENT=Dn;exports.FEATURE_REMOTE_SEARCH=$n;exports.INSTALLATION_HEADER=Pn;exports.InteractionParticipantRole=kn;exports.MAX_ACTIONS=b;exports.MAX_BLOCKS=k;exports.MAX_FIELDS=_;exports.MAX_LIST_ITEMS=T;exports.MAX_MEMORY_BUDGET=jt;exports.MAX_MEMORY_CHARS=Vt;exports.MIN_MEMORY_BUDGET=Ht;exports.PAUSED_RUN_STATUSES=be;exports.PHONE_REGIONS=C;exports.PRESENCE_ONLINE_WINDOW_MS=wn;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=Ln;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=vn;exports.PUBLIC_EMAIL_DOMAINS=Re;exports.RELATED_SUBJECT_KINDS=Me;exports.SIGNATURE_INTENTS=$t;exports.SUMMARY_MIN_LAST_CHARS=ve;exports.SUMMARY_MIN_MESSAGES=Oe;exports.TERMINAL_RUN_STATUSES=Te;exports.TRIGGER_VARS=It;exports.UNSUPPORTED=Un;exports.USAGE_DIMENSIONS=de;exports.USAGE_DIMENSION_IDS=me;exports.actingIdentityKey=_e;exports.activityIconOf=Ge;exports.activityJoinUrl=Ye;exports.activitySnippet=se;exports.activityTextParams=le;exports.activityTimelineText=We;exports.activityTimestamp=et;exports.activityTypeInfo=u;exports.actorKey=Ct;exports.aiAttachmentKind=Le;exports.aiAttachmentRejection=Tn;exports.aiVendorAcceptsAttachment=Dt;exports.aiVendorDefaultModel=Lt;exports.aiVendorLabel=vt;exports.aiVendorNeedsBaseUrl=xt;exports.aiVendorsWith=kt;exports.applySignature=Ut;exports.artifactBodyBytes=gt;exports.artifactOutline=ht;exports.artifactToMarkdown=Et;exports.buildActivityPreview=Qe;exports.buildChannelIntents=Sn;exports.buildShareKeys=yt;exports.carriesText=He;exports.channelKindForScheme=On;exports.channelKindOf=Be;exports.cleanMessageText=dn;exports.defineIntent=xn;exports.disabledIntentsFromCapabilities=bn;exports.emailDomain=en;exports.endpointKey=rn;exports.filterByEndpoint=Nn;exports.filterByIntent=Mn;exports.filterByTargetScheme=$e;exports.findAiVendor=h;exports.flattenLocales=nt;exports.floorToPeriod=pe;exports.formatActingIdentity=ye;exports.formatPeriod=ue;exports.getActivitySeenUserIds=Ze;exports.getContactEndpoints=wt;exports.getShortTitle=Bt;exports.getUrgencyScore=Gt;exports.humanizeAction=bt;exports.isAssigned=Pt;exports.isClosed=Kt;exports.isInteractionUnseen=Ft;exports.isLikelyBulk=gn;exports.isMessageType=Fe;exports.isPaused=Ot;exports.isPlaybookAuthoredType=Xe;exports.isPublicEmailDomain=nn;exports.isReplyableType=Ve;exports.isRetryable=Rt;exports.isTerminal=Ie;exports.isThreadLongEnough=hn;exports.looksLikeEmail=Qt;exports.matchContactToIntents=Cn;exports.messageCountsAs=je;exports.needsPhoneRegion=an;exports.normalizeArtifactBlocks=ft;exports.normalizeBlocks=Ke;exports.normalizeEmail=V;exports.parseActingIdentity=Mt;exports.periodsInRange=rt;exports.phoneSuffix=Zt;exports.plainTextFromMarkdown=ln;exports.playbookActor=Nt;exports.readPath=M;exports.registrableDomain=Ce;exports.relatedByDefault=Wt;exports.resolveAccountCapabilities=De;exports.resolveActivityText=N;exports.resolveChannelIntents=xe;exports.resolveSignature=Se;exports.sanitizeInline=Ee;exports.shareKeyForTeam=B;exports.shareKeyForUser=G;exports.shareKeysForViewer=_t;exports.stripHtml=oe;exports.toE164=P;exports.toolSourceKinds=Tt;exports.usageMetricId=fe;exports.usageMetrics=ot;
|