import{aa as n,ab as c}from"./_applist-tangy-colts-beg-36.js";import{aR as p,_ as a}from"./main-tangy-colts-beg.js";import{s as h}from"./machine.-tangy-colts-beg-869.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const l=async()=>p("pro_get_all_post_types_jet_engine",void 0,void 0,"GET");globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const i=async t=>{t.setComponent("post-type-id",o=>{o.loading=!0});const{data:e,status:s}=await l();if(s==="error"){t.setComponent("post-type-id",o=>{t.util.isSelectComponent(o)&&(o.status=s,o.loading=!1,o.invalidMessage=e)}),console.error("Failed to fetch post-type");return}t.setComponent("post-type-id",o=>{t.util.isSelectComponent(o)&&(o.options=e,o.loading=!1,o.status=void 0)})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const g=n(({helpers:t})=>({actions:{ON_MACHINE_LOAD:async({$:e})=>{h(e,[{db:"postTypeId",id:"post-type-id"}]),await i(e)},REFETCH_POST_TYPES:async({$:e})=>i(e),SELECT_POST_TYPE:async({$:e,e:s})=>{e.setThisComponent(o=>{o.value=s}),e.setDb({postTypeId:s})}},states:{components:[{componentName:t.componentName.select,fieldType:"config",id:"post-type-id",label:a("Post-types"),onChange:"SELECT_POST_TYPE",onRefetch:"REFETCH_POST_TYPES",options:[],placeholder:a("Select a post-type"),render:!0,value:void 0},{componentName:t.componentName.hookListener,fieldType:"config",id:"hook-listener",label:a("Listen Hook"),render:({$:e})=>{var s;return c((s=e.getComponent("post-type-id"))==null?void 0:s.value)}}]}}));export{g as default};
