(()=>{"use strict";var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};t.d({},{t_:()=>M,AJ:()=>k,gw:()=>P,DW:()=>D,qS:()=>B,r4:()=>O,v:()=>C});async function e(t,e){if(M('#tt-carousel[data-type="barrage"]'))return;const{swiperStyle:i,lang:r}=C,n=C.columns[e],a=P("#trustoo-barrage-carousel",t.is_home_active,t.is_product_active);if(!a)return;C.barrageSpeed=1e3*t.speed;const o={sort_by:"commented-at-descending"};1===t.show_reviews?o.is_show_all=1:2===t.show_reviews?o.is_feature=1:5===t.show_reviews&&(C.productId?o.product_id=C.productId:o.is_show_all=1);const c=await C.request("getReviews",o);let l=null,d=null;if(c[0])return;if(0===c[1].list.length)return;l=c[1].list,d=c[1].total_rating,C.reviewsLists[e]=l;let u="",p="";const v=t;i.textContent+=`\n\t#tt-carousel{\n\t\t--title-color: ${v.title_color};\n\t\t--desc-color: ${v.description_color};\n\t\t--block-bg-color:${v.block_bg_color};\n\t\t--card-bg-color:${t.widget_layout_card_bg_color};\n\t\t--card-radius:${v.card_border_radius}px;\n\t\t--photo-radius: ${t.image_border_radius+"px"};\n\t}\n\t${D(v,"barrage")}\n\t`;const w=l.length;let _=null,g=null;let h="first";w>(C.isMobile?5:10)?(_=l.filter(((t,e)=>e%2==0)),g=l.filter(((t,e)=>e%2!=0))):_=l,g?p=s(g,t,"second"):h="single",u=s(_,t,h);let f="";if(1===t.is_show_description){const e=`${d.total_reviews}`;f=`
${r.card_carousel.barrage.desc.replace("{{total_rating}}",d.rating).replace("{{total_reviews}}",e)}
`}a.insertAdjacentHTML("beforeend",`\n
\n
\n\t\t${1===t.is_show_title?`
${r.card_carousel.barrage.title}
`:""}\n\t\t${f}\n
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t${u}\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t${p?`
`:""}\n\t\t\t\t\n
\n\t\t\t\n
\n
\n
\n `);const m=M('#tt-carousel[data-type="barrage"] #tt-carousel-list'),y=parseInt(getComputedStyle(m).width);C.isMobile?C.columns[e]=w<=2?1:2:w<5&&w>=3?C.columns[e]=w-1:w<3&&(C.columns[e]=w);const $=C.columns[e]-1,b=452*C.columns[e]+32*$;bt.style.width=b+"px"))}function s(t,e,s){return t.reduce(((t,i,r)=>{let n="",a="";if(i.resources.length){const t=e.show_photos_option;if(1===t){const t=i.resources[0];a=(2===t.resource_type?t.thumb_src:t.src)||i.product_image_src}else 2===t&&(a=i.product_image_src)}else a=i.product_image_src;let o="",c=r;"single"!==s&&(c=2*r,"second"===s&&(c+=1)),o=a?``:O("noImage"),n+=`\n\t\t\t\t${o}\n\t\t\t\t
`,n=`${n}
`;return t+=`\n\t\t\n
\n\t\t
\n\t\t${n}
\n\t\t
\n\t\t
${i.author}
\n\t\t\t
${B(i.star,C)}
\n\t\t
\n\t\t
${i.content}
\n\t\t
\n `}),"")}async function i(t,e){if(M('#tt-carousel[data-type="photo"]'))return;const{swiperStyle:s,lang:i}=C,r=C.columns[e],n=P("#trustoo-photo-carousel",t.is_home_active,t.is_product_active);if(!n)return;const a={has_resource:1};1===t.show_reviews?a.is_show_all=1:2===t.show_reviews?a.is_feature=1:5===t.show_reviews&&(C.productId?a.product_id=C.productId:a.is_show_all=1);const o=await C.request("getReviews",a);let c=null,l=null;if(o[0])return;if(0===o[1].list.length)return;c=o[1].list,l=o[1].total_rating,C.reviewsLists[e]=c;const d=c.length;let u="";const p=t;s.textContent+=`\n\t#tt-carousel[data-type=photo]{\n\t\t--btn-bg-color: ${p.scroll_bg_color};\n\t\t--title-color: ${p.title_color};\n\t\t--desc-color: ${p.description_color};\n\t\t--star-bg-color:${p.stars_bg_card_color||"#fff"};\n\t\t--block-bg-color:${p.block_bg_color||"#fff"};\n\t\t--card-radius:${p.card_border_radius}px;\n\t}\n\t#tt-carousel[data-type=photo] .resource-list{\n\t\theight: ${204*(1==p.photo_ratio?1:1.33)}px\n\t}\n\t${D(p,"photo")}\n\t`;const v=t.scroll_buttons_icon_color;c.forEach(((s,i)=>{let r="";1===t.is_show_verified_purchase&&1===s.verified_badge&&(r=C.badgeIconSvg);const n=s.resources[0];if(!n)return;const a=2===n.resource_type?n.thumb_src:n.src,o=2===n.resource_type?O("video"):"",c=`\n\t\t
\n\t\t ${o}\n\t\t
`;u+=`\n\t\t\n
\n\t\t
\n\t\t${c}
\n\t\t
\n\t\t\t
${s.author}
${1===s.verified_badge?r:""}
\n\t\t
${s.content}
\n\t\t
\n `}));let w="";if(1===t.is_show_description){const e=`${l.total_reviews}`;w=`${i.card_carousel.photo.desc.replace("{{total_rating}}",l.rating).replace("{{total_reviews}}",e)}
`}n.insertAdjacentHTML("beforeend",`\n
\n
\n\t\t${1===t.is_show_title?`
${i.card_carousel.photo.title}
`:""}\n\t\t${w}\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n ${u}\n\t\t\t
\n
\n
\n\t\t\t${d>C.columns[e]?`
${O("scrollBtn",v)}
\n\t\t\t
${O("scrollBtn",v)}
`:""}\n
\n
\n
\n
\n `)}async function r(t,e){if(M('#tt-carousel[data-type="primary"]'))return;let s="initial";const{swiperStyle:i}=C,r=C.columns[e],n=P("#trustoo-card-carousel-widget",t.is_home_active,t.is_product_active);if(!n)return;const a={};1===t.show_reviews?a.is_show_all=1:2===t.show_reviews?a.is_feature=1:5===t.show_reviews&&(C.productId?a.product_id=C.productId:a.is_show_all=1);const o=await C.request("getReviews",a);let c=null,l=null;if(o[0])return;if(0===o[1].list.length)return;c=o[1].list,l=o[1].total_rating,C.reviewsLists[e]=c;const d=c.length;d