import{D as p}from"./chunk-VYUKN3XQ.js";import{Na as l,a as i,b as n}from"./chunk-XNQ3RS5P.js";var N=(()=>{let a=class a{static getDotDiscount(e){let t=e==null?void 0:e.dotDiscount;if(t){let r=JSON.parse(t.text);return n(i({},t),{config:n(i({},r),{text:r.text,type:r.type?r.type:"CLASSIC"})})}}static getModelName(e,t){return this.productNameRemoveMemory(this.productNameRemoveDualSim(this.productNameRemoveBrand(e,t)))}static productNameRemoveBrand(e,t){return e.brand&&t.displayName.indexOf(e.brand.name)>-1?t.displayName.replace(e.brand.name,"").trim():t.displayName}static productNameRemoveDualSim(e){return e.replace(/\(?dual sim\)?/i,"").trim()}static productNameRemoveMemory(e){return e.split(" ").filter(t=>!t.toUpperCase().includes("GB")&&!t.toUpperCase().includes("MB")).join(" ")}getActiveVariant(e,t){var s,m,c,u;let r=(s=e.variants)==null?void 0:s[0];return t&&(r=(c=(m=e.variants)==null?void 0:m.find(d=>d.id===t))!=null?c:r),n(i({},r),{capacity:(u=e.badge)==null?void 0:u.capacity,brand:e.brand,categoryName:e.categoryName})}getBadges(e){return e.badge?Object.values(e.badge).filter(t=>!!t):[]}static outOfStock(e,t){return e==="noStock"||e==="expired"||t===p.error}};a.\u0275fac=function(t){return new(t||a)},a.\u0275prov=l({token:a,factory:a.\u0275fac});let o=a;return o})();export{N as a};