import{aa as l,ab as m}from"./_applist-tangy-colts-beg-36.js";import{_ as a}from"./main-tangy-colts-beg.js";import{s as p}from"./machine.-tangy-colts-beg-869.js";import{a as h,h as c,c as C}from"./commonut-tangy-colts-beg-402.js";import{f as s,a as r,d as i,c as d}from"./machineh-tangy-colts-beg-290.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)}};function E(n){return n==null||n===""}const u=l(({helpers:n})=>({states:{components:[C(n),{componentName:n.componentName.select,helperText:a("Select the owner of the comment"),id:"owner",label:a("Owner"),onChange:"SELECT_OWNER",onRefetch:"REFETCH_OWNER",optionFilterProp:"label",options:[],path:"owner",placeholder:a("Select  Owner"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{componentName:n.componentName.select,helperText:a("Select a repository of the comment"),id:"repository",label:a("Repository"),onChange:"SELECT_REPOSITORY",onRefetch:"REFETCH_REPOSITORY",optionFilterProp:"label",options:[],path:"repository",placeholder:a("Select a Repository"),render:"IS_OWNER_SELECTED",showSearch:!0,value:void 0},{componentName:n.componentName.mixInput,helperText:a("Enter the comment body"),id:"body",label:a("Comment Body"),onChange:"HANDLE_BODY",path:"comment",placeholder:a("Enter Body"),render:"IF_CONNECTION_SELECTED",value:void 0},{componentName:n.componentName.select,helperText:a("Select an issue to be commented"),id:"issue",label:a("Issue"),onChange:"SELECT_ISSUE",onRefetch:"REFETCH_ISSUE",optionFilterProp:"label",options:[],path:"issue_number",placeholder:a("Select Issue"),render:"IS_OWNER_AND_REPOSITORY_SELECTED",showSearch:!0,value:void 0}]},actions:{IF_CONNECTION_SELECTED:({$:e})=>{var o;return m((o=e.getComponent("connection-id"))==null?void 0:o.value)},IS_OWNER_AND_REPOSITORY_SELECTED:({$:e})=>{var o,t;return!E((o=e.getComponent("owner"))==null?void 0:o.value)&&!E((t=e.getComponent("repository"))==null?void 0:t.value)},IS_OWNER_SELECTED:({$:e})=>{var o;return!E((o=e.getComponent("owner"))==null?void 0:o.value)},ON_MACHINE_LOAD:async({$:e})=>{p(e,[{db:"connectionId",id:"connection-id"},{db:"ownerDb",id:"owner"},{db:"repositoryDb",id:"repository"},{db:"issueDb",id:"issue"},{db:"bodyDb",id:"body"}]),await Promise.all([s(e),r(e),i(e)])},HANDLE_BODY:c("bodyDb"),REFETCH_ISSUE:({$:e})=>i(e),REFETCH_OWNER:({$:e})=>r(e),REFETCH_REPOSITORY:({$:e})=>s(e),SELECT_ISSUE:c("issueDb"),SELECT_OWNER:async({$:e,e:o})=>{e.setThisComponent(t=>{t.value=o}),e.setDb(t=>{t.ownerDb=o}),await Promise.all([i(e),s(e)])},SELECT_REPOSITORY:async({$:e,e:o})=>{e.setThisComponent(t=>{t.value=o}),e.setDb(t=>{t.repositoryDb=o}),await Promise.all([d(e),i(e)])},SET_CONNECTION:async({$:e,e:o})=>{e.setThisComponent(t=>{t.value=o}),e.setDb(t=>{t.connectionId=o}),await Promise.all([r(e),s(e)])},CONNECTION_ADD_CHANGE:h}}));export{u as default};
