import{k as N,h as u,i as _,r as h,e as p,o as t,d as o,a as f,w as n,c as i,F as y,g as x}from"./vue.esm-bundler.js?ver=1.3.21";const $={class:"fct-multiple-select-group"},C={class:"input-prepend"},E={class:"input-append"},O={__name:"Product",props:{field:{type:Object},value:{type:Object},fieldKey:{type:String}},setup(a){const V=N().ctx,k=a,s=u("include"),v=u([]),B=u([]),w=u([]),r=u(""),g=u(null),b=d=>{if(d==="")return!1;r.value=!0,clearTimeout(g.value),g.value=setTimeout(()=>{V.$get("products/searchVariantByName",{name:d}).then(e=>{v.value=e.products}).catch(e=>{}).finally(()=>{r.value=!1})},500)};return _(()=>{s.value=k.field.value.length>0?"include":"exclude"}),(d,e)=>{const c=h("el-option"),m=h("el-select");return t(),p("div",$,[o("div",C,[f(m,{modelValue:s.value,"onUpdate:modelValue":e[0]||(e[0]=l=>s.value=l),placeholder:d.$t("Select")},{default:n(()=>[f(c,{disabled:B.value.length>0,label:d.$t("Include"),value:"include"},null,8,["disabled","label"]),f(c,{disabled:w.value.length>0,label:d.$t("Exclude"),value:"exclude"},null,8,["disabled","label"])]),_:1},8,["modelValue","placeholder"])]),o("div",E,[s.value==="exclude"?(t(),i(m,{key:0,modelValue:a.value.excluded_products,"onUpdate:modelValue":e[1]||(e[1]=l=>a.value.excluded_products=l),multiple:"",placeholder:a.field.placeholder,filterable:"",remote:"","reserve-keyword":!1,"remote-method":b,loading:r.value},{loading:n(()=>e[3]||(e[3]=[o("svg",{class:"circular",viewBox:"0 0 50 50"},[o("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none"})],-1)])),default:n(()=>[(t(!0),p(y,null,x(v.value,l=>(t(),i(c,{key:l.id,label:l.variation_title,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])):(t(),i(m,{key:1,modelValue:a.value.included_products,"onUpdate:modelValue":e[2]||(e[2]=l=>a.value.included_products=l),multiple:"",placeholder:a.field.placeholder,filterable:"",remote:"","remote-method":b,"reserve-keyword":!1,loading:r.value},{loading:n(()=>e[4]||(e[4]=[o("svg",{class:"circular",viewBox:"0 0 50 50"},[o("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none"})],-1)])),default:n(()=>[(t(!0),p(y,null,x(v.value,l=>(t(),i(c,{key:l.id,label:l.variation_title,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]))])])}}};export{O as default};
