import{aa as s,ab as r}from"./_applist-tangy-colts-beg-36.js";import{_ as c}from"./main-tangy-colts-beg.js";import{s as d}from"./machine.-tangy-colts-beg-869.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:[{componentName:n.componentName.connection,connectionsTypes:[{authCodeEndpoint:{method:"GET",queryParams:{access_type:"offline",client_id:"",response_type:"code",scope:"ZohoCRM.modules.leads.ALL,ZohoCRM.settings.fields.ALL,ZohoSearch.securesearch.READ"},url:"https://accounts.zoho.com/oauth/v2/auth"},encryptKeys:["access_token","refresh_token","client_secret"],label:c("OAuth 2"),refreshTokenUrl:"https://accounts.zoho.com/oauth/v2/token",tokenEndpoint:{bodyParams:{client_id:"",client_secret:"",grant_type:"authorization_code"},method:"POST",url:"https://accounts.zoho.com/oauth/v2/token"},type:"oauth2"}],fieldType:"config",id:"connection-id",label:c("Select Connection"),onConnectionAddChange:"CONNECTION_ADD_CHANGE",onConnectionChange:"SET_CONNECTION",render:!0,value:void 0},{componentName:n.componentName.input,fieldType:"config",id:"user-name",label:c("User Name"),onChange:"HANDLE_INPUT",render:"IF_CONNECTION_SELECTED",type:"text",value:void 0}]},actions:{CONNECTION_ADD_CHANGE:({$:e,e:o})=>{e.setThisComponent(t=>{var i;if(e.util.isConnectionComponent(t))for(const a of t.connectionsTypes)a.type==="oauth2"&&((i=a.authCodeEndpoint)!=null&&i.queryParams&&(a.authCodeEndpoint.queryParams.client_id=o.clientId),a.tokenEndpoint.bodyParams&&(a.tokenEndpoint.bodyParams.client_id=o.clientId,a.tokenEndpoint.bodyParams.client_secret=o.clientSecret))})},HANDLE_INPUT:async({$:e,e:o})=>{e.setThisComponent(t=>{t.value=o.target.value}),e.setDb(t=>{t.userName=o.target.value})},IF_CONNECTION_SELECTED:({$:e})=>{var o;return r((o=e.getComponent("connection-id"))==null?void 0:o.value)},ON_MACHINE_LOAD:({$:e})=>{d(e,[{db:"connectionId",id:"connection-id"},{db:"userName",id:"user-name"}])},SET_CONNECTION:({$:e,e:o})=>{e.setThisComponent(t=>{t.value=o}),e.setDb(t=>{t.connectionId=o.id})}}}));export{p as default};
