import{aa as c,ab as l}from"./_applist-tangy-colts-beg-36.js";import{_ as o}from"./main-tangy-colts-beg.js";import{s as d}from"./machine.-tangy-colts-beg-869.js";import{f as i}from"./machineh-tangy-colts-beg-95.js";import{h as s,c as p}from"./notionco-tangy-colts-beg-866.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 N=c(({helpers:n})=>({states:{components:[p(n),{componentName:n.componentName.select,fieldType:"config",id:"page-id",label:o("Parent Page"),onChange:"SELECT_PAGE",onRefetch:"REFETCH_PAGE",optionFilterProp:"label",options:[],placeholder:o("Select a Page"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{componentName:n.componentName.mixInput,fieldType:"config",helperText:o("The title of the database."),id:"title-id",label:o("Title"),onChange:"SELECT_TITLE",placeholder:o("Enter the title of the database"),render:"IF_CONNECTION_SELECTED",value:void 0},{addItemButtonLabel:"Add Column",componentName:n.componentName.repeaterField,fieldsMetaData:[{componentName:n.componentName.select,label:o("Field"),name:"notionField",options:[{label:o("Title"),value:"title"},{label:o("Rich Text"),value:"rich_text"},{label:o("People"),value:"people"},{label:o("Date"),value:"date"},{label:o("Email"),value:"email"},{label:o("Url"),value:"url"},{label:o("Checkbox"),value:"checkbox"}],required:!1,style:{width:200},value:void 0},{componentName:n.componentName.mixInput,label:o("Value"),name:"value",required:!0,value:[],wrapperClassName:"w-100"}],id:"field-properties",label:o("Properties"),onChange:"ON_CHANGE_FIELD",path:"FieldProperties",render:"IF_PAGE_ID_SELECTED",value:[]}]},actions:{IF_CONNECTION_SELECTED:({$:e})=>{var a;return l((a=e.getComponent("connection-id"))==null?void 0:a.value)},IF_PAGE_ID_SELECTED:({$:e})=>{var a;return l((a=e.getComponent("page-id"))==null?void 0:a.value)},ON_CHANGE_FIELD:({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a}),e.setDb(t=>{t.FieldProperties=a})},ON_MACHINE_LOAD:async({$:e})=>{d(e,[{db:"connectionId",id:"connection-id"},{db:"pageId",id:"page-id"},{db:"titleId",id:"title-id"},{db:"FieldProperties",id:"field-properties"}]),await i(e)},REFETCH_PAGE:async({$:e})=>{await i(e)},SELECT_PAGE:async({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a}),e.setDb(t=>{t.pageId=a})},SELECT_TITLE:async({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a}),e.setDb(t=>{t.titleId=a})},SET_CONNECTION:async({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a}),e.setDb(t=>{t.connectionId=a}),await i(e)},CONNECTION_ADD_CHANGE:s}}));export{N as default};
