import{aa as i}from"./_applist-tangy-colts-beg-36.js";import{_ as t}from"./main-tangy-colts-beg.js";import{i as r,m as s,j as c}from"./import-tangy-colts-beg-35.js";import{s as p}from"./machine.-tangy-colts-beg-869.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(a,e){return this.cache.has(a)?this.cache.get(a):(this.cache.set(a,e),e)}};const C=i(({helpers:a})=>({states:{components:[{allowClear:!0,componentName:a.componentName.connection,connectionsTypes:r,customConnection:!0,fieldType:"config",id:"connection-id",label:t("Connection (optional)"),onConnectionChange:"HANDLE_CONNECTION",render:!0,value:void 0},{componentName:a.componentName.mixInput,fieldType:"config",id:"url",label:t("Request URL"),onChange:"HANDLE_URL",render:!0,required:!0,value:void 0},{componentName:a.componentName.select,fieldType:"config",id:"method",label:t("Method"),onChange:"HANDLE_METHOD",options:s,render:!0,required:!0,value:"GET"},{componentName:a.componentName.select,fieldType:"config",id:"content-type",label:t("Content Type"),onChange:"HANDLE_CONTENT_TYPE",options:c,render:"IF_METHOD_IS_NOT_GET",required:!0,value:"application/json"},{addItemButtonLabel:"Add",componentName:a.componentName.repeaterField,fieldsMetaData:[{componentName:a.componentName.mixInput,name:"key",placeholder:t("Key"),required:!0,value:[],wrapperClassName:"w-full"},{componentName:a.componentName.mixInput,name:"value",placeholder:t("Value"),required:!0,value:void 0,wrapperClassName:"w-full"}],id:"headers",label:t("Headers"),loading:!1,onChange:"HANDLE_HEADERS",render:!0,value:[]},{addItemButtonLabel:"Add",componentName:a.componentName.repeaterField,fieldsMetaData:[{componentName:a.componentName.mixInput,name:"key",placeholder:t("Key"),required:!0,value:[],wrapperClassName:"w-full"},{componentName:a.componentName.mixInput,name:"value",placeholder:t("Value"),required:!0,value:void 0,wrapperClassName:"w-full"}],id:"query-params",label:t("Query Params"),loading:!1,onChange:"HANDLE_QUERY_PARAMS",render:!0,value:[]},{addItemButtonLabel:"Add",componentName:a.componentName.repeaterField,fieldsMetaData:[{componentName:a.componentName.mixInput,name:"key",placeholder:t("Key"),required:!0,value:[],wrapperClassName:"w-full"},{componentName:a.componentName.mixInput,name:"value",placeholder:t("Value"),required:!0,value:void 0,wrapperClassName:"w-full"}],id:"body",label:t("Body"),loading:!1,onChange:"HANDLE_BODY",render:"GET_METHOD_AND_RAW_BODY_ENABLE_CHECK",value:[]},{componentName:a.componentName.switch,fieldType:"config",id:"is-enable-raw-body",label:t("Raw Body"),onChange:"HANDLE_RAW_BODY",render:"IF_CONTENT_TYPE_IS_RAW",value:!1},{componentName:a.componentName.mixInput,fieldType:"config",id:"raw-body-content",label:t(""),onChange:"HANDLE_RAW_BODY_CONTENT",render:"IF_ENABLE_RAW_BODY",required:!1,value:void 0}]},actions:{ON_MACHINE_LOAD:async({$:e})=>{p(e,[{db:"body",id:"body"},{db:"connectionId",id:"connection-id"},{db:"contentType",id:"content-type"},{db:"isEnableRawBody",id:"is-enable-raw-body"},{db:"rawBodyContent",id:"raw-body-content"},{db:"headers",id:"headers"},{db:"method",id:"method"},{db:"queryParams",id:"query-params"},{db:"url",id:"url"}])},HANDLE_RAW_BODY:({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.isEnableRawBody=o})},IF_CONTENT_TYPE_IS_RAW:({$:e})=>{var l,d;const o=["application/json","text/plain","text/html","application/xml"],n=(l=e.getComponent("content-type"))==null?void 0:l.value,m=(d=e.getComponent("method"))==null?void 0:d.value;return o.includes(n)&&m!=="GET"},IF_ENABLE_RAW_BODY:({$:e})=>{var m,l;const o=(m=e.getComponent("is-enable-raw-body"))==null?void 0:m.value,n=(l=e.getComponent("method"))==null?void 0:l.value;return o&&n!=="GET"},IF_METHOD_IS_NOT_GET:({$:e})=>{var o;return((o=e.getComponent("method"))==null?void 0:o.value)!=="GET"},GET_METHOD_AND_RAW_BODY_ENABLE_CHECK:({$:e})=>{var m,l;const o=(m=e.getComponent("method"))==null?void 0:m.value,n=(l=e.getComponent("is-enable-raw-body"))==null?void 0:l.value;return o!=="GET"&&!n},HANDLE_RAW_BODY_CONTENT:({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.rawBodyContent=o})},HANDLE_BODY:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.body=o})},HANDLE_CONNECTION:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.connectionId=o})},HANDLE_CONTENT_TYPE:async({$:e,e:o})=>{e.setThisComponent(m=>{m.value=o}),e.setDb(m=>{m.contentType=o}),["multipart/form-data","application/x-www-form-urlencoded"].includes(o)&&e.setComponent("is-enable-raw-body",m=>{m.value=!1})},HANDLE_HEADERS:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.headers=o})},HANDLE_METHOD:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.method=o})},HANDLE_QUERY_PARAMS:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.queryParams=o})},HANDLE_URL:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.url=o})}}}));export{C as a};
