function g(){import.meta.url,import("_").catch(()=>1),async function*(){}().next()}const{__:n}=wp.i18n;function m(t){return t.reduce((r,e)=>{var a;if(!e.value)return r;if(e.name.endsWith("[]")){const s=e.name.slice(0,-2);r[s]=(a=r[s])!=null?a:[],r[s].push(e.value)}else r[e.name]=e.value;return r},{})}function p(t,o){jQuery("#name").val(t),jQuery("#description").val(o)}function h(t,o){jQuery("#tag-name").val(t),jQuery("#tag-description").val(o)}const u={1:{product_name:n("Product Name","storeagent-ai-for-woocommerce")},2:{"tones[]":n("Tones","storeagent-ai-for-woocommerce")},3:{"characteristics[]":n("Common Characteristics","storeagent-ai-for-woocommerce")},4:{"age_focus[]":n("Age Focus","storeagent-ai-for-woocommerce")},5:{"target_audiences[]":n("Target Audience","storeagent-ai-for-woocommerce")},6:{"keywords[]":n("Keywords","storeagent-ai-for-woocommerce")}};function l(t){const o=t.data("step"),r=u[o]||{},e={};return Object.entries(r).forEach(([a,s])=>{const c=t.find('[name="'.concat(a,'"]'));if(c.length)if(a.endsWith("[]"))c.is(":checkbox")?c.filter(":checked").length===0&&(e[a]=n("Please select at least one ".concat(s," option"),"storeagent-ai-for-woocommerce")):c.map((f,d)=>jQuery(d).val()).get().filter(Boolean).length===0&&(e[a]=n("Please input at least one ".concat(s),"storeagent-ai-for-woocommerce"));else{const i=c.val();(!i||typeof i=="string"&&i.trim()==="")&&(e[a]=n("".concat(s," is required"),"storeagent-ai-for-woocommerce"))}}),{isValid:Object.keys(e).length===0,errors:e}}function y(t){const o={};return Object.keys(u).forEach(r=>{const e=t.find(".saai-category-description-form-step-".concat(r)),a=l(e);Object.assign(o,a.errors)}),{isValid:Object.keys(o).length===0,errors:o}}export{u as S,g as __vite_legacy_guard,l as a,h as b,m as p,p as u,y as v};
