import{aa as r,ab as c}from"./_applist-tangy-colts-beg-36.js";import{_ as e}from"./main-tangy-colts-beg.js";import{s as m}from"./machine.-tangy-colts-beg-869.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(a,o){return this.cache.has(a)?this.cache.get(a):(this.cache.set(a,o),o)}};const N=r(({helpers:a})=>({states:{components:[{addConnectionHelpingText:e('You can get your API key from <a class="text-blue-600 underline" href="https://www.jotform.com/myaccount/api" target="_blank" rel="noopener noreferrer nofollow">here</a>'),componentName:a.componentName.connection,connectionsTypes:[{encryptKeys:["value"],label:e("API Key"),showKey:!1,type:"api_key",verifyConnection:{method:"GET",queryParams:{apiKey:""},responseKeyMatch:["message"],responseMatch:{responseCode:200},url:"https://api.jotform.com/user"}}],fieldType:"config",id:"connection-id",label:e("Select Connection"),onConnectionAddChange:"CONNECTION_ADD_CHANGE",onConnectionChange:"SET_CONNECTION",render:!0,value:void 0},{componentName:a.componentName.mixInput,id:"form-title",label:e("Form"),onChange:"HANDLE_MIX_INPUT",path:"title",render:"IF_CONNECTION_SELECTED",value:void 0},{addItemButtonLabel:"Add Item",componentName:a.componentName.repeaterField,direction:"vertical",fieldsMetaData:[{componentName:a.componentName.mixInput,label:e("Label"),name:"text",required:!0,value:void 0},{componentName:a.componentName.mixInput,label:e("Slug"),name:"name",required:!0,value:void 0},{componentName:a.componentName.select,dropdownStyle:{minWidth:150},label:e("Type"),name:"type",options:[{label:e("Header"),value:"control_head"},{label:e("Full Name"),value:"control_fullname"},{label:e("Email"),value:"control_email"},{label:e("Address"),value:"control_address"},{label:e("Phone"),value:"control_phone"},{label:e("Date Picker"),value:"control_datetime"},{label:e("Signature"),value:"control_signature"},{label:e("Short Text"),value:"control_textbox"},{label:e("Long Text"),value:"control_textarea"},{label:e("Dropdown"),value:"control_dropdown"},{label:e("Single Choice"),value:"control_radio"},{label:e("Multiple Choice"),value:"control_checkbox"},{label:e("Number"),value:"control_number"},{label:e("Image"),value:"control_image"},{label:e("File Upload"),value:"control_fileupload"},{label:e("Time"),value:"control_time"},{label:e("Captcha"),value:"control_captcha"},{label:e("Spinner"),value:"control_spinner"},{label:e("Submit"),value:"control_button"}],required:!0,value:void 0},{componentName:a.componentName.mixInput,label:e("Order"),name:"order",required:!0,value:void 0}],id:"questions",inputGroupProps:{label:e("Question #{COUNT}")},label:e("Questions"),loading:!1,onChange:"ON_CHANGE_QUESTIONS",render:"IF_CONNECTION_SELECTED",value:[]},{componentName:a.componentName.input,id:"form-height",label:e("Form Height"),onChange:"HANDLE_INPUT",path:"height",render:"IF_CONNECTION_SELECTED",type:"number",value:void 0}]},actions:{ON_MACHINE_LOAD:({$:o})=>{m(o,[{db:"connectionId",id:"connection-id"},{db:"formTitle",id:"form-title"},{db:"questions",id:"questions"},{db:"formHeight",id:"form-height"}])},CONNECTION_ADD_CHANGE:({$:o,e:t})=>{o.setThisComponent(n=>{o.util.isConnectionComponent(n)&&n.connectionsTypes.forEach(l=>{var i;l.type==="api_key"&&((i=l.verifyConnection)!=null&&i.queryParams)&&(l.verifyConnection.queryParams.apiKey=t.value)})})},HANDLE_INPUT:({$:o,e:t})=>{o.setThisComponent(n=>{n.value=t.target.value}),o.setDb(n=>{n.formHeight=t.target.value})},HANDLE_MIX_INPUT:({$:o,e:t})=>{o.setThisComponent(n=>{n.value=t}),o.setDb(n=>{n.formTitle=t})},IF_CONNECTION_SELECTED:({$:o})=>{var t;return c((t=o.getComponent("connection-id"))==null?void 0:t.value)},ON_CHANGE_QUESTIONS:({$:o,e:t})=>{o.setThisComponent(n=>{n.value=t}),o.setDb(n=>{n.questions=t})},SET_CONNECTION:({$:o,e:t})=>{o.setThisComponent(n=>{n.value=t}),o.setDb(n=>{n.connectionId=t})}}}));export{N as default};
