import{T as d}from"./TaskCreateDialog-BSGqPjjd.chunk.mjs";import{d as u,s as g,e as m,g as p}from"./index-VLl5aIR_.chunk.mjs";const k=(n,e={})=>new Promise((c,o)=>{const s=document.createElement("div");document.getElementById("body-user").append(s);const t=u(n,{...e,onClose(){t.$el.remove(),o(new Error("Selection canceled"))}}).use(g).mount(s)});window.addEventListener("DOMContentLoaded",()=>{window.OCA?.Talk?.registerMessageAction&&window.OCA.Talk.registerMessageAction({label:m("tasks","Create a task"),icon:"icon-tasks",async callback({message:{message:n,messageParameters:e,actorDisplayName:c},metadata:{name:o,token:s}}){const t=n.replace(/{[a-z0-9-_]+}/gi,function(r){const a=r.substr(1,r.length-2);if(e[a]){if(e[a].type==="file"&&e[a].path)return e[a].path;if(e[a].type==="user"||e[a].type==="call")return"@"+e[a].name;if(e[a].name)return e[a].name}return r}),i=t.replace(/^(.{255}[^\s]*).*/,"$1"),l=i===""?t.substr(0,255):i;try{await k(d,{summary:l,description:t+`

[`+m("tasks","Message from {author} in {conversationName}",{author:c,conversationName:o})+"]("+p("/call/"+s)+")"})}catch{console.debug("Task creation dialog was canceled")}}})});
//# sourceMappingURL=tasks-talk.mjs.map
