import{o as e,t}from"./chunk-mlkTr37E.js";import{t as n}from"./src-BB3-yf7b.js";var r=t(((e,t)=>{var n=(function(){function e(e,t){return t!=null&&e instanceof t}var t;try{t=Map}catch{t=function(){}}var n;try{n=Set}catch{n=function(){}}var r;try{r=Promise}catch{r=function(){}}function i(a,o,s,c,u){typeof o==`object`&&(s=o.depth,c=o.prototype,u=o.includeNonEnumerable,o=o.circular);var d=[],f=[],p=typeof Buffer<`u`;o===void 0&&(o=!0),s===void 0&&(s=1/0);function m(a,s){if(a===null)return null;if(s===0)return a;var h,g;if(typeof a!=`object`)return a;if(e(a,t))h=new t;else if(e(a,n))h=new n;else if(e(a,r))h=new r(function(e,t){a.then(function(t){e(m(t,s-1))},function(e){t(m(e,s-1))})});else if(i.__isArray(a))h=[];else if(i.__isRegExp(a))h=new RegExp(a.source,l(a)),a.lastIndex&&(h.lastIndex=a.lastIndex);else if(i.__isDate(a))h=new Date(a.getTime());else if(p&&Buffer.isBuffer(a))return h=Buffer.allocUnsafe?Buffer.allocUnsafe(a.length):new Buffer(a.length),a.copy(h),h;else e(a,Error)?h=Object.create(a):c===void 0?(g=Object.getPrototypeOf(a),h=Object.create(g)):(h=Object.create(c),g=c);if(o){var _=d.indexOf(a);if(_!=-1)return f[_];d.push(a),f.push(h)}for(var v in e(a,t)&&a.forEach(function(e,t){var n=m(t,s-1),r=m(e,s-1);h.set(n,r)}),e(a,n)&&a.forEach(function(e){var t=m(e,s-1);h.add(t)}),a){var y;g&&(y=Object.getOwnPropertyDescriptor(g,v)),!(y&&y.set==null)&&(h[v]=m(a[v],s-1))}if(Object.getOwnPropertySymbols)for(var b=Object.getOwnPropertySymbols(a),v=0;v<b.length;v++){var x=b[v],S=Object.getOwnPropertyDescriptor(a,x);S&&!S.enumerable&&!u||(h[x]=m(a[x],s-1),S.enumerable||Object.defineProperty(h,x,{enumerable:!1}))}if(u)for(var C=Object.getOwnPropertyNames(a),v=0;v<C.length;v++){var w=C[v],S=Object.getOwnPropertyDescriptor(a,w);S&&S.enumerable||(h[w]=m(a[w],s-1),Object.defineProperty(h,w,{enumerable:!1}))}return h}return m(a,s)}i.clonePrototype=function(e){if(e===null)return null;var t=function(){};return t.prototype=e,new t};function a(e){return Object.prototype.toString.call(e)}i.__objToStr=a;function o(e){return typeof e==`object`&&a(e)===`[object Date]`}i.__isDate=o;function s(e){return typeof e==`object`&&a(e)===`[object Array]`}i.__isArray=s;function c(e){return typeof e==`object`&&a(e)===`[object RegExp]`}i.__isRegExp=c;function l(e){var t=``;return e.global&&(t+=`g`),e.ignoreCase&&(t+=`i`),e.multiline&&(t+=`m`),t}return i.__getRegExpFlags=l,i})();typeof t==`object`&&t.exports&&(t.exports=n)})),i=e(r()),a=e(n()),o=async e=>{let t={...e.product_price,...e.product_images,...e.product_attributes,...e.product_review,...e.product_meta,...e.item,shop_data:e.shop_detailed,account_data:e.account};return t.name=t.title,t.itemid=t.item_id,t.shopid=t.shop_id,t.models=(t.models||[]).map(e=>(e.modelid=e.model_id||0,e.itemid=e.item_id||t.item_id||0,e.promotionid=e.promotion_id||0,e)),t.video_info_list=[t.video],t.sold=(0,a.default)(t.models,e=>e.sold),t.historical_sold=t.global_sold,t.view_count=t.view_count||0,t.liked_count=t.liked_count||0,t.cmt_count=t.cmt_count||0,t},s=async e=>{let t=(0,i.default)({...e,weight:{unit:2,value:e.weight.toString()},description_info:{description:e.description,description_type:`normal`},pre_order_info:{pre_order:e.pre_order,days_to_ship:e.days_to_ship}});if(e.description_json){let n=e.description_json.map(e=>e.img_id?{type:1,value:e.img_id}:e.text?{type:0,value:`${e.text} \n`}:{type:0,value:`

`});t.description_info.description_type=`json`,t.description_info.description=JSON.stringify({field_list:n})}return t.dimension.width=e.dimension.width.toString(),t.dimension.length=e.dimension.length.toString(),t.dimension.height=e.dimension.height.toString(),t.std_tier_variation_list=e.tier_variation.map((e,t)=>({id:0,group_id:t.toString(),custom_value:e.name,value_list:e.options.map((t,n)=>({id:0,custom_value:t,image_id:e.images[n]}))})),t.model_list=e.model_list.sort((e,t)=>e.name<t.name?-1:1),t.enable_model_level_dts=!1,t.attributes=e.attributes.map(e=>{let t={};return e.attribute_value_id?t.value_id=Number(e.attribute_value_id):e.custom_value&&e.custom_value.raw_value&&(t.raw_value=e.custom_value.raw_value,t.unit=e.custom_value.unit),{attribute_id:e.attribute_id,attribute_values:[t]}}),t};export{o as n,r,s as t};