import{aa as s,ab as c}from"./_applist-tangy-colts-beg-36.js";import{_ as o}from"./main-tangy-colts-beg.js";import{h as t,s as E}from"./machine.-tangy-colts-beg-869.js";import{e as i,h as C,b as l,c as r,d as m}from"./machineh-tangy-colts-beg-816.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 p=s(({helpers:n})=>({states:{components:[r(n),{allowClear:!0,componentName:n.componentName.select,fieldType:"config",helperText:o("Select the channel for which you want to create an invite."),id:"channel-id",label:o("Select Channel"),onChange:"SELECT_CHANNEL",onRefetch:"REFETCH_CHANNELS",options:[],render:"IF_CONNECTION_SELECTED",required:!0,value:void 0},{componentName:n.componentName.mixInput,helperText:o("Duration of invite in seconds before expiry (0 for never)."),id:"max-age",label:o("Max Age (seconds)"),onChange:"SET_MAX_AGE",path:"max_age",render:"IF_CHANNEL_SELECTED",required:!1,value:[]},{componentName:n.componentName.mixInput,helperText:o("Max number of uses or 0 for unlimited."),id:"max-uses",label:o("Max Uses"),onChange:"SET_MAX_USES",path:"max_uses",render:"IF_CHANNEL_SELECTED",required:!1,value:[]}]},actions:{SET_CONNECTION:async({$:e,e:a})=>{t("connectionId")({$:e,e:a}),await i(e),m(e,n)},CONNECTION_ADD_CHANGE:l,HANDLE_BOT_TOKEN:C,SELECT_CHANNEL:t("channelId"),REFETCH_CHANNELS:({$:e})=>i(e),SET_MAX_AGE:t("maxAge"),SET_MAX_USES:t("maxUses"),IF_CHANNEL_SELECTED:({$:e})=>{var a;return c((a=e.getComponent("channel-id"))==null?void 0:a.value)},IF_CONNECTION_SELECTED:({$:e})=>{var a;return c((a=e.getComponent("connection-id"))==null?void 0:a.value)},ON_MACHINE_LOAD:({$:e})=>{E(e,[{db:"connectionId",id:"connection-id"},{db:"channelId",id:"channel-id"},{db:"maxAge",id:"max-age"},{db:"maxUses",id:"max-uses"}]),i(e)}}}));export{p as default};
