@opencxh/domain 1.147.0 → 1.150.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.
@@ -1,3 +1,4 @@
1
1
  export * from './help-center';
2
+ export * from './locales';
2
3
  export * from './tree';
3
4
  export * from './types';
@@ -0,0 +1,35 @@
1
+ import { KbLocale } from './types';
2
+ /**
3
+ * Languages a knowledge base can be authored in.
4
+ *
5
+ * Deliberately **not** the shell's UI locale list. That one is a hardcoded
6
+ * `['nl','en']` in `LocalizationManager`, and a customer publishing a German
7
+ * help centre has nothing to do with which language our own buttons are in.
8
+ *
9
+ * The labels are endonyms — a language names itself the same way whoever reads
10
+ * the picker. So this is a fixed map on purpose, and not the "never freeze
11
+ * labels at module load" case the design system warns about.
12
+ *
13
+ * In domain rather than in the kb app because both ends need the same answer:
14
+ * the language picker in the editor, and the writing assistant's system prompt,
15
+ * which has to name the language it must write in. Two copies would drift, and
16
+ * the way you would find out is an article coming back in the wrong language.
17
+ */
18
+ export interface KbLocaleOption {
19
+ code: KbLocale;
20
+ /** The language's own name, for a picker. */
21
+ label: string;
22
+ /** Its English name, for telling a model which language to write in. */
23
+ english: string;
24
+ }
25
+ export declare const KB_LOCALES: KbLocaleOption[];
26
+ /** The language's own name, or the bare code for one we do not list. */
27
+ export declare function localeName(code: string): string;
28
+ /**
29
+ * How to name this language to a model.
30
+ *
31
+ * A bare BCP-47 tag is a weak instruction — `"nl"` inside an otherwise English
32
+ * prompt is not enough to stop a model answering in English. Both names plus
33
+ * the tag leaves nothing to infer.
34
+ */
35
+ export declare function localeInstruction(code: string): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,60 @@
1
+ import { MemoryItem, MemoryKindId, MemoryVisibility } from './item';
2
+ /**
3
+ * Het beheer-contract: **alles** wat er in het geheugen van deze organisatie staat, plat.
4
+ *
5
+ * Bewust géén tweede `MemoryQuery`. Dat contract is de retrieval-engine — ranking, embeddings,
6
+ * tekenbudget, autorisatie per subject — en beantwoordt "wat is hier relevant". Deze vraagt
7
+ * "wat staat er". Dezelfde route zou beide slechter doen: de engine moet mogen wegfilteren wat
8
+ * niet scoort, en een beheerpagina mag juist niets stilhouden.
9
+ */
10
+ export interface MemoryBrowseQuery {
11
+ /** Exacte soort. Leeg = alle. */
12
+ kind?: MemoryKindId;
13
+ /** Schrijvende app (`ai`, `comms`, `context`, …). */
14
+ source?: string;
15
+ /** Het deel vóór de `:` van het subject — `interaction`, `contact`, `company`. */
16
+ subjectKind?: string;
17
+ /** Exact subject, bv. `contact:c_9`. Wint van {@link subjectKind}. */
18
+ subject?: string;
19
+ visibility?: MemoryVisibility;
20
+ /** Alleen items met `occurredAt >= since` (ms). */
21
+ since?: number;
22
+ /** Scan-cap. Geklemd op {@link MAX_MEMORY_BROWSE}. */
23
+ limit?: number;
24
+ }
25
+ /**
26
+ * Harde bovengrens op één beheer-scan.
27
+ *
28
+ * Er is geen full-text-operator in deze datastore, dus vrij zoeken gebeurt ná het ophalen. Zonder
29
+ * cap zou een organisatie met tienduizenden items haar hele geheugen door één response persen.
30
+ * Wordt de cap geraakt, dan zegt {@link MemoryBrowseResult.truncated} dat — stil afkappen op een
31
+ * pagina die "alles" belooft is de ene fout die hier niet mag.
32
+ */
33
+ export declare const MAX_MEMORY_BROWSE = 1000;
34
+ export interface MemoryBrowseFacets {
35
+ /** Bronnen die in deze scan voorkomen, met hun aantal. Aflopend. */
36
+ sources: Array<{
37
+ value: string;
38
+ count: number;
39
+ }>;
40
+ kinds: Array<{
41
+ value: string;
42
+ count: number;
43
+ }>;
44
+ subjectKinds: Array<{
45
+ value: string;
46
+ count: number;
47
+ }>;
48
+ }
49
+ export interface MemoryBrowseResult {
50
+ items: MemoryItem[];
51
+ /** Hoeveel rijen het structurele filter opleverde (== `items.length`, of de cap). */
52
+ scanned: number;
53
+ /** Cap geraakt: er is méér dan dit. Verfijn het filter. */
54
+ truncated?: boolean;
55
+ /**
56
+ * Wat er in deze scan te kiezen valt. Afgeleid uit de scan en niet uit een `DISTINCT`, want
57
+ * die bestaat hier niet — bij `truncated` zijn dit dus de facetten van het zichtbare deel.
58
+ */
59
+ facets: MemoryBrowseFacets;
60
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './alias';
2
+ export * from './browse';
2
3
  export * from './ingest';
3
4
  export * from './item';
4
5
  export * from './kind';
@@ -0,0 +1,46 @@
1
+ import { Topic, TopicExampleCandidate } from './types';
2
+ /**
3
+ * De vorm waarop twee voorbeelden "hetzelfde" zijn.
4
+ *
5
+ * Alleen voor vergelijken, nooit voor opslaan: wat de beheerder ziet is de originele tekst.
6
+ * Tien keer "Ik wil mijn factuur" leert de classifier niets en verdringt wel een voorbeeld dat het
7
+ * wél zou doen, dus hoofdletters, leestekens en dubbele spaties mogen dat niet verhullen.
8
+ */
9
+ export declare function normalizeExample(text: string): string;
10
+ /** Afkappen op een hele zin waar dat kan, anders hard op de grens. */
11
+ export declare function truncateExample(text: string): string;
12
+ /**
13
+ * Een voorstel toevoegen. Geeft de nieuwe kandidatenlijst terug, of `null` als er niets te
14
+ * veranderen viel — de caller slaat dan geen schrijfactie op.
15
+ *
16
+ * Drie redenen om `null` te geven, en ze zijn alle drie gewoon:
17
+ * 1. Lege tekst. Een gesprek zonder inkomend bericht levert geen voorbeeld.
18
+ * 2. Het staat al bij `examples`. De beheerder heeft dit al beoordeeld; het opnieuw voorstellen is
19
+ * ruis, en na één afwijzing zou het bij elke volgende toekenning terugkomen.
20
+ * 3. Het staat al bij de kandidaten. Wel wordt hij dan **bijgewerkt** als de nieuwe melding een
21
+ * correctie is: dat is het sterkere signaal en het hoort bovenaan.
22
+ */
23
+ export declare function addExampleCandidate(topic: Pick<Topic, "examples" | "exampleCandidates">, candidate: TopicExampleCandidate): TopicExampleCandidate[] | null;
24
+ /**
25
+ * Een voorstel overnemen: van de kandidatenlijst naar `examples`.
26
+ *
27
+ * Draait in de **editor**, niet op de server — accepteren is een bewerking van het onderwerp en
28
+ * gaat mee met de gewone opslag. Dat scheelt een endpoint en houdt "wat de beheerder ziet" en "wat
29
+ * er opgeslagen wordt" één ding.
30
+ *
31
+ * Bij een volle `examples` valt de **oudste** eruit (voorop in de lijst). Dat is niet
32
+ * onvermijdelijk goed — de eerste voorbeelden zijn vaak met zorg getypt — maar het alternatief is
33
+ * de beheerder een keuze voorleggen op het moment dat hij iets anders aan het doen is. De cap staat
34
+ * in de UI vermeld.
35
+ */
36
+ export declare function acceptExampleCandidate(topic: Pick<Topic, "examples" | "exampleCandidates">, text: string): Pick<Topic, "examples" | "exampleCandidates">;
37
+ /**
38
+ * Een voorstel weggooien.
39
+ *
40
+ * Er wordt **niet** onthouden dat je hem hebt afgewezen. Verschijnt exact dezelfde zin nog eens bij
41
+ * een handmatige toekenning, dan staat hij er weer. Bewust geen derde lijst met afgewezen teksten:
42
+ * dat is dubbel zoveel state voor een geval dat alleen optreedt bij een generieke openingszin
43
+ * ("Hallo, ik heb een vraag") — en dán is terugkomen ook niet gek. Hindert het toch, dan is de
44
+ * echte oplossing hem accepteren, want daarna wordt hij nooit meer voorgesteld.
45
+ */
46
+ export declare function rejectExampleCandidate(topic: Pick<Topic, "exampleCandidates">, text: string): TopicExampleCandidate[];
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,3 @@
1
+ export * from './examples';
2
+ export * from './scope';
1
3
  export * from './types';
@@ -0,0 +1,20 @@
1
+ import { Topic } from './types';
2
+ /**
3
+ * Mag dit onderwerp aangeboden worden op een gesprek in een inbox van dit team?
4
+ *
5
+ * Let op het woord *aangeboden*. Dit is een **keuzelijst-filter**, geen autorisatie: het
6
+ * leesrecht is al afgehandeld door de server (`buildScopeQuery` in
7
+ * `apps/communication/server/src/utils/scope.ts`), en wat hier binnenkomt mag de gebruiker dus
8
+ * sowieso zien. Wat dit filter toevoegt is relevantie — Sales hoeft de onderwerpen van Support
9
+ * niet door te scrollen.
10
+ *
11
+ * Daarom mag je hem **nooit** gebruiken om een reeds toegekend onderwerp op te zoeken. Een gesprek
12
+ * dat van team wisselt houdt zijn etiket; dat opzoeken in de gefilterde lijst zou het label leeg
13
+ * laten terwijl er wel degelijk een onderwerp op staat.
14
+ *
15
+ * `personal` valt altijd af: die scope wordt bij het schrijven geweigerd, en komt er ooit toch een
16
+ * rij zo binnen, dan hoort hij niet in een gedeelde keuzelijst.
17
+ */
18
+ export declare function topicOfferedForTeam(topic: Topic, teamId: string | undefined): boolean;
19
+ /** {@link topicOfferedForTeam} over een lijst. */
20
+ export declare function topicsForTeam(topics: Topic[], teamId: string | undefined): Topic[];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,16 +1,61 @@
1
- export type KnowledgeSourceType = "url" | "knowledge_base";
2
- export interface KnowledgeSource {
3
- type: KnowledgeSourceType;
4
- title?: string;
5
- url?: string;
6
- knowledgeBaseId?: string;
7
- categoryIds?: string[];
8
- }
1
+ import { OwnerScope } from '../contact/types';
2
+ /**
3
+ * Een onderwerp is een **etiket** op een gesprek: waar gaat dit over. Verder niets.
4
+ *
5
+ * Er zat ooit ook een kennis-kant in (`knowledgeSources`: urls en kb-artikelen die "bij dit
6
+ * onderwerp horen"). Die is eruit gehaald omdat hij door niemand gelezen werd — het formulier
7
+ * vulde hem, de entity bewaarde hem, en geen enkele prompt of zoekactie deed er iets mee. Wat hij
8
+ * beloofde doet de kennisbank inmiddels beter (hybride RAG over álle artikelen) en het geheugen
9
+ * daarnaast (`memory_find_similar`, uit echt verkeer). Zie `docs/TOPICS.md`.
10
+ */
9
11
  export interface Topic {
10
12
  id: string;
11
13
  organizationId: string;
14
+ /**
15
+ * Van wie dit onderwerp is. `org` of `team`; **`personal` wordt geweigerd bij het schrijven** —
16
+ * een onderwerp dat maar één persoon kent, kan een collega niet lezen op een gesprek dat hij
17
+ * overneemt. Het type laat het toe omdat `OwnerScope` gedeeld is; de validatie niet.
18
+ */
19
+ ownerScope: OwnerScope;
12
20
  name: string;
13
21
  description: string;
22
+ /**
23
+ * Voorbeeldzinnen die de classificatie-prompt meekrijgt. Dit is het enige veld dat de
24
+ * classifier scherper maakt, en dus het enige dat het waard is om bij te houden.
25
+ */
14
26
  examples: string[];
15
- knowledgeSources?: KnowledgeSource[];
27
+ /**
28
+ * Voorgestelde voorbeelden, nog niet overgenomen. Groeit vanzelf: elke keer dat een **mens**
29
+ * dit onderwerp op een gesprek zet of corrigeert, komt de openingszin hier terecht.
30
+ *
31
+ * Bewust náást `examples` en niet erin: de classificatie-prompt is de plek waar één slecht
32
+ * voorbeeld het gedrag van élk volgend gesprek verschuift, en er is geen undo op een prompt die
33
+ * drie weken scheef stond. `examples` blijft van de beheerder; dit is een voorstel.
34
+ */
35
+ exampleCandidates?: TopicExampleCandidate[];
36
+ }
37
+ /**
38
+ * Eén voorgesteld voorbeeld.
39
+ *
40
+ * `corrected` onderscheidt "iemand zette een onderwerp op een gesprek dat er nog geen had" van
41
+ * "iemand zette het onderwerp om" — dat tweede is een gecorrigeerde fout en daarmee het meest
42
+ * informatieve geval dat er is. De UI zet ze daarom bovenaan.
43
+ */
44
+ export interface TopicExampleCandidate {
45
+ text: string;
46
+ interactionId: string;
47
+ addedAt: number;
48
+ corrected: boolean;
16
49
  }
50
+ /**
51
+ * Hoeveel voorbeelden er per onderwerp mee mogen.
52
+ *
53
+ * De hele lijst gaat als JSON de systemprompt in bij élke classificatie
54
+ * (`apps/ai/server/src/playbook/ai/classify.ts`), dus ongelimiteerd groeien maakt het classificeren
55
+ * per gesprek duurder tot het niet meer past.
56
+ */
57
+ export declare const MAX_TOPIC_EXAMPLES = 20;
58
+ /** Idem voor de kandidatenlijst: een voorstellenbak die volloopt, leest niemand meer na. */
59
+ export declare const MAX_TOPIC_CANDIDATES = 20;
60
+ /** Een voorbeeld is een openingszin, geen transcript. */
61
+ export declare const MAX_TOPIC_EXAMPLE_CHARS = 300;
package/dist/index.cjs CHANGED
@@ -1,18 +1,18 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=10,_=10,T=10,b=5,Je=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 Qe(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(!Je.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 ue(e){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()}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 Y(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function R(e){return e?.split("@")?.[0]||e||""}function y(e){return e.map(t=>t.name).join(", ")}function z(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const m={VOICE_CALL_STARTED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek gestart",timeline:e=>e.direction==="inbound"?`Inbound call started — ${R(e.payload.from)}`:`Outbound call started — ${R(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${Y(e.payload.duration)}`},VOICE_CALL_MISSED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gemiste oproep",timeline:e=>`Missed call — ${R(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:q},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:q},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=>`${z(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=>`${z(e.payload.callType)} ended${Y(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 q(e){const t=e.payload,n=t.bodySnippet?.trim()||ue(t.body??"");return t.subject?`${t.subject} — ${n}`:n}function p(e){return m[e]}function Ze(e){return p(e)?.icon??"circle"}function et(e){return p(e)?.channelKind}function tt(e){const t=p(e)?.shape;return t==="message"||t==="note"}function nt(e){return p(e)?.replyable===!0}function it(e){return p(e)?.carriesText===!0}function at(e){return p(e)?.countsAs}function rt(e){return p(e)?.playbookAuthored===!0}function pe(e){const t=p(e.type)?.snippet;return t?t(e):""}function ot(e,t){const n=p(e.type)?.timeline;return n?n(e,t):e.type.replace(/_/g," ").toLowerCase()}function st(e){const t=p(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 de(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 lt=e=>e;function J(e){const t=m[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 Q(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 fe{constructor(t=[],n=lt){this.translate=n;for(const a of t)a?.type&&(a.type in m||this.declared.has(a.type)||this.declared.set(a.type,a))}declared=new Map;get(t){if(t in m)return J(t);const n=this.declared.get(t);return n?Q(n):void 0}triggerable(){const t=Object.keys(m).filter(a=>m[a].triggerable).map(J),n=[...this.declared.values()].map(Q).filter(a=>a.triggerable);return[...t,...n]}timelineText(t,n){const a=m[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=m[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 ct=new fe,Z=140;function ut(e){const t=e.trim();return t.length<=Z?t:t.slice(0,Z-1).trimEnd()+"…"}function pt(e,t){const n=de(t?.text,e),a=t?N(t.text,e,i=>i):null;return{activityId:e.id,type:e.type,snippet:ut(a??pe(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...n?{snippetKey:n.key,snippetParams:n.params}:{}}}function dt(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 ft(e){return e.createdAt??0}const mt=[{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 gt(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 v(e){return e<10?`0${e}`:`${e}`}function me(e,t){const n=new Date(e),a=`${n.getUTCFullYear()}-${v(n.getUTCMonth()+1)}-${v(n.getUTCDate())}`;return t==="day"?a:`${a}T${v(n.getUTCHours())}`}function ge(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const ht=36e5,At=864e5;function Et(e,t,n){const a=n==="hour"?ht:At,i=[];for(let r=ge(e,n);r<=t;r+=a)i.push(me(r,n));return i}const he=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],Ae=he.map(e=>e.id);function Ee(e,t){return`${e}.usage.${t}`}function yt(e,t){return t.map(n=>({id:Ee(e,n.unit),label:n.label,category:"Verbruik",valueType:n.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...Ae,...n.extraDimensions??[],"time"]}))}const ye=new Set(["info","success","warning","destructive"]),k=200,D=100,$=200,P=12,U=4,K=4e3,I=500,_t=256*1024,Tt=new Set(["heading","paragraph","list","quote","code","divider","table","kpi","callout"]),_e=["http:","https:","mailto:","tel:"],bt=/^[a-z][a-z0-9+.-]*:/i;function Te(e){const t=e.trim().replace(/^<|>$/g,"");if(!t)return!1;const n=bt.exec(t)?.[0];return n?_e.includes(n.toLowerCase()):!t.startsWith("//")}const It=/^[ \t]{0,3}\[([^\]]+)\]:[ \t]*(\S+).*$/gm;function St(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=ee(e,i,"[","]");if(r<0||e[r+1]!=="("){t+=e[n],n+=1;continue}const o=ee(e,r+2,"(",")");if(o<0){t+=e[n],n+=1;continue}const s=e.slice(i,r),l=e.slice(r+2,o).trim().split(/\s+/)[0]??"";t+=a||!Te(l)?s:e.slice(n,o+1),n=o+1}return t}function ee(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 be(e){return St(e).replace(It,(t,n,a)=>Te(a)?t:"")}function u(e,t=K){return typeof e=="string"?be(e).slice(0,t):""}function Mt(e,t=K){return typeof e=="string"?e.slice(0,t):""}function Nt(e,t="info"){return typeof e=="string"&&ye.has(e)?e:t}function Ct(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(!Tt.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=u(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=u(i.text);if(!o){t("a paragraph without text");continue}n.push({...r,type:"paragraph",text:o});break}case"quote":{const o=u(i.text);if(!o){t("a quote without text");continue}n.push({...r,type:"quote",text:o});break}case"code":{const o=Mt(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 d of o){if(s.length>=D){t("more than "+D+" list items");break}const f=u(d?.text);if(!f)continue;const c=u(d?.lead,200);s.push(c?{lead:c,text:f}:{text:f})}if(s.length===0){t("a list without usable items");continue}const l=i.style==="numbered"?"numbered":"bulleted";n.push({...r,type:"list",style:l,items:s});break}case"table":{const o=Array.isArray(i.columns)?i.columns:[],s=[];for(const c of o){if(s.length>=P){t("more than "+P+" table columns");break}const A=u(c?.label,I),L=c?.align==="right"?"right":void 0;s.push(L?{label:A,align:L}:{label:A})}if(s.length===0){t("a table without columns");continue}const l=Array.isArray(i.rows)?i.rows:[],d=[];for(const c of l){if(d.length>=$){t("more than "+$+" table rows");break}const A=Array.isArray(c)?c:[];d.push(s.map((L,qe)=>u(A[qe],I)))}const f=u(i.caption,I);n.push({...r,type:"table",columns:s,rows:d,...f?{caption:f}:{}});break}case"kpi":{const o=Array.isArray(i.items)?i.items:[],s=[];for(const l of o){if(s.length>=U){t("more than "+U+" kpi items");break}const d=u(l?.value,40),f=u(l?.label,80);if(!d||!f)continue;const c=l?.tone;s.push(typeof c=="string"&&ye.has(c)?{value:d,label:f,tone:c}:{value:d,label:f})}if(s.length===0){t("a kpi block without usable items");continue}n.push({...r,type:"kpi",items:s});break}case"callout":{const o=u(i.text);if(!o){t("a callout without text");continue}const s=u(i.title,200);n.push({...r,type:"callout",tone:Nt(i.tone),...s?{title:s}:{},text:o});break}}}return n}function Lt(e){return JSON.stringify(e).length}function Ot(e){return{blocks:e.length,types:e.map(t=>t.type),headings:e.flatMap(t=>t.type==="heading"?[t.text]:[])}}function te(e){return e.replace(/\|/g,"\\|").replace(/\r?\n/g," ").trim()}function ne(e,t,n){const a=e.map((i,r)=>n?.[r]==="right"?"---:":"---");return[`| ${e.map(te).join(" | ")} |`,`| ${a.join(" | ")} |`,...t.map(i=>`| ${i.map(te).join(" | ")} |`)]}function Rt(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=ne(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 ne(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 vt(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=Rt(i);r.length>0&&n.push(r.join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=10,T=10,b=10,I=5,st=new Set(["header","section","context","divider","image","list","actions","attachments"]);function x(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 lt(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const a of e){if(n.length>=D){t("more than "+D+" blocks; the rest was dropped");break}if(!a||typeof a!="object")continue;const i=a;if(!st.has(i.type)){t("unknown block type "+String(i.type));continue}switch(i.type){case"header":if(!x(i.text)){t("a header without text");continue}break;case"context":if(!x(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&&(t("more than "+T+" fields in a section"),i.fields=i.fields.slice(0,T));break;case"list":if(!Array.isArray(i.items)||i.items.length===0){t("a list without items");continue}i.items.length>b&&(t("more than "+b+" list items"),i.items=i.items.slice(0,b));break;case"actions":{const r=Array.isArray(i.elements)?i.elements:[],o=r.filter(s=>s&&s.action_id&&s.invoke&&x(s.text));if(o.length!==r.length&&t("an action without action_id, invoke or text"),o.length===0)continue;o.length>I&&t("more than "+I+" actions"),i.elements=o.slice(0,I);break}}n.push(i)}return n}function me(e){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()}function y(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 J(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function v(e){return e?.split("@")?.[0]||e||""}function _(e){return e.map(t=>t.name).join(", ")}function Q(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const m={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?` (${y(e.payload.duration)})`:""}`,timeline:e=>`Call ended${J(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?` (${y(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:Z},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:Z},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=>`${_(e.payload.members)} toegevoegd`,timeline:e=>{const t=_(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=>`${_(e.payload.members)} verlaten`,timeline:e=>{const t=_(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=>`${Q(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?` (${y(e.payload.duration)})`:""}`,timeline:e=>`${Q(e.payload.callType)} ended${J(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?` (${y(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 Z(e){const t=e.payload,n=t.bodySnippet?.trim()||me(t.body??"");return t.subject?`${t.subject} — ${n}`:n}function p(e){return m[e]}function ct(e){return p(e)?.icon??"circle"}function ut(e){return p(e)?.channelKind}function pt(e){const t=p(e)?.shape;return t==="message"||t==="note"}function dt(e){return p(e)?.replyable===!0}function ft(e){return p(e)?.carriesText===!0}function mt(e){return p(e)?.countsAs}function gt(e){return p(e)?.playbookAuthored===!0}function ge(e){const t=p(e.type)?.snippet;return t?t(e):""}function ht(e,t){const n=p(e.type)?.timeline;return n?n(e,t):e.type.replace(/_/g," ").toLowerCase()}function At(e){const t=p(e.type)?.joinUrl;return t?t(e):void 0}function N(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 O(e,t,n){if(e===void 0)return null;if(typeof e=="string")return e||null;if("value"in e)return N(t,e.value)||null;const a={};for(const[r,o]of Object.entries(e.params??{}))a[r]=N(t,o);const i=n(e.key,a);return i===e.key?null:i}function he(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]=N(t,i);return{key:e.key,params:n}}const Et=e=>e;function ee(e){const t=m[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 te(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 Ae{constructor(t=[],n=Et){this.translate=n;for(const a of t)a?.type&&(a.type in m||this.declared.has(a.type)||this.declared.set(a.type,a))}declared=new Map;get(t){if(t in m)return ee(t);const n=this.declared.get(t);return n?te(n):void 0}triggerable(){const t=Object.keys(m).filter(a=>m[a].triggerable).map(ee),n=[...this.declared.values()].map(te).filter(a=>a.triggerable);return[...t,...n]}timelineText(t,n){const a=m[t.type];if(a?.timeline)return a.timeline(t,n);const i=this.declared.get(t.type);return O(i?.text,t,this.translate)??t.type.replace(/_/g," ").toLowerCase()}snippet(t){const n=m[t.type];if(n?.snippet)return n.snippet(t);const a=this.declared.get(t.type);return O(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 yt=new Ae,ne=140;function _t(e){const t=e.trim();return t.length<=ne?t:t.slice(0,ne-1).trimEnd()+"…"}function Tt(e,t){const n=he(t?.text,e),a=t?O(t.text,e,i=>i):null;return{activityId:e.id,type:e.type,snippet:_t(a??ge(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...n?{snippetKey:n.key,snippetParams:n.params}:{}}}function bt(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 It(e){return e.createdAt??0}const St=[{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 Mt(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 k(e){return e<10?`0${e}`:`${e}`}function Ee(e,t){const n=new Date(e),a=`${n.getUTCFullYear()}-${k(n.getUTCMonth()+1)}-${k(n.getUTCDate())}`;return t==="day"?a:`${a}T${k(n.getUTCHours())}`}function ye(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const Ct=36e5,Nt=864e5;function Ot(e,t,n){const a=n==="hour"?Ct:Nt,i=[];for(let r=ye(e,n);r<=t;r+=a)i.push(Ee(r,n));return i}const _e=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],Te=_e.map(e=>e.id);function be(e,t){return`${e}.usage.${t}`}function Lt(e,t){return t.map(n=>({id:be(e,n.unit),label:n.label,category:"Verbruik",valueType:n.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...Te,...n.extraDimensions??[],"time"]}))}const Ie=new Set(["info","success","warning","destructive"]),P=200,$=100,U=200,w=12,K=4,G=4e3,S=500,Rt=256*1024,xt=new Set(["heading","paragraph","list","quote","code","divider","table","kpi","callout"]),Se=["http:","https:","mailto:","tel:"],vt=/^[a-z][a-z0-9+.-]*:/i;function Me(e){const t=e.trim().replace(/^<|>$/g,"");if(!t)return!1;const n=vt.exec(t)?.[0];return n?Se.includes(n.toLowerCase()):!t.startsWith("//")}const kt=/^[ \t]{0,3}\[([^\]]+)\]:[ \t]*(\S+).*$/gm;function Dt(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=ie(e,i,"[","]");if(r<0||e[r+1]!=="("){t+=e[n],n+=1;continue}const o=ie(e,r+2,"(",")");if(o<0){t+=e[n],n+=1;continue}const s=e.slice(i,r),l=e.slice(r+2,o).trim().split(/\s+/)[0]??"";t+=a||!Me(l)?s:e.slice(n,o+1),n=o+1}return t}function ie(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 Ce(e){return Dt(e).replace(kt,(t,n,a)=>Me(a)?t:"")}function u(e,t=G){return typeof e=="string"?Ce(e).slice(0,t):""}function Pt(e,t=G){return typeof e=="string"?e.slice(0,t):""}function $t(e,t="info"){return typeof e=="string"&&Ie.has(e)?e:t}function Ut(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const a of e){if(n.length>=P){t("more than "+P+" blocks; the rest was dropped");break}if(!a||typeof a!="object")continue;const i=a;if(!xt.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=u(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=u(i.text);if(!o){t("a paragraph without text");continue}n.push({...r,type:"paragraph",text:o});break}case"quote":{const o=u(i.text);if(!o){t("a quote without text");continue}n.push({...r,type:"quote",text:o});break}case"code":{const o=Pt(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 d of o){if(s.length>=$){t("more than "+$+" list items");break}const f=u(d?.text);if(!f)continue;const c=u(d?.lead,200);s.push(c?{lead:c,text:f}:{text:f})}if(s.length===0){t("a list without usable items");continue}const l=i.style==="numbered"?"numbered":"bulleted";n.push({...r,type:"list",style:l,items:s});break}case"table":{const o=Array.isArray(i.columns)?i.columns:[],s=[];for(const c of o){if(s.length>=w){t("more than "+w+" table columns");break}const E=u(c?.label,S),R=c?.align==="right"?"right":void 0;s.push(R?{label:E,align:R}:{label:E})}if(s.length===0){t("a table without columns");continue}const l=Array.isArray(i.rows)?i.rows:[],d=[];for(const c of l){if(d.length>=U){t("more than "+U+" table rows");break}const E=Array.isArray(c)?c:[];d.push(s.map((R,ot)=>u(E[ot],S)))}const f=u(i.caption,S);n.push({...r,type:"table",columns:s,rows:d,...f?{caption:f}:{}});break}case"kpi":{const o=Array.isArray(i.items)?i.items:[],s=[];for(const l of o){if(s.length>=K){t("more than "+K+" kpi items");break}const d=u(l?.value,40),f=u(l?.label,80);if(!d||!f)continue;const c=l?.tone;s.push(typeof c=="string"&&Ie.has(c)?{value:d,label:f,tone:c}:{value:d,label:f})}if(s.length===0){t("a kpi block without usable items");continue}n.push({...r,type:"kpi",items:s});break}case"callout":{const o=u(i.text);if(!o){t("a callout without text");continue}const s=u(i.title,200);n.push({...r,type:"callout",tone:$t(i.tone),...s?{title:s}:{},text:o});break}}}return n}function wt(e){return JSON.stringify(e).length}function Kt(e){return{blocks:e.length,types:e.map(t=>t.type),headings:e.flatMap(t=>t.type==="heading"?[t.text]:[])}}function ae(e){return e.replace(/\|/g,"\\|").replace(/\r?\n/g," ").trim()}function re(e,t,n){const a=e.map((i,r)=>n?.[r]==="right"?"---:":"---");return[`| ${e.map(ae).join(" | ")} |`,`| ${a.join(" | ")} |`,...t.map(i=>`| ${i.map(ae).join(" | ")} |`)]}function Bt(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=re(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 re(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 Ft(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=Bt(i);r.length>0&&n.push(r.join(`
2
2
  `))}return`${n.join(`
3
3
 
4
4
  `)}
5
- `}const B=e=>`user:${e}`,G=e=>`team:${e}`;function xt(e){const t=new Set;for(const n of e??[])n?.id&&(n.kind==="user"&&t.add(B(n.id)),n.kind==="team"&&t.add(G(n.id)));return[...t].sort()}function kt(e,t){return[B(e),...t.map(G)]}function Dt(e){const t=new Set;for(const n of e??[])n?.kind&&t.add(n.kind);return[...t]}function $t(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const Pt=[{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"}],Ut={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function Ie(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function wt(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 Se(e){return Ie(e)}function Kt(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 Bt(e){return Se(e)}const Me=["done","escalated","failed","timed_out","stopped"],Ne=["awaiting_approval","awaiting_reply"];function Ce(e){return Me.includes(e)}function Gt(e){return Ce(e)}function Ft(e){return Ne.includes(e)}function Ht(e,t){const n=e.labels??[];return n.find(a=>a.locale===t)?.label??n[0]?.label??e.url}function Vt(e,t,n){const a=e.translations??[];return a.find(i=>i.locale===t)??(n?a.find(i=>i.locale===n):void 0)??{locale:t}}const F=3;function Le(e,t){const n=new Set;let a=1,i=t.get(e)?.parentId;for(;i;){if(n.has(i)||(n.add(i),a++,a>F+1))return 1/0;i=t.get(i)?.parentId}return a}function jt(e,t,n){if(!e)return!0;if(e===t)return!1;const a=new Map(n.map(o=>[o.id,o]));if(!a.has(e)||t&&Oe(e,t,a))return!1;const i=Le(e,a),r=t?H(t,n):1;return i+r<=F}function Oe(e,t,n){const a=new Set;let i=n.get(e)?.parentId;for(;i;){if(i===t)return!0;if(a.has(i))return!1;a.add(i),i=n.get(i)?.parentId}return!1}function H(e,t,n=new Set){if(n.has(e))return 1;n.add(e);const a=t.filter(i=>i.parentId===e);return a.length?1+Math.max(...a.map(i=>H(i.id,t,n))):1}const Re="en";function ve(e){return e.defaultLocale||e.locale||Re}function Wt(e){const t=new Set,n=[];for(const a of[ve(e),...e.locales??[]])!a||t.has(a)||(t.add(a),n.push(a));return n}function Xt(e,t,n){const a=e.translations??[];return a.find(i=>i.locale===t)?.name??(n?a.find(i=>i.locale===n)?.name:void 0)??e.name}const V=[{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 V.find(t=>t.id===e)}function Yt(e){return h(e)?.label??e}function zt(e,t="gpt-5-mini"){return h(e)?.defaultModel??t}function qt(e){return V.filter(t=>t.capabilities.includes(e))}function Jt(e){const t=h(e);return!!t&&!t.baseUrl}function Qt(e,t){return t==="text"?!0:h(e)?.attachmentKinds?.includes(t)===!0}const Zt=new Set(["mail","message"]);function xe(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function en(e,t,n,a="html"){if(!e)return n;const i=xe(e,t);return i?`${n}${a==="text"?`
5
+ `}const H=e=>`user:${e}`,V=e=>`team:${e}`;function Gt(e){const t=new Set;for(const n of e??[])n?.id&&(n.kind==="user"&&t.add(H(n.id)),n.kind==="team"&&t.add(V(n.id)));return[...t].sort()}function Ht(e,t){return[H(e),...t.map(V)]}function Vt(e){const t=new Set;for(const n of e??[])n?.kind&&t.add(n.kind);return[...t]}function Xt(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const jt=[{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"}],Wt={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function Ne(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function Yt(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 Oe(e){return Ne(e)}function zt(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 qt(e){return Oe(e)}const Le=["done","escalated","failed","timed_out","stopped"],Re=["awaiting_approval","awaiting_reply"];function xe(e){return Le.includes(e)}function Jt(e){return xe(e)}function Qt(e){return Re.includes(e)}function Zt(e,t){const n=e.labels??[];return n.find(a=>a.locale===t)?.label??n[0]?.label??e.url}function en(e,t,n){const a=e.translations??[];return a.find(i=>i.locale===t)??(n?a.find(i=>i.locale===n):void 0)??{locale:t}}const B=[{code:"nl",label:"Nederlands",english:"Dutch"},{code:"en",label:"English",english:"English"},{code:"de",label:"Deutsch",english:"German"},{code:"fr",label:"Français",english:"French"},{code:"es",label:"Español",english:"Spanish"},{code:"it",label:"Italiano",english:"Italian"},{code:"pt",label:"Português",english:"Portuguese"},{code:"pl",label:"Polski",english:"Polish"},{code:"sv",label:"Svenska",english:"Swedish"},{code:"da",label:"Dansk",english:"Danish"},{code:"nb",label:"Norsk bokmål",english:"Norwegian Bokmål"},{code:"fi",label:"Suomi",english:"Finnish"},{code:"tr",label:"Türkçe",english:"Turkish"}];function ve(e){const t=(e??"").toLowerCase();return B.find(n=>n.code===t)??B.find(n=>n.code===t.split("-")[0])}function tn(e){return ve(e)?.label??e}function nn(e){const t=ve(e);return t?t.english===t.label?`${t.english} (${t.code})`:`${t.english} — ${t.label} (${t.code})`:e}const X=3;function ke(e,t){const n=new Set;let a=1,i=t.get(e)?.parentId;for(;i;){if(n.has(i)||(n.add(i),a++,a>X+1))return 1/0;i=t.get(i)?.parentId}return a}function an(e,t,n){if(!e)return!0;if(e===t)return!1;const a=new Map(n.map(o=>[o.id,o]));if(!a.has(e)||t&&De(e,t,a))return!1;const i=ke(e,a),r=t?j(t,n):1;return i+r<=X}function De(e,t,n){const a=new Set;let i=n.get(e)?.parentId;for(;i;){if(i===t)return!0;if(a.has(i))return!1;a.add(i),i=n.get(i)?.parentId}return!1}function j(e,t,n=new Set){if(n.has(e))return 1;n.add(e);const a=t.filter(i=>i.parentId===e);return a.length?1+Math.max(...a.map(i=>j(i.id,t,n))):1}const Pe="en";function $e(e){return e.defaultLocale||e.locale||Pe}function rn(e){const t=new Set,n=[];for(const a of[$e(e),...e.locales??[]])!a||t.has(a)||(t.add(a),n.push(a));return n}function on(e,t,n){const a=e.translations??[];return a.find(i=>i.locale===t)?.name??(n?a.find(i=>i.locale===n)?.name:void 0)??e.name}const Ue=20,we=20,M=300;function g(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").replace(/\s+/g," ").trim()}function Ke(e){const t=e.replace(/\s+/g," ").trim();if(t.length<=M)return t;const n=t.slice(0,M),a=Math.max(n.lastIndexOf(". "),n.lastIndexOf("! "),n.lastIndexOf("? "));return a>M*.6?n.slice(0,a+1):`${n.trimEnd()}…`}function sn(e,t){const n=Ke(t.text),a=g(n);if(!a||(e.examples??[]).some(o=>g(o)===a))return null;const i=e.exampleCandidates??[],r=i.findIndex(o=>g(o.text)===a);if(r>=0){if(i[r].corrected||!t.corrected)return null;const o=[...i];return o[r]={...o[r],corrected:!0,addedAt:t.addedAt},oe(o)}return oe([{...t,text:n},...i]).slice(0,we)}function oe(e){return[...e].sort((t,n)=>Number(n.corrected)-Number(t.corrected)||n.addedAt-t.addedAt)}function ln(e,t){const n=g(t),a=(e.examples??[]).filter(r=>r.trim());return{examples:a.some(r=>g(r)===n)?a:[...a,t].slice(-Ue),exampleCandidates:Be(e,t)}}function Be(e,t){const n=g(t);return(e.exampleCandidates??[]).filter(a=>g(a.text)!==n)}function Fe(e,t){const n=e.ownerScope;return n?n.kind==="org"?!0:n.kind==="team"?!!t&&n.teamId===t:!1:!1}function cn(e,t){return e.filter(n=>Fe(n,t))}const W=[{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 A(e){return W.find(t=>t.id===e)}function un(e){return A(e)?.label??e}function pn(e,t="gpt-5-mini"){return A(e)?.defaultModel??t}function dn(e){return W.filter(t=>t.capabilities.includes(e))}function fn(e){const t=A(e);return!!t&&!t.baseUrl}function mn(e,t){return t==="text"?!0:A(e)?.attachmentKinds?.includes(t)===!0}const gn=new Set(["mail","message"]);function Ge(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function hn(e,t,n,a="html"){if(!e)return n;const i=Ge(e,t);return i?`${n}${a==="text"?`
6
6
 
7
- `:t==="mail"?"<br><br>-- <br>":"<br><br>"}${i.body}`:n}function tn(e){return e.endpoints??[]}const nn=e=>!!e.assignedUserId||!!e.assignedInboxId,an=e=>e.status==="closed",rn=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,on=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function sn(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const ln=2e3,cn=500,un=12e3,pn=4e3,ke=["contact","company"];function dn(e){if(!e)return!1;const t=e.slice(0,e.indexOf(":"));return ke.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}},De="NL",fn=15,mn=8,gn=Array.from(new Set(Object.values(C).map(e=>e.callingCode))).sort((e,t)=>t.length-e.length);function ie(e){if(e)return C[e.trim().toUpperCase()]}function S(e,t){return e.length>=t.nsnMin&&e.length<=t.nsnMax}function ae(e){if(e.length>fn)return null;for(const t of gn){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<mn?null:`+${e}`}function hn(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 An(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 w(e,t){if(!e)return null;const n=hn(e);if(!n)return null;const a=n.startsWith("+"),i=n.replace(/\D/g,"");if(!i)return null;if(a)return ae(i);if(i.startsWith("00"))return ae(i.slice(2));const r=ie(t)??ie(De);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 En(e,t=9){const n=(e??"").replace(/\D/g,"");return n.length<t?null:n.slice(-t)}function j(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 yn(e){const t=j(e);return t?t.slice(t.lastIndexOf("@")+1):null}const _n=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function $e(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 _n.has(n)&&t.length>=3?t.slice(-3).join("."):n}const Pe=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 Tn(e){const t=$e(e);return t?Pe.has(t):!1}function bn(e){if(!e)return!1;const t=e.trim().toLowerCase();return t==="tel"||t==="sms"||t==="whatsapp"||t==="fax"}function In(e,t,n){if(!e||!t)return null;const a=e.trim().toLowerCase();if(a==="tel"||a==="sms"||a==="whatsapp"){const r=w(t,n);return r?`tel:${r}`:null}if(a==="fax"){const r=w(t,n);return r?`fax:${r}`:null}if(a==="mailto"||a==="email"){const r=j(t);return r?`mailto:${r}`:null}const i=t.trim().toLowerCase();return i?`${a}:${i}`:null}const Sn=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,Mn=/(\*|_)(?=\S)([^*_\n]*?\S)\1/g;function Nn(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(`
7
+ `:t==="mail"?"<br><br>-- <br>":"<br><br>"}${i.body}`:n}function An(e){return e.endpoints??[]}const En=e=>!!e.assignedUserId||!!e.assignedInboxId,yn=e=>e.status==="closed",_n=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,Tn=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function bn(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const In=1e3,Sn=2e3,Mn=500,Cn=12e3,Nn=4e3,He=["contact","company"];function On(e){if(!e)return!1;const t=e.slice(0,e.indexOf(":"));return He.includes(t)}const L={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}},Ve="NL",Ln=15,Rn=8,xn=Array.from(new Set(Object.values(L).map(e=>e.callingCode))).sort((e,t)=>t.length-e.length);function se(e){if(e)return L[e.trim().toUpperCase()]}function C(e,t){return e.length>=t.nsnMin&&e.length<=t.nsnMax}function le(e){if(e.length>Ln)return null;for(const t of xn){if(!e.startsWith(t))continue;const n=e.slice(t.length);for(const a of Object.values(L)){if(a.callingCode!==t)continue;const i=a.trunkPrefix,r=i&&n.startsWith(i)?n.slice(i.length):n;if(C(r,a))return`+${t}${r}`}return null}return e.length<Rn?null:`+${e}`}function vn(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 kn(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 F(e,t){if(!e)return null;const n=vn(e);if(!n)return null;const a=n.startsWith("+"),i=n.replace(/\D/g,"");if(!i)return null;if(a)return le(i);if(i.startsWith("00"))return le(i.slice(2));const r=se(t)??se(Ve);if(!r)return null;const o=r.trunkPrefix;if(o&&i.startsWith(o)){const s=i.slice(o.length);return C(s,r)?`+${r.callingCode}${s}`:null}if(i.startsWith(r.callingCode)){const s=i.slice(r.callingCode.length);if(C(s,r))return`+${r.callingCode}${s}`}return!o&&C(i,r)?`+${r.callingCode}${i}`:null}function Dn(e,t=9){const n=(e??"").replace(/\D/g,"");return n.length<t?null:n.slice(-t)}function Y(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 Pn(e){const t=Y(e);return t?t.slice(t.lastIndexOf("@")+1):null}const $n=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function Xe(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 $n.has(n)&&t.length>=3?t.slice(-3).join("."):n}const je=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 Un(e){const t=Xe(e);return t?je.has(t):!1}function wn(e){if(!e)return!1;const t=e.trim().toLowerCase();return t==="tel"||t==="sms"||t==="whatsapp"||t==="fax"}function Kn(e,t,n){if(!e||!t)return null;const a=e.trim().toLowerCase();if(a==="tel"||a==="sms"||a==="whatsapp"){const r=F(t,n);return r?`tel:${r}`:null}if(a==="fax"){const r=F(t,n);return r?`fax:${r}`:null}if(a==="mailto"||a==="email"){const r=Y(t);return r?`mailto:${r}`:null}const i=t.trim().toLowerCase();return i?`${a}:${i}`:null}const Bn=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,Fn=/(\*|_)(?=\S)([^*_\n]*?\S)\1/g;function Gn(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(`
8
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(`
9
- `),t=t.replace(Sn,"$2"),t=t.replace(Mn,"$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],re=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,Ln=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function On(e){const t=e.split(`
10
- `);for(let n=0;n<t.length;n++)if(Ln.test(t[n])||re.test(t[n])&&t.slice(n+1,n+4).some(a=>re.test(a)))return t.slice(0,n).join(`
11
- `).trim();return e}function oe(e){let t=e;return t=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),t=t.replace(/<br\s*\/?>/gi,`
9
+ `),t=t.replace(Bn,"$2"),t=t.replace(Fn,"$2"),t=t.replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1"),t=t.replace(/`([^`\n]+)`/g,"$1"),t.replace(/\s+/g," ").trim()}const Hn=[/<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],ce=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,Vn=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function Xn(e){const t=e.split(`
10
+ `);for(let n=0;n<t.length;n++)if(Vn.test(t[n])||ce.test(t[n])&&t.slice(n+1,n+4).some(a=>ce.test(a)))return t.slice(0,n).join(`
11
+ `).trim();return e}function ue(e){let t=e;return t=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),t=t.replace(/<br\s*\/?>/gi,`
12
12
  `),t=t.replace(/<\/(p|h[1-6]|ul|ol|table|blockquote)>/gi,`
13
13
 
14
14
  `),t=t.replace(/<\/(div|li|tr)>/gi,`
15
- `),t=t.replace(/<\/(td|th)>/gi," "),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function se(e){return!Number.isInteger(e)||e<0||e>1114111?null:String.fromCodePoint(e)}function le(e){return e.replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#(\d+);/g,(t,n)=>se(Number(n))??t).replace(/&#x([0-9a-f]+);/gi,(t,n)=>se(parseInt(n,16))??t).replace(/&amp;/gi,"&")}function ce(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
15
+ `),t=t.replace(/<\/(td|th)>/gi," "),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function pe(e){return!Number.isInteger(e)||e<0||e>1114111?null:String.fromCodePoint(e)}function de(e){return e.replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#(\d+);/g,(t,n)=>pe(Number(n))??t).replace(/&#x([0-9a-f]+);/gi,(t,n)=>pe(parseInt(n,16))??t).replace(/&amp;/gi,"&")}function fe(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
16
16
  `).replace(/\n{3,}/g,`
17
17
 
18
- `).trim()}function Rn(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=ce(le(oe(n)));return a||(a=ce(le(oe(e)))),On(a)||a}const vn=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,xn=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function kn(e,t){return!!(e&&vn.test(e)||t&&xn.test(t))}const Ue=3,we=600;function Dn(e,t){return e>=Ue||t>=we}const $n=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/webp"]),Pn=new Set(["text/plain","text/markdown","text/csv","application/json","text/html","application/xml","text/xml"]);function Ke(e){const t=(e??"").trim().toLowerCase().split(";")[0];return t?$n.has(t)?"image":t==="application/pdf"?"pdf":Pn.has(t)?"text":t.startsWith("audio/")?"audio":"unsupported":"unsupported"}const g=1024*1024,Be={image:5*g,pdf:20*g,text:1*g,audio:20*g},Un=25*g,wn=5;function Kn(e,t){const n=Ke(e);return n==="unsupported"?"unsupported":t>Be[n]?"too-large":null}function Ge(e,t){const n=new Set(e.disabledIntents??[]),a=e.intentOverrides??{},i=t.intents.filter(o=>!n.has(o.intent)).map(o=>Gn(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 Fe(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=Fe(e,t);return Object.entries(n).filter(([,a])=>!a).map(([a])=>a)}function Gn(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function Fn(e,t){const n=[];for(const a of e){if(!a.enabled)continue;const i=t[a.providerId];if(i)for(const r of Ge(a,i))n.push({channel:a,description:i,capability:r})}return n}function Hn(e,t){return t.filter(n=>n.capability.intent===e)}function He(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function Vn(e,t){return He(e.scheme,t)}function jn(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 Ve=(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))(Ve||{});const Wn={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 Xn(e){return e?Wn[e]??"note":"note"}const Yn="message_window",zn="message_templates",qn={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},Jn=(e,t)=>({intent:e,...t}),Qn="folder_management",Zn="remote_search",ei={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},W="auth";function X(e){const t=typeof e=="string"?e.match(/apps\/([^/?#]+)/):null;return t?t[1]:null}function ti(e){const t=X(e);return t?t!==W:typeof e=="string"&&e.startsWith("/wake")}function ni(e){return typeof e!="string"||e===""||e==="/"?!0:X(e)===W}function ii(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function je(e){const n=e.split("/").filter(Boolean).map(a=>a.startsWith(":")?a.endsWith("?")?"(?:/[^/]+)?":"/[^/]+":"/"+ii(a)).join("");return new RegExp(`^${n}\\/?$`)}function We(e,t){const n=e.split("/").filter(Boolean),a=t.split("/").filter(Boolean),i={};return n.forEach((r,o)=>{if(r.startsWith(":")){const s=r.endsWith("?")?r.slice(1,-1):r.slice(1),l=a[o];l&&(i[s]=l)}}),i}function Xe(e){return e.publicBasePath??`/apps/${e.name}`}function ai(e){const t=[];for(const n of e){if(!n?.name)continue;const a=Xe(n);for(const i of n.routes??[]){if(!i.public)continue;const r=i.path==="/"?"":i.path;t.push({appName:n.name,resource:i.resource,pattern:`${a}${r}`,props:i.props})}}return t}function Ye(e,t){const n=e.split("/").filter(Boolean),a=t.split("/").filter(Boolean);for(let i=0;i<Math.min(n.length,a.length);i++){const r=n[i].startsWith(":"),o=a[i].startsWith(":");if(r!==o)return o}return n.length>a.length}function ze(e,t){if(typeof e!="string")return null;let n=null;for(const a of t)je(a.pattern).test(e)&&(!n||Ye(a.pattern,n.pattern))&&(n=a);return n?{...n,params:{...n.props,...We(n.pattern,e)}}:null}function ri(e,t){return ze(e,t)!==null}const oi=9e4,si="installation-id";exports.ACTIVITY_CATALOG=m;exports.AI_ATTACHMENT_LIMITS=Be;exports.AI_ATTACHMENT_MAX_PER_TURN=wn;exports.AI_ATTACHMENT_TURN_BUDGET=Un;exports.AI_VENDORS=V;exports.ALLOWED_LINK_SCHEMES=_e;exports.ARTIFACT_MAX_BLOCKS=k;exports.ARTIFACT_MAX_BODY_BYTES=_t;exports.ARTIFACT_MAX_CELL_LEN=I;exports.ARTIFACT_MAX_KPI_ITEMS=U;exports.ARTIFACT_MAX_LIST_ITEMS=D;exports.ARTIFACT_MAX_TABLE_COLUMNS=P;exports.ARTIFACT_MAX_TABLE_ROWS=$;exports.ARTIFACT_MAX_TEXT_LEN=K;exports.AUTH_APP_NAME=W;exports.ActivityTypeRegistry=fe;exports.BUILT_IN_ONLY=ct;exports.CLASSIFY_VARS=Ut;exports.CORE_DIMENSIONS=mt;exports.CommunicationScheme=Ve;exports.DEFAULT_MEMORY_BUDGET=pn;exports.DEFAULT_PHONE_REGION=De;exports.FEATURE_FOLDER_MANAGEMENT=Qn;exports.FEATURE_REMOTE_SEARCH=Zn;exports.INSTALLATION_HEADER=si;exports.InteractionParticipantRole=qn;exports.KB_FALLBACK_LOCALE=Re;exports.MAX_ACTIONS=b;exports.MAX_BLOCKS=x;exports.MAX_COLLECTION_DEPTH=F;exports.MAX_FIELDS=_;exports.MAX_LIST_ITEMS=T;exports.MAX_MEMORY_BUDGET=un;exports.MAX_MEMORY_CHARS=ln;exports.MIN_MEMORY_BUDGET=cn;exports.PAUSED_RUN_STATUSES=Ne;exports.PHONE_REGIONS=C;exports.PRESENCE_ONLINE_WINDOW_MS=oi;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=zn;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=Yn;exports.PUBLIC_EMAIL_DOMAINS=Pe;exports.RELATED_SUBJECT_KINDS=ke;exports.SIGNATURE_INTENTS=Zt;exports.SUMMARY_MIN_LAST_CHARS=we;exports.SUMMARY_MIN_MESSAGES=Ue;exports.TERMINAL_RUN_STATUSES=Me;exports.TRIGGER_VARS=Pt;exports.UNSUPPORTED=ei;exports.USAGE_DIMENSIONS=he;exports.USAGE_DIMENSION_IDS=Ae;exports.actingIdentityKey=Se;exports.activityIconOf=Ze;exports.activityJoinUrl=st;exports.activitySnippet=pe;exports.activityTextParams=de;exports.activityTimelineText=ot;exports.activityTimestamp=ft;exports.activityTypeInfo=p;exports.actorKey=Bt;exports.aiAttachmentKind=Ke;exports.aiAttachmentRejection=Kn;exports.aiVendorAcceptsAttachment=Qt;exports.aiVendorDefaultModel=zt;exports.aiVendorLabel=Yt;exports.aiVendorNeedsBaseUrl=Jt;exports.aiVendorsWith=qt;exports.appNameFromPath=X;exports.applySignature=en;exports.artifactBodyBytes=Lt;exports.artifactOutline=Ot;exports.artifactToMarkdown=vt;exports.buildActivityPreview=pt;exports.buildChannelIntents=Fn;exports.buildShareKeys=xt;exports.canNestUnder=jt;exports.carriesText=it;exports.categoryLabel=Xt;exports.channelKindForScheme=Xn;exports.channelKindOf=et;exports.cleanMessageText=Rn;exports.defaultLocaleOf=ve;exports.defineIntent=Jn;exports.depthOf=Le;exports.disabledIntentsFromCapabilities=Bn;exports.emailDomain=yn;exports.endpointKey=In;exports.extractParams=We;exports.filterByEndpoint=Vn;exports.filterByIntent=Hn;exports.filterByTargetScheme=He;exports.findAiVendor=h;exports.flattenLocales=gt;exports.floorToPeriod=ge;exports.formatActingIdentity=Ie;exports.formatPeriod=me;exports.getActivitySeenUserIds=dt;exports.getContactEndpoints=tn;exports.getShortTitle=on;exports.getUrgencyScore=rn;exports.heightOf=H;exports.helpCenterText=Vt;exports.humanizeAction=$t;exports.isAssigned=nn;exports.isClosed=an;exports.isDeepLink=ti;exports.isDescendant=Oe;exports.isInteractionUnseen=sn;exports.isLandingPath=ni;exports.isLikelyBulk=kn;exports.isMessageType=tt;exports.isMoreSpecificPattern=Ye;exports.isPaused=Ft;exports.isPlaybookAuthoredType=rt;exports.isPublicEmailDomain=Tn;exports.isPublicPath=ri;exports.isReplyableType=nt;exports.isRetryable=Gt;exports.isTerminal=Ce;exports.isThreadLongEnough=Dn;exports.linkLabel=Ht;exports.localesOf=Wt;exports.looksLikeEmail=An;exports.matchContactToIntents=jn;exports.matchPublicRoute=ze;exports.messageCountsAs=at;exports.needsPhoneRegion=bn;exports.normalizeArtifactBlocks=Ct;exports.normalizeBlocks=Qe;exports.normalizeEmail=j;exports.parseActingIdentity=wt;exports.pathToRegex=je;exports.periodsInRange=Et;exports.phoneSuffix=En;exports.plainTextFromMarkdown=Nn;exports.playbookActor=Kt;exports.publicBasePathFor=Xe;exports.publicRoutePatterns=ai;exports.readPath=M;exports.registrableDomain=$e;exports.relatedByDefault=dn;exports.resolveAccountCapabilities=Fe;exports.resolveActivityText=N;exports.resolveChannelIntents=Ge;exports.resolveSignature=xe;exports.sanitizeInline=be;exports.shareKeyForTeam=G;exports.shareKeyForUser=B;exports.shareKeysForViewer=kt;exports.stripHtml=ue;exports.toE164=w;exports.toolSourceKinds=Dt;exports.usageMetricId=Ee;exports.usageMetrics=yt;
18
+ `).trim()}function jn(e){if(typeof e!="string"||!e)return"";let t=e.length;for(const r of Hn){const o=e.search(r);o>=0&&o<t&&(t=o)}const n=e.slice(0,t);let a=fe(de(ue(n)));return a||(a=fe(de(ue(e)))),Xn(a)||a}const Wn=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,Yn=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function zn(e,t){return!!(e&&Wn.test(e)||t&&Yn.test(t))}const We=3,Ye=600;function qn(e,t){return e>=We||t>=Ye}const Jn=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/webp"]),Qn=new Set(["text/plain","text/markdown","text/csv","application/json","text/html","application/xml","text/xml"]);function ze(e){const t=(e??"").trim().toLowerCase().split(";")[0];return t?Jn.has(t)?"image":t==="application/pdf"?"pdf":Qn.has(t)?"text":t.startsWith("audio/")?"audio":"unsupported":"unsupported"}const h=1024*1024,qe={image:5*h,pdf:20*h,text:1*h,audio:20*h},Zn=25*h,ei=5;function ti(e,t){const n=ze(e);return n==="unsupported"?"unsupported":t>qe[n]?"too-large":null}function Je(e,t){const n=new Set(e.disabledIntents??[]),a=e.intentOverrides??{},i=t.intents.filter(o=>!n.has(o.intent)).map(o=>ii(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 Qe(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 ni(e,t){const n=Qe(e,t);return Object.entries(n).filter(([,a])=>!a).map(([a])=>a)}function ii(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function ai(e,t){const n=[];for(const a of e){if(!a.enabled)continue;const i=t[a.providerId];if(i)for(const r of Je(a,i))n.push({channel:a,description:i,capability:r})}return n}function ri(e,t){return t.filter(n=>n.capability.intent===e)}function Ze(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function oi(e,t){return Ze(e.scheme,t)}function si(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 et=(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))(et||{});const li={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 ci(e){return e?li[e]??"note":"note"}const ui="message_window",pi="message_templates",di={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},fi=(e,t)=>({intent:e,...t}),mi="folder_management",gi="remote_search",hi={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},z="auth";function q(e){const t=typeof e=="string"?e.match(/apps\/([^/?#]+)/):null;return t?t[1]:null}function Ai(e){const t=q(e);return t?t!==z:typeof e=="string"&&e.startsWith("/wake")}function Ei(e){return typeof e!="string"||e===""||e==="/"?!0:q(e)===z}function yi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tt(e){const n=e.split("/").filter(Boolean).map(a=>a.startsWith(":")?a.endsWith("?")?"(?:/[^/]+)?":"/[^/]+":"/"+yi(a)).join("");return new RegExp(`^${n}\\/?$`)}function nt(e,t){const n=e.split("/").filter(Boolean),a=t.split("/").filter(Boolean),i={};return n.forEach((r,o)=>{if(r.startsWith(":")){const s=r.endsWith("?")?r.slice(1,-1):r.slice(1),l=a[o];l&&(i[s]=l)}}),i}function it(e){return e.publicBasePath??`/apps/${e.name}`}function _i(e){const t=[];for(const n of e){if(!n?.name)continue;const a=it(n);for(const i of n.routes??[]){if(!i.public)continue;const r=i.path==="/"?"":i.path;t.push({appName:n.name,resource:i.resource,pattern:`${a}${r}`,props:i.props})}}return t}function at(e,t){const n=e.split("/").filter(Boolean),a=t.split("/").filter(Boolean);for(let i=0;i<Math.min(n.length,a.length);i++){const r=n[i].startsWith(":"),o=a[i].startsWith(":");if(r!==o)return o}return n.length>a.length}function rt(e,t){if(typeof e!="string")return null;let n=null;for(const a of t)tt(a.pattern).test(e)&&(!n||at(a.pattern,n.pattern))&&(n=a);return n?{...n,params:{...n.props,...nt(n.pattern,e)}}:null}function Ti(e,t){return rt(e,t)!==null}const bi=9e4,Ii="installation-id";exports.ACTIVITY_CATALOG=m;exports.AI_ATTACHMENT_LIMITS=qe;exports.AI_ATTACHMENT_MAX_PER_TURN=ei;exports.AI_ATTACHMENT_TURN_BUDGET=Zn;exports.AI_VENDORS=W;exports.ALLOWED_LINK_SCHEMES=Se;exports.ARTIFACT_MAX_BLOCKS=P;exports.ARTIFACT_MAX_BODY_BYTES=Rt;exports.ARTIFACT_MAX_CELL_LEN=S;exports.ARTIFACT_MAX_KPI_ITEMS=K;exports.ARTIFACT_MAX_LIST_ITEMS=$;exports.ARTIFACT_MAX_TABLE_COLUMNS=w;exports.ARTIFACT_MAX_TABLE_ROWS=U;exports.ARTIFACT_MAX_TEXT_LEN=G;exports.AUTH_APP_NAME=z;exports.ActivityTypeRegistry=Ae;exports.BUILT_IN_ONLY=yt;exports.CLASSIFY_VARS=Wt;exports.CORE_DIMENSIONS=St;exports.CommunicationScheme=et;exports.DEFAULT_MEMORY_BUDGET=Nn;exports.DEFAULT_PHONE_REGION=Ve;exports.FEATURE_FOLDER_MANAGEMENT=mi;exports.FEATURE_REMOTE_SEARCH=gi;exports.INSTALLATION_HEADER=Ii;exports.InteractionParticipantRole=di;exports.KB_FALLBACK_LOCALE=Pe;exports.KB_LOCALES=B;exports.MAX_ACTIONS=I;exports.MAX_BLOCKS=D;exports.MAX_COLLECTION_DEPTH=X;exports.MAX_FIELDS=T;exports.MAX_LIST_ITEMS=b;exports.MAX_MEMORY_BROWSE=In;exports.MAX_MEMORY_BUDGET=Cn;exports.MAX_MEMORY_CHARS=Sn;exports.MAX_TOPIC_CANDIDATES=we;exports.MAX_TOPIC_EXAMPLES=Ue;exports.MAX_TOPIC_EXAMPLE_CHARS=M;exports.MIN_MEMORY_BUDGET=Mn;exports.PAUSED_RUN_STATUSES=Re;exports.PHONE_REGIONS=L;exports.PRESENCE_ONLINE_WINDOW_MS=bi;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=pi;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=ui;exports.PUBLIC_EMAIL_DOMAINS=je;exports.RELATED_SUBJECT_KINDS=He;exports.SIGNATURE_INTENTS=gn;exports.SUMMARY_MIN_LAST_CHARS=Ye;exports.SUMMARY_MIN_MESSAGES=We;exports.TERMINAL_RUN_STATUSES=Le;exports.TRIGGER_VARS=jt;exports.UNSUPPORTED=hi;exports.USAGE_DIMENSIONS=_e;exports.USAGE_DIMENSION_IDS=Te;exports.acceptExampleCandidate=ln;exports.actingIdentityKey=Oe;exports.activityIconOf=ct;exports.activityJoinUrl=At;exports.activitySnippet=ge;exports.activityTextParams=he;exports.activityTimelineText=ht;exports.activityTimestamp=It;exports.activityTypeInfo=p;exports.actorKey=qt;exports.addExampleCandidate=sn;exports.aiAttachmentKind=ze;exports.aiAttachmentRejection=ti;exports.aiVendorAcceptsAttachment=mn;exports.aiVendorDefaultModel=pn;exports.aiVendorLabel=un;exports.aiVendorNeedsBaseUrl=fn;exports.aiVendorsWith=dn;exports.appNameFromPath=q;exports.applySignature=hn;exports.artifactBodyBytes=wt;exports.artifactOutline=Kt;exports.artifactToMarkdown=Ft;exports.buildActivityPreview=Tt;exports.buildChannelIntents=ai;exports.buildShareKeys=Gt;exports.canNestUnder=an;exports.carriesText=ft;exports.categoryLabel=on;exports.channelKindForScheme=ci;exports.channelKindOf=ut;exports.cleanMessageText=jn;exports.defaultLocaleOf=$e;exports.defineIntent=fi;exports.depthOf=ke;exports.disabledIntentsFromCapabilities=ni;exports.emailDomain=Pn;exports.endpointKey=Kn;exports.extractParams=nt;exports.filterByEndpoint=oi;exports.filterByIntent=ri;exports.filterByTargetScheme=Ze;exports.findAiVendor=A;exports.flattenLocales=Mt;exports.floorToPeriod=ye;exports.formatActingIdentity=Ne;exports.formatPeriod=Ee;exports.getActivitySeenUserIds=bt;exports.getContactEndpoints=An;exports.getShortTitle=Tn;exports.getUrgencyScore=_n;exports.heightOf=j;exports.helpCenterText=en;exports.humanizeAction=Xt;exports.isAssigned=En;exports.isClosed=yn;exports.isDeepLink=Ai;exports.isDescendant=De;exports.isInteractionUnseen=bn;exports.isLandingPath=Ei;exports.isLikelyBulk=zn;exports.isMessageType=pt;exports.isMoreSpecificPattern=at;exports.isPaused=Qt;exports.isPlaybookAuthoredType=gt;exports.isPublicEmailDomain=Un;exports.isPublicPath=Ti;exports.isReplyableType=dt;exports.isRetryable=Jt;exports.isTerminal=xe;exports.isThreadLongEnough=qn;exports.linkLabel=Zt;exports.localeInstruction=nn;exports.localeName=tn;exports.localesOf=rn;exports.looksLikeEmail=kn;exports.matchContactToIntents=si;exports.matchPublicRoute=rt;exports.messageCountsAs=mt;exports.needsPhoneRegion=wn;exports.normalizeArtifactBlocks=Ut;exports.normalizeBlocks=lt;exports.normalizeEmail=Y;exports.normalizeExample=g;exports.parseActingIdentity=Yt;exports.pathToRegex=tt;exports.periodsInRange=Ot;exports.phoneSuffix=Dn;exports.plainTextFromMarkdown=Gn;exports.playbookActor=zt;exports.publicBasePathFor=it;exports.publicRoutePatterns=_i;exports.readPath=N;exports.registrableDomain=Xe;exports.rejectExampleCandidate=Be;exports.relatedByDefault=On;exports.resolveAccountCapabilities=Qe;exports.resolveActivityText=O;exports.resolveChannelIntents=Je;exports.resolveSignature=Ge;exports.sanitizeInline=Ce;exports.shareKeyForTeam=V;exports.shareKeyForUser=H;exports.shareKeysForViewer=Ht;exports.stripHtml=me;exports.toE164=F;exports.toolSourceKinds=Vt;exports.topicOfferedForTeam=Fe;exports.topicsForTeam=cn;exports.truncateExample=Ke;exports.usageMetricId=be;exports.usageMetrics=Lt;