@opencxh/domain 1.134.3 → 1.134.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,10 +1,12 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=10,d=10,m=10,f=5,ue=new Set(["header","section","context","divider","image","list","actions","attachments"]);function b(e){if(typeof e=="string")return e.length>0;if(!e||typeof e!="object")return!1;const t=e;return typeof t.key=="string"||typeof t.value=="string"}function pe(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const i of e){if(n.length>=T){t("more than "+T+" blocks; the rest was dropped");break}if(!i||typeof i!="object")continue;const a=i;if(!ue.has(a.type)){t("unknown block type "+String(a.type));continue}switch(a.type){case"header":if(!b(a.text)){t("a header without text");continue}break;case"context":if(!b(a.text)){t("a context block without text");continue}break;case"image":if(!a.url||!a.alt){t("an image without url or alt");continue}break;case"section":Array.isArray(a.fields)&&a.fields.length>d&&(t("more than "+d+" fields in a section"),a.fields=a.fields.slice(0,d));break;case"list":if(!Array.isArray(a.items)||a.items.length===0){t("a list without items");continue}a.items.length>m&&(t("more than "+m+" list items"),a.items=a.items.slice(0,m));break;case"actions":{const r=Array.isArray(a.elements)?a.elements:[],o=r.filter(l=>l&&l.action_id&&l.invoke&&b(l.text));if(o.length!==r.length&&t("an action without action_id, invoke or text"),o.length===0)continue;o.length>f&&t("more than "+f+" actions"),a.elements=o.slice(0,f);break}}n.push(a)}return n}function K(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 u(e){if(!e||e<0)return"";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function v(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function I(e){return e?.split("@")?.[0]||e||""}function p(e){return e.map(t=>t.name).join(", ")}function C(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const c={VOICE_CALL_STARTED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek gestart",timeline:e=>e.direction==="inbound"?`Inbound call started — ${I(e.payload.from)}`:`Outbound call started — ${I(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?` (${u(e.payload.duration)})`:""}`,timeline:e=>`Call ended${v(e.payload.duration)}`},VOICE_CALL_MISSED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gemiste oproep",timeline:e=>`Missed call — ${I(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?` (${u(e.payload.duration)})`:""}`,timeline:()=>"Video call ended"},VIDEO_CALL_MISSED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gemiste oproep",timeline:()=>"Missed video call"},VIDEO_CALL_FAILED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek mislukt",timeline:()=>"Video call failed"},EMAIL_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.EMAIL_RECEIVED",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:O},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:O},CHAT_MESSAGE_SENT:{shape:"message",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:e=>e.payload.text??""},CHAT_MESSAGE_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.CHAT_MESSAGE_RECEIVED",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:e=>e.payload.text??""},CHAT_MEMBER_JOINED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${p(e.payload.members)} toegevoegd`,timeline:e=>{const t=p(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=>`${p(e.payload.members)} verlaten`,timeline:e=>{const t=p(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=>`${C(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?` (${u(e.payload.duration)})`:""}`,timeline:e=>`${C(e.payload.callType)} ended${v(e.payload.duration)}`,joinUrl:e=>e.payload.joinUrl},CHAT_EVENT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>e.payload.text??e.payload.eventType,timeline:e=>e.payload.text||e.payload.eventType},TRANSCRIPT_ADDED:{shape:"artifact",triggerable:!0,displayNameKey:"communication:activity.TRANSCRIPT_ADDED",component:"communication:TranscriptionActivity",icon:"captions",carriesText:!0,snippet:e=>(e.payload.segments??[]).map(t=>t.text).join(" ")},COMMENT_ADDED:{shape:"note",component:"communication:CommentActivity",icon:"sticky-note",carriesText:!0,snippet:e=>e.payload.text??""},FILE_UPLOADED:{shape:"artifact",component:"communication:FileActivity",icon:"paperclip",snippet:e=>`Bestand: ${e.payload.fileName}`},AI_MESSAGE_ADDED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.AI_MESSAGE_ADDED",icon:"circle",snippet:e=>e.payload.output?.text??e.payload.input?.text??"",timeline:()=>"AI message added"},AI_ACTION_PROPOSED:{shape:"event",component:"communication:ProposedActionCard",icon:"circle",playbookAuthored:!0,snippet:e=>`Voorstel wacht op goedkeuring (${e.payload.actions?.length??0} actie(s))`},PLAYBOOK_STARTED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:e=>`Playbook gestart${e.payload.playbookName?`: ${e.payload.playbookName}`:""}`,timeline:e=>`Playbook gestart${e.payload.playbookName?` — ${e.payload.playbookName}`:""}`},PLAYBOOK_COMPLETED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook afgerond",timeline:()=>"Playbook afgerond"},PLAYBOOK_ESCALATED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook geëscaleerd naar een mens",timeline:()=>"Playbook geëscaleerd naar een mens"},MEETING_SCHEDULED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gepland: ${e.payload.title}`,timeline:()=>"Meeting scheduled",joinUrl:e=>e.payload.joinUrl},MEETING_STARTED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gestart: ${e.payload.title}`,timeline:()=>"Meeting started",joinUrl:e=>e.payload.joinUrl},MEETING_ENDED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering beëindigd${e.payload.duration?` (${u(e.payload.duration)})`:""}`,timeline:()=>"Meeting ended"},MEETING_PARTICIPANT_JOINED:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} deelgenomen`,timeline:(e,t)=>`${t} joined the meeting`},MEETING_PARTICIPANT_LEFT:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} verlaten`,timeline:(e,t)=>`${t} left the meeting`},INTERACTION_CREATED:{shape:"event",icon:"circle",snippet:()=>"Interactie aangemaakt",timeline:(e,t)=>`Interaction started by ${t}`},INTERACTION_STATUS_CHANGED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.INTERACTION_STATUS_CHANGED",icon:"circle-dot",snippet:e=>`Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`,timeline:(e,t)=>`Status changed to ${e.payload.toStatus} by ${t}`},INTERACTION_ASSIGNED:{shape:"event",icon:"user",snippet:()=>"Interactie toegewezen",timeline:(e,t)=>`Assigned by ${t}`}};function O(e){const t=e.payload,n=t.bodySnippet?.trim()||K(t.body??"");return t.subject?`${t.subject} — ${n}`:n}function s(e){return c[e]}function de(e){return s(e)?.icon??"circle"}function me(e){return s(e)?.channelKind}function fe(e){const t=s(e)?.shape;return t==="message"||t==="note"}function ge(e){return s(e)?.replyable===!0}function Ee(e){return s(e)?.carriesText===!0}function he(e){return s(e)?.countsAs}function ye(e){return s(e)?.playbookAuthored===!0}function w(e){const t=s(e.type)?.snippet;return t?t(e):""}function Ae(e,t){const n=s(e.type)?.timeline;return n?n(e,t):e.type.replace(/_/g," ").toLowerCase()}function be(e){const t=s(e.type)?.joinUrl;return t?t(e):void 0}function E(e,t){let n=e;for(const i of t.split(".")){if(n==null||typeof n!="object")return"";n=n[i]}return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):""}function h(e,t,n){if(e===void 0)return null;if(typeof e=="string")return e||null;if("value"in e)return E(t,e.value)||null;const i={};for(const[r,o]of Object.entries(e.params??{}))i[r]=E(t,o);const a=n(e.key,i);return a===e.key?null:a}function V(e,t){if(!e||typeof e=="string"||"value"in e)return null;const n={};for(const[i,a]of Object.entries(e.params??{}))n[i]=E(t,a);return{key:e.key,params:n}}const Ie=e=>e;function R(e){const t=c[e];return{type:e,shape:t.shape,channelKind:t.channelKind,icon:t.icon,replyable:t.replyable===!0,countsAs:t.countsAs,carriesText:t.carriesText===!0,triggerable:t.triggerable===!0,component:t.component,builtIn:!0,displayNameKey:t.displayNameKey}}function D(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 B{constructor(t=[],n=Ie){this.translate=n;for(const i of t)i?.type&&(i.type in c||this.declared.has(i.type)||this.declared.set(i.type,i))}declared=new Map;get(t){if(t in c)return R(t);const n=this.declared.get(t);return n?D(n):void 0}triggerable(){const t=Object.keys(c).filter(i=>c[i].triggerable).map(R),n=[...this.declared.values()].map(D).filter(i=>i.triggerable);return[...t,...n]}timelineText(t,n){const i=c[t.type];if(i?.timeline)return i.timeline(t,n);const a=this.declared.get(t.type);return h(a?.text,t,this.translate)??t.type.replace(/_/g," ").toLowerCase()}snippet(t){const n=c[t.type];if(n?.snippet)return n.snippet(t);const i=this.declared.get(t.type);return h(i?.text,t,this.translate)??""}descriptor(t){return this.declared.get(t)}blocks(t){const n=this.declared.get(t)?.render;return n?.length?n:void 0}get translator(){return this.translate}}const _e=new B,L=140;function Te(e){const t=e.trim();return t.length<=L?t:t.slice(0,L-1).trimEnd()+"…"}function Se(e,t){const n=V(t?.text,e),i=t?h(t.text,e,a=>a):null;return{activityId:e.id,type:e.type,snippet:Te(i??w(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...n?{snippetKey:n.key,snippetParams:n.params}:{}}}function Me(e,t,n=[]){const i=e.createdAt;if(!i)return[];const a=new Set(n);return e.author.type==="user"&&e.author.id&&a.add(e.author.id),Object.entries(t).filter(([r,o])=>o>=i&&!a.has(r)).map(([r])=>r)}function Ne(e){return e.createdAt??0}const ve=[{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 Ce(e){const t=[];for(const n of Object.keys(e))for(const i of Object.keys(e[n]))t.push({lang:n,key:i,value:e[n][i]});return t}function _(e){return e<10?`0${e}`:`${e}`}function H(e,t){const n=new Date(e),i=`${n.getUTCFullYear()}-${_(n.getUTCMonth()+1)}-${_(n.getUTCDate())}`;return t==="day"?i:`${i}T${_(n.getUTCHours())}`}function j(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const Oe=36e5,Re=864e5;function De(e,t,n){const i=n==="hour"?Oe:Re,a=[];for(let r=j(e,n);r<=t;r+=i)a.push(H(r,n));return a}const F=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],W=F.map(e=>e.id);function Y(e,t){return`${e}.usage.${t}`}function Le(e,t){return t.map(n=>({id:Y(e,n.unit),label:n.label,category:"Verbruik",valueType:n.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...W,...n.extraDimensions??[],"time"]}))}function ke(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const Ue=[{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"}],xe={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function X(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function $e(e){if(typeof e!="string")return;const t=e.trim();if(t==="org")return{kind:"org"};const n=t.indexOf(":");if(n<=0)return;const i=t.slice(0,n),a=t.slice(n+1).trim();if(a){if(i==="user")return{kind:"user",userId:a};if(i==="team")return{kind:"team",teamId:a}}}function z(e){return X(e)}function Pe(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 Ge(e){return z(e)}const q=["done","escalated","failed","timed_out","stopped"],J=["awaiting_approval","awaiting_reply"];function Q(e){return q.includes(e)}function Ke(e){return Q(e)}function we(e){return J.includes(e)}const M=[{id:"openai",label:"OpenAI",capabilities:["chat","transcription","embedding"],defaultModel:"gpt-5-mini",baseUrl:"https://api.openai.com/v1"},{id:"gemini",label:"Google Gemini",capabilities:["chat","transcription","embedding"],defaultModel:"gemini-3.5-flash",baseUrl:"https://generativelanguage.googleapis.com/v1beta"},{id:"anthropic",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 y(e){return M.find(t=>t.id===e)}function Ve(e){return y(e)?.label??e}function Be(e,t="gpt-5-mini"){return y(e)?.defaultModel??t}function He(e){return M.filter(t=>t.capabilities.includes(e))}function je(e){const t=y(e);return!!t&&!t.baseUrl}const Fe=new Set(["mail","message"]);function Z(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function We(e,t,n,i="html"){if(!e)return n;const a=Z(e,t);return a?`${n}${i==="text"?`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=10,d=10,m=10,f=5,pe=new Set(["header","section","context","divider","image","list","actions","attachments"]);function b(e){if(typeof e=="string")return e.length>0;if(!e||typeof e!="object")return!1;const n=e;return typeof n.key=="string"||typeof n.value=="string"}function ue(e,n=()=>{}){if(!Array.isArray(e))return[];const t=[];for(const i of e){if(t.length>=T){n("more than "+T+" blocks; the rest was dropped");break}if(!i||typeof i!="object")continue;const a=i;if(!pe.has(a.type)){n("unknown block type "+String(a.type));continue}switch(a.type){case"header":if(!b(a.text)){n("a header without text");continue}break;case"context":if(!b(a.text)){n("a context block without text");continue}break;case"image":if(!a.url||!a.alt){n("an image without url or alt");continue}break;case"section":Array.isArray(a.fields)&&a.fields.length>d&&(n("more than "+d+" fields in a section"),a.fields=a.fields.slice(0,d));break;case"list":if(!Array.isArray(a.items)||a.items.length===0){n("a list without items");continue}a.items.length>m&&(n("more than "+m+" list items"),a.items=a.items.slice(0,m));break;case"actions":{const r=Array.isArray(a.elements)?a.elements:[],o=r.filter(l=>l&&l.action_id&&l.invoke&&b(l.text));if(o.length!==r.length&&n("an action without action_id, invoke or text"),o.length===0)continue;o.length>f&&n("more than "+f+" actions"),a.elements=o.slice(0,f);break}}t.push(a)}return t}function K(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 p(e){if(!e||e<0)return"";const n=Math.floor(e/60),t=Math.floor(e%60);return`${n}:${t.toString().padStart(2,"0")}`}function v(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function _(e){return e?.split("@")?.[0]||e||""}function u(e){return e.map(n=>n.name).join(", ")}function C(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const c={VOICE_CALL_STARTED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek gestart",timeline:e=>e.direction==="inbound"?`Inbound call started — ${_(e.payload.from)}`:`Outbound call started — ${_(e.payload.to)}`},VOICE_CALL_ANSWERED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek aangenomen",timeline:(e,n)=>`Call answered — ${n}`},VOICE_CALL_HOLD:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"In de wacht",timeline:(e,n)=>`Call on hold — ${n}`},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?` (${p(e.payload.duration)})`:""}`,timeline:e=>`Call ended${v(e.payload.duration)}`},VOICE_CALL_MISSED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gemiste oproep",timeline:e=>`Missed call — ${_(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?` (${p(e.payload.duration)})`:""}`,timeline:()=>"Video call ended"},VIDEO_CALL_MISSED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gemiste oproep",timeline:()=>"Missed video call"},VIDEO_CALL_FAILED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek mislukt",timeline:()=>"Video call failed"},EMAIL_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.EMAIL_RECEIVED",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:O},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:O},CHAT_MESSAGE_SENT:{shape:"message",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:e=>e.payload.text??""},CHAT_MESSAGE_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.CHAT_MESSAGE_RECEIVED",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:e=>e.payload.text??""},CHAT_MEMBER_JOINED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${u(e.payload.members)} toegevoegd`,timeline:e=>{const n=u(e.payload.members)||"Someone",t=e.payload.initiator?.name?` · added by ${e.payload.initiator.name}`:"";return`${n} joined the chat${t}`}},CHAT_MEMBER_LEFT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${u(e.payload.members)} verlaten`,timeline:e=>{const n=u(e.payload.members)||"Someone",t=e.payload.initiator?.name?` · removed by ${e.payload.initiator.name}`:"";return`${n} left the chat${t}`}},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=>`${C(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?` (${p(e.payload.duration)})`:""}`,timeline:e=>`${C(e.payload.callType)} ended${v(e.payload.duration)}`,joinUrl:e=>e.payload.joinUrl},CHAT_EVENT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>e.payload.text??e.payload.eventType,timeline:e=>e.payload.text||e.payload.eventType},TRANSCRIPT_ADDED:{shape:"artifact",triggerable:!0,displayNameKey:"communication:activity.TRANSCRIPT_ADDED",component:"communication:TranscriptionActivity",icon:"captions",carriesText:!0,snippet:e=>(e.payload.segments??[]).map(n=>n.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?` (${p(e.payload.duration)})`:""}`,timeline:()=>"Meeting ended"},MEETING_PARTICIPANT_JOINED:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} deelgenomen`,timeline:(e,n)=>`${n} joined the meeting`},MEETING_PARTICIPANT_LEFT:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} verlaten`,timeline:(e,n)=>`${n} left the meeting`},INTERACTION_CREATED:{shape:"event",icon:"circle",snippet:()=>"Interactie aangemaakt",timeline:(e,n)=>`Interaction started by ${n}`},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,n)=>`Status changed to ${e.payload.toStatus} by ${n}`},INTERACTION_ASSIGNED:{shape:"event",icon:"user",snippet:()=>"Interactie toegewezen",timeline:(e,n)=>`Assigned by ${n}`}};function O(e){const n=e.payload,t=n.bodySnippet?.trim()||K(n.body??"");return n.subject?`${n.subject} — ${t}`:t}function s(e){return c[e]}function de(e){return s(e)?.icon??"circle"}function me(e){return s(e)?.channelKind}function fe(e){const n=s(e)?.shape;return n==="message"||n==="note"}function ge(e){return s(e)?.replyable===!0}function Ee(e){return s(e)?.carriesText===!0}function he(e){return s(e)?.countsAs}function ye(e){return s(e)?.playbookAuthored===!0}function w(e){const n=s(e.type)?.snippet;return n?n(e):""}function Ae(e,n){const t=s(e.type)?.timeline;return t?t(e,n):e.type.replace(/_/g," ").toLowerCase()}function be(e){const n=s(e.type)?.joinUrl;return n?n(e):void 0}function E(e,n){let t=e;for(const i of n.split(".")){if(t==null||typeof t!="object")return"";t=t[i]}return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):""}function h(e,n,t){if(e===void 0)return null;if(typeof e=="string")return e||null;if("value"in e)return E(n,e.value)||null;const i={};for(const[r,o]of Object.entries(e.params??{}))i[r]=E(n,o);const a=t(e.key,i);return a===e.key?null:a}function V(e,n){if(!e||typeof e=="string"||"value"in e)return null;const t={};for(const[i,a]of Object.entries(e.params??{}))t[i]=E(n,a);return{key:e.key,params:t}}const _e=e=>e;function R(e){const n=c[e];return{type:e,shape:n.shape,channelKind:n.channelKind,icon:n.icon,replyable:n.replyable===!0,countsAs:n.countsAs,carriesText:n.carriesText===!0,triggerable:n.triggerable===!0,component:n.component,builtIn:!0,displayNameKey:n.displayNameKey}}function D(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 B{constructor(n=[],t=_e){this.translate=t;for(const i of n)i?.type&&(i.type in c||this.declared.has(i.type)||this.declared.set(i.type,i))}declared=new Map;get(n){if(n in c)return R(n);const t=this.declared.get(n);return t?D(t):void 0}triggerable(){const n=Object.keys(c).filter(i=>c[i].triggerable).map(R),t=[...this.declared.values()].map(D).filter(i=>i.triggerable);return[...n,...t]}timelineText(n,t){const i=c[n.type];if(i?.timeline)return i.timeline(n,t);const a=this.declared.get(n.type);return h(a?.text,n,this.translate)??n.type.replace(/_/g," ").toLowerCase()}snippet(n){const t=c[n.type];if(t?.snippet)return t.snippet(n);const i=this.declared.get(n.type);return h(i?.text,n,this.translate)??""}descriptor(n){return this.declared.get(n)}blocks(n){const t=this.declared.get(n)?.render;return t?.length?t:void 0}get translator(){return this.translate}}const Ie=new B,L=140;function Te(e){const n=e.trim();return n.length<=L?n:n.slice(0,L-1).trimEnd()+"…"}function Se(e,n){const t=V(n?.text,e),i=n?h(n.text,e,a=>a):null;return{activityId:e.id,type:e.type,snippet:Te(i??w(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...t?{snippetKey:t.key,snippetParams:t.params}:{}}}function Me(e,n,t=[]){const i=e.createdAt;if(!i)return[];const a=new Set(t);return e.author.type==="user"&&e.author.id&&a.add(e.author.id),Object.entries(n).filter(([r,o])=>o>=i&&!a.has(r)).map(([r])=>r)}function Ne(e){return e.createdAt??0}const ve=[{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 Ce(e){const n=[];for(const t of Object.keys(e))for(const i of Object.keys(e[t]))n.push({lang:t,key:i,value:e[t][i]});return n}function I(e){return e<10?`0${e}`:`${e}`}function H(e,n){const t=new Date(e),i=`${t.getUTCFullYear()}-${I(t.getUTCMonth()+1)}-${I(t.getUTCDate())}`;return n==="day"?i:`${i}T${I(t.getUTCHours())}`}function j(e,n){const t=new Date(e);return t.setUTCMinutes(0,0,0),n==="day"&&t.setUTCHours(0),t.getTime()}const Oe=36e5,Re=864e5;function De(e,n,t){const i=t==="hour"?Oe:Re,a=[];for(let r=j(e,t);r<=n;r+=i)a.push(H(r,t));return a}const F=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],W=F.map(e=>e.id);function Y(e,n){return`${e}.usage.${n}`}function Le(e,n){return n.map(t=>({id:Y(e,t.unit),label:t.label,category:"Verbruik",valueType:t.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...W,...t.extraDimensions??[],"time"]}))}function ke(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const Ue=[{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"}],$e={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function z(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function xe(e){if(typeof e!="string")return;const n=e.trim();if(n==="org")return{kind:"org"};const t=n.indexOf(":");if(t<=0)return;const i=n.slice(0,t),a=n.slice(t+1).trim();if(a){if(i==="user")return{kind:"user",userId:a};if(i==="team")return{kind:"team",teamId:a}}}function X(e){return z(e)}function Pe(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 Ge(e){return X(e)}const q=["done","escalated","failed","timed_out","stopped"],J=["awaiting_approval","awaiting_reply"];function Q(e){return q.includes(e)}function Ke(e){return Q(e)}function we(e){return J.includes(e)}const M=[{id:"openai",label:"OpenAI",capabilities:["chat","transcription","embedding"],defaultModel:"gpt-5-mini",baseUrl:"https://api.openai.com/v1"},{id:"gemini",label:"Google Gemini",capabilities:["chat","transcription","embedding"],defaultModel:"gemini-3.5-flash",baseUrl:"https://generativelanguage.googleapis.com/v1beta"},{id:"anthropic",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 y(e){return M.find(n=>n.id===e)}function Ve(e){return y(e)?.label??e}function Be(e,n="gpt-5-mini"){return y(e)?.defaultModel??n}function He(e){return M.filter(n=>n.capabilities.includes(e))}function je(e){const n=y(e);return!!n&&!n.baseUrl}const Fe=new Set(["mail","message"]);function Z(e,n){const t=e.settings?.signatures?.[n];return!t||!t.enabled||!t.body||t.body.trim()===""?null:t}function We(e,n,t,i="html"){if(!e)return t;const a=Z(e,n);return a?`${t}${i==="text"?`
2
2
 
3
- `:t==="mail"?"<br><br>-- <br>":"<br><br>"}${a.body}`:n}function Ye(e){return e.endpoints??[]}const Xe=e=>!!e.assignedUserId||!!e.assignedInboxId,ze=e=>e.status==="closed",qe=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,Je=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function Qe(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const Ze=2e3,et=500,tt=12e3,nt=4e3,ee=["contact","company"];function it(e){if(!e)return!1;const t=e.slice(0,e.indexOf(":"));return ee.includes(t)}const A={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}},te="NL",at=15,rt=8,ot=Array.from(new Set(Object.values(A).map(e=>e.callingCode))).sort((e,t)=>t.length-e.length);function k(e){if(e)return A[e.trim().toUpperCase()]}function g(e,t){return e.length>=t.nsnMin&&e.length<=t.nsnMax}function U(e){if(e.length>at)return null;for(const t of ot){if(!e.startsWith(t))continue;const n=e.slice(t.length);for(const i of Object.values(A)){if(i.callingCode!==t)continue;const a=i.trunkPrefix,r=a&&n.startsWith(a)?n.slice(a.length):n;if(g(r,i))return`+${t}${r}`}return null}return e.length<rt?null:`+${e}`}function st(e){let t=e.trim();const n=t.match(/^(sips?|tel|whatsapp):/i);n&&(t=t.slice(n[0].length));const i=t.indexOf("@");return i>=0&&(t=t.slice(0,i)),t.trim()}function lt(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 S(e,t){if(!e)return null;const n=st(e);if(!n)return null;const i=n.startsWith("+"),a=n.replace(/\D/g,"");if(!a)return null;if(i)return U(a);if(a.startsWith("00"))return U(a.slice(2));const r=k(t)??k(te);if(!r)return null;const o=r.trunkPrefix;if(o&&a.startsWith(o)){const l=a.slice(o.length);return g(l,r)?`+${r.callingCode}${l}`:null}if(a.startsWith(r.callingCode)){const l=a.slice(r.callingCode.length);if(g(l,r))return`+${r.callingCode}${l}`}return!o&&g(a,r)?`+${r.callingCode}${a}`:null}function ct(e,t=9){const n=(e??"").replace(/\D/g,"");return n.length<t?null:n.slice(-t)}function N(e){if(!e)return null;const t=e.trim().toLowerCase(),n=t.lastIndexOf("@");if(n<=0||n===t.length-1)return null;const i=t.slice(0,n).split("+")[0],a=t.slice(n+1);return!i||!a.includes(".")?null:`${i}@${a}`}function ut(e){const t=N(e);return t?t.slice(t.lastIndexOf("@")+1):null}const pt=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function ne(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 pt.has(n)&&t.length>=3?t.slice(-3).join("."):n}const ie=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 dt(e){const t=ne(e);return t?ie.has(t):!1}function mt(e){if(!e)return!1;const t=e.trim().toLowerCase();return t==="tel"||t==="sms"||t==="whatsapp"||t==="fax"}function ft(e,t,n){if(!e||!t)return null;const i=e.trim().toLowerCase();if(i==="tel"||i==="sms"||i==="whatsapp"){const r=S(t,n);return r?`tel:${r}`:null}if(i==="fax"){const r=S(t,n);return r?`fax:${r}`:null}if(i==="mailto"||i==="email"){const r=N(t);return r?`mailto:${r}`:null}const a=t.trim().toLowerCase();return a?`${i}:${a}`:null}const gt=[/<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],x=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,Et=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function ht(e){const t=e.split(`
4
- `);for(let n=0;n<t.length;n++)if(Et.test(t[n])||x.test(t[n])&&t.slice(n+1,n+4).some(i=>x.test(i)))return t.slice(0,n).join(`
5
- `).trim();return e}function $(e){let t=e;return t=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),t=t.replace(/<br\s*\/?>/gi,`
6
- `),t=t.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi,`
7
- `),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function P(e){return e.replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#39;/gi,"'").replace(/&#(\d+);/g,(t,n)=>String.fromCharCode(Number(n))).replace(/&amp;/gi,"&")}function G(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
3
+ `:n==="mail"?"<br><br>-- <br>":"<br><br>"}${a.body}`:t}function Ye(e){return e.endpoints??[]}const ze=e=>!!e.assignedUserId||!!e.assignedInboxId,Xe=e=>e.status==="closed",qe=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,Je=(e,n=30)=>e.title?.length<=n?e.title:`${e.title.substring(0,n)}...`;function Qe(e,n){return e.lastActivityAt?!(e.seenBy??[]).includes(n):!1}const Ze=2e3,en=500,nn=12e3,tn=4e3,ee=["contact","company"];function an(e){if(!e)return!1;const n=e.slice(0,e.indexOf(":"));return ee.includes(n)}const A={NL:{callingCode:"31",trunkPrefix:"0",nsnMin:7,nsnMax:9},BE:{callingCode:"32",trunkPrefix:"0",nsnMin:8,nsnMax:9},LU:{callingCode:"352",nsnMin:6,nsnMax:9},DE:{callingCode:"49",trunkPrefix:"0",nsnMin:6,nsnMax:13},FR:{callingCode:"33",trunkPrefix:"0",nsnMin:9,nsnMax:9},GB:{callingCode:"44",trunkPrefix:"0",nsnMin:9,nsnMax:10},IE:{callingCode:"353",trunkPrefix:"0",nsnMin:7,nsnMax:9},ES:{callingCode:"34",nsnMin:9,nsnMax:9},PT:{callingCode:"351",nsnMin:9,nsnMax:9},IT:{callingCode:"39",nsnMin:6,nsnMax:11},AT:{callingCode:"43",trunkPrefix:"0",nsnMin:7,nsnMax:13},CH:{callingCode:"41",trunkPrefix:"0",nsnMin:9,nsnMax:9},DK:{callingCode:"45",nsnMin:8,nsnMax:8},SE:{callingCode:"46",trunkPrefix:"0",nsnMin:7,nsnMax:13},NO:{callingCode:"47",nsnMin:8,nsnMax:8},FI:{callingCode:"358",trunkPrefix:"0",nsnMin:5,nsnMax:12},PL:{callingCode:"48",nsnMin:9,nsnMax:9},US:{callingCode:"1",nsnMin:10,nsnMax:10},CA:{callingCode:"1",nsnMin:10,nsnMax:10}},ne="NL",rn=15,on=8,sn=Array.from(new Set(Object.values(A).map(e=>e.callingCode))).sort((e,n)=>n.length-e.length);function k(e){if(e)return A[e.trim().toUpperCase()]}function g(e,n){return e.length>=n.nsnMin&&e.length<=n.nsnMax}function U(e){if(e.length>rn)return null;for(const n of sn){if(!e.startsWith(n))continue;const t=e.slice(n.length);for(const i of Object.values(A)){if(i.callingCode!==n)continue;const a=i.trunkPrefix,r=a&&t.startsWith(a)?t.slice(a.length):t;if(g(r,i))return`+${n}${r}`}return null}return e.length<on?null:`+${e}`}function ln(e){let n=e.trim();const t=n.match(/^(sips?|tel|whatsapp):/i);t&&(n=n.slice(t[0].length));const i=n.indexOf("@");return i>=0&&(n=n.slice(0,i)),n.trim()}function cn(e){if(!e)return!1;const n=e.indexOf("@");if(n<=0)return!1;const t=e.slice(0,n).trim();return!/^[+\d\s().-]+$/.test(t)}function S(e,n){if(!e)return null;const t=ln(e);if(!t)return null;const i=t.startsWith("+"),a=t.replace(/\D/g,"");if(!a)return null;if(i)return U(a);if(a.startsWith("00"))return U(a.slice(2));const r=k(n)??k(ne);if(!r)return null;const o=r.trunkPrefix;if(o&&a.startsWith(o)){const l=a.slice(o.length);return g(l,r)?`+${r.callingCode}${l}`:null}if(a.startsWith(r.callingCode)){const l=a.slice(r.callingCode.length);if(g(l,r))return`+${r.callingCode}${l}`}return!o&&g(a,r)?`+${r.callingCode}${a}`:null}function pn(e,n=9){const t=(e??"").replace(/\D/g,"");return t.length<n?null:t.slice(-n)}function N(e){if(!e)return null;const n=e.trim().toLowerCase(),t=n.lastIndexOf("@");if(t<=0||t===n.length-1)return null;const i=n.slice(0,t).split("+")[0],a=n.slice(t+1);return!i||!a.includes(".")?null:`${i}@${a}`}function un(e){const n=N(e);return n?n.slice(n.lastIndexOf("@")+1):null}const dn=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function te(e){if(!e)return null;const n=e.trim().toLowerCase().replace(/\.$/,"").split(".").filter(Boolean);if(n.length<2)return null;const t=n.slice(-2).join(".");return dn.has(t)&&n.length>=3?n.slice(-3).join("."):t}const ie=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 mn(e){const n=te(e);return n?ie.has(n):!1}function fn(e){if(!e)return!1;const n=e.trim().toLowerCase();return n==="tel"||n==="sms"||n==="whatsapp"||n==="fax"}function gn(e,n,t){if(!e||!n)return null;const i=e.trim().toLowerCase();if(i==="tel"||i==="sms"||i==="whatsapp"){const r=S(n,t);return r?`tel:${r}`:null}if(i==="fax"){const r=S(n,t);return r?`fax:${r}`:null}if(i==="mailto"||i==="email"){const r=N(n);return r?`mailto:${r}`:null}const a=n.trim().toLowerCase();return a?`${i}:${a}`:null}const En=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,hn=/(\*|_)(?=\S)([^*_\n]*?\S)\1/g;function yn(e){if(typeof e!="string"||!e)return"";let n=e;return n=n.replace(/```[a-z]*\n?/gi,"").replace(/~~~[a-z]*\n?/gi,""),n=n.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1"),n=n.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1"),n=n.replace(/\[([^\]]*)\]\[[^\]]*\]/g,"$1"),n=n.replace(/<((?:https?|mailto):[^>\s]+)>/gi,"$1"),n=n.split(`
4
+ `).map(t=>t.replace(/^\s{0,3}#{1,6}\s+/,"").replace(/^\s{0,3}>\s?/,"").replace(/^\s*[-*+]\s+/,"").replace(/^\s*\d+[.)]\s+/,"").replace(/^\s*(?:[-*_]\s*){3,}$/,"")).join(`
5
+ `),n=n.replace(En,"$2"),n=n.replace(hn,"$2"),n=n.replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1"),n=n.replace(/`([^`\n]+)`/g,"$1"),n.replace(/\s+/g," ").trim()}const An=[/<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],$=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,bn=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function _n(e){const n=e.split(`
6
+ `);for(let t=0;t<n.length;t++)if(bn.test(n[t])||$.test(n[t])&&n.slice(t+1,t+4).some(i=>$.test(i)))return n.slice(0,t).join(`
7
+ `).trim();return e}function x(e){let n=e;return n=n.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),n=n.replace(/<br\s*\/?>/gi,`
8
+ `),n=n.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi,`
9
+ `),n=n.replace(/<[^>]+>/g,""),n=n.replace(/<[^>]*$/,""),n}function P(e){return e.replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#39;/gi,"'").replace(/&#(\d+);/g,(n,t)=>String.fromCharCode(Number(t))).replace(/&amp;/gi,"&")}function G(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
8
10
  `).replace(/\n{3,}/g,`
9
11
 
10
- `).trim()}function yt(e){if(typeof e!="string"||!e)return"";let t=e.length;for(const r of gt){const o=e.search(r);o>=0&&o<t&&(t=o)}const n=e.slice(0,t);let i=G(P($(n)));return i||(i=G(P($(e)))),ht(i)||i}const At=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,bt=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function It(e,t){return!!(e&&At.test(e)||t&&bt.test(t))}const ae=3,re=600;function _t(e,t){return e>=ae||t>=re}function oe(e,t){const n=new Set(e.disabledIntents??[]),i=e.intentOverrides??{},a=t.intents.filter(o=>!n.has(o.intent)).map(o=>St(o,i[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return a;const r=new Set(a.map(o=>o.intent));for(const o of e.extraIntents)r.has(o.intent)||(a.push(o),r.add(o.intent));return a}function se(e,t){const n={};for(const i of e.intents){if(!i.togglable)continue;const a=t?.[i.intent];n[i.intent]=a??i.defaultEnabled??!0}return n}function Tt(e,t){const n=se(e,t);return Object.entries(n).filter(([,i])=>!i).map(([i])=>i)}function St(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function Mt(e,t){const n=[];for(const i of e){if(!i.enabled)continue;const a=t[i.providerId];if(a)for(const r of oe(i,a))n.push({channel:i,description:a,capability:r})}return n}function Nt(e,t){return t.filter(n=>n.capability.intent===e)}function le(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function vt(e,t){return le(e.scheme,t)}function Ct(e,t,n){const i=[];for(const a of e)for(const r of n)r.capability.intent===t&&r.capability.targetSchemes.includes(a.scheme)&&i.push({channelIntent:r,endpoint:a});return i}var ce=(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))(ce||{});const Ot="message_window",Rt="message_templates",Dt={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},Lt=(e,t)=>({intent:e,...t}),kt="folder_management",Ut="remote_search",xt={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},$t=9e4,Pt="installation-id";exports.ACTIVITY_CATALOG=c;exports.AI_VENDORS=M;exports.ActivityTypeRegistry=B;exports.BUILT_IN_ONLY=_e;exports.CLASSIFY_VARS=xe;exports.CORE_DIMENSIONS=ve;exports.CommunicationScheme=ce;exports.DEFAULT_MEMORY_BUDGET=nt;exports.DEFAULT_PHONE_REGION=te;exports.FEATURE_FOLDER_MANAGEMENT=kt;exports.FEATURE_REMOTE_SEARCH=Ut;exports.INSTALLATION_HEADER=Pt;exports.InteractionParticipantRole=Dt;exports.MAX_ACTIONS=f;exports.MAX_BLOCKS=T;exports.MAX_FIELDS=d;exports.MAX_LIST_ITEMS=m;exports.MAX_MEMORY_BUDGET=tt;exports.MAX_MEMORY_CHARS=Ze;exports.MIN_MEMORY_BUDGET=et;exports.PAUSED_RUN_STATUSES=J;exports.PHONE_REGIONS=A;exports.PRESENCE_ONLINE_WINDOW_MS=$t;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=Rt;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=Ot;exports.PUBLIC_EMAIL_DOMAINS=ie;exports.RELATED_SUBJECT_KINDS=ee;exports.SIGNATURE_INTENTS=Fe;exports.SUMMARY_MIN_LAST_CHARS=re;exports.SUMMARY_MIN_MESSAGES=ae;exports.TERMINAL_RUN_STATUSES=q;exports.TRIGGER_VARS=Ue;exports.UNSUPPORTED=xt;exports.USAGE_DIMENSIONS=F;exports.USAGE_DIMENSION_IDS=W;exports.actingIdentityKey=z;exports.activityIconOf=de;exports.activityJoinUrl=be;exports.activitySnippet=w;exports.activityTextParams=V;exports.activityTimelineText=Ae;exports.activityTimestamp=Ne;exports.activityTypeInfo=s;exports.actorKey=Ge;exports.aiVendorDefaultModel=Be;exports.aiVendorLabel=Ve;exports.aiVendorNeedsBaseUrl=je;exports.aiVendorsWith=He;exports.applySignature=We;exports.buildActivityPreview=Se;exports.buildChannelIntents=Mt;exports.carriesText=Ee;exports.channelKindOf=me;exports.cleanMessageText=yt;exports.defineIntent=Lt;exports.disabledIntentsFromCapabilities=Tt;exports.emailDomain=ut;exports.endpointKey=ft;exports.filterByEndpoint=vt;exports.filterByIntent=Nt;exports.filterByTargetScheme=le;exports.findAiVendor=y;exports.flattenLocales=Ce;exports.floorToPeriod=j;exports.formatActingIdentity=X;exports.formatPeriod=H;exports.getActivitySeenUserIds=Me;exports.getContactEndpoints=Ye;exports.getShortTitle=Je;exports.getUrgencyScore=qe;exports.humanizeAction=ke;exports.isAssigned=Xe;exports.isClosed=ze;exports.isInteractionUnseen=Qe;exports.isLikelyBulk=It;exports.isMessageType=fe;exports.isPaused=we;exports.isPlaybookAuthoredType=ye;exports.isPublicEmailDomain=dt;exports.isReplyableType=ge;exports.isRetryable=Ke;exports.isTerminal=Q;exports.isThreadLongEnough=_t;exports.looksLikeEmail=lt;exports.matchContactToIntents=Ct;exports.messageCountsAs=he;exports.needsPhoneRegion=mt;exports.normalizeBlocks=pe;exports.normalizeEmail=N;exports.parseActingIdentity=$e;exports.periodsInRange=De;exports.phoneSuffix=ct;exports.playbookActor=Pe;exports.readPath=E;exports.registrableDomain=ne;exports.relatedByDefault=it;exports.resolveAccountCapabilities=se;exports.resolveActivityText=h;exports.resolveChannelIntents=oe;exports.resolveSignature=Z;exports.stripHtml=K;exports.toE164=S;exports.usageMetricId=Y;exports.usageMetrics=Le;
12
+ `).trim()}function In(e){if(typeof e!="string"||!e)return"";let n=e.length;for(const r of An){const o=e.search(r);o>=0&&o<n&&(n=o)}const t=e.slice(0,n);let i=G(P(x(t)));return i||(i=G(P(x(e)))),_n(i)||i}const Tn=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,Sn=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function Mn(e,n){return!!(e&&Tn.test(e)||n&&Sn.test(n))}const ae=3,re=600;function Nn(e,n){return e>=ae||n>=re}function oe(e,n){const t=new Set(e.disabledIntents??[]),i=e.intentOverrides??{},a=n.intents.filter(o=>!t.has(o.intent)).map(o=>Cn(o,i[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return a;const r=new Set(a.map(o=>o.intent));for(const o of e.extraIntents)r.has(o.intent)||(a.push(o),r.add(o.intent));return a}function se(e,n){const t={};for(const i of e.intents){if(!i.togglable)continue;const a=n?.[i.intent];t[i.intent]=a??i.defaultEnabled??!0}return t}function vn(e,n){const t=se(e,n);return Object.entries(t).filter(([,i])=>!i).map(([i])=>i)}function Cn(e,n){return n?{intent:n.intent??e.intent,targetSchemes:n.targetSchemes??e.targetSchemes,transport:n.transport??e.transport}:e}function On(e,n){const t=[];for(const i of e){if(!i.enabled)continue;const a=n[i.providerId];if(a)for(const r of oe(i,a))t.push({channel:i,description:a,capability:r})}return t}function Rn(e,n){return n.filter(t=>t.capability.intent===e)}function le(e,n){return n.filter(t=>t.capability.targetSchemes.includes(e))}function Dn(e,n){return le(e.scheme,n)}function Ln(e,n,t){const i=[];for(const a of e)for(const r of t)r.capability.intent===n&&r.capability.targetSchemes.includes(a.scheme)&&i.push({channelIntent:r,endpoint:a});return i}var ce=(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))(ce||{});const kn="message_window",Un="message_templates",$n={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},xn=(e,n)=>({intent:e,...n}),Pn="folder_management",Gn="remote_search",Kn={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},wn=9e4,Vn="installation-id";exports.ACTIVITY_CATALOG=c;exports.AI_VENDORS=M;exports.ActivityTypeRegistry=B;exports.BUILT_IN_ONLY=Ie;exports.CLASSIFY_VARS=$e;exports.CORE_DIMENSIONS=ve;exports.CommunicationScheme=ce;exports.DEFAULT_MEMORY_BUDGET=tn;exports.DEFAULT_PHONE_REGION=ne;exports.FEATURE_FOLDER_MANAGEMENT=Pn;exports.FEATURE_REMOTE_SEARCH=Gn;exports.INSTALLATION_HEADER=Vn;exports.InteractionParticipantRole=$n;exports.MAX_ACTIONS=f;exports.MAX_BLOCKS=T;exports.MAX_FIELDS=d;exports.MAX_LIST_ITEMS=m;exports.MAX_MEMORY_BUDGET=nn;exports.MAX_MEMORY_CHARS=Ze;exports.MIN_MEMORY_BUDGET=en;exports.PAUSED_RUN_STATUSES=J;exports.PHONE_REGIONS=A;exports.PRESENCE_ONLINE_WINDOW_MS=wn;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=Un;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=kn;exports.PUBLIC_EMAIL_DOMAINS=ie;exports.RELATED_SUBJECT_KINDS=ee;exports.SIGNATURE_INTENTS=Fe;exports.SUMMARY_MIN_LAST_CHARS=re;exports.SUMMARY_MIN_MESSAGES=ae;exports.TERMINAL_RUN_STATUSES=q;exports.TRIGGER_VARS=Ue;exports.UNSUPPORTED=Kn;exports.USAGE_DIMENSIONS=F;exports.USAGE_DIMENSION_IDS=W;exports.actingIdentityKey=X;exports.activityIconOf=de;exports.activityJoinUrl=be;exports.activitySnippet=w;exports.activityTextParams=V;exports.activityTimelineText=Ae;exports.activityTimestamp=Ne;exports.activityTypeInfo=s;exports.actorKey=Ge;exports.aiVendorDefaultModel=Be;exports.aiVendorLabel=Ve;exports.aiVendorNeedsBaseUrl=je;exports.aiVendorsWith=He;exports.applySignature=We;exports.buildActivityPreview=Se;exports.buildChannelIntents=On;exports.carriesText=Ee;exports.channelKindOf=me;exports.cleanMessageText=In;exports.defineIntent=xn;exports.disabledIntentsFromCapabilities=vn;exports.emailDomain=un;exports.endpointKey=gn;exports.filterByEndpoint=Dn;exports.filterByIntent=Rn;exports.filterByTargetScheme=le;exports.findAiVendor=y;exports.flattenLocales=Ce;exports.floorToPeriod=j;exports.formatActingIdentity=z;exports.formatPeriod=H;exports.getActivitySeenUserIds=Me;exports.getContactEndpoints=Ye;exports.getShortTitle=Je;exports.getUrgencyScore=qe;exports.humanizeAction=ke;exports.isAssigned=ze;exports.isClosed=Xe;exports.isInteractionUnseen=Qe;exports.isLikelyBulk=Mn;exports.isMessageType=fe;exports.isPaused=we;exports.isPlaybookAuthoredType=ye;exports.isPublicEmailDomain=mn;exports.isReplyableType=ge;exports.isRetryable=Ke;exports.isTerminal=Q;exports.isThreadLongEnough=Nn;exports.looksLikeEmail=cn;exports.matchContactToIntents=Ln;exports.messageCountsAs=he;exports.needsPhoneRegion=fn;exports.normalizeBlocks=ue;exports.normalizeEmail=N;exports.parseActingIdentity=xe;exports.periodsInRange=De;exports.phoneSuffix=pn;exports.plainTextFromMarkdown=yn;exports.playbookActor=Pe;exports.readPath=E;exports.registrableDomain=te;exports.relatedByDefault=an;exports.resolveAccountCapabilities=se;exports.resolveActivityText=h;exports.resolveChannelIntents=oe;exports.resolveSignature=Z;exports.stripHtml=K;exports.toE164=S;exports.usageMetricId=Y;exports.usageMetrics=Le;
package/dist/index.d.ts CHANGED
@@ -32,6 +32,7 @@ export * from './entities/transcript';
32
32
  export * from './entities/user';
33
33
  export * from './entities/webhook';
34
34
  export * from './text/endpoint';
35
+ export * from './text/markdown';
35
36
  export * from './text/message';
36
37
  export * from './text/triage';
37
38
  export * from './platform/ai-tools';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const _e = 10, Te = 10, Me = 10, Se = 5, x = /* @__PURE__ */ new Set([
1
+ const Se = 10, Me = 10, Ce = 10, ve = 5, x = /* @__PURE__ */ new Set([
2
2
  "header",
3
3
  "section",
4
4
  "context",
@@ -14,7 +14,7 @@ function m(e) {
14
14
  const n = e;
15
15
  return typeof n.key == "string" || typeof n.value == "string";
16
16
  }
17
- function Ce(e, n = () => {
17
+ function Ne(e, n = () => {
18
18
  }) {
19
19
  if (!Array.isArray(e)) return [];
20
20
  const t = [];
@@ -72,7 +72,7 @@ function Ce(e, n = () => {
72
72
  function U(e) {
73
73
  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();
74
74
  }
75
- function u(e) {
75
+ function p(e) {
76
76
  if (!e || e < 0) return "";
77
77
  const n = Math.floor(e / 60), t = Math.floor(e % 60);
78
78
  return `${n}:${t.toString().padStart(2, "0")}`;
@@ -83,10 +83,10 @@ function A(e) {
83
83
  function f(e) {
84
84
  return e?.split("@")?.[0] || e || "";
85
85
  }
86
- function p(e) {
86
+ function u(e) {
87
87
  return e.map((n) => n.name).join(", ");
88
88
  }
89
- function I(e) {
89
+ function _(e) {
90
90
  return e === "meeting" ? "Meeting" : e === "video" ? "Video call" : "Audio call";
91
91
  }
92
92
  const c = {
@@ -122,7 +122,7 @@ const c = {
122
122
  shape: "event",
123
123
  channelKind: "voice",
124
124
  icon: "phone",
125
- snippet: (e) => `Gesprek beëindigd${e.payload.duration ? ` (${u(e.payload.duration)})` : ""}`,
125
+ snippet: (e) => `Gesprek beëindigd${e.payload.duration ? ` (${p(e.payload.duration)})` : ""}`,
126
126
  timeline: (e) => `Call ended${A(e.payload.duration)}`
127
127
  },
128
128
  VOICE_CALL_MISSED: {
@@ -176,7 +176,7 @@ const c = {
176
176
  shape: "event",
177
177
  channelKind: "video",
178
178
  icon: "video",
179
- snippet: (e) => `Gesprek beëindigd${e.payload.duration ? ` (${u(e.payload.duration)})` : ""}`,
179
+ snippet: (e) => `Gesprek beëindigd${e.payload.duration ? ` (${p(e.payload.duration)})` : ""}`,
180
180
  timeline: () => "Video call ended"
181
181
  },
182
182
  VIDEO_CALL_MISSED: {
@@ -204,7 +204,7 @@ const c = {
204
204
  replyable: !0,
205
205
  carriesText: !0,
206
206
  countsAs: "inbound_message",
207
- snippet: _
207
+ snippet: I
208
208
  },
209
209
  EMAIL_SENT: {
210
210
  shape: "message",
@@ -214,7 +214,7 @@ const c = {
214
214
  replyable: !0,
215
215
  carriesText: !0,
216
216
  countsAs: "outbound_message",
217
- snippet: _
217
+ snippet: I
218
218
  },
219
219
  /* ---- chat ---- */
220
220
  CHAT_MESSAGE_SENT: {
@@ -243,9 +243,9 @@ const c = {
243
243
  shape: "event",
244
244
  channelKind: "chat",
245
245
  icon: "message-circle",
246
- snippet: (e) => `${p(e.payload.members)} toegevoegd`,
246
+ snippet: (e) => `${u(e.payload.members)} toegevoegd`,
247
247
  timeline: (e) => {
248
- const n = p(e.payload.members) || "Someone", t = e.payload.initiator?.name ? ` · added by ${e.payload.initiator.name}` : "";
248
+ const n = u(e.payload.members) || "Someone", t = e.payload.initiator?.name ? ` · added by ${e.payload.initiator.name}` : "";
249
249
  return `${n} joined the chat${t}`;
250
250
  }
251
251
  },
@@ -253,9 +253,9 @@ const c = {
253
253
  shape: "event",
254
254
  channelKind: "chat",
255
255
  icon: "message-circle",
256
- snippet: (e) => `${p(e.payload.members)} verlaten`,
256
+ snippet: (e) => `${u(e.payload.members)} verlaten`,
257
257
  timeline: (e) => {
258
- const n = p(e.payload.members) || "Someone", t = e.payload.initiator?.name ? ` · removed by ${e.payload.initiator.name}` : "";
258
+ const n = u(e.payload.members) || "Someone", t = e.payload.initiator?.name ? ` · removed by ${e.payload.initiator.name}` : "";
259
259
  return `${n} left the chat${t}`;
260
260
  }
261
261
  },
@@ -271,15 +271,15 @@ const c = {
271
271
  channelKind: "chat",
272
272
  icon: "message-circle",
273
273
  snippet: () => "Gesprek gestart",
274
- timeline: (e) => `${I(e.payload.callType)} started${e.payload.initiator ? ` by ${e.payload.initiator.name}` : ""}`,
274
+ timeline: (e) => `${_(e.payload.callType)} started${e.payload.initiator ? ` by ${e.payload.initiator.name}` : ""}`,
275
275
  joinUrl: (e) => e.payload.joinUrl
276
276
  },
277
277
  CHAT_CALL_ENDED: {
278
278
  shape: "event",
279
279
  channelKind: "chat",
280
280
  icon: "message-circle",
281
- snippet: (e) => `Gesprek beëindigd${e.payload.duration ? ` (${u(e.payload.duration)})` : ""}`,
282
- timeline: (e) => `${I(e.payload.callType)} ended${A(e.payload.duration)}`,
281
+ snippet: (e) => `Gesprek beëindigd${e.payload.duration ? ` (${p(e.payload.duration)})` : ""}`,
282
+ timeline: (e) => `${_(e.payload.callType)} ended${A(e.payload.duration)}`,
283
283
  joinUrl: (e) => e.payload.joinUrl
284
284
  },
285
285
  CHAT_EVENT: {
@@ -367,7 +367,7 @@ const c = {
367
367
  MEETING_ENDED: {
368
368
  shape: "event",
369
369
  icon: "calendar",
370
- snippet: (e) => `Vergadering beëindigd${e.payload.duration ? ` (${u(e.payload.duration)})` : ""}`,
370
+ snippet: (e) => `Vergadering beëindigd${e.payload.duration ? ` (${p(e.payload.duration)})` : ""}`,
371
371
  timeline: () => "Meeting ended"
372
372
  },
373
373
  MEETING_PARTICIPANT_JOINED: {
@@ -404,44 +404,44 @@ const c = {
404
404
  timeline: (e, n) => `Assigned by ${n}`
405
405
  }
406
406
  };
407
- function _(e) {
407
+ function I(e) {
408
408
  const n = e.payload, t = n.bodySnippet?.trim() || U(n.body ?? "");
409
409
  return n.subject ? `${n.subject} — ${t}` : t;
410
410
  }
411
411
  function l(e) {
412
412
  return c[e];
413
413
  }
414
- function ve(e) {
414
+ function Oe(e) {
415
415
  return l(e)?.icon ?? "circle";
416
416
  }
417
- function Ne(e) {
417
+ function ke(e) {
418
418
  return l(e)?.channelKind;
419
419
  }
420
- function Oe(e) {
420
+ function De(e) {
421
421
  const n = l(e)?.shape;
422
422
  return n === "message" || n === "note";
423
423
  }
424
- function ke(e) {
424
+ function Le(e) {
425
425
  return l(e)?.replyable === !0;
426
426
  }
427
- function De(e) {
427
+ function $e(e) {
428
428
  return l(e)?.carriesText === !0;
429
429
  }
430
- function Le(e) {
430
+ function Re(e) {
431
431
  return l(e)?.countsAs;
432
432
  }
433
- function Re(e) {
433
+ function xe(e) {
434
434
  return l(e)?.playbookAuthored === !0;
435
435
  }
436
436
  function P(e) {
437
437
  const n = l(e.type)?.snippet;
438
438
  return n ? n(e) : "";
439
439
  }
440
- function $e(e, n) {
440
+ function Ue(e, n) {
441
441
  const t = l(e.type)?.timeline;
442
442
  return t ? t(e, n) : e.type.replace(/_/g, " ").toLowerCase();
443
443
  }
444
- function xe(e) {
444
+ function Pe(e) {
445
445
  const n = l(e.type)?.joinUrl;
446
446
  return n ? n(e) : void 0;
447
447
  }
@@ -488,7 +488,7 @@ function T(e) {
488
488
  displayNameKey: n.displayNameKey
489
489
  };
490
490
  }
491
- function M(e) {
491
+ function S(e) {
492
492
  return {
493
493
  type: e.type,
494
494
  shape: e.shape,
@@ -513,11 +513,11 @@ class G {
513
513
  get(n) {
514
514
  if (n in c) return T(n);
515
515
  const t = this.declared.get(n);
516
- return t ? M(t) : void 0;
516
+ return t ? S(t) : void 0;
517
517
  }
518
518
  /** Alles wat als trigger aangeboden mag worden, ingebouwd en gedeclareerd. */
519
519
  triggerable() {
520
- const n = Object.keys(c).filter((i) => c[i].triggerable).map(T), t = [...this.declared.values()].map(M).filter((i) => i.triggerable);
520
+ const n = Object.keys(c).filter((i) => c[i].triggerable).map(T), t = [...this.declared.values()].map(S).filter((i) => i.triggerable);
521
521
  return [...n, ...t];
522
522
  }
523
523
  /**
@@ -552,12 +552,12 @@ class G {
552
552
  return this.translate;
553
553
  }
554
554
  }
555
- const Ue = new G(), S = 140;
555
+ const we = new G(), M = 140;
556
556
  function V(e) {
557
557
  const n = e.trim();
558
- return n.length <= S ? n : n.slice(0, S - 1).trimEnd() + "…";
558
+ return n.length <= M ? n : n.slice(0, M - 1).trimEnd() + "…";
559
559
  }
560
- function Pe(e, n) {
560
+ function Ke(e, n) {
561
561
  const t = w(n?.text, e), i = n ? y(n.text, e, (a) => a) : null;
562
562
  return {
563
563
  activityId: e.id,
@@ -569,16 +569,16 @@ function Pe(e, n) {
569
569
  ...t ? { snippetKey: t.key, snippetParams: t.params } : {}
570
570
  };
571
571
  }
572
- function we(e, n, t = []) {
572
+ function Ge(e, n, t = []) {
573
573
  const i = e.createdAt;
574
574
  if (!i) return [];
575
575
  const a = new Set(t);
576
576
  return e.author.type === "user" && e.author.id && a.add(e.author.id), Object.entries(n).filter(([r, o]) => o >= i && !a.has(r)).map(([r]) => r);
577
577
  }
578
- function Ke(e) {
578
+ function Ve(e) {
579
579
  return e.createdAt ?? 0;
580
580
  }
581
- const Ge = [
581
+ const He = [
582
582
  { id: "agent", label: "Agent", labelSource: "user" },
583
583
  { id: "team", label: "Team", labelSource: "team" },
584
584
  { id: "inbox", label: "Inbox", labelSource: "inbox" },
@@ -588,7 +588,7 @@ const Ge = [
588
588
  { id: "handledBy", label: "Afhandelaar", labelSource: "raw" },
589
589
  { id: "time", label: "Tijd", labelSource: "raw" }
590
590
  ];
591
- function Ve(e) {
591
+ function je(e) {
592
592
  const n = [];
593
593
  for (const t of Object.keys(e))
594
594
  for (const i of Object.keys(e[t]))
@@ -602,14 +602,14 @@ function H(e, n) {
602
602
  const t = new Date(e), i = `${t.getUTCFullYear()}-${g(t.getUTCMonth() + 1)}-${g(t.getUTCDate())}`;
603
603
  return n === "day" ? i : `${i}T${g(t.getUTCHours())}`;
604
604
  }
605
- function B(e, n) {
605
+ function j(e, n) {
606
606
  const t = new Date(e);
607
607
  return t.setUTCMinutes(0, 0, 0), n === "day" && t.setUTCHours(0), t.getTime();
608
608
  }
609
- const j = 36e5, F = 864e5;
610
- function He(e, n, t) {
611
- const i = t === "hour" ? j : F, a = [];
612
- for (let r = B(e, t); r <= n; r += i)
609
+ const B = 36e5, F = 864e5;
610
+ function Be(e, n, t) {
611
+ const i = t === "hour" ? B : F, a = [];
612
+ for (let r = j(e, t); r <= n; r += i)
613
613
  a.push(H(r, t));
614
614
  return a;
615
615
  }
@@ -620,7 +620,7 @@ const X = [
620
620
  function Y(e, n) {
621
621
  return `${e}.usage.${n}`;
622
622
  }
623
- function Be(e, n) {
623
+ function Fe(e, n) {
624
624
  return n.map((t) => ({
625
625
  id: Y(e, t.unit),
626
626
  label: t.label,
@@ -635,10 +635,10 @@ function Be(e, n) {
635
635
  ]
636
636
  }));
637
637
  }
638
- function je(e) {
638
+ function Xe(e) {
639
639
  return (e.startsWith("tool:") ? e.slice(5) : e).replace(/__/g, " · ").replace(/\./g, " · ").replace(/_/g, " ");
640
640
  }
641
- const Fe = [
641
+ const We = [
642
642
  { name: "text", type: "string" },
643
643
  { name: "subject", type: "string" },
644
644
  { name: "from", type: "string" },
@@ -661,7 +661,7 @@ const Fe = [
661
661
  // een nieuw adres) — een stap die hierop leunt hoort dus een `condition` te hebben.
662
662
  { name: "contactId", type: "string" },
663
663
  { name: "companyId", type: "string" }
664
- ], Xe = {
664
+ ], Ye = {
665
665
  topics: [
666
666
  { name: "topic", type: "string" },
667
667
  { name: "confidence", type: "number" }
@@ -682,7 +682,7 @@ function z(e) {
682
682
  return "org";
683
683
  }
684
684
  }
685
- function We(e) {
685
+ function ze(e) {
686
686
  if (typeof e != "string") return;
687
687
  const n = e.trim();
688
688
  if (n === "org") return { kind: "org" };
@@ -697,7 +697,7 @@ function We(e) {
697
697
  function q(e) {
698
698
  return z(e);
699
699
  }
700
- function Ye(e) {
700
+ function qe(e) {
701
701
  switch (e.kind) {
702
702
  case "personal":
703
703
  return { kind: "user", userId: e.userId };
@@ -707,20 +707,20 @@ function Ye(e) {
707
707
  return { kind: "org" };
708
708
  }
709
709
  }
710
- function ze(e) {
710
+ function Je(e) {
711
711
  return q(e);
712
712
  }
713
713
  const J = ["done", "escalated", "failed", "timed_out", "stopped"], Q = ["awaiting_approval", "awaiting_reply"];
714
714
  function Z(e) {
715
715
  return J.includes(e);
716
716
  }
717
- function qe(e) {
717
+ function Qe(e) {
718
718
  return Z(e);
719
719
  }
720
- function Je(e) {
720
+ function Ze(e) {
721
721
  return Q.includes(e);
722
722
  }
723
- const R = [
723
+ const $ = [
724
724
  {
725
725
  id: "openai",
726
726
  label: "OpenAI",
@@ -809,47 +809,47 @@ const R = [
809
809
  }
810
810
  ];
811
811
  function E(e) {
812
- return R.find((n) => n.id === e);
812
+ return $.find((n) => n.id === e);
813
813
  }
814
- function Qe(e) {
814
+ function en(e) {
815
815
  return E(e)?.label ?? e;
816
816
  }
817
- function Ze(e, n = "gpt-5-mini") {
817
+ function nn(e, n = "gpt-5-mini") {
818
818
  return E(e)?.defaultModel ?? n;
819
819
  }
820
- function en(e) {
821
- return R.filter((n) => n.capabilities.includes(e));
820
+ function tn(e) {
821
+ return $.filter((n) => n.capabilities.includes(e));
822
822
  }
823
- function nn(e) {
823
+ function an(e) {
824
824
  const n = E(e);
825
825
  return !!n && !n.baseUrl;
826
826
  }
827
- const tn = /* @__PURE__ */ new Set(["mail", "message"]);
827
+ const rn = /* @__PURE__ */ new Set(["mail", "message"]);
828
828
  function ee(e, n) {
829
829
  const t = e.settings?.signatures?.[n];
830
830
  return !t || !t.enabled || !t.body || t.body.trim() === "" ? null : t;
831
831
  }
832
- function an(e, n, t, i = "html") {
832
+ function on(e, n, t, i = "html") {
833
833
  if (!e) return t;
834
834
  const a = ee(e, n);
835
835
  return a ? `${t}${i === "text" ? `
836
836
 
837
837
  ` : n === "mail" ? "<br><br>-- <br>" : "<br><br>"}${a.body}` : t;
838
838
  }
839
- function rn(e) {
839
+ function sn(e) {
840
840
  return e.endpoints ?? [];
841
841
  }
842
- const on = (e) => !!e.assignedUserId || !!e.assignedInboxId, sn = (e) => e.status === "closed", ln = (e) => ({
842
+ const ln = (e) => !!e.assignedUserId || !!e.assignedInboxId, cn = (e) => e.status === "closed", pn = (e) => ({
843
843
  urgent: 10,
844
844
  high: 5,
845
845
  normal: 2,
846
846
  low: 1
847
- })[e.priority] || 0, cn = (e, n = 30) => e.title?.length <= n ? e.title : `${e.title.substring(0, n)}...`;
848
- function un(e, n) {
847
+ })[e.priority] || 0, un = (e, n = 30) => e.title?.length <= n ? e.title : `${e.title.substring(0, n)}...`;
848
+ function dn(e, n) {
849
849
  return e.lastActivityAt ? !(e.seenBy ?? []).includes(n) : !1;
850
850
  }
851
- const pn = 2e3, dn = 500, mn = 12e3, fn = 4e3, ne = ["contact", "company"];
852
- function gn(e) {
851
+ const mn = 2e3, fn = 500, gn = 12e3, hn = 4e3, ne = ["contact", "company"];
852
+ function yn(e) {
853
853
  if (!e) return !1;
854
854
  const n = e.slice(0, e.indexOf(":"));
855
855
  return ne.includes(n);
@@ -908,7 +908,7 @@ function oe(e) {
908
908
  const i = n.indexOf("@");
909
909
  return i >= 0 && (n = n.slice(0, i)), n.trim();
910
910
  }
911
- function hn(e) {
911
+ function En(e) {
912
912
  if (!e) return !1;
913
913
  const n = e.indexOf("@");
914
914
  if (n <= 0) return !1;
@@ -936,19 +936,19 @@ function N(e, n) {
936
936
  }
937
937
  return !o && d(a, r) ? `+${r.callingCode}${a}` : null;
938
938
  }
939
- function yn(e, n = 9) {
939
+ function bn(e, n = 9) {
940
940
  const t = (e ?? "").replace(/\D/g, "");
941
941
  return t.length < n ? null : t.slice(-n);
942
942
  }
943
- function $(e) {
943
+ function R(e) {
944
944
  if (!e) return null;
945
945
  const n = e.trim().toLowerCase(), t = n.lastIndexOf("@");
946
946
  if (t <= 0 || t === n.length - 1) return null;
947
947
  const i = n.slice(0, t).split("+")[0], a = n.slice(t + 1);
948
948
  return !i || !a.includes(".") ? null : `${i}@${a}`;
949
949
  }
950
- function En(e) {
951
- const n = $(e);
950
+ function An(e) {
951
+ const n = R(e);
952
952
  return n ? n.slice(n.lastIndexOf("@") + 1) : null;
953
953
  }
954
954
  const se = /* @__PURE__ */ new Set([
@@ -1013,16 +1013,16 @@ const ce = /* @__PURE__ */ new Set([
1013
1013
  "proximus.be",
1014
1014
  "scarlet.be"
1015
1015
  ]);
1016
- function bn(e) {
1016
+ function _n(e) {
1017
1017
  const n = le(e);
1018
1018
  return n ? ce.has(n) : !1;
1019
1019
  }
1020
- function An(e) {
1020
+ function In(e) {
1021
1021
  if (!e) return !1;
1022
1022
  const n = e.trim().toLowerCase();
1023
1023
  return n === "tel" || n === "sms" || n === "whatsapp" || n === "fax";
1024
1024
  }
1025
- function In(e, n, t) {
1025
+ function Tn(e, n, t) {
1026
1026
  if (!e || !n) return null;
1027
1027
  const i = e.trim().toLowerCase();
1028
1028
  if (i === "tel" || i === "sms" || i === "whatsapp") {
@@ -1034,13 +1034,23 @@ function In(e, n, t) {
1034
1034
  return r ? `fax:${r}` : null;
1035
1035
  }
1036
1036
  if (i === "mailto" || i === "email") {
1037
- const r = $(n);
1037
+ const r = R(n);
1038
1038
  return r ? `mailto:${r}` : null;
1039
1039
  }
1040
1040
  const a = n.trim().toLowerCase();
1041
1041
  return a ? `${i}:${a}` : null;
1042
1042
  }
1043
- const ue = [
1043
+ const pe = /(\*\*|__)(?=\S)([\s\S]*?\S)\1/g, ue = /(\*|_)(?=\S)([^*_\n]*?\S)\1/g;
1044
+ function Sn(e) {
1045
+ if (typeof e != "string" || !e) return "";
1046
+ let n = e;
1047
+ return n = n.replace(/```[a-z]*\n?/gi, "").replace(/~~~[a-z]*\n?/gi, ""), n = n.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1"), n = n.replace(/\[([^\]]*)\]\([^)]*\)/g, "$1"), n = n.replace(/\[([^\]]*)\]\[[^\]]*\]/g, "$1"), n = n.replace(/<((?:https?|mailto):[^>\s]+)>/gi, "$1"), n = n.split(`
1048
+ `).map(
1049
+ (t) => t.replace(/^\s{0,3}#{1,6}\s+/, "").replace(/^\s{0,3}>\s?/, "").replace(/^\s*[-*+]\s+/, "").replace(/^\s*\d+[.)]\s+/, "").replace(/^\s*(?:[-*_]\s*){3,}$/, "")
1050
+ ).join(`
1051
+ `), n = n.replace(pe, "$2"), n = n.replace(ue, "$2"), n = n.replace(/~~(?=\S)([\s\S]*?\S)~~/g, "$1"), n = n.replace(/`([^`\n]+)`/g, "$1"), n.replace(/\s+/g, " ").trim();
1052
+ }
1053
+ const de = [
1044
1054
  /<blockquote/i,
1045
1055
  /class="?gmail_quote/i,
1046
1056
  // Gmail quote container
@@ -1053,12 +1063,12 @@ const ue = [
1053
1063
  // Outlook underscore separator before "From:"
1054
1064
  /\bOn\b[\s\S]{0,200}?\bwrote:/i
1055
1065
  // Gmail "On <date> <name> wrote:"
1056
- ], O = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, pe = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
1057
- function de(e) {
1066
+ ], O = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, me = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
1067
+ function fe(e) {
1058
1068
  const n = e.split(`
1059
1069
  `);
1060
1070
  for (let t = 0; t < n.length; t++)
1061
- if (pe.test(n[t]) || O.test(n[t]) && n.slice(t + 1, t + 4).some((i) => O.test(i)))
1071
+ if (me.test(n[t]) || O.test(n[t]) && n.slice(t + 1, t + 4).some((i) => O.test(i)))
1062
1072
  return n.slice(0, t).join(`
1063
1073
  `).trim();
1064
1074
  return e;
@@ -1078,34 +1088,34 @@ function L(e) {
1078
1088
 
1079
1089
  `).trim();
1080
1090
  }
1081
- function _n(e) {
1091
+ function Mn(e) {
1082
1092
  if (typeof e != "string" || !e) return "";
1083
1093
  let n = e.length;
1084
- for (const r of ue) {
1094
+ for (const r of de) {
1085
1095
  const o = e.search(r);
1086
1096
  o >= 0 && o < n && (n = o);
1087
1097
  }
1088
1098
  const t = e.slice(0, n);
1089
1099
  let i = L(D(k(t)));
1090
- return i || (i = L(D(k(e)))), de(i) || i;
1100
+ return i || (i = L(D(k(e)))), fe(i) || i;
1091
1101
  }
1092
- const me = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, fe = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
1093
- function Tn(e, n) {
1094
- return !!(e && me.test(e) || n && fe.test(n));
1102
+ const ge = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, he = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
1103
+ function Cn(e, n) {
1104
+ return !!(e && ge.test(e) || n && he.test(n));
1095
1105
  }
1096
- const ge = 3, he = 600;
1097
- function Mn(e, n) {
1098
- return e >= ge || n >= he;
1106
+ const ye = 3, Ee = 600;
1107
+ function vn(e, n) {
1108
+ return e >= ye || n >= Ee;
1099
1109
  }
1100
- function ye(e, n) {
1101
- const t = new Set(e.disabledIntents ?? []), i = e.intentOverrides ?? {}, a = n.intents.filter((o) => !t.has(o.intent)).map((o) => be(o, i[o.intent]));
1110
+ function be(e, n) {
1111
+ const t = new Set(e.disabledIntents ?? []), i = e.intentOverrides ?? {}, a = n.intents.filter((o) => !t.has(o.intent)).map((o) => _e(o, i[o.intent]));
1102
1112
  if (!e.extraIntents || e.extraIntents.length === 0) return a;
1103
1113
  const r = new Set(a.map((o) => o.intent));
1104
1114
  for (const o of e.extraIntents)
1105
1115
  r.has(o.intent) || (a.push(o), r.add(o.intent));
1106
1116
  return a;
1107
1117
  }
1108
- function Ee(e, n) {
1118
+ function Ae(e, n) {
1109
1119
  const t = {};
1110
1120
  for (const i of e.intents) {
1111
1121
  if (!i.togglable) continue;
@@ -1114,46 +1124,46 @@ function Ee(e, n) {
1114
1124
  }
1115
1125
  return t;
1116
1126
  }
1117
- function Sn(e, n) {
1118
- const t = Ee(e, n);
1127
+ function Nn(e, n) {
1128
+ const t = Ae(e, n);
1119
1129
  return Object.entries(t).filter(([, i]) => !i).map(([i]) => i);
1120
1130
  }
1121
- function be(e, n) {
1131
+ function _e(e, n) {
1122
1132
  return n ? {
1123
1133
  intent: n.intent ?? e.intent,
1124
1134
  targetSchemes: n.targetSchemes ?? e.targetSchemes,
1125
1135
  transport: n.transport ?? e.transport
1126
1136
  } : e;
1127
1137
  }
1128
- function Cn(e, n) {
1138
+ function On(e, n) {
1129
1139
  const t = [];
1130
1140
  for (const i of e) {
1131
1141
  if (!i.enabled) continue;
1132
1142
  const a = n[i.providerId];
1133
1143
  if (a)
1134
- for (const r of ye(i, a))
1144
+ for (const r of be(i, a))
1135
1145
  t.push({ channel: i, description: a, capability: r });
1136
1146
  }
1137
1147
  return t;
1138
1148
  }
1139
- function vn(e, n) {
1149
+ function kn(e, n) {
1140
1150
  return n.filter((t) => t.capability.intent === e);
1141
1151
  }
1142
- function Ae(e, n) {
1152
+ function Ie(e, n) {
1143
1153
  return n.filter((t) => t.capability.targetSchemes.includes(e));
1144
1154
  }
1145
- function Nn(e, n) {
1146
- return Ae(e.scheme, n);
1155
+ function Dn(e, n) {
1156
+ return Ie(e.scheme, n);
1147
1157
  }
1148
- function On(e, n, t) {
1158
+ function Ln(e, n, t) {
1149
1159
  const i = [];
1150
1160
  for (const a of e)
1151
1161
  for (const r of t)
1152
1162
  r.capability.intent === n && r.capability.targetSchemes.includes(a.scheme) && i.push({ channelIntent: r, endpoint: a });
1153
1163
  return i;
1154
1164
  }
1155
- var Ie = /* @__PURE__ */ ((e) => (e.MAILTO = "mailto", e.SIP = "sip", e.TEL = "tel", e.WEBHOOK = "webhook", e.USERNAME = "username", e.ID = "id", e.CUSTOM = "custom", e.URL = "url", e.TELEGRAM = "telegram", e.WHATSAPP = "whatsapp", e.MESSENGER = "messenger", e.INSTAGRAM = "instagram", e.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(Ie || {});
1156
- const kn = "message_window", Dn = "message_templates", Ln = {
1165
+ var Te = /* @__PURE__ */ ((e) => (e.MAILTO = "mailto", e.SIP = "sip", e.TEL = "tel", e.WEBHOOK = "webhook", e.USERNAME = "username", e.ID = "id", e.CUSTOM = "custom", e.URL = "url", e.TELEGRAM = "telegram", e.WHATSAPP = "whatsapp", e.MESSENGER = "messenger", e.INSTAGRAM = "instagram", e.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(Te || {});
1166
+ const $n = "message_window", Rn = "message_templates", xn = {
1157
1167
  // E-mail
1158
1168
  FROM: "from",
1159
1169
  TO: "to",
@@ -1170,110 +1180,111 @@ const kn = "message_window", Dn = "message_templates", Ln = {
1170
1180
  // Voice/conference
1171
1181
  HOST: "host",
1172
1182
  PARTICIPANT: "participant"
1173
- }, Rn = (e, n) => ({ intent: e, ...n }), $n = "folder_management", xn = "remote_search", Un = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, Pn = 9e4, wn = "installation-id";
1183
+ }, Un = (e, n) => ({ intent: e, ...n }), Pn = "folder_management", wn = "remote_search", Kn = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, Gn = 9e4, Vn = "installation-id";
1174
1184
  export {
1175
1185
  c as ACTIVITY_CATALOG,
1176
- R as AI_VENDORS,
1186
+ $ as AI_VENDORS,
1177
1187
  G as ActivityTypeRegistry,
1178
- Ue as BUILT_IN_ONLY,
1179
- Xe as CLASSIFY_VARS,
1180
- Ge as CORE_DIMENSIONS,
1181
- Ie as CommunicationScheme,
1182
- fn as DEFAULT_MEMORY_BUDGET,
1188
+ we as BUILT_IN_ONLY,
1189
+ Ye as CLASSIFY_VARS,
1190
+ He as CORE_DIMENSIONS,
1191
+ Te as CommunicationScheme,
1192
+ hn as DEFAULT_MEMORY_BUDGET,
1183
1193
  te as DEFAULT_PHONE_REGION,
1184
- $n as FEATURE_FOLDER_MANAGEMENT,
1185
- xn as FEATURE_REMOTE_SEARCH,
1186
- wn as INSTALLATION_HEADER,
1187
- Ln as InteractionParticipantRole,
1188
- Se as MAX_ACTIONS,
1189
- _e as MAX_BLOCKS,
1190
- Te as MAX_FIELDS,
1191
- Me as MAX_LIST_ITEMS,
1192
- mn as MAX_MEMORY_BUDGET,
1193
- pn as MAX_MEMORY_CHARS,
1194
- dn as MIN_MEMORY_BUDGET,
1194
+ Pn as FEATURE_FOLDER_MANAGEMENT,
1195
+ wn as FEATURE_REMOTE_SEARCH,
1196
+ Vn as INSTALLATION_HEADER,
1197
+ xn as InteractionParticipantRole,
1198
+ ve as MAX_ACTIONS,
1199
+ Se as MAX_BLOCKS,
1200
+ Me as MAX_FIELDS,
1201
+ Ce as MAX_LIST_ITEMS,
1202
+ gn as MAX_MEMORY_BUDGET,
1203
+ mn as MAX_MEMORY_CHARS,
1204
+ fn as MIN_MEMORY_BUDGET,
1195
1205
  Q as PAUSED_RUN_STATUSES,
1196
1206
  b as PHONE_REGIONS,
1197
- Pn as PRESENCE_ONLINE_WINDOW_MS,
1198
- Dn as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
1199
- kn as PROVIDER_FEATURE_MESSAGE_WINDOW,
1207
+ Gn as PRESENCE_ONLINE_WINDOW_MS,
1208
+ Rn as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
1209
+ $n as PROVIDER_FEATURE_MESSAGE_WINDOW,
1200
1210
  ce as PUBLIC_EMAIL_DOMAINS,
1201
1211
  ne as RELATED_SUBJECT_KINDS,
1202
- tn as SIGNATURE_INTENTS,
1203
- he as SUMMARY_MIN_LAST_CHARS,
1204
- ge as SUMMARY_MIN_MESSAGES,
1212
+ rn as SIGNATURE_INTENTS,
1213
+ Ee as SUMMARY_MIN_LAST_CHARS,
1214
+ ye as SUMMARY_MIN_MESSAGES,
1205
1215
  J as TERMINAL_RUN_STATUSES,
1206
- Fe as TRIGGER_VARS,
1207
- Un as UNSUPPORTED,
1216
+ We as TRIGGER_VARS,
1217
+ Kn as UNSUPPORTED,
1208
1218
  X as USAGE_DIMENSIONS,
1209
1219
  W as USAGE_DIMENSION_IDS,
1210
1220
  q as actingIdentityKey,
1211
- ve as activityIconOf,
1212
- xe as activityJoinUrl,
1221
+ Oe as activityIconOf,
1222
+ Pe as activityJoinUrl,
1213
1223
  P as activitySnippet,
1214
1224
  w as activityTextParams,
1215
- $e as activityTimelineText,
1216
- Ke as activityTimestamp,
1225
+ Ue as activityTimelineText,
1226
+ Ve as activityTimestamp,
1217
1227
  l as activityTypeInfo,
1218
- ze as actorKey,
1219
- Ze as aiVendorDefaultModel,
1220
- Qe as aiVendorLabel,
1221
- nn as aiVendorNeedsBaseUrl,
1222
- en as aiVendorsWith,
1223
- an as applySignature,
1224
- Pe as buildActivityPreview,
1225
- Cn as buildChannelIntents,
1226
- De as carriesText,
1227
- Ne as channelKindOf,
1228
- _n as cleanMessageText,
1229
- Rn as defineIntent,
1230
- Sn as disabledIntentsFromCapabilities,
1231
- En as emailDomain,
1232
- In as endpointKey,
1233
- Nn as filterByEndpoint,
1234
- vn as filterByIntent,
1235
- Ae as filterByTargetScheme,
1228
+ Je as actorKey,
1229
+ nn as aiVendorDefaultModel,
1230
+ en as aiVendorLabel,
1231
+ an as aiVendorNeedsBaseUrl,
1232
+ tn as aiVendorsWith,
1233
+ on as applySignature,
1234
+ Ke as buildActivityPreview,
1235
+ On as buildChannelIntents,
1236
+ $e as carriesText,
1237
+ ke as channelKindOf,
1238
+ Mn as cleanMessageText,
1239
+ Un as defineIntent,
1240
+ Nn as disabledIntentsFromCapabilities,
1241
+ An as emailDomain,
1242
+ Tn as endpointKey,
1243
+ Dn as filterByEndpoint,
1244
+ kn as filterByIntent,
1245
+ Ie as filterByTargetScheme,
1236
1246
  E as findAiVendor,
1237
- Ve as flattenLocales,
1238
- B as floorToPeriod,
1247
+ je as flattenLocales,
1248
+ j as floorToPeriod,
1239
1249
  z as formatActingIdentity,
1240
1250
  H as formatPeriod,
1241
- we as getActivitySeenUserIds,
1242
- rn as getContactEndpoints,
1243
- cn as getShortTitle,
1244
- ln as getUrgencyScore,
1245
- je as humanizeAction,
1246
- on as isAssigned,
1247
- sn as isClosed,
1248
- un as isInteractionUnseen,
1249
- Tn as isLikelyBulk,
1250
- Oe as isMessageType,
1251
- Je as isPaused,
1252
- Re as isPlaybookAuthoredType,
1253
- bn as isPublicEmailDomain,
1254
- ke as isReplyableType,
1255
- qe as isRetryable,
1251
+ Ge as getActivitySeenUserIds,
1252
+ sn as getContactEndpoints,
1253
+ un as getShortTitle,
1254
+ pn as getUrgencyScore,
1255
+ Xe as humanizeAction,
1256
+ ln as isAssigned,
1257
+ cn as isClosed,
1258
+ dn as isInteractionUnseen,
1259
+ Cn as isLikelyBulk,
1260
+ De as isMessageType,
1261
+ Ze as isPaused,
1262
+ xe as isPlaybookAuthoredType,
1263
+ _n as isPublicEmailDomain,
1264
+ Le as isReplyableType,
1265
+ Qe as isRetryable,
1256
1266
  Z as isTerminal,
1257
- Mn as isThreadLongEnough,
1258
- hn as looksLikeEmail,
1259
- On as matchContactToIntents,
1260
- Le as messageCountsAs,
1261
- An as needsPhoneRegion,
1262
- Ce as normalizeBlocks,
1263
- $ as normalizeEmail,
1264
- We as parseActingIdentity,
1265
- He as periodsInRange,
1266
- yn as phoneSuffix,
1267
- Ye as playbookActor,
1267
+ vn as isThreadLongEnough,
1268
+ En as looksLikeEmail,
1269
+ Ln as matchContactToIntents,
1270
+ Re as messageCountsAs,
1271
+ In as needsPhoneRegion,
1272
+ Ne as normalizeBlocks,
1273
+ R as normalizeEmail,
1274
+ ze as parseActingIdentity,
1275
+ Be as periodsInRange,
1276
+ bn as phoneSuffix,
1277
+ Sn as plainTextFromMarkdown,
1278
+ qe as playbookActor,
1268
1279
  h as readPath,
1269
1280
  le as registrableDomain,
1270
- gn as relatedByDefault,
1271
- Ee as resolveAccountCapabilities,
1281
+ yn as relatedByDefault,
1282
+ Ae as resolveAccountCapabilities,
1272
1283
  y as resolveActivityText,
1273
- ye as resolveChannelIntents,
1284
+ be as resolveChannelIntents,
1274
1285
  ee as resolveSignature,
1275
1286
  U as stripHtml,
1276
1287
  N as toE164,
1277
1288
  Y as usageMetricId,
1278
- Be as usageMetrics
1289
+ Fe as usageMetrics
1279
1290
  };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Markdown → plain text, for the places that show a *line* rather than a
3
+ * document: the snippet under a conversation in the inbox, a search result, a
4
+ * push notification.
5
+ *
6
+ * Those lines come from stored bodies, and a growing share of them is written by
7
+ * an assistant or a playbook — so they arrive as markdown and the list showed
8
+ * `**Klant** vraagt om een offerte` verbatim. Rendering the markdown there is
9
+ * not the answer: the row is one truncated line, and bold-in-a-snippet is noise.
10
+ *
11
+ * Deliberately a stripper, not a parser: it removes notation and keeps the
12
+ * words. Anything it does not recognise it leaves alone, which is the safe
13
+ * direction — an unrecognised construct shows as text, never as an error.
14
+ */
15
+ export declare function plainTextFromMarkdown(raw: unknown): string;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.134.3",
3
+ "version": "1.134.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",