import{aa as l,ab as s}from"./_applist-tangy-colts-beg-36.js";import{_ as t}from"./main-tangy-colts-beg.js";import{h as n,s as c}from"./machine.-tangy-colts-beg-869.js";import{h as E,c as r}from"./gohighle-tangy-colts-beg-43.js";import{j as T,b as d}from"./machineh-tangy-colts-beg-622.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const u=l(({helpers:o})=>({states:{components:[r(o),{allowClear:!0,componentName:o.componentName.select,fieldType:"config",helperText:t("Select the contact to associate this task with."),id:"contact-id",label:t("Contact"),onChange:"SET_CONTACT_ID",onRefetch:"REFETCH_CONTACTS",optionFilterProp:"label",options:[],render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{allowClear:!0,componentName:o.componentName.select,fieldType:"config",helperText:t("Select the task you want to update."),id:"task-id",label:t("Select Task"),onChange:"SET_TASK_ID",onRefetch:"REFETCH_TASKS",optionFilterProp:"label",options:[],render:"IF_CONTACT_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:o.componentName.mixInput,helperText:t("Enter the title of the task."),id:"task-title",label:t("Title"),onChange:"SET_TASK_TITLE",path:"title",render:"IF_TASK_SELECTED",required:!1,value:[]},{componentName:o.componentName.mixInput,helperText:t("Enter the due date and time in ISO 8601 format (e.g., 2024-12-31T23:59:59Z)."),id:"task-due-date",label:t("Due Date"),onChange:"SET_TASK_DUE_DATE",path:"dueDate",render:"IF_TASK_SELECTED",required:!1,value:[]},{componentName:o.componentName.mixInput,helperText:t("Enter the description or body of the task."),id:"task-body",label:t("Description"),onChange:"SET_TASK_BODY",path:"body",render:"IF_TASK_SELECTED",required:!1,value:[]},{componentName:o.componentName.mixInput,helperText:t("Enter the ID of the user to whom the task is assigned."),id:"task-assigned-to",label:t("Assigned To"),onChange:"SET_TASK_ASSIGNED_TO",path:"assignedTo",render:"IF_TASK_SELECTED",required:!1,value:[]},{componentName:o.componentName.switch,helperText:t("Select whether the task is completed or pending."),id:"task-completed",label:t("Completed"),onChange:"SET_TASK_COMPLETED",path:"completed",render:"IF_TASK_SELECTED",size:"small",value:!1}]},actions:{CONNECTION_ADD_CHANGE:E,IF_CONNECTION_SELECTED:({$:e})=>{var a;return s((a=e.getComponent("connection-id"))==null?void 0:a.value)},IF_CONTACT_SELECTED:({$:e})=>{var a;return s((a=e.getComponent("contact-id"))==null?void 0:a.value)},IF_TASK_SELECTED:({$:e})=>{var a;return s((a=e.getComponent("task-id"))==null?void 0:a.value)},REFETCH_CONTACTS:({$:e})=>d(e),REFETCH_TASKS:({$:e})=>T(e),SET_TASK_ASSIGNED_TO:n("taskAssignedTo"),SET_TASK_BODY:n("taskBody"),SET_TASK_COMPLETED:n("taskCompleted"),SET_TASK_DUE_DATE:n("taskDueDate"),SET_TASK_ID:n("taskId"),SET_TASK_TITLE:n("taskTitle"),SET_CONNECTION:({$:e,e:a})=>{n("connectionId")({$:e,e:a}),d(e)},SET_CONTACT_ID:async({$:e,e:a})=>{n("contactId")({$:e,e:a}),e.setDb(i=>{i.taskId=void 0}),e.setComponent("task-id",i=>{e.util.isSelectComponent(i)&&(i.value=void 0,i.options=[])}),a&&await T(e)},ON_MACHINE_LOAD:async({$:e})=>{c(e,[{db:"connectionId",id:"connection-id"},{db:"contactId",id:"contact-id"},{db:"taskId",id:"task-id"},{db:"taskTitle",id:"task-title"},{db:"taskDueDate",id:"task-due-date"},{db:"taskBody",id:"task-body"},{db:"taskAssignedTo",id:"task-assigned-to"},{db:"taskCompleted",id:"task-completed"}]),await Promise.all([d(e),T(e)])}}}));export{u as default};
