import{aa as p}from"./_applist-tangy-colts-beg-36.js";import{_ as e}from"./main-tangy-colts-beg.js";import{h as o,s as c,a as u}from"./machine.-tangy-colts-beg-869.js";import{p as l}from"./commonut-tangy-colts-beg-731.js";import{b as n,c as i,d as r}from"./machineh-tangy-colts-beg-680.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,a){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,a),a)}};const N=p(({helpers:t})=>({states:{components:[{componentName:t.componentName.select,fieldType:"config",id:"product-type",label:e("Product Type"),onChange:"HANDLE_PRODUCT_TYPE",options:[{label:e("Physical Product"),value:"physical"},{label:e("Digital Product"),value:"digital"}],placeholder:e("Select a product type"),render:!0,required:!0,value:void 0},{componentName:t.componentName.switch,fieldType:"config",id:"manage-downloadable",label:e("Enable Downloadable Management"),onChange:"HANDLE_MANAGE_DOWNLOADABLE",render:"SHOULD_SHOW_MANAGE_DOWNLOADABLE",size:"small",value:void 0},{componentName:t.componentName.select,id:"product-status",label:e("Product Status"),onChange:"HANDLE_PRODUCT_STATUS",options:[{label:e("Publish"),value:"publish"},{label:e("Draft"),value:"draft"}],path:"product_status",placeholder:e("Select a product status"),render:!0,value:void 0},{componentName:t.componentName.select,fieldType:"config",id:"product-categories",label:e("Product Categories"),mode:"multiple",onChange:"HANDLE_PRODUCT_CATEGORIES",onRefetch:"REFETCH_PRODUCT_CATEGORIES",options:[],placeholder:e("Select a product category"),render:!0,value:void 0},{componentName:t.componentName.select,fieldType:"config",id:"product-brands",label:e("Product Brands"),mode:"multiple",onChange:"HANDLE_PRODUCT_BRANDS",onRefetch:"REFETCH_PRODUCT_BRANDS",options:[],placeholder:e("Select a product brand"),render:!0,value:void 0},{componentName:t.componentName.select,fieldType:"config",id:"shipping-class",label:e("Shipping Class"),onChange:"HANDLE_SHIPPING_CLASS",onRefetch:"REFETCH_SHIPPING_CLASS",options:[],placeholder:e("Select a shipping class"),render:!0,value:void 0},{addItemButtonLabel:e("Add Field"),componentName:t.componentName.repeaterField,fieldsMetaData:[{componentName:t.componentName.select,label:e("Product Field"),name:"product_field",options:l,placeholder:e("Select a product field"),required:!0,value:"",wrapperClassName:"w-100"},{componentName:t.componentName.mixInput,label:e("Value"),name:"value",placeholder:e("Enter a value"),required:!0,value:[],wrapperClassName:"w-100"}],id:"field-map",label:e("Fields Mapping"),onChange:"HANDLE_FIELD_MAPPING",path:"field_map",render:!0,value:[]},{componentName:t.componentName.mixInput,fieldType:"config",id:"featured-media-id",label:e("Featured Media ID"),onChange:"HANDLE_FEATURED_MEDIA_ID",placeholder:e("Enter a featured media ID"),render:!0,value:void 0},{componentName:t.componentName.mixInput,fieldType:"config",id:"gallery-image-ids",label:e("Gallery Image IDs"),onChange:"HANDLE_GALLERY_IMAGE_IDS",placeholder:e("Enter comma separated IDs. Example: 23,45,67"),render:!0,value:void 0}]},actions:{SHOULD_SHOW_MANAGE_DOWNLOADABLE:({$:a})=>{var d;return((d=a.getComponent("product-type"))==null?void 0:d.value)==="digital"},HANDLE_FEATURED_MEDIA_ID:o("featuredMediaId"),HANDLE_FIELD_MAPPING:o("fieldMap"),HANDLE_GALLERY_IMAGE_IDS:o("galleryImageIds"),HANDLE_MANAGE_DOWNLOADABLE:o("manageDownloadable"),HANDLE_PRODUCT_BRANDS:o("productBrands"),HANDLE_PRODUCT_CATEGORIES:o("productCategories"),HANDLE_PRODUCT_STATUS:o("productStatus"),HANDLE_PRODUCT_TYPE:o("productType"),HANDLE_SHIPPING_CLASS:o("shippingClass"),ON_MACHINE_LOAD:async({$:a})=>{c(a,[{db:"productType",id:"product-type"},{db:"productStatus",id:"product-status"},{db:"manageDownloadable",id:"manage-downloadable"},{db:"productCategories",id:"product-categories"},{db:"productBrands",id:"product-brands"},{db:"shippingClass",id:"shipping-class"},{db:"fieldMap",id:"field-map"},{db:"featuredMediaId",id:"featured-media-id"},{db:"galleryImageIds",id:"gallery-image-ids"}]),u({$:a,componentId:"field-map",dbKey:"fieldMap",fields:l,mapFieldKey:"product_field",mapFieldValue:"value"}),await Promise.all([i(a),r(a),n(a)])},REFETCH_PRODUCT_BRANDS:({$:a})=>r(a),REFETCH_PRODUCT_CATEGORIES:({$:a})=>i(a),REFETCH_SHIPPING_CLASS:({$:a})=>n(a)}}));export{N as default};
