import{aa as m,ab as l}from"./_applist-tangy-colts-beg-36.js";import{_ as a}from"./main-tangy-colts-beg.js";import{s as E}from"./machine.-tangy-colts-beg-869.js";import{a as i}from"./machineh-tangy-colts-beg-552.js";import{h as c,a as o,c as r}from"./slackcom-tangy-colts-beg-679.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(n,e){return this.cache.has(n)?this.cache.get(n):(this.cache.set(n,e),e)}};const T=m(({helpers:n})=>({states:{components:[r(n),{componentName:n.componentName.select,id:"user-id",isLoadable:!0,label:a("User"),onChange:"SET_USER",onLoadData:"ON_LOAD_USER_DATA",onRefetch:"REFETCH_USER",optionFilterProp:"label",options:[],path:"user",placeholder:a("Select a User"),render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:n.componentName.mixInput,helperText:a("Specify text of the message to send."),id:"message",label:a("Message"),onChange:"SET_MESSAGE",path:"text",render:"IF_CONNECTION_SELECTED",required:!0,value:[]},{componentName:n.componentName.switch,fieldType:"config",helperText:a("If you Switch No, this message will appear to come from you. Direct messages are always sent by bots."),id:"is-bot",label:a("Send as a bot?"),onChange:"SET_BOT_FOR_SEND_MESSAGE",path:"as_user",render:"IF_CONNECTION_SELECTED",size:"small",value:!1},{componentName:n.componentName.mixInput,helperText:a("Specify the bot name here, Note that the Specified bot name will appear in Slack only if you are authorized with bot token."),id:"bot-name",label:a("Bot Name"),onChange:"SET_BOT_NAME",path:"username",render:"IF_BOT_SELECTED",value:[]},{componentName:n.componentName.mixInput,helperText:a("Specify the bot icon URL here, Note that the Specified bot icon will appear in Slack only if you are authorized with bot token."),id:"bot-icon",label:a("Bot Icon"),onChange:"SET_BOT_ICON",path:"icon_url",render:"IF_BOT_SELECTED",value:[]},{componentName:n.componentName.mixInput,helperText:a("Self specified, this will upload the given image URL to Slack and attach it to the message separately."),id:"image",label:a("Attach Image by URL"),onChange:"SET_IMAGE_URL",path:"image_url",render:"IF_CONNECTION_SELECTED",value:[]},{componentName:n.componentName.switch,helperText:a("Enable to automatically expand links in this message. For example: turn a YouTube link into a playable widget."),id:"is-auto-expand-links",label:a("Is Auto Expand Links?"),onChange:"SET_AUTO_EXPAND_LINKS",path:"unfurl_links",render:"IF_CONNECTION_SELECTED",size:"small",value:!1},{componentName:n.componentName.switch,helperText:a("If Switch No, any usernames and channels mentioned would not be linked (or mentioned). Also affects @channel and @group."),id:"link-names",label:a("Link Usernames and Channel Names?"),onChange:"SET_LINK_NAME",path:"link_names",render:"IF_CONNECTION_SELECTED",size:"small",value:!1},{componentName:n.componentName.mixInput,helperText:a("Enter the time (as a Unix timestamp) when the message should be sent."),id:"schedule-at",label:a("Schedule At"),onChange:"SET_SCHEDULE",path:"post_at",render:"IF_CONNECTION_SELECTED",value:[]}]},actions:{SET_CONNECTION:async({$:e,e:t})=>{o("connection")({$:e,e:t}),await i(e)},IF_CONNECTION_SELECTED:({$:e})=>{var t;return l((t=e.getComponent("connection-id"))==null?void 0:t.value)},IF_BOT_SELECTED:({$:e})=>{var t,s;if(l((t=e.getComponent("connection-id"))==null?void 0:t.value)&&((s=e.getComponent("is-bot"))==null?void 0:s.value)===!0)return!0},REFETCH_USER:async({$:e})=>{await i(e),e.setComponent("user-id",t=>{e.util.isSelectComponent(t)&&(t.isLoadable=!0)})},ON_LOAD_USER_DATA:({$:e,e:t})=>i(e,t.count),SET_USER:o("user"),SET_MESSAGE:o("message"),SET_BOT_FOR_SEND_MESSAGE:o("bot"),SET_IMAGE_URL:o("imageUrl"),SET_AUTO_EXPAND_LINKS:o("autoExpand"),SET_LINK_NAME:o("linkName"),SET_SCHEDULE:o("schedule"),SET_BOT_NAME:o("botName"),SET_BOT_ICON:o("botIcon"),CONNECTION_ADD_CHANGE:c,ON_MACHINE_LOAD:async({$:e})=>{var t;E(e,[{db:"connection",id:"connection-id"},{db:"user",id:"user-id"},{db:"message",id:"message"},{db:"bot",id:"is-bot"},{db:"imageUrl",id:"image"},{db:"autoExpand",id:"is-auto-expand-links"},{db:"linkName",id:"link-names"},{db:"schedule",id:"schedule-at"},{db:"botName",id:"bot-name"},{db:"botIcon",id:"bot-icon"}]),(t=e.db)!=null&&t.connection&&await i(e)}}}));export{T as default};
