@opencxh/domain 1.198.0 → 1.198.2

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.
@@ -212,7 +212,7 @@ export type FileUploadedPayload = {
212
212
  * status changes leaving no trace, so a conversation jumped out of and back into the list without
213
213
  * anything saying why.
214
214
  */
215
- export type InteractionStatus = "open" | "pending" | "closed" | "snoozed";
215
+ export type InteractionStatus = "open" | "closed" | "snoozed";
216
216
  export type InteractionStatusChangedPayload = {
217
217
  fromStatus: InteractionStatus;
218
218
  toStatus: InteractionStatus;
@@ -1,7 +1,7 @@
1
1
  import { AttentionCtx, ParkMark, Priority, Scored } from '../../platform/attention';
2
2
  import { Interaction } from './types';
3
3
  /** The only statuses that can ask for attention; `closed` and `snoozed` never compete. */
4
- export declare const ATTENTION_STATUSES: readonly ["open", "pending"];
4
+ export declare const ATTENTION_STATUSES: readonly ["open"];
5
5
  /**
6
6
  * Deterministic attention scoring for one conversation. No AI: every point is a transparent,
7
7
  * testable rule, and each contributor lands in `reasons` so a reader can be told *why* something
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@
4
4
  `)}
5
5
  `}const Z=e=>`user:${e}`,Q=e=>`team:${e}`;function ur(e){const t=new Set;for(const n of e??[])n?.id&&(n.kind==="user"&&t.add(Z(n.id)),n.kind==="team"&&t.add(Q(n.id)));return[...t].sort()}function dr(e,t){return[Z(e),...t.map(Q)]}function pr(e){const t=new Set;for(const n of e??[])n?.kind&&t.add(n.kind);return[...t]}const He=["done","escalated"];function fr(e){return He.includes(e)}const We="assignment";function mr(e){return`${We}:${e}`}function gr(e,t,n){if(e.direction==="inbound")return!0;if(e.author?.type==="user"&&e.author.id===t)return!1;const r=e.payload?.mentions;return Array.isArray(r)&&r.includes(t)?!0:n==="reply"}function hr(e){return e.subjectKind&&e.subjectId?{type:e.subjectKind,id:e.subjectId}:void 0}const Ve=12;function Ar(e,t,n=Ve){const r=t+1;return e?e.kind==="done"?{status:"done",waitingOn:null,turns:r,reason:e.note}:e.kind==="escalate"?{status:"escalated",waitingOn:null,turns:r,reason:e.reason}:r>=n?{status:"escalated",waitingOn:null,turns:r,reason:`na ${n} beurten nog niet afgerond, dus een mens neemt het over`}:{status:"waiting",waitingOn:e.on,turns:r}:{status:"escalated",waitingOn:null,turns:r,reason:"de agent rondde zijn beurt af zonder te zeggen wat er moet gebeuren (wachten, afronden of overdragen)"}}const Er=new Set(["mail","message"]);function je(e,t){const n=e.settings?.signatures?.[t];return!n?.enabled||!n.body||n.body.trim()===""?null:n}function Sr(e,t,n,r="html"){if(!e)return n;const i=je(e,t);return i?`${n}${r==="text"?`
6
6
 
7
- `:t==="mail"?"<br><br>-- <br>":"<br><br>"}${i.body}`:n}function yr(e){return e.endpoints??[]}const Ye=36e5,Xe=864e5,g=-1/0,_r=e=>e.score>g,E={urgent:40,high:25,normal:10,low:0};function Tr(e){return Object.fromEntries(e.map(t=>[t.resourceId,t]))}const Ir=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,br=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function ze(e,t){return!!(e&&Ir.test(e)||t&&br.test(t))}const qe=3,Je=600;function Mr(e,t){return e>=qe||t>=Je}function Ze(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const Qe=["open","pending"],et=1e3,tt={urgent:1,high:4,normal:8,low:24},nt=72;function rt(e){return e.lastActivityAt??(e.createdAt?new Date(ve(e)).getTime():0)}function it(e,t){return at(t.remindersById?.[e.id],e,t.now)}function at(e,t,n){return!e||e.remindAt<=n?!1:!((t.lastActivityAt??0)>e.parkedAt&&t.lastActivityPreview?.direction==="inbound")}const ot=e=>Ce(e)==="outbound_message",st=e=>Qe.includes(e);function k(e,t){return Math.max(0,(t-rt(e))/Ye)}function ct(e,t){const n=e.assignedInboxId?t?.[e.assignedInboxId]:void 0;return typeof n=="number"&&n>0?n:tt[e.priority??"normal"]}function Or(e){const t={};for(const n of e)typeof n.slaHours=="number"&&n.slaHours>0&&(t[n.id]=n.slaHours);return t}function Rr(e,t,n){return!st(e.status)||e.firstResponseAt?!1:k(e,t)>ct(e,n)}function lt(e,t){const n=e.lastActivityPreview;return n?.direction!=="outbound"||!ot(n.type)?!1:k(e,t)<nt}function Cr(e,t){if(!st(e.status))return{score:g,reasons:[]};if(e.snoozedTill&&e.snoozedTill>t.now)return{score:g,reasons:[]};if(lt(e,t.now))return{score:g,reasons:[]};if(it(e,t))return{score:g,reasons:[]};let n=0;const r=[],i=e.priority??"normal";E[i]>0&&(n+=E[i],r.push(`priority:${i}`)),Ze(e,t.userId)&&(n+=20,r.push("unseen")),e.assignedUserId&&e.assignedUserId===t.userId&&(n+=15,r.push("assigned-to-you"));const a=k(e,t.now);if(a>0){const s=Math.min(a*2,30);n+=s,a>=1&&r.push(`waiting:${Math.round(a)}h`)}const o=e.lastActivityPreview;return o?.type==="AI_ACTION_PROPOSED"&&(n+=30,r.push("awaiting-approval")),o?.direction==="outbound"&&ot(o.type)&&(n+=10,r.push("no-reply")),!e.firstResponseAt&&e.lastActivityPreview?.direction==="inbound"&&(n+=10,r.push("awaiting-reply")),ze(e.remoteParty?.resource,e.lastActivityPreview?.snippet)&&(n-=et,r.push("bulk")),{score:n,reasons:r}}const wr=e=>!!e.assignedUserId||!!e.assignedInboxId,Nr=e=>e.status==="closed",kr=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,vr=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function Dr(e,t){const n=e.labels??[];return n.find(r=>r.locale===t)?.label??n[0]?.label??e.url}function Lr(e,t,n){const r=e.translations??[];return r.find(i=>i.locale===t)??(n?r.find(i=>i.locale===n):void 0)??{locale:t}}const V=[{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 ut(e){const t=(e??"").toLowerCase();return V.find(n=>n.code===t)??V.find(n=>n.code===t.split("-")[0])}function Pr(e){return ut(e)?.label??e}function xr(e){const t=ut(e);return t?t.english===t.label?`${t.english} (${t.code})`:`${t.english} — ${t.label} (${t.code})`:e}const ee=3;function dt(e,t){const n=new Set;let r=1,i=t.get(e)?.parentId;for(;i;){if(n.has(i)||(n.add(i),r++,r>ee+1))return 1/0;i=t.get(i)?.parentId}return r}function Ur(e,t,n){if(!e)return!0;if(e===t)return!1;const r=new Map(n.map(o=>[o.id,o]));if(!r.has(e)||t&&pt(e,t,r))return!1;const i=dt(e,r),a=t?te(t,n):1;return i+a<=ee}function pt(e,t,n){const r=new Set;let i=n.get(e)?.parentId;for(;i;){if(i===t)return!0;if(r.has(i))return!1;r.add(i),i=n.get(i)?.parentId}return!1}function te(e,t,n=new Set){if(n.has(e))return 1;n.add(e);const r=t.filter(i=>i.parentId===e);return r.length?1+Math.max(...r.map(i=>te(i.id,t,n))):1}const ft="en";function mt(e){return e.defaultLocale||e.locale||ft}function $r(e){const t=new Set,n=[];for(const r of[mt(e),...e.locales??[]])!r||t.has(r)||(t.add(r),n.push(r));return n}function Kr(e,t,n){const r=e.translations??[];return r.find(i=>i.locale===t)?.name??(n?r.find(i=>i.locale===n)?.name:void 0)??e.name}const j=["lookup","condition","parallel","for-each"];function Y(e){for(const t of e){if(!j.includes(t.type))return`staptype "${t.type}" mag niet meelezen (alleen ${j.join(", ")})`;if(t.type==="parallel")for(const n of t.branches??[]){const r=Y(n);if(r)return r}if(t.type==="for-each"){const n=Y(t.body??[]);if(n)return n}}return null}function Br(e,t){switch(e.kind){case"org":return!0;case"team":return!!t.teamId&&e.teamId===t.teamId;case"personal":return e.userId===t.userId}}function Gr(e,t){return e.filter(n=>n.enabled&&Br(n.ownerScope,t))}function Fr(e){return e.credentialScope?e.credentialScope:(e.authMode??"header")==="header"||e.oauth?.scope==="org"?"shared":"per-user"}function Hr(e){return`mcp__${e}__`}const Wr=1e3,Vr=2e3,jr=500,Yr=12e3,Xr=4e3,gt=["contact","company","work_item"];function zr(e){if(!e)return!1;const t=e.slice(0,e.indexOf(":"));return gt.includes(t)}const qr="onboarding-source",Jr=["support","billing","availability","sales","onboarding"],Zr=["keep","replace"];function ht(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function Qr(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 r=t.slice(0,n),i=t.slice(n+1).trim();if(i){if(r==="user")return{kind:"user",userId:i};if(r==="team")return{kind:"team",teamId:i}}}function At(e){return ht(e)}function Et(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"}}}const St=Et;function ei(e){return e.agentId?{kind:"user",userId:e.agentId}:St(e.ownerScope)}function ti(e){return At(e)}function ni(e,t){if(!t)return;let n=e;for(const r of t.split(".")){if(n===null||typeof n!="object")return;n=n[r]}return n}function ri(e,t){return e.targets.find(n=>n.activityTypes.includes(t))}function ii(e,t){if(t)return e.targets.find(n=>n.id===t)}function yt(e){return e?.kind==="assignment"}function ai(e){const{trigger:t,agentId:n,target:r,activityType:i,assigneeUserId:a,authorUserId:o}=e;return yt(t)?n?r?r.activityTypes.includes(i)?a?a!==n?"assigned to someone else":o&&o===n?"the agent assigned this to itself, which would restart its own run":null:`no assignee found at ${r.assigneePath}`:`activity type ${i} does not announce an assignment for ${r.id}`:`assignment target kind "${t.targetKind}" is not declared by any installed app`:"this playbook has no agent, so an assignment can never be for it":"trigger is not an assignment trigger"}function oi(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const si=[{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:"itemId",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:"toCategory",type:"string"},{name:"contactId",type:"string"},{name:"companyId",type:"string"},{name:"assigneeUserId",type:"string"}],ci={topics:[{name:"topicId",type:"string"},{name:"topic",type:"string"},{name:"confidence",type:"number"},{name:"reasoning",type:"string"}],question:[{name:"answer",type:"boolean"},{name:"reasoning",type:"string"}],extract:[]};function _t(e){return`${e.type}:${e.id}`}const Tt="interaction";function It(e){return e?.type===Tt?e.id:void 0}const bt=64,Mt=8e3;function li(e){const t=typeof e=="number"?e:Number(String(e??"").trim());if(!(!Number.isFinite(t)||t<=0))return Math.min(Math.max(Math.round(t),bt),Mt)}const ui={kind:"workflow",steps:[]};function di(e){return e?.kind==="workflow"?e.steps:[]}function pi(e){return e?.kind==="procedure"?e.procedure:void 0}function Ot(e){const t=e?.approved??0,n=t+(e?.rejected??0);return{total:n,rate:n?t/n:0}}const Rt=10,Ct=.9;function fi(e){const{total:t,rate:n}=Ot(e);return t>=Rt&&n>=Ct}const wt=["done","escalated","failed","stopped"];function mi(e){return wt.includes(e)}function Nt(e){return e==="waiting"}function gi(e){return e==="running"||Nt(e)}function ne(e){return e.subjectKind&&e.subjectId?{type:e.subjectKind,id:e.subjectId}:void 0}function hi(e){const t=ne(e);return t?_t(t):void 0}function Ai(e){return It(ne(e))}function Ei(e,t){const n=e.accumulatedSeconds||0;return e.runningSince?n+Math.max(0,Math.floor((t-e.runningSince)/1e3)):n}function Si(e,t){const n=Math.max(1,Math.ceil(Math.max(0,e)/60));if(!t||t==="exact")return n*60;const r=Number(t);return!Number.isFinite(r)||r<=0?n*60:Math.ceil(n/r)*r*60}function yi(e){const t=Math.max(0,Math.round(e/60));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function _i(e){const t=Math.max(0,Math.floor(e)),n=a=>String(a).padStart(2,"0"),r=Math.floor(t/60)%60,i=Math.floor(t/3600);return i>0?`${i}:${n(r)}:${n(t%60)}`:`${n(r)}:${n(t%60)}`}function kt(e){return(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,48).replace(/^-+|-+$/g,"")}function Ti(e,t){const n=kt(e)||"werksoort",r=new Set(t);if(!r.has(n))return n;for(let i=2;i<500;i++){const a=`${n}-${i}`;if(!r.has(a))return a}return`${n}-${r.size+1}`}function Ii(e,t){const n=e.ownerScope;return!n||n.kind==="org"?!0:t.includes(n.teamId)}function bi(e){return e.filter(t=>!t.archived).sort(vt)}function vt(e,t){const n=(e.order??0)-(t.order??0);return n!==0?n:(e.label||"").localeCompare(t.label||"")}const Dt=20,Lt=20,R=300;function h(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").replace(/\s+/g," ").trim()}function Pt(e){const t=e.replace(/\s+/g," ").trim();if(t.length<=R)return t;const n=t.slice(0,R),r=Math.max(n.lastIndexOf(". "),n.lastIndexOf("! "),n.lastIndexOf("? "));return r>R*.6?n.slice(0,r+1):`${n.trimEnd()}…`}function Mi(e,t){const n=Pt(t.text),r=h(n);if(!r||(e.examples??[]).some(o=>h(o)===r))return null;const i=e.exampleCandidates??[],a=i.findIndex(o=>h(o.text)===r);if(a>=0){if(i[a].corrected||!t.corrected)return null;const o=[...i];return o[a]={...o[a],corrected:!0,addedAt:t.addedAt},Ee(o)}return Ee([{...t,text:n},...i]).slice(0,Lt)}function Ee(e){return[...e].sort((t,n)=>Number(n.corrected)-Number(t.corrected)||n.addedAt-t.addedAt)}function Oi(e,t){const n=h(t),r=(e.examples??[]).filter(a=>a.trim());return{examples:r.some(a=>h(a)===n)?r:[...r,t].slice(-Dt),exampleCandidates:xt(e,t)}}function xt(e,t){const n=h(t);return(e.exampleCandidates??[]).filter(r=>h(r.text)!==n)}function Ut(e,t){const n=e.ownerScope;return n?n.kind==="org"?!0:n.kind==="team"?!!t&&n.teamId===t:!1:!1}function Ri(e,t){return e.filter(n=>Ut(n,t))}function Ci(e){return e.type==="agent"}const wi="WORK_COMMENT_ADDED",Ni="WORK_ITEM_ASSIGNED",ki="WORK_ITEM_STATUS_CHANGED";function vi(e,t){const n=r=>{const i=new Date(r);return i.setHours(0,0,0,0),i.getTime()};return Math.round((n(e)-n(t))/Xe)}function Di(e,t){if(e.closedAt!=null)return{score:g,reasons:[]};const n=t.remindersById?.[e.id];if(n&&n.remindAt>t.now)return{score:g,reasons:[]};let r=0;const i=[],a=e.priority??"normal";if(E[a]>0&&(r+=E[a],i.push(`priority:${a}`)),typeof e.dueDate=="number"){const o=vi(e.dueDate,t.now);o<0?(r+=35,i.push("overdue")):o===0&&(r+=20,i.push("due-today"))}return e.source?.initiator==="system"&&e.source.systemReason&&(r+=15,i.push(`auto:${e.source.systemReason}`)),{score:r,reasons:i}}const $t="work_item",Kt="work_project";function Bt(e){return`${$t}:${e}`}function re(e){return`${Kt}:${e}`}function Li(e,t,n){const r=`${e}-${t}`;return n?`${r}-${n}`:r}function Pi(e){const t=/^([A-Za-z0-9]{2,8})-(\d+)(?:-(\d+))?$/.exec((e||"").trim());return t?{projectKey:t[1].toUpperCase(),sequenceNumber:Number(t[2]),...t[3]?{subSequence:Number(t[3])}:{}}:null}function xi(e){return(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,3)||"PRJ"}function Ui(e,t=25){const n=new Set([Bt(e.id)]);e.projectId&&n.add(re(e.projectId));for(const r of e.ancestorKeys??[])n.add(r);for(const r of e.partyKeys??[])n.add(r);return Array.from(n).slice(0,t)}function $i(e){return[re(e.id)]}const v=[{key:"open",label:"status_open",category:"todo",order:0},{key:"in_progress",label:"status_in_progress",category:"in_progress",order:1},{key:"done",label:"status_done",category:"done",order:2},{key:"cancelled",label:"status_cancelled",category:"done",order:3}],ie=v.map(e=>e.key);function Gt(e){return e?.statuses?.length?e.statuses:v}function Ft(e,t){return t.find(n=>n.key===e)?.category??"todo"}function Ki(e,t){return t.find(n=>n.key===e)}function Bi(e){const t=Gt(e),n=e?.defaultStatusKey;return n&&t.some(r=>r.key===n)?n:Ht(t)[0]?.key??v[0].key}function Ht(e){return[...e].sort((t,n)=>{const r=(t.order??0)-(n.order??0);return r!==0?r:(t.label||"").localeCompare(n.label||"")})}function Gi(e,t){return Ft(e,t)==="done"}function Wt(e){return(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,48).replace(/^-+|-+$/g,"")}function Fi(e,t){const n=Wt(e)||"status",r=new Set([...t,...ie]);if(!r.has(n))return n;for(let i=2;i<500;i++){const a=`${n}-${i}`;if(!r.has(a))return a}return`${n}-${r.size+1}`}function Hi(e){const t=[];if(!e.length)return[{index:-1,reason:"empty"}];const n=new Set;return e.forEach((r,i)=>{if(!r.key){t.push({index:i,reason:"missing_key"});return}ie.includes(r.key)&&t.push({index:i,reason:"reserved_key",key:r.key}),n.has(r.key)&&t.push({index:i,reason:"duplicate_key",key:r.key}),n.add(r.key)}),e.some(r=>r.category==="todo"||r.category==="in_progress")||t.push({index:-1,reason:"no_open"}),e.some(r=>r.category==="done")||t.push({index:-1,reason:"no_done"}),t}const Wi=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/webp"]),Vi=new Set(["text/plain","text/markdown","text/csv","application/json","text/html","application/xml","text/xml"]);function Vt(e){const t=(e??"").trim().toLowerCase().split(";")[0];return t?Wi.has(t)?"image":t==="application/pdf"?"pdf":Vi.has(t)?"text":t.startsWith("audio/")?"audio":"unsupported":"unsupported"}const A=1024*1024,jt={image:5*A,pdf:20*A,text:1*A,audio:20*A},ji=25*A,Yi=5;function Xi(e,t){const n=Vt(e);return n==="unsupported"?"unsupported":t>jt[n]?"too-large":null}function zi(e){return e.access!=="read"&&e.effect!=="internal"}function Yt(e){return`${e.kind}:${e.id||e.url||e.title}`}function qi(e,t=[]){const n=new Set(t),r=[],i=[];for(const a of e){const o=Yt(a);n.has(o)||(n.add(o),r.push(a),i.push(o))}return{sources:r,keys:i}}const Ji="assist-source",Zi=["blocking","due","open"];function Qi(e,t){const[n,r]=(e.subjectKey??"").split(":");return n===t&&r?r:void 0}const Se={blocking:0,due:1,open:2};function ea(e,t){return Se[e.band??"open"]-Se[t.band??"open"]||(t.priority??0)-(e.priority??0)||e.id.localeCompare(t.id)}function ta(e){return e.sessions.filter(t=>t.id!==e.exceptSessionId&&t.state==="connected"&&e.canHold(t.providerId))}function na(e){return e.sessions.filter(t=>t.id!==e.exceptSessionId&&t.state==="connected"&&!e.canHold(t.providerId))}function ra(e){return e.sessions.some(n=>n.id!==e.exceptSessionId&&(n.state==="connected"||n.state==="on_hold"))?{admit:!1,reason:"busy"}:{admit:!0}}function Xt(e,t){const n=new Set(e.disabledIntents??[]),r=e.intentOverrides??{},i=t.intents.filter(o=>!n.has(o.intent)).map(o=>aa(o,r[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return i;const a=new Set(i.map(o=>o.intent));for(const o of e.extraIntents)a.has(o.intent)||(i.push(o),a.add(o.intent));return i}function zt(e,t){const n={};for(const r of e.intents){if(!r.togglable)continue;const i=t?.[r.intent];n[r.intent]=i??r.defaultEnabled??!0}return n}function ia(e,t){const n=zt(e,t);return Object.entries(n).filter(([,r])=>!r).map(([r])=>r)}function aa(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function oa(e,t){const n=[];for(const r of e){if(!r.enabled)continue;const i=t[r.providerId];if(i)for(const a of Xt(r,i))n.push({channel:r,description:i,capability:a})}return n}function sa(e,t){return t.filter(n=>n.capability.intent===e)}function qt(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function ca(e,t){return qt(e.scheme,t)}function la(e,t,n){const r=[];for(const i of e)for(const a of n)a.capability.intent===t&&a.capability.targetSchemes.includes(i.scheme)&&r.push({channelIntent:a,endpoint:i});return r}var Jt=(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))(Jt||{});const ua={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 da(e){return e?ua[e]??"note":"note"}const pa="message_window",fa="message_templates",ma={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},ga=(e,t)=>({intent:e,...t}),ha="folder_management",Aa="remote_search",Ea={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},Sa="context.collect",ya="installation-id";function _a(e){const t=[];for(const n of Object.keys(e))for(const r of Object.keys(e[n]))t.push({lang:n,key:r,value:e[n][r]});return t}const Ta="notification-source",Ia=(e,t)=>`${e}.pref.${t}`,ba={ai:["account.read","account.write","agent.read","agent.write","assignment.read","assignment.write","budget.read","budget.write","connector.read","connector.write","context.read","context.write","conversation.read","conversation.write","lens.read","lens.write","message.read","message.write","playbook.read","playbook.write","profile.read","profile.write","run.read","run.write","settings.read","settings.write","tool.read","transcript.write","usage.read"],analytics:["report.read"],"app-store":["app.publish","app.read","app.write","setting.read","setting.write"],assist:["board.read"],automations:["sync.read","sync.write","webhook.read","webhook.write"],communication:["account.read","account.write","activity-type.read","activity.read","activity.write","attachment.read","attribute.read","attribute.write","calendar.read","calendar.write","channel.read","channel.write","custom-field.read","custom-field.write","folder.read","folder.write","inbox.read","inbox.write","interaction.read","interaction.write","reminder.read","template.read","template.write","topic.read","topic.write"],context:["kind.read","kind.write","memory.read","memory.write"],crm:["company.read","company.write","contact.read","contact.write"],"eylo-voip":["account.read","account.write","callflow.read","callflow.write","channel.read","channel.write","contact.read","contact.write","device.read","device.write","group.read","group.write","interaction.read","interaction.write","media.read","media.write","menu.read","menu.write","phone-number.read","phone-number.write","recording.read","recording.write","sip.read","temporal-rule.read","temporal-rule.write","user.read","user.write","vmbox.read","vmbox.write","webhook.read","webhook.write"],google:["account.read","account.write","contact.read"],kb:["article.read","article.write","category.read","category.write","help-center.read","help-center.write","kb.read","kb.write"],mail:["account.write"],meta:["account.read","account.write"],microsoft:["account.read","account.write","contact.read","sync.write"],organization:["billing.read","billing.write","settings.read","settings.write","team.read","team.write"],shopify:["account.read","account.write","order.read"],slack:["thread.read","thread.write"],storage:["artifact.read","artifact.write","file.read","file.write","mount.read","mount.write"],time:["entry.read","entry.write","work-type.read","work-type.write"],user:["user.read","user.write"],work:["item.read","item.write","project.read","project.write"]},ae=9e4,Zt=["out_of_office"],Qt=e=>Zt.includes(e);function Ma(e,t,n){const r=n-e<ae,i=t?.status&&(!t.expiresAt||t.expiresAt>n)?t:void 0;if(!i?.status)return{online:r,status:r?"available":"offline"};const a=i.status;return!r&&!Qt(a)?{online:!1,status:"offline"}:{online:r,status:a,message:i.message}}function Oa(e,t){const n=t-e.lastSeenAt<ae,r=n||Qt(e.status)?e.status:"offline";return n===e.online&&r===e.status?e:{...e,online:n,status:r}}function Ra(e,t){return e?.teamId&&t.includes(e.teamId)?{teamId:e.teamId,mustChoose:!1}:t.length===1?{teamId:t[0],mustChoose:!1}:{teamId:void 0,mustChoose:t.length>1}}function Ca(e){return e.providerAvailable&&e.allowed}const wa="resources.describe",Na="resources.search",ka="resources.resolve",va="resources.attached";function Da(e){const t=e.indexOf(":");return t===-1?e:e.slice(0,t)}const oe="auth";function se(e){const t=typeof e=="string"?e.match(/apps\/([^/?#]+)/):null;return t?t[1]:null}function La(e){const t=se(e);return t?t!==oe:typeof e=="string"&&e.startsWith("/wake")}function Pa(e){return typeof e!="string"||e===""||e==="/"?!0:se(e)===oe}function xa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function en(e){const n=e.split("/").filter(Boolean).map(r=>r.startsWith(":")?r.endsWith("?")?"(?:/[^/]+)?":"/[^/]+":`/${xa(r)}`).join("");return new RegExp(`^${n}\\/?$`)}function tn(e,t){const n=e.split("/").filter(Boolean),r=t.split("/").filter(Boolean),i={};return n.forEach((a,o)=>{if(a.startsWith(":")){const s=a.endsWith("?")?a.slice(1,-1):a.slice(1),l=r[o];l&&(i[s]=l)}}),i}function nn(e){return e.publicBasePath??`/apps/${e.name}`}function Ua(e){const t=[];for(const n of e){if(!n?.name)continue;const r=nn(n);for(const i of n.routes??[]){if(!i.public)continue;const a=i.path==="/"?"":i.path;t.push({appName:n.name,resource:i.resource,pattern:`${r}${a}`,props:i.props})}}return t}function rn(e,t){const n=e.split("/").filter(Boolean),r=t.split("/").filter(Boolean);for(let i=0;i<Math.min(n.length,r.length);i++){const a=n[i].startsWith(":"),o=r[i].startsWith(":");if(a!==o)return o}return n.length>r.length}function an(e,t){if(typeof e!="string")return null;let n=null;for(const r of t)en(r.pattern).test(e)&&(!n||rn(r.pattern,n.pattern))&&(n=r);return n?{...n,params:{...n.props,...tn(n.pattern,e)}}:null}function $a(e,t){return an(e,t)!==null}const Ka="sync-source",Ba="sync-target",Ga=20,Fa={afrikaans:["[Muziek]","(C) TV GELDERLAND 2021","*Thomp thomp thomp*","www.youtube.com","ä n wood s","!.."],english:["[applause]","[APPLAUSE]","(claps)","(clapping)","(audience applauds)","(keyboard clicking)","(keyboard clacking)","(clicking)","[CLICK]","[BLANK_AUDIO]","(upbeat music)","(dramatic music)","[music playing]","(electronic music)","(audience cheering)","(audience cheers)","[MUSIC]","( ( ( ( ) ( ) ( ) ( )","(laughs)","(air whooshing)","<u>Transcribed</u> by https://otter.ai","All new tonight at 6... coming up. A new look at your forecast is A new look at your forecast is","www.mooji.org","KATHRYN A new forecast is coming up... A new forecast is coming up...","KATHRYN pandemic started. increasing since the The pandemic has been","A new look at your forecast this morning... A new look at your","We'll be right back.","We'll see you next week.","Thanks for watching!","❤️ Translated by Amara.org Communit"],flemish:["*clap*","TV GELDERLAND 2020","TV Gelderland 2021","(C) TV GELDERLAND 2021","[Muziek]","Kuman","Ondertitels ingediend door de Amara.org gemeenschap","Ondertiteld door de Amara.org gemeenschap","Dank u wel voor het kijken.","Ondertiteling door de Amara.org gemeenschap","GELUID VAN MAHIH U similarly"],french:["(applaudissements)","[Applaudissements]","Sous-titres réalisés par la communauté d'Amara.org","- Bonne journée. - Bonjour.","POP POP הי","Merci d'avoir regardé cette vidéo.","Merci d'avoir regardé cette vidéo!","Merci d'avoir regardé la vidéo.","J'espère que vous avez apprécié la vidéo.","Je vous remercie de vous abonner","Merci d'avoir regardé!","❤️ par SousTitreur.com","— Sous-titrage ST'501 —","Thanks for watching!","Sous-titres réalisés par l'Amara.org","Sous-titres réalisés para la communauté d'Amara.org","Sous-titres réalisés par la communauté d'Amara.org","Sous-titres fait par Sous-titres par Amara.org","Sous-titres réalisés par les SousTitres d'Amara.org","Sous-titres par Amara.org","Sous-titres par la communauté d'Amara.org","Sous-titres réalisés pour la communauté d'Amara.org","Sous-titres réalisés par la communauté de l'Amara.org","Sous-Titres faits par la communauté d'Amara.org","Sous-titres par l'Amara.org","Sous-titres fait par la communauté d'Amara.org","Sous-titrage ST' 501","Sous-titrage ST'501","Cliquez-vous sur les sous-titres et abonnez-vous à la chaîne d'Amara.org","❤️ par SousTitreur.com"],german:["[Klicken]","(Jubel)","*lacht*","[Anhaltender Beifall]","[Applaus]","(Applaus)","* Applaus *","[MUSIK]","* mustard ml Drumglöck und knack in einem Handbewerb *","Untertitelung aufgrund der Amara.org-Community","Untertitel im Auftrag des ZDF für funk, 2017","Untertitel von Stephanie Geiges","Untertitel der Amara.org-Community","Untertitel im Auftrag des ZDF, 2017","Untertitel im Auftrag des ZDF, 2020","Untertitel im Auftrag des ZDF, 2018","Untertitel im Auftrag des ZDF, 2021","Untertitelung im Auftrag des ZDF, 2021","Copyright WDR 2021","Copyright WDR 2020","Copyright WDR 2019","SWR 2021","SWR 2020"],italian:["Alla prossima!","*applauso*","[Musica]","[Musica]","[Applausi]","*Bip bip bip bip*","(musica del NS shore)","D' 1962 alle tribunte del Gulf","Sottotitoli creati dalla comunità Amara.org","Sottotitoli di Sottotitoli di Amara.org","Sottotitoli e revisione al canale di Amara.org","Sottotitoli e revisione a cura di Amara.org","Sottotitoli e revisione a cura di QTSS","Sottotitoli e revisione a cura di QTSS.","Sottotitoli a cura di QTSS","Sottotitoli a cura di Sottotitoli"],spanish:["[música]","[Música de cierre]","[Aplausos]","(Aplausos)","www.alimmenta.com","¡Gracias por ver el vídeo!","(sonidos del celular) (Inudible distorsión)","¡Suscríbete!","Subtítulos realizados por la comunidad de Amara.org","Subtitulado por la comunidad de Amara.org","Subtítulos por la comunidad de Amara.org","Subtítulos creados por la comunidad de Amara.org","Subtítulos en español de Amara.org","Subtítulos hechos por la comunidad de Amara.org","Subtitulos por la comunidad de Amara.org","Más información www.alimmenta.com","www.mooji.org","[MÚSICA]","[Music cuts in British]"]},on=e=>{let t=e;return Object.values(Fa).forEach(n=>{n.forEach(r=>{t=t.replaceAll(r,"")})}),t=t.replace(/\(.*?\)/g,""),t=t.replace(/\[.*?\]/g,""),t},sn=6e4,cn=8e3,ln=2,un=.4,Ha=3,Wa=new Set(["aan","als","ben","bent","bij","dan","dat","deze","die","dit","doen","door","dus","echt","een","eens","even","gaan","gaat","geen","geweest","goed","graag","had","heb","hebben","hebt","heeft","het","hier","hoe","hoor","iets","inderdaad","kan","klopt","kunnen","kunt","maar","mag","mee","meer","met","mij","mijn","misschien","moet","moeten","naar","net","niet","nog","nou","oke","ook","over","prima","toch","uhm","uit","van","veel","voor","wat","weer","weet","wel","wij","wil","wilt","worden","wordt","zeg","zeggen","zijn","zou","zult","about","and","are","been","but","can","does","for","have","just","know","like","not","okay","right","she","that","the","them","then","there","they","this","want","was","well","were","what","will","with","would","yeah","you","your"]);function dn(e){const t=new Set;for(const n of e.toLowerCase().split(/[^a-z0-9À-ɏ]+/))n.length<Ha||Wa.has(n)||t.add(n);return[...t]}function pn(e,t){if(!e.length)return 0;if(!t.length)return 1;const n=new Set(t),r=new Set(e);let i=0;for(const a of r)n.has(a)||(i+=1);return i/r.size}function fn(e,t=sn){const n=e.filter(o=>!o.partial&&typeof o.text=="string");if(!n.length)return{text:"",segmentCount:0};const i=n.reduce((o,s)=>Math.max(o,s.endedAt??0),0)-t;return{text:n.filter(o=>(o.endedAt??0)>=i).map(o=>on(o.text).trim()).filter(Boolean).join(" ").replace(/\s+/g," ").trim(),segmentCount:n.length}}const mn=60;function Va(e,t,n=mn){const r=new Set(e),i=[...e];for(const a of t)!a||r.has(a)||(r.add(a),i.push(a));return i.slice(-n)}function ja(e){const{segments:t,now:n,state:r}=e;if(r.lastTriggerAt&&n-r.lastTriggerAt<cn)return{trigger:!1,reason:"too_soon"};const i=fn(t,e.windowMs);if(!i.text)return{trigger:!1,reason:"no_speech"};const a=i.segmentCount-(r.lastSegmentCount??0);if(r.lastQueryTerms&&a<ln)return{trigger:!1,reason:"too_few_new"};const o=dn(i.text);return o.length?r.lastQueryTerms?.length&&pn(o,r.lastQueryTerms)<un?{trigger:!1,reason:"same_topic"}:{trigger:!0,text:i.text,terms:o,segmentCount:i.segmentCount}:{trigger:!1,reason:"no_speech"}}const Ya=["personal","workspace","connections","work","ai"],Xa="navNotice",D={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}},gn="NL",za=15,qa=8,Ja=Array.from(new Set(Object.values(D).map(e=>e.callingCode))).sort((e,t)=>t.length-e.length);function ye(e){if(e)return D[e.trim().toUpperCase()]}function C(e,t){return e.length>=t.nsnMin&&e.length<=t.nsnMax}function _e(e){if(e.length>za)return null;for(const t of Ja){if(!e.startsWith(t))continue;const n=e.slice(t.length);for(const r of Object.values(D)){if(r.callingCode!==t)continue;const i=r.trunkPrefix,a=i&&n.startsWith(i)?n.slice(i.length):n;if(C(a,r))return`+${t}${a}`}return null}return e.length<qa?null:`+${e}`}function Za(e){let t=e.trim();const n=t.match(/^(sips?|tel|whatsapp):/i);n&&(t=t.slice(n[0].length));const r=t.indexOf("@");return r>=0&&(t=t.slice(0,r)),t.trim()}function Qa(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 X(e,t){if(!e)return null;const n=Za(e);if(!n)return null;const r=n.startsWith("+"),i=n.replace(/\D/g,"");if(!i)return null;if(r)return _e(i);if(i.startsWith("00"))return _e(i.slice(2));const a=ye(t)??ye(gn);if(!a)return null;const o=a.trunkPrefix;if(o&&i.startsWith(o)){const s=i.slice(o.length);return C(s,a)?`+${a.callingCode}${s}`:null}if(i.startsWith(a.callingCode)){const s=i.slice(a.callingCode.length);if(C(s,a))return`+${a.callingCode}${s}`}return!o&&C(i,a)?`+${a.callingCode}${i}`:null}function eo(e,t=9){const n=(e??"").replace(/\D/g,"");return n.length<t?null:n.slice(-t)}function ce(e){if(!e)return null;const t=e.trim().toLowerCase(),n=t.lastIndexOf("@");if(n<=0||n===t.length-1)return null;const r=t.slice(0,n).split("+")[0],i=t.slice(n+1);return!r||!i.includes(".")?null:`${r}@${i}`}function to(e){const t=ce(e);return t?t.slice(t.lastIndexOf("@")+1):null}const no=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function hn(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 no.has(n)&&t.length>=3?t.slice(-3).join("."):n}const An=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 ro(e){const t=hn(e);return t?An.has(t):!1}function io(e){if(!e)return!1;const t=e.trim().toLowerCase();return t==="tel"||t==="sms"||t==="whatsapp"||t==="fax"}function ao(e,t,n){if(!e||!t)return null;const r=e.trim().toLowerCase();if(r==="tel"||r==="sms"||r==="whatsapp"){const a=X(t,n);return a?`tel:${a}`:null}if(r==="fax"){const a=X(t,n);return a?`fax:${a}`:null}if(r==="mailto"||r==="email"){const a=ce(t);return a?`mailto:${a}`:null}const i=t.trim().toLowerCase();return i?`${r}:${i}`:null}const oo=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,so=/(\*|_)(?=\S)([^*_\n]*?\S)\1/g;function co(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 yr(e){return e.endpoints??[]}const Ye=36e5,Xe=864e5,g=-1/0,_r=e=>e.score>g,E={urgent:40,high:25,normal:10,low:0};function Tr(e){return Object.fromEntries(e.map(t=>[t.resourceId,t]))}const Ir=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,br=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function ze(e,t){return!!(e&&Ir.test(e)||t&&br.test(t))}const qe=3,Je=600;function Mr(e,t){return e>=qe||t>=Je}function Ze(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const Qe=["open"],et=1e3,tt={urgent:1,high:4,normal:8,low:24},nt=72;function rt(e){return e.lastActivityAt??(e.createdAt?new Date(ve(e)).getTime():0)}function it(e,t){return at(t.remindersById?.[e.id],e,t.now)}function at(e,t,n){return!e||e.remindAt<=n?!1:!((t.lastActivityAt??0)>e.parkedAt&&t.lastActivityPreview?.direction==="inbound")}const ot=e=>Ce(e)==="outbound_message",st=e=>Qe.includes(e);function k(e,t){return Math.max(0,(t-rt(e))/Ye)}function ct(e,t){const n=e.assignedInboxId?t?.[e.assignedInboxId]:void 0;return typeof n=="number"&&n>0?n:tt[e.priority??"normal"]}function Or(e){const t={};for(const n of e)typeof n.slaHours=="number"&&n.slaHours>0&&(t[n.id]=n.slaHours);return t}function Rr(e,t,n){return!st(e.status)||e.firstResponseAt?!1:k(e,t)>ct(e,n)}function lt(e,t){const n=e.lastActivityPreview;return n?.direction!=="outbound"||!ot(n.type)?!1:k(e,t)<nt}function Cr(e,t){if(!st(e.status))return{score:g,reasons:[]};if(e.snoozedTill&&e.snoozedTill>t.now)return{score:g,reasons:[]};if(lt(e,t.now))return{score:g,reasons:[]};if(it(e,t))return{score:g,reasons:[]};let n=0;const r=[],i=e.priority??"normal";E[i]>0&&(n+=E[i],r.push(`priority:${i}`)),Ze(e,t.userId)&&(n+=20,r.push("unseen")),e.assignedUserId&&e.assignedUserId===t.userId&&(n+=15,r.push("assigned-to-you"));const a=k(e,t.now);if(a>0){const s=Math.min(a*2,30);n+=s,a>=1&&r.push(`waiting:${Math.round(a)}h`)}const o=e.lastActivityPreview;return o?.type==="AI_ACTION_PROPOSED"&&(n+=30,r.push("awaiting-approval")),o?.direction==="outbound"&&ot(o.type)&&(n+=10,r.push("no-reply")),!e.firstResponseAt&&e.lastActivityPreview?.direction==="inbound"&&(n+=10,r.push("awaiting-reply")),ze(e.remoteParty?.resource,e.lastActivityPreview?.snippet)&&(n-=et,r.push("bulk")),{score:n,reasons:r}}const wr=e=>!!e.assignedUserId||!!e.assignedInboxId,Nr=e=>e.status==="closed",kr=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,vr=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function Dr(e,t){const n=e.labels??[];return n.find(r=>r.locale===t)?.label??n[0]?.label??e.url}function Lr(e,t,n){const r=e.translations??[];return r.find(i=>i.locale===t)??(n?r.find(i=>i.locale===n):void 0)??{locale:t}}const V=[{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 ut(e){const t=(e??"").toLowerCase();return V.find(n=>n.code===t)??V.find(n=>n.code===t.split("-")[0])}function Pr(e){return ut(e)?.label??e}function xr(e){const t=ut(e);return t?t.english===t.label?`${t.english} (${t.code})`:`${t.english} — ${t.label} (${t.code})`:e}const ee=3;function dt(e,t){const n=new Set;let r=1,i=t.get(e)?.parentId;for(;i;){if(n.has(i)||(n.add(i),r++,r>ee+1))return 1/0;i=t.get(i)?.parentId}return r}function Ur(e,t,n){if(!e)return!0;if(e===t)return!1;const r=new Map(n.map(o=>[o.id,o]));if(!r.has(e)||t&&pt(e,t,r))return!1;const i=dt(e,r),a=t?te(t,n):1;return i+a<=ee}function pt(e,t,n){const r=new Set;let i=n.get(e)?.parentId;for(;i;){if(i===t)return!0;if(r.has(i))return!1;r.add(i),i=n.get(i)?.parentId}return!1}function te(e,t,n=new Set){if(n.has(e))return 1;n.add(e);const r=t.filter(i=>i.parentId===e);return r.length?1+Math.max(...r.map(i=>te(i.id,t,n))):1}const ft="en";function mt(e){return e.defaultLocale||e.locale||ft}function $r(e){const t=new Set,n=[];for(const r of[mt(e),...e.locales??[]])!r||t.has(r)||(t.add(r),n.push(r));return n}function Kr(e,t,n){const r=e.translations??[];return r.find(i=>i.locale===t)?.name??(n?r.find(i=>i.locale===n)?.name:void 0)??e.name}const j=["lookup","condition","parallel","for-each"];function Y(e){for(const t of e){if(!j.includes(t.type))return`staptype "${t.type}" mag niet meelezen (alleen ${j.join(", ")})`;if(t.type==="parallel")for(const n of t.branches??[]){const r=Y(n);if(r)return r}if(t.type==="for-each"){const n=Y(t.body??[]);if(n)return n}}return null}function Br(e,t){switch(e.kind){case"org":return!0;case"team":return!!t.teamId&&e.teamId===t.teamId;case"personal":return e.userId===t.userId}}function Gr(e,t){return e.filter(n=>n.enabled&&Br(n.ownerScope,t))}function Fr(e){return e.credentialScope?e.credentialScope:(e.authMode??"header")==="header"||e.oauth?.scope==="org"?"shared":"per-user"}function Hr(e){return`mcp__${e}__`}const Wr=1e3,Vr=2e3,jr=500,Yr=12e3,Xr=4e3,gt=["contact","company","work_item"];function zr(e){if(!e)return!1;const t=e.slice(0,e.indexOf(":"));return gt.includes(t)}const qr="onboarding-source",Jr=["support","billing","availability","sales","onboarding"],Zr=["keep","replace"];function ht(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function Qr(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 r=t.slice(0,n),i=t.slice(n+1).trim();if(i){if(r==="user")return{kind:"user",userId:i};if(r==="team")return{kind:"team",teamId:i}}}function At(e){return ht(e)}function Et(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"}}}const St=Et;function ei(e){return e.agentId?{kind:"user",userId:e.agentId}:St(e.ownerScope)}function ti(e){return At(e)}function ni(e,t){if(!t)return;let n=e;for(const r of t.split(".")){if(n===null||typeof n!="object")return;n=n[r]}return n}function ri(e,t){return e.targets.find(n=>n.activityTypes.includes(t))}function ii(e,t){if(t)return e.targets.find(n=>n.id===t)}function yt(e){return e?.kind==="assignment"}function ai(e){const{trigger:t,agentId:n,target:r,activityType:i,assigneeUserId:a,authorUserId:o}=e;return yt(t)?n?r?r.activityTypes.includes(i)?a?a!==n?"assigned to someone else":o&&o===n?"the agent assigned this to itself, which would restart its own run":null:`no assignee found at ${r.assigneePath}`:`activity type ${i} does not announce an assignment for ${r.id}`:`assignment target kind "${t.targetKind}" is not declared by any installed app`:"this playbook has no agent, so an assignment can never be for it":"trigger is not an assignment trigger"}function oi(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const si=[{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:"itemId",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:"toCategory",type:"string"},{name:"contactId",type:"string"},{name:"companyId",type:"string"},{name:"assigneeUserId",type:"string"}],ci={topics:[{name:"topicId",type:"string"},{name:"topic",type:"string"},{name:"confidence",type:"number"},{name:"reasoning",type:"string"}],question:[{name:"answer",type:"boolean"},{name:"reasoning",type:"string"}],extract:[]};function _t(e){return`${e.type}:${e.id}`}const Tt="interaction";function It(e){return e?.type===Tt?e.id:void 0}const bt=64,Mt=8e3;function li(e){const t=typeof e=="number"?e:Number(String(e??"").trim());if(!(!Number.isFinite(t)||t<=0))return Math.min(Math.max(Math.round(t),bt),Mt)}const ui={kind:"workflow",steps:[]};function di(e){return e?.kind==="workflow"?e.steps:[]}function pi(e){return e?.kind==="procedure"?e.procedure:void 0}function Ot(e){const t=e?.approved??0,n=t+(e?.rejected??0);return{total:n,rate:n?t/n:0}}const Rt=10,Ct=.9;function fi(e){const{total:t,rate:n}=Ot(e);return t>=Rt&&n>=Ct}const wt=["done","escalated","failed","stopped"];function mi(e){return wt.includes(e)}function Nt(e){return e==="waiting"}function gi(e){return e==="running"||Nt(e)}function ne(e){return e.subjectKind&&e.subjectId?{type:e.subjectKind,id:e.subjectId}:void 0}function hi(e){const t=ne(e);return t?_t(t):void 0}function Ai(e){return It(ne(e))}function Ei(e,t){const n=e.accumulatedSeconds||0;return e.runningSince?n+Math.max(0,Math.floor((t-e.runningSince)/1e3)):n}function Si(e,t){const n=Math.max(1,Math.ceil(Math.max(0,e)/60));if(!t||t==="exact")return n*60;const r=Number(t);return!Number.isFinite(r)||r<=0?n*60:Math.ceil(n/r)*r*60}function yi(e){const t=Math.max(0,Math.round(e/60));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function _i(e){const t=Math.max(0,Math.floor(e)),n=a=>String(a).padStart(2,"0"),r=Math.floor(t/60)%60,i=Math.floor(t/3600);return i>0?`${i}:${n(r)}:${n(t%60)}`:`${n(r)}:${n(t%60)}`}function kt(e){return(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,48).replace(/^-+|-+$/g,"")}function Ti(e,t){const n=kt(e)||"werksoort",r=new Set(t);if(!r.has(n))return n;for(let i=2;i<500;i++){const a=`${n}-${i}`;if(!r.has(a))return a}return`${n}-${r.size+1}`}function Ii(e,t){const n=e.ownerScope;return!n||n.kind==="org"?!0:t.includes(n.teamId)}function bi(e){return e.filter(t=>!t.archived).sort(vt)}function vt(e,t){const n=(e.order??0)-(t.order??0);return n!==0?n:(e.label||"").localeCompare(t.label||"")}const Dt=20,Lt=20,R=300;function h(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").replace(/\s+/g," ").trim()}function Pt(e){const t=e.replace(/\s+/g," ").trim();if(t.length<=R)return t;const n=t.slice(0,R),r=Math.max(n.lastIndexOf(". "),n.lastIndexOf("! "),n.lastIndexOf("? "));return r>R*.6?n.slice(0,r+1):`${n.trimEnd()}…`}function Mi(e,t){const n=Pt(t.text),r=h(n);if(!r||(e.examples??[]).some(o=>h(o)===r))return null;const i=e.exampleCandidates??[],a=i.findIndex(o=>h(o.text)===r);if(a>=0){if(i[a].corrected||!t.corrected)return null;const o=[...i];return o[a]={...o[a],corrected:!0,addedAt:t.addedAt},Ee(o)}return Ee([{...t,text:n},...i]).slice(0,Lt)}function Ee(e){return[...e].sort((t,n)=>Number(n.corrected)-Number(t.corrected)||n.addedAt-t.addedAt)}function Oi(e,t){const n=h(t),r=(e.examples??[]).filter(a=>a.trim());return{examples:r.some(a=>h(a)===n)?r:[...r,t].slice(-Dt),exampleCandidates:xt(e,t)}}function xt(e,t){const n=h(t);return(e.exampleCandidates??[]).filter(r=>h(r.text)!==n)}function Ut(e,t){const n=e.ownerScope;return n?n.kind==="org"?!0:n.kind==="team"?!!t&&n.teamId===t:!1:!1}function Ri(e,t){return e.filter(n=>Ut(n,t))}function Ci(e){return e.type==="agent"}const wi="WORK_COMMENT_ADDED",Ni="WORK_ITEM_ASSIGNED",ki="WORK_ITEM_STATUS_CHANGED";function vi(e,t){const n=r=>{const i=new Date(r);return i.setHours(0,0,0,0),i.getTime()};return Math.round((n(e)-n(t))/Xe)}function Di(e,t){if(e.closedAt!=null)return{score:g,reasons:[]};const n=t.remindersById?.[e.id];if(n&&n.remindAt>t.now)return{score:g,reasons:[]};let r=0;const i=[],a=e.priority??"normal";if(E[a]>0&&(r+=E[a],i.push(`priority:${a}`)),typeof e.dueDate=="number"){const o=vi(e.dueDate,t.now);o<0?(r+=35,i.push("overdue")):o===0&&(r+=20,i.push("due-today"))}return e.source?.initiator==="system"&&e.source.systemReason&&(r+=15,i.push(`auto:${e.source.systemReason}`)),{score:r,reasons:i}}const $t="work_item",Kt="work_project";function Bt(e){return`${$t}:${e}`}function re(e){return`${Kt}:${e}`}function Li(e,t,n){const r=`${e}-${t}`;return n?`${r}-${n}`:r}function Pi(e){const t=/^([A-Za-z0-9]{2,8})-(\d+)(?:-(\d+))?$/.exec((e||"").trim());return t?{projectKey:t[1].toUpperCase(),sequenceNumber:Number(t[2]),...t[3]?{subSequence:Number(t[3])}:{}}:null}function xi(e){return(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,3)||"PRJ"}function Ui(e,t=25){const n=new Set([Bt(e.id)]);e.projectId&&n.add(re(e.projectId));for(const r of e.ancestorKeys??[])n.add(r);for(const r of e.partyKeys??[])n.add(r);return Array.from(n).slice(0,t)}function $i(e){return[re(e.id)]}const v=[{key:"open",label:"status_open",category:"todo",order:0},{key:"in_progress",label:"status_in_progress",category:"in_progress",order:1},{key:"done",label:"status_done",category:"done",order:2},{key:"cancelled",label:"status_cancelled",category:"done",order:3}],ie=v.map(e=>e.key);function Gt(e){return e?.statuses?.length?e.statuses:v}function Ft(e,t){return t.find(n=>n.key===e)?.category??"todo"}function Ki(e,t){return t.find(n=>n.key===e)}function Bi(e){const t=Gt(e),n=e?.defaultStatusKey;return n&&t.some(r=>r.key===n)?n:Ht(t)[0]?.key??v[0].key}function Ht(e){return[...e].sort((t,n)=>{const r=(t.order??0)-(n.order??0);return r!==0?r:(t.label||"").localeCompare(n.label||"")})}function Gi(e,t){return Ft(e,t)==="done"}function Wt(e){return(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,48).replace(/^-+|-+$/g,"")}function Fi(e,t){const n=Wt(e)||"status",r=new Set([...t,...ie]);if(!r.has(n))return n;for(let i=2;i<500;i++){const a=`${n}-${i}`;if(!r.has(a))return a}return`${n}-${r.size+1}`}function Hi(e){const t=[];if(!e.length)return[{index:-1,reason:"empty"}];const n=new Set;return e.forEach((r,i)=>{if(!r.key){t.push({index:i,reason:"missing_key"});return}ie.includes(r.key)&&t.push({index:i,reason:"reserved_key",key:r.key}),n.has(r.key)&&t.push({index:i,reason:"duplicate_key",key:r.key}),n.add(r.key)}),e.some(r=>r.category==="todo"||r.category==="in_progress")||t.push({index:-1,reason:"no_open"}),e.some(r=>r.category==="done")||t.push({index:-1,reason:"no_done"}),t}const Wi=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/webp"]),Vi=new Set(["text/plain","text/markdown","text/csv","application/json","text/html","application/xml","text/xml"]);function Vt(e){const t=(e??"").trim().toLowerCase().split(";")[0];return t?Wi.has(t)?"image":t==="application/pdf"?"pdf":Vi.has(t)?"text":t.startsWith("audio/")?"audio":"unsupported":"unsupported"}const A=1024*1024,jt={image:5*A,pdf:20*A,text:1*A,audio:20*A},ji=25*A,Yi=5;function Xi(e,t){const n=Vt(e);return n==="unsupported"?"unsupported":t>jt[n]?"too-large":null}function zi(e){return e.access!=="read"&&e.effect!=="internal"}function Yt(e){return`${e.kind}:${e.id||e.url||e.title}`}function qi(e,t=[]){const n=new Set(t),r=[],i=[];for(const a of e){const o=Yt(a);n.has(o)||(n.add(o),r.push(a),i.push(o))}return{sources:r,keys:i}}const Ji="assist-source",Zi=["blocking","due","open"];function Qi(e,t){const[n,r]=(e.subjectKey??"").split(":");return n===t&&r?r:void 0}const Se={blocking:0,due:1,open:2};function ea(e,t){return Se[e.band??"open"]-Se[t.band??"open"]||(t.priority??0)-(e.priority??0)||e.id.localeCompare(t.id)}function ta(e){return e.sessions.filter(t=>t.id!==e.exceptSessionId&&t.state==="connected"&&e.canHold(t.providerId))}function na(e){return e.sessions.filter(t=>t.id!==e.exceptSessionId&&t.state==="connected"&&!e.canHold(t.providerId))}function ra(e){return e.sessions.some(n=>n.id!==e.exceptSessionId&&(n.state==="connected"||n.state==="on_hold"))?{admit:!1,reason:"busy"}:{admit:!0}}function Xt(e,t){const n=new Set(e.disabledIntents??[]),r=e.intentOverrides??{},i=t.intents.filter(o=>!n.has(o.intent)).map(o=>aa(o,r[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return i;const a=new Set(i.map(o=>o.intent));for(const o of e.extraIntents)a.has(o.intent)||(i.push(o),a.add(o.intent));return i}function zt(e,t){const n={};for(const r of e.intents){if(!r.togglable)continue;const i=t?.[r.intent];n[r.intent]=i??r.defaultEnabled??!0}return n}function ia(e,t){const n=zt(e,t);return Object.entries(n).filter(([,r])=>!r).map(([r])=>r)}function aa(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function oa(e,t){const n=[];for(const r of e){if(!r.enabled)continue;const i=t[r.providerId];if(i)for(const a of Xt(r,i))n.push({channel:r,description:i,capability:a})}return n}function sa(e,t){return t.filter(n=>n.capability.intent===e)}function qt(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function ca(e,t){return qt(e.scheme,t)}function la(e,t,n){const r=[];for(const i of e)for(const a of n)a.capability.intent===t&&a.capability.targetSchemes.includes(i.scheme)&&r.push({channelIntent:a,endpoint:i});return r}var Jt=(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))(Jt||{});const ua={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 da(e){return e?ua[e]??"note":"note"}const pa="message_window",fa="message_templates",ma={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},ga=(e,t)=>({intent:e,...t}),ha="folder_management",Aa="remote_search",Ea={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},Sa="context.collect",ya="installation-id";function _a(e){const t=[];for(const n of Object.keys(e))for(const r of Object.keys(e[n]))t.push({lang:n,key:r,value:e[n][r]});return t}const Ta="notification-source",Ia=(e,t)=>`${e}.pref.${t}`,ba={ai:["account.read","account.write","agent.read","agent.write","assignment.read","assignment.write","budget.read","budget.write","connector.read","connector.write","context.read","context.write","conversation.read","conversation.write","lens.read","lens.write","message.read","message.write","playbook.read","playbook.write","profile.read","profile.write","run.read","run.write","settings.read","settings.write","tool.read","transcript.write","usage.read"],analytics:["report.read"],"app-store":["app.publish","app.read","app.write","setting.read","setting.write"],assist:["board.read"],automations:["sync.read","sync.write","webhook.read","webhook.write"],communication:["account.read","account.write","activity-type.read","activity.read","activity.write","attachment.read","attribute.read","attribute.write","calendar.read","calendar.write","channel.read","channel.write","custom-field.read","custom-field.write","folder.read","folder.write","inbox.read","inbox.write","interaction.read","interaction.write","reminder.read","template.read","template.write","topic.read","topic.write"],context:["kind.read","kind.write","memory.read","memory.write"],crm:["company.read","company.write","contact.read","contact.write"],"eylo-voip":["account.read","account.write","callflow.read","callflow.write","channel.read","channel.write","contact.read","contact.write","device.read","device.write","group.read","group.write","interaction.read","interaction.write","media.read","media.write","menu.read","menu.write","phone-number.read","phone-number.write","recording.read","recording.write","sip.read","temporal-rule.read","temporal-rule.write","user.read","user.write","vmbox.read","vmbox.write","webhook.read","webhook.write"],google:["account.read","account.write","contact.read"],kb:["article.read","article.write","category.read","category.write","help-center.read","help-center.write","kb.read","kb.write"],mail:["account.write"],meta:["account.read","account.write"],microsoft:["account.read","account.write","contact.read","sync.write"],organization:["billing.read","billing.write","settings.read","settings.write","team.read","team.write"],shopify:["account.read","account.write","order.read"],slack:["thread.read","thread.write"],storage:["artifact.read","artifact.write","file.read","file.write","mount.read","mount.write"],time:["entry.read","entry.write","work-type.read","work-type.write"],user:["user.read","user.write"],work:["item.read","item.write","project.read","project.write"]},ae=9e4,Zt=["out_of_office"],Qt=e=>Zt.includes(e);function Ma(e,t,n){const r=n-e<ae,i=t?.status&&(!t.expiresAt||t.expiresAt>n)?t:void 0;if(!i?.status)return{online:r,status:r?"available":"offline"};const a=i.status;return!r&&!Qt(a)?{online:!1,status:"offline"}:{online:r,status:a,message:i.message}}function Oa(e,t){const n=t-e.lastSeenAt<ae,r=n||Qt(e.status)?e.status:"offline";return n===e.online&&r===e.status?e:{...e,online:n,status:r}}function Ra(e,t){return e?.teamId&&t.includes(e.teamId)?{teamId:e.teamId,mustChoose:!1}:t.length===1?{teamId:t[0],mustChoose:!1}:{teamId:void 0,mustChoose:t.length>1}}function Ca(e){return e.providerAvailable&&e.allowed}const wa="resources.describe",Na="resources.search",ka="resources.resolve",va="resources.attached";function Da(e){const t=e.indexOf(":");return t===-1?e:e.slice(0,t)}const oe="auth";function se(e){const t=typeof e=="string"?e.match(/apps\/([^/?#]+)/):null;return t?t[1]:null}function La(e){const t=se(e);return t?t!==oe:typeof e=="string"&&e.startsWith("/wake")}function Pa(e){return typeof e!="string"||e===""||e==="/"?!0:se(e)===oe}function xa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function en(e){const n=e.split("/").filter(Boolean).map(r=>r.startsWith(":")?r.endsWith("?")?"(?:/[^/]+)?":"/[^/]+":`/${xa(r)}`).join("");return new RegExp(`^${n}\\/?$`)}function tn(e,t){const n=e.split("/").filter(Boolean),r=t.split("/").filter(Boolean),i={};return n.forEach((a,o)=>{if(a.startsWith(":")){const s=a.endsWith("?")?a.slice(1,-1):a.slice(1),l=r[o];l&&(i[s]=l)}}),i}function nn(e){return e.publicBasePath??`/apps/${e.name}`}function Ua(e){const t=[];for(const n of e){if(!n?.name)continue;const r=nn(n);for(const i of n.routes??[]){if(!i.public)continue;const a=i.path==="/"?"":i.path;t.push({appName:n.name,resource:i.resource,pattern:`${r}${a}`,props:i.props})}}return t}function rn(e,t){const n=e.split("/").filter(Boolean),r=t.split("/").filter(Boolean);for(let i=0;i<Math.min(n.length,r.length);i++){const a=n[i].startsWith(":"),o=r[i].startsWith(":");if(a!==o)return o}return n.length>r.length}function an(e,t){if(typeof e!="string")return null;let n=null;for(const r of t)en(r.pattern).test(e)&&(!n||rn(r.pattern,n.pattern))&&(n=r);return n?{...n,params:{...n.props,...tn(n.pattern,e)}}:null}function $a(e,t){return an(e,t)!==null}const Ka="sync-source",Ba="sync-target",Ga=20,Fa={afrikaans:["[Muziek]","(C) TV GELDERLAND 2021","*Thomp thomp thomp*","www.youtube.com","ä n wood s","!.."],english:["[applause]","[APPLAUSE]","(claps)","(clapping)","(audience applauds)","(keyboard clicking)","(keyboard clacking)","(clicking)","[CLICK]","[BLANK_AUDIO]","(upbeat music)","(dramatic music)","[music playing]","(electronic music)","(audience cheering)","(audience cheers)","[MUSIC]","( ( ( ( ) ( ) ( ) ( )","(laughs)","(air whooshing)","<u>Transcribed</u> by https://otter.ai","All new tonight at 6... coming up. A new look at your forecast is A new look at your forecast is","www.mooji.org","KATHRYN A new forecast is coming up... A new forecast is coming up...","KATHRYN pandemic started. increasing since the The pandemic has been","A new look at your forecast this morning... A new look at your","We'll be right back.","We'll see you next week.","Thanks for watching!","❤️ Translated by Amara.org Communit"],flemish:["*clap*","TV GELDERLAND 2020","TV Gelderland 2021","(C) TV GELDERLAND 2021","[Muziek]","Kuman","Ondertitels ingediend door de Amara.org gemeenschap","Ondertiteld door de Amara.org gemeenschap","Dank u wel voor het kijken.","Ondertiteling door de Amara.org gemeenschap","GELUID VAN MAHIH U similarly"],french:["(applaudissements)","[Applaudissements]","Sous-titres réalisés par la communauté d'Amara.org","- Bonne journée. - Bonjour.","POP POP הי","Merci d'avoir regardé cette vidéo.","Merci d'avoir regardé cette vidéo!","Merci d'avoir regardé la vidéo.","J'espère que vous avez apprécié la vidéo.","Je vous remercie de vous abonner","Merci d'avoir regardé!","❤️ par SousTitreur.com","— Sous-titrage ST'501 —","Thanks for watching!","Sous-titres réalisés par l'Amara.org","Sous-titres réalisés para la communauté d'Amara.org","Sous-titres réalisés par la communauté d'Amara.org","Sous-titres fait par Sous-titres par Amara.org","Sous-titres réalisés par les SousTitres d'Amara.org","Sous-titres par Amara.org","Sous-titres par la communauté d'Amara.org","Sous-titres réalisés pour la communauté d'Amara.org","Sous-titres réalisés par la communauté de l'Amara.org","Sous-Titres faits par la communauté d'Amara.org","Sous-titres par l'Amara.org","Sous-titres fait par la communauté d'Amara.org","Sous-titrage ST' 501","Sous-titrage ST'501","Cliquez-vous sur les sous-titres et abonnez-vous à la chaîne d'Amara.org","❤️ par SousTitreur.com"],german:["[Klicken]","(Jubel)","*lacht*","[Anhaltender Beifall]","[Applaus]","(Applaus)","* Applaus *","[MUSIK]","* mustard ml Drumglöck und knack in einem Handbewerb *","Untertitelung aufgrund der Amara.org-Community","Untertitel im Auftrag des ZDF für funk, 2017","Untertitel von Stephanie Geiges","Untertitel der Amara.org-Community","Untertitel im Auftrag des ZDF, 2017","Untertitel im Auftrag des ZDF, 2020","Untertitel im Auftrag des ZDF, 2018","Untertitel im Auftrag des ZDF, 2021","Untertitelung im Auftrag des ZDF, 2021","Copyright WDR 2021","Copyright WDR 2020","Copyright WDR 2019","SWR 2021","SWR 2020"],italian:["Alla prossima!","*applauso*","[Musica]","[Musica]","[Applausi]","*Bip bip bip bip*","(musica del NS shore)","D' 1962 alle tribunte del Gulf","Sottotitoli creati dalla comunità Amara.org","Sottotitoli di Sottotitoli di Amara.org","Sottotitoli e revisione al canale di Amara.org","Sottotitoli e revisione a cura di Amara.org","Sottotitoli e revisione a cura di QTSS","Sottotitoli e revisione a cura di QTSS.","Sottotitoli a cura di QTSS","Sottotitoli a cura di Sottotitoli"],spanish:["[música]","[Música de cierre]","[Aplausos]","(Aplausos)","www.alimmenta.com","¡Gracias por ver el vídeo!","(sonidos del celular) (Inudible distorsión)","¡Suscríbete!","Subtítulos realizados por la comunidad de Amara.org","Subtitulado por la comunidad de Amara.org","Subtítulos por la comunidad de Amara.org","Subtítulos creados por la comunidad de Amara.org","Subtítulos en español de Amara.org","Subtítulos hechos por la comunidad de Amara.org","Subtitulos por la comunidad de Amara.org","Más información www.alimmenta.com","www.mooji.org","[MÚSICA]","[Music cuts in British]"]},on=e=>{let t=e;return Object.values(Fa).forEach(n=>{n.forEach(r=>{t=t.replaceAll(r,"")})}),t=t.replace(/\(.*?\)/g,""),t=t.replace(/\[.*?\]/g,""),t},sn=6e4,cn=8e3,ln=2,un=.4,Ha=3,Wa=new Set(["aan","als","ben","bent","bij","dan","dat","deze","die","dit","doen","door","dus","echt","een","eens","even","gaan","gaat","geen","geweest","goed","graag","had","heb","hebben","hebt","heeft","het","hier","hoe","hoor","iets","inderdaad","kan","klopt","kunnen","kunt","maar","mag","mee","meer","met","mij","mijn","misschien","moet","moeten","naar","net","niet","nog","nou","oke","ook","over","prima","toch","uhm","uit","van","veel","voor","wat","weer","weet","wel","wij","wil","wilt","worden","wordt","zeg","zeggen","zijn","zou","zult","about","and","are","been","but","can","does","for","have","just","know","like","not","okay","right","she","that","the","them","then","there","they","this","want","was","well","were","what","will","with","would","yeah","you","your"]);function dn(e){const t=new Set;for(const n of e.toLowerCase().split(/[^a-z0-9À-ɏ]+/))n.length<Ha||Wa.has(n)||t.add(n);return[...t]}function pn(e,t){if(!e.length)return 0;if(!t.length)return 1;const n=new Set(t),r=new Set(e);let i=0;for(const a of r)n.has(a)||(i+=1);return i/r.size}function fn(e,t=sn){const n=e.filter(o=>!o.partial&&typeof o.text=="string");if(!n.length)return{text:"",segmentCount:0};const i=n.reduce((o,s)=>Math.max(o,s.endedAt??0),0)-t;return{text:n.filter(o=>(o.endedAt??0)>=i).map(o=>on(o.text).trim()).filter(Boolean).join(" ").replace(/\s+/g," ").trim(),segmentCount:n.length}}const mn=60;function Va(e,t,n=mn){const r=new Set(e),i=[...e];for(const a of t)!a||r.has(a)||(r.add(a),i.push(a));return i.slice(-n)}function ja(e){const{segments:t,now:n,state:r}=e;if(r.lastTriggerAt&&n-r.lastTriggerAt<cn)return{trigger:!1,reason:"too_soon"};const i=fn(t,e.windowMs);if(!i.text)return{trigger:!1,reason:"no_speech"};const a=i.segmentCount-(r.lastSegmentCount??0);if(r.lastQueryTerms&&a<ln)return{trigger:!1,reason:"too_few_new"};const o=dn(i.text);return o.length?r.lastQueryTerms?.length&&pn(o,r.lastQueryTerms)<un?{trigger:!1,reason:"same_topic"}:{trigger:!0,text:i.text,terms:o,segmentCount:i.segmentCount}:{trigger:!1,reason:"no_speech"}}const Ya=["personal","workspace","connections","work","ai"],Xa="navNotice",D={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}},gn="NL",za=15,qa=8,Ja=Array.from(new Set(Object.values(D).map(e=>e.callingCode))).sort((e,t)=>t.length-e.length);function ye(e){if(e)return D[e.trim().toUpperCase()]}function C(e,t){return e.length>=t.nsnMin&&e.length<=t.nsnMax}function _e(e){if(e.length>za)return null;for(const t of Ja){if(!e.startsWith(t))continue;const n=e.slice(t.length);for(const r of Object.values(D)){if(r.callingCode!==t)continue;const i=r.trunkPrefix,a=i&&n.startsWith(i)?n.slice(i.length):n;if(C(a,r))return`+${t}${a}`}return null}return e.length<qa?null:`+${e}`}function Za(e){let t=e.trim();const n=t.match(/^(sips?|tel|whatsapp):/i);n&&(t=t.slice(n[0].length));const r=t.indexOf("@");return r>=0&&(t=t.slice(0,r)),t.trim()}function Qa(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 X(e,t){if(!e)return null;const n=Za(e);if(!n)return null;const r=n.startsWith("+"),i=n.replace(/\D/g,"");if(!i)return null;if(r)return _e(i);if(i.startsWith("00"))return _e(i.slice(2));const a=ye(t)??ye(gn);if(!a)return null;const o=a.trunkPrefix;if(o&&i.startsWith(o)){const s=i.slice(o.length);return C(s,a)?`+${a.callingCode}${s}`:null}if(i.startsWith(a.callingCode)){const s=i.slice(a.callingCode.length);if(C(s,a))return`+${a.callingCode}${s}`}return!o&&C(i,a)?`+${a.callingCode}${i}`:null}function eo(e,t=9){const n=(e??"").replace(/\D/g,"");return n.length<t?null:n.slice(-t)}function ce(e){if(!e)return null;const t=e.trim().toLowerCase(),n=t.lastIndexOf("@");if(n<=0||n===t.length-1)return null;const r=t.slice(0,n).split("+")[0],i=t.slice(n+1);return!r||!i.includes(".")?null:`${r}@${i}`}function to(e){const t=ce(e);return t?t.slice(t.lastIndexOf("@")+1):null}const no=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function hn(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 no.has(n)&&t.length>=3?t.slice(-3).join("."):n}const An=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 ro(e){const t=hn(e);return t?An.has(t):!1}function io(e){if(!e)return!1;const t=e.trim().toLowerCase();return t==="tel"||t==="sms"||t==="whatsapp"||t==="fax"}function ao(e,t,n){if(!e||!t)return null;const r=e.trim().toLowerCase();if(r==="tel"||r==="sms"||r==="whatsapp"){const a=X(t,n);return a?`tel:${a}`:null}if(r==="fax"){const a=X(t,n);return a?`fax:${a}`:null}if(r==="mailto"||r==="email"){const a=ce(t);return a?`mailto:${a}`:null}const i=t.trim().toLowerCase();return i?`${r}:${i}`:null}const oo=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,so=/(\*|_)(?=\S)([^*_\n]*?\S)\1/g;function co(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
9
  `),t=t.replace(oo,"$2"),t=t.replace(so,"$2"),t=t.replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1"),t=t.replace(/`([^`\n]+)`/g,"$1"),t.replace(/\s+/g," ").trim()}const lo=[/<blockquote/i,/class="?gmail_quote/i,/id="?[^"]*divRplyFwdMsg/i,/id="?[^"]*mail-editor-reference-message-container/i,/-{3,}\s*Original Message\s*-{3,}/i,/\n_{5,}\s*\n/,/\bOn\b[\s\S]{0,200}?\bwrote:/i],Te=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,uo=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function po(e){const t=e.split(`
10
10
  `);for(let n=0;n<t.length;n++)if(uo.test(t[n])||Te.test(t[n])&&t.slice(n+1,n+4).some(r=>Te.test(r)))return t.slice(0,n).join(`
package/dist/index.js CHANGED
@@ -1215,10 +1215,7 @@ function Vr(e, t) {
1215
1215
  function ft(e, t) {
1216
1216
  return e.lastActivityAt ? !(e.seenBy ?? []).includes(t) : !1;
1217
1217
  }
1218
- const mt = [
1219
- "open",
1220
- "pending"
1221
- ], gt = 1e3, ht = {
1218
+ const mt = ["open"], gt = 1e3, ht = {
1222
1219
  urgent: 1,
1223
1220
  high: 4,
1224
1221
  normal: 8,
@@ -45,6 +45,8 @@ export interface AssistNudge extends AssistRanked {
45
45
  snoozeAction?: string;
46
46
  /** Where "done" posts, as an invoke action. Same rule as `snoozeAction`. */
47
47
  resolveAction?: string;
48
+ /** Where "hand to a colleague" posts `{ userId }`, as an invoke action. Same rule. */
49
+ assignAction?: string;
48
50
  /**
49
51
  * Federated resource that draws this nudge's body in the queue, as `"<app>:<Component>"`.
50
52
  * Handed {@link AssistCardProps}. Absent = the queue falls back to `text` plus a button to `url`.
@@ -51,6 +51,8 @@ export interface AppSwitcherPlacement {
51
51
  order?: number;
52
52
  /** Also offer the app in the mobile tab bar. Core apps are there by default. */
53
53
  mobile?: boolean;
54
+ /** Permissions the reader needs before the app is listed at all (`"<app>.<resource>.<action>"`). */
55
+ permissions?: string[];
54
56
  }
55
57
  export interface AppManifest<_TSDK = any> {
56
58
  /**
@@ -12,6 +12,11 @@ export interface MenuItem {
12
12
  group?: string;
13
13
  /** The required capabilities of the menu item. */
14
14
  requiredCapabilities?: string[];
15
+ /**
16
+ * Permissions (`"<app>.<resource>.<action>"`) the reader needs to see this item. All must hold.
17
+ * Absent = visible to everyone. Read `docs/ROLES.md` for the vocabulary.
18
+ */
19
+ permissions?: string[];
15
20
  }
16
21
  export interface NamespacedMenuItem extends MenuItem {
17
22
  /** The namespace of the menu item. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.198.0",
3
+ "version": "1.198.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",