UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 1.96 kB
var e=/[<>|]/,t=/[\^|>]/,n=/^[A-Z0-9_]+$/,r=/(?<![<\w])@([A-Z][A-Z0-9_]+)/g,i=3e3;function a(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function o(e){return e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&amp;/g,`&`)}function s(e,t={}){return v(e),{...t.emoji===void 0?{}:{emoji:t.emoji},text:e,type:`plain_text`}}function c(e,t={}){return v(e),{text:e,type:`mrkdwn`,...t.verbatim===void 0?{}:{verbatim:t.verbatim}}}function l(e){return y(e,`userId`),`<@${e}>`}function u(e){return y(e,`channelId`),`<#${e}>`}function d(e){return y(e,`userGroupId`),`<!subteam^${e}>`}function f(e){return`<!${e}>`}function p(e,t){return b(e,`url`),t?`<${e}|${a(t)}>`:`<${e}>`}function m(e,t,n,r={}){x(t,`token`);let i=e instanceof Date?Math.floor(e.getTime()/1e3):e;if(!Number.isInteger(i))throw TypeError(`timestamp must be an integer unix timestamp or Date`);return`<!date^${i}^${t}${r.link?`^${S(r.link)}`:``}|${a(n)}>`}function h(e){let t=e;return t=t.replace(/<@([A-Z0-9_]+)\|([^<>]+)>/g,`@$2`),t=t.replace(/<@([A-Z0-9_]+)>/g,`@$1`),t=t.replace(/<#[A-Z0-9_]+\|([^<>]+)>/g,`#$1`),t=t.replace(/<#([A-Z0-9_]+)>/g,`#$1`),t=t.replace(/<(https?:\/\/[^|<>]+)\|([^<>]+)>/g,`[$2]($1)`),t=t.replace(/<(https?:\/\/[^<>]+)>/g,`$1`),t=t.replace(/(?<![_*\\])\*([^*\n]+)\*(?![_*])/g,`**$1**`),t=t.replace(/(?<!~)~([^~\n]+)~(?!~)/g,`~~$1~~`),o(t)}function g(e){return e.replace(/\*\*(.+?)\*\*/g,`*$1*`)}function _(e){return e.replace(r,`<@$1>`)}function v(e){if(e.length<1||e.length>i)throw TypeError(`text must be between 1 and ${i} characters`)}function y(e,t){if(!n.test(e))throw TypeError(`${t} must be a Slack ID`)}function b(t,n){if(e.test(t))throw TypeError(`${n} cannot contain Slack control characters`)}function x(e,n){if(t.test(e))throw TypeError(`${n} cannot contain Slack date control characters`)}function S(e){return x(e,`link`),e}export{m as a,l as c,g as d,h as f,u as i,d as l,s as n,p as o,o as p,a as r,f as s,c as t,_ as u};