import{p as Te}from"./paginationMeta-DF6W6vpY.js";import{d as je,a as Be,r as n,u as ze,o as $e,B as ae,z as Me,cP as Ke,f as c,g as d,i as o,h as u,w as s,x as L,m as O,j as a,l as N,L as T,k as w,y as J,A as x,F as j,C as E,I as B,S as Re,E as Q,V as oe,D as z,t as ie,G as Z,J as se,cu as qe,X as re,T as Ge,dx as Oe,_ as Je}from"./index-BJQI7x7T.js";import{A as Ee}from"./Aitubiao-CNe-KajI.js";import{b as Qe,g as Ze,d as We}from"./product-CF8ZbdKC.js";import Xe from"./productItem-BdBUNJmY.js";import He from"./batchAdd-BFzyIKZV.js";import Ye from"./quickView-DAwrg44l.js";import{i as et,a as tt}from"./alioss-DvE9eIRm.js";import{V as v}from"./VCol-Cp6UTXQF.js";import{V as ne}from"./VSkeletonLoader-CGEHmXOW.js";import{V as lt,a as ue}from"./VList-Bx4QW1Fl.js";import{V as $}from"./VRow-oNqYnw5y.js";import{V as de}from"./VTooltip-D7FuUxPl.js";import{V as W}from"./VSelect-NvyHj-SD.js";import{V as at}from"./VAutocomplete-1-bMQ5k3.js";import{V as ot}from"./VChip-ngmJQn7j.js";import{V as it}from"./VPagination-D32PweKp.js";import"./myImg-BHxN34IM.js";import"./VHover-DquvnFs9.js";import"./editPrice-DJE_AqIm.js";import"./AppTextField.vue_vue_type_script_setup_true_lang-B_VAYCIW.js";import"./orderAndItemFittings-CcZ6fyXq.js";import"./replenishInventory-C6PnUgSF.js";import"./paymentDialog.vue_vue_type_script_setup_true_lang-DvfPAtm4.js";import"./paypal.vue_vue_type_script_setup_true_lang-DVLPtDio.js";import"./payApi-BDNv54__.js";import"./currencyPrice.vue_vue_type_script_setup_true_lang-CAyssTEC.js";import"./brandServices-BJ-Yq2YF.js";import"./myProduct-C6oIp35q.js";import"./noData-IsWEUHkL.js";import"./VSwitch-sRzZeJ3i.js";import"./VDataTable-DBzQtITj.js";import"./VTable-Nw8UbLpZ.js";import"./filter-BR9REiQB.js";import"./VNumberInput-C3Z7faMl.js";import"./styleSelect-9Y9c__vp.js";import"./file-D63WmP2B.js";import"./array--3Swg3I5.js";import"./buyNow-D4vUhytk.js";import"./index-BBI6MPk3.js";import"./order-DG4AXXQ0.js";import"./dayjs.min-ByWsX4dK.js";import"./VStepper-LS7CK1kX.js";import"./VSheet-PrCpCEF0.js";import"./VMenu-C18DXlkE.js";import"./VCombobox-ElCYS2rI.js";import"./VRadioGroup-DVe1LZZ4.js";import"./fileInput-B0uZlWIl.js";import"./VFileInput-mhjVpq_Y.js";import"./persionalizeItem-pwrKxVuh.js";import"./productSpecificInfo-CPI976ex.js";import"./VTabs-DuIp2f_c.js";import"./VSlideGroup-DJRmcC4k.js";import"./skuChoose-BmQ6t3Zn.js";import"./colorSelect.vue_vue_type_style_index_0_lang-oqW4kFzm.js";import"./textInput-DBiV6AbL.js";import"./VSlider-CNniBCRZ.js";/* empty css */const st={class:"d-flex justify-end"},rt={key:0,class:"d-flex"},nt={class:"d-flex"},ut={style:{width:"520px"},class:"position-relative"},dt={class:"d-flex justify-space-between ai-search-box-head"},ct={key:0,class:"ai-search-top-text-color"},pt={key:1,class:"ai-search-top-text-color"},mt={class:"d-flex align-center ml-5 flex-wrap"},vt={class:"mt-10 ai-img-input-box d-flex align-center"},ft={class:"mt-6 d-flex align-center"},gt={class:"mt-6 ai-img-input-box d-flex align-center"},ht={key:0},yt={key:0,class:"ga-5"},Vt={key:1},bt={key:1,class:"no-data-box align-content-sm-center",style:{height:"484px"}},wt={class:"d-flex justify-space-between"},xt={class:"d-flex"},kt=je({__name:"index",setup(St){const M=Be(),X=n([]),K=n([1]),l=n({sortField:null,category1:1,labelIds:[],favorite:null,keyword:null,current:1,size:36,isDropshipped:null,aiSearchImageUrl:null,aiSearchKeyword:null}),ce=[{id:1,name:"New Added"},{id:2,name:"Early Added"}],H=n([]),k=n(!0),R=n(!0);(()=>{Qe().then(i=>{H.value=i.data.records})})();const f=n(""),V=n(!1),y=n(!0),p=n([]),q=n(1),S=n(!1),m=()=>{S.value=!1,k.value=!0,Ze(l.value).then(i=>{p.value=i.data.records,q.value=i.data.total,k.value=!1,U.value&&(V.value=!1,f.value="Click the cross to cancel the search results."),p.value<=0?S.value=!0:S.value=!1,window.scrollTo({top:0,behavior:"smooth"})})},D=ze(),pe=i=>{D.setPageDataCurrent(i),p.value=[],m()},me=()=>{l.value.current=1,p.value=[],m()};$e(()=>{(D.$state.pageData.routerName==="products-calog-handle"||D.$state.pageData.routerName==="products-calog-distribution")&&(l.value.current=D.$state.pageData.current),m()});const b=n(!1),Y=n(0),ve=i=>{Y.value=i,b.value=!0},fe=i=>{b.value=i};(()=>{We({current:1,size:1e3,category1:1}).then(e=>{X.value=e.data.records,R.value=!1})})();const ge=i=>{l.value.typeId=i.id,l.value.current=1,l.value.aiSearchImageUrl=null,l.value.aiSearchKeyword=null,p.value=[],m()},G=()=>{l.value.favorite||(l.value.favorite=null),l.value.current=1,l.value.aiSearchImageUrl=null,l.value.aiSearchKeyword=null,p.value=[],m()},he=()=>{l.value.keyword=l.value.keyword.trim(),l.value.current=1,l.value.aiSearchImageUrl=null,l.value.aiSearchKeyword=null,p.value=[],m()},ye=()=>{l.value.keyword=null,l.value.current=1,l.value.aiSearchImageUrl=null,l.value.aiSearchKeyword=null,p.value=[],m()},Ve=()=>{l.value.favorite=!l.value.favorite,l.value.favorite||(l.value.favorite=null),l.value.current=1,l.value.aiSearchImageUrl=null,l.value.aiSearchKeyword=null,p.value=[],m()};ae.RM=3;const be=Me(()=>(i,e)=>new ae(i).div(e).round(0).toString()),I=n(!1),we=()=>{I.value=!0},xe=[{name:"All",type:null},{name:"Dropshipped",type:!0},{name:"Not Dropshipped",type:!1}],U=n(!1),ke=()=>{U.value=!0},g=n(""),_=n(""),C=n(!1),ee=n(null),P=n("JPG, PNG, file types and bulky-upload supported"),Se=n(null),De=n(null),Ie=n(),Ue=i=>{i.preventDefault(),C.value=!0},_e=i=>{var t;C.value=!1;const e=(t=i.dataTransfer)==null?void 0:t.files;e&&e.length>0&&Ce(e[0]),te(e,!0)},Ce=i=>{if(P.value=null,!["image/jpeg","image/png","image/jpg"].includes(i.type)){P.value="Unsupported image format, please upload JPG/PNG file";return}const t=5*1024*1024;if(i.size>t){P.value="The file size exceeds the 5MB limit";return}const r=i;r.preview=URL.createObjectURL(i),De.value=r,Se.value=r.preview},Pe=i=>{},A=n(0),Ae=n(""),te=async(i,e)=>{const t=n(null);if(e)t.value=i[0];else{new FileReader;const{files:r}=i.target;t.value=r[0]}if(t.value)try{const r=await et(),h=await Fe(r,t.value);Ae.value=h.fileOssName.objectUrl}catch(r){console.log(r)}},Fe=async(i,e)=>{const t=await tt(e),r=await i.multipartUpload(t.objectName,e,{partSize:800*1024,progress:F=>{A.value=Math.floor(F*100)},headers:{"Cache-Control":"max-age=360000"}}),h=new Image;return h.src=t.objectUrl,e.name.replace(/\.[^/.]+$/,""),g.value=t.objectUrl,le(),h.onload=async()=>{P.value="JPG, PNG, file types and bulky-upload supported",Le.value=!0},setTimeout(()=>{A.value=0},1e3),{res:r,fileOssName:t}},Le=n(!1);Ke(Ie,Pe);const le=()=>{const i=/^https?:\/\//;if(!g.value){f.value='The link starts with "http://" or "https://"';return}if(!i.test(g.value)){f.value='The link starts with "http://" or "https://"';return}f.value="",V.value=!0,l.value.current=1,l.value.aiSearchImageUrl=g.value,l.value.aiSearchKeyword=null,p.value=[],y.value=!1,m()},Ne=()=>{V.value=!0,l.value.current=1,l.value.aiSearchKeyword=_.value,l.value.aiSearchImageUrl=null,p.value=[],y.value=!1,m()};return(i,e)=>(d(),c(j,null,[o($,null,{default:s(()=>[o(v,{md:"12",cols:"12",class:"seach-box-input"},{default:s(()=>[u("div",st,[a(M).$state.userBaseInfo.currentShop.shopType!==2&&a(M).$state.userBaseInfo.currentShop!==null&&a(M).$state.userBaseInfo.currentShop!==void 0?(d(),L(N,{key:0,variant:"flat",color:"#000000",height:"42px",onClick:T(we,["prevent"]),"prepend-icon":"custom-apps-2-add-line"},{default:s(()=>e[16]||(e[16]=[w(" Bulk Dropship Products ")])),_:1,__:[16]})):O("",!0)])]),_:1}),o(v,{md:"2",cols:"12"},{default:s(()=>[o(J,{style:{position:"sticky",top:"80px"}},{default:s(()=>[a(R)?(d(),c("div",rt,[o(ne,{loading:a(R),width:"305",type:"list-item,list-item,list-item,list-item,list-item,list-item,list-item,list-item,list-item"},null,8,["loading"])])):(d(),L(lt,{key:1,opened:a(K),"onUpdate:opened":e[0]||(e[0]=t=>x(K)?K.value=t:null),"onClick:select":ge},{default:s(()=>[(d(!0),c(j,null,E(a(X),(t,r)=>(d(),c("div",{key:r},[o(ue,{title:t.name,value:t.id},null,8,["title","value"])]))),128))]),_:1},8,["opened"]))]),_:1})]),_:1}),o(v,{md:"10",cols:"12"},{default:s(()=>[o(J,{class:"productCalog-content"},{default:s(()=>[o(B,{class:"pa-5"},{default:s(()=>e[17]||(e[17]=[u("div",{class:"productCalog-title"}," Product Details ",-1)])),_:1,__:[17]}),o(B,{class:"pa-5"},{default:s(()=>[o($,null,{default:s(()=>[o(v,{md:"5"},{default:s(()=>[u("div",nt,[u("div",ut,[o(Q,{modelValue:a(l).keyword,"onUpdate:modelValue":e[1]||(e[1]=t=>a(l).keyword=t),"prepend-inner-icon":"custom-search-2-line",class:"align-center",label:"Product Name, SKU, Product Num",placeholder:"Placeholder",variant:"outlined",clearable:"","onClick:clear":ye,onChange:he},{"append-inner":s(()=>[o(de,{text:"AI Search"},{activator:s(({props:t})=>[o(oe,z(t,{class:"cursor-pointer",onClick:ke,src:a(Ee),style:{width:"20px",height:"20px","border-radius":"0px"}}),null,16,["src"])]),_:1})]),_:1},8,["modelValue"]),Re((d(),c("div",{class:"ai-search-box position-absolute",onMouseover:e[7]||(e[7]=t=>y.value=!0),onMouseout:e[8]||(e[8]=t=>y.value=!1)},[o(J,null,{default:s(()=>[o(B,{class:"pa-3 pt-4 pb-4"},{default:s(()=>[u("div",dt,[e[19]||(e[19]=u("div",null,null,-1)),u("div",null,[a(f)&&!a(V)?(d(),c("div",ct,ie(a(f)),1)):a(V)?(d(),c("div",pt,e[18]||(e[18]=[w("Searching, please wait "),u("span",{class:"jumping-dots-3"},[u("span",null,"."),u("span",null,"."),u("span",null,"."),u("span",{class:"ml-1"},"."),u("span",null,"."),u("span",null,".")],-1)]))):O("",!0)]),o(Z,{icon:"custom-close-line",onClick:e[2]||(e[2]=t=>{U.value=!1,y.value=!0,f.value=""})})]),u("div",{class:se(["ai-box-default pb-5",a(y)?"":"ai-box-close"])},[u("div",{class:se(["d-flex align-center justify-center mt-10",{dragging:a(C)}]),onClick:e[3]||(e[3]=t=>{var r;return(r=a(ee))==null?void 0:r.click()}),onDragover:T(Ue,["prevent"]),onDragleave:e[4]||(e[4]=t=>C.value=!1),onDrop:T(_e,["prevent"])},[o(Z,{icon:"custom-image-add-fill",style:{width:"50px",height:"50px"},color:"#7367f1"}),u("div",mt,[o(N,{class:"ml-2 touch-upload",variant:"text",color:"#7367f1"},{default:s(()=>e[20]||(e[20]=[w(" Upload File ")])),_:1,__:[20]})])],34),u("div",vt,[o(Q,{modelValue:a(g),"onUpdate:modelValue":e[5]||(e[5]=t=>x(g)?g.value=t:null),class:"align-center mr-2",label:"Paste image URL link",placeholder:"Paste image URL link",variant:"outlined",clearable:""},null,8,["modelValue"]),o(N,{variant:"outlined",color:"#7367f1",onClick:le},{default:s(()=>e[21]||(e[21]=[w("Search")])),_:1,__:[21]})]),a(A)>0?(d(),L(qe,{key:0,color:"rgb(var(--v-theme-primary))","model-value":a(A),striped:""},null,8,["model-value"])):O("",!0),u("div",ft,[o(re),e[22]||(e[22]=u("div",{class:"ml-2 mr-2"},"or",-1)),o(re)]),u("div",gt,[o(Q,{modelValue:a(_),"onUpdate:modelValue":e[6]||(e[6]=t=>x(_)?_.value=t:null),class:"align-center mr-2",label:"Describe the product's appearance to the AI.",placeholder:"Describe the product's appearance to the AI.",variant:"outlined",clearable:""},null,8,["modelValue"]),o(N,{variant:"outlined",color:"#7367f1",onClick:Ne},{default:s(()=>e[23]||(e[23]=[w("Search")])),_:1,__:[23]})])],2)]),_:1})]),_:1})],32)),[[Ge,a(U)],[Oe]])])])]),_:1}),o(v,{md:"2",cols:"12"},{default:s(()=>[o(W,{modelValue:a(l).isDropshipped,"onUpdate:modelValue":[e[9]||(e[9]=t=>a(l).isDropshipped=t),G],label:"Dropshipped",items:xe,"item-title":"name","item-value":"type","return-object":!1,variant:"outlined"},null,8,["modelValue"])]),_:1}),o(v,{md:"2",cols:"12"},{default:s(()=>[o(at,{modelValue:a(l).labelIds,"onUpdate:modelValue":[e[10]||(e[10]=t=>a(l).labelIds=t),G],chips:"","closable-chips":"",multiple:"",items:a(H),"item-title":"name","item-value":"id",label:"Label",variant:"outlined","return-object":!1},{chip:s(({props:t,item:r})=>[o(ot,z(t,{text:r.raw.name}),null,16,["text"])]),item:s(({props:t,item:r})=>{var h,F;return[o(ue,z(t,{title:(h=r==null?void 0:r.raw)==null?void 0:h.name,subtitle:(F=r==null?void 0:r.raw)==null?void 0:F.group}),null,16,["title","subtitle"])]}),_:1},8,["modelValue","items"])]),_:1}),o(v,{md:"2",cols:"12"},{default:s(()=>[o(W,{modelValue:a(l).sortField,"onUpdate:modelValue":[e[11]||(e[11]=t=>a(l).sortField=t),G],label:"Sort",items:ce,"item-title":"name","item-value":"id","return-object":!1,variant:"outlined","prepend-inner-icon":"custom-arrow-up-down-line"},null,8,["modelValue"])]),_:1}),o(v,{md:"1",cols:"12",class:"d-flex justify-center align-center"},{default:s(()=>[o(de,{text:a(l).favorite?"Favorites":"Not Favorited"},{activator:s(({props:t})=>[o(Z,z(t,{icon:a(l).favorite?"custom-heart-fill":"custom-heart-line",size:"30",color:a(l).favorite?"#FF4D49":"#3C4056",onClick:T(Ve,["stop"])}),null,16,["icon","color"])]),_:1},8,["text"])]),_:1})]),_:1})]),_:1}),o(B,{class:"pa-5"},{default:s(()=>[a(S)?(d(),c("div",bt,[o(oe,{width:310,"aspect-ratio":"16/9",cover:"",src:i.NoData},null,8,["src"])])):(d(),c("div",ht,[a(k)?(d(),c("div",yt,[o($,null,{default:s(()=>[(d(),c(j,null,E(12,(t,r)=>o(v,{md:"4",sm:"6",xs:"12",lg:"4",xl:"3",xxl:"2",key:r},{default:s(()=>[o(ne,{loading:a(k),height:"536",type:"image, list-item,list-item,list-item,list-item, actions"},null,8,["loading"])]),_:2},1024)),64))]),_:1})])):(d(),c("div",Vt,[o($,null,{default:s(()=>[(d(!0),c(j,null,E(a(p),(t,r)=>(d(),L(v,{md:"4",sm:"6",xs:"12",lg:"4",xl:"3",xxl:"2",key:r},{default:s(()=>[o(Xe,{"product-details-item-data":t,"onUpdate:quickViewItem":ve},null,8,["product-details-item-data"])]),_:2},1024))),128))]),_:1})]))])),u("div",wt,[u("div",null,ie(("paginationMeta"in i?i.paginationMeta:a(Te))({page:a(l).current,itemsPerPage:a(l).size},a(q))),1),u("div",xt,[o(W,{class:"mr-5",modelValue:a(l).size,"onUpdate:modelValue":[e[12]||(e[12]=t=>a(l).size=t),me],width:"100px",items:[36,48,96],variant:"outlined"},null,8,["modelValue"]),o(it,{modelValue:a(l).current,"onUpdate:modelValue":[e[13]||(e[13]=t=>a(l).current=t),pe],"total-visible":5,length:a(be)(a(q),a(l).size),rounded:"circle"},null,8,["modelValue","length"])])])]),_:1})]),_:1})]),_:1})]),_:1}),o(Ye,{id:a(Y),"quick-view-dialog-visible":a(b),"onUpdate:quickViewDialogVisible":e[14]||(e[14]=t=>x(b)?b.value=t:null),"onUpdate:closeQuickViewDialogVisible":fe},null,8,["id","quick-view-dialog-visible"]),o(He,{"batch-add-dialog-visible":a(I),"onUpdate:batchAddDialogVisible":e[15]||(e[15]=t=>x(I)?I.value=t:null)},null,8,["batch-add-dialog-visible"]),u("input",{ref_key:"fileInput",ref:ee,type:"file",accept:".jpeg,.png,.jpg",hidden:"",onChange:te},null,544)],64))}}),Al=Je(kt,[["__scopeId","data-v-10e93c0b"]]);export{Al as default};