(function appEasyProtect($){let App=function App(){this.sessionId='6ac096b5a089675543d27b11bb68f39a';this.sessionToken='75600433e7f061aa4a2d09615c532f6fb8564eea98135ba0ed050c9b6dc3fa4c';this.listType='whitelist';this.shopId=214;this.translations={"add_text":{"__default":"Dodaj","pl_PL":"dodaj"},"no_option_text":{"__default":"brak","pl_PL":"brak"},"protectionAddText":{"__default":"Dodaj","pl_PL":"dodaj"},"noOptionText":{"__default":"brak","pl_PL":"brak"},"infoPageText":{"__default":"dowiedz si\u0119 wi\u0119cej","pl_PL":"dowiedz si\u0119 wi\u0119cej"},"checkboxEnableEasyProtectText":{"__default":"jestem zainteresowany gwarancj\u0105 EP","pl_PL":"jestem zainteresowany gwarancj\u0105 EP"},"productIndexText2":{"__default":"Zyskaj nawet 3 lata dodatkowej ochrony dla swojego sprz\u0119tu","pl_PL":"Zyskaj nawet 3 lata dodatkowej ochrony dla swojego sprz\u0119tu"},"productIndexOptionText":{"__default":"Ochrona","pl_PL":"Ochrona"},"productIndexNoOptionText":{"__default":"podstawowa","pl_PL":"podstatowa"}};this.productId=16776;this.optionPriceRangeId=134;this.optionTimePeriodId=135;this.optionToProductId=157;this.optionDataId=158;this.infoPageId=25;this.checkboxEnableFieldId=10;this.noOption=1;this.checkboxEnableEasyProtect=0;this.addEasyProtectToProductIndex=0;this.productIds=[];this.categoriesIds={"13":"Laptopy / Ultrabooki / Notebooki","14":"Laptopy nowe","15":"Laptopy poleasingowe","22":"Zasilacze do laptopów","63":"Dell","64":"Dell Latitude E64xx","68":"Dell Latitude E5470","70":"Komputery stacjonarne","71":"Stacje graficzne","72":"Precision T3600","73":"Dell Latitude E7440","74":"Dell Latitude E7450","78":"Dell Latitude E5450","81":"Dell Latitude E6530","82":"Apple","83":"MacBook Air","84":"Dell Latitude E7470","85":"Optiplex 9030 (AIO)","87":"Dell Latitude E6440","88":"Dell Latitude 14 Rugged","89":"Dell Latitude 7390","90":"Optiplex 7010","91":"Precision T5610","92":"Precision T5600","93":"Dell Latitude 7480","94":"Dell Latitude E7250","95":"Dell Latitude E6540","96":"Laptopy Outlet | Refurbished","97":"Dell Latitude E7270","98":"Precision T7600","99":"Optiplex 7040","127":"Komputery nowe","128":"All In One","129":"Komputery poleasingowe","130":"All In One","131":"Stacje robocze","132":"Monitory LCD","137":"Drukarki, urządzenia wielofunkcyjne","138":"Drukarki atramentowe","139":"Drukarki laserowe","140":"Urządzenia wielofunkcyjne atramentowe","141":"Urządzenia wielofunkcyjne laserowe","154":"Dell XPS 9560","155":"Dell Latitude E5550","156":"Dell Latitude E5550","157":"Dell Latitude 5480","159":"Optiplex 9020 (AIO)","160":"Dell Precision M4800","161":"Dell Latitude 7370","162":"Dell Precision 7510","163":"Dell Precision M6800","164":"Dell Precision 7710","165":"Dell Latitude 5480","166":"Dell Latitude E7270","167":"Dell Latitude 5590","168":"Dell Latitude E5570","169":"Dell Latitude E6430","171":"Dell Latitude E5570","172":"Dell Latitude 7490","173":"Optiplex 7440 (AIO)","174":"Dell Latitude 5580","176":"Dell Latitude 6430u","177":"Dell Latitude 5591","178":"Dell Precision 7520","179":"Dell Latitude E5470","200":"Dell Latitude E7280","201":"Dell Latitude E6420","202":"Dell Latitude E5430","203":"Dell inne modele","204":"Dell Latitude 5490","205":"HP Elitebook 840 G5","206":"HP Zbook Studio G3","208":"Dell Latitude 3470","209":"Lenovo","210":"ThinkPad T460s","211":"Dell Vostro 5471","212":"MacBook Pro","213":"Dell Precision 5510","214":"Dell Inspiron 5593","215":"Dell Inspiron 5593","217":"Dell Latitude 7275","218":"Dell Latitude 3490","219":"Dell Latitude 7290","220":"Dell Inspiron 7391 (2w1)","221":"Dell Inspiron 7391 (2w1)","224":"Dell Latitude 7400","225":"Dell Latitude 5500","300":"Dell Latitude 3570","301":"Dell Inspiron 5749","302":"Dell Vostro 3559","303":"Dell Precision 7530","312":"Laptopy - zastosowanie","313":"Biznesowe","314":"Gamingowe","315":"Stacje graficzne","316":"Multimedialne","317":"Domowe i edukacyjne","318":"Dell Latitude 5591","328":"Dell Latitude 7300","337":"Dell Latitude 7420","338":"Dell Latitude 7420","339":"Dell Latitude 7310","340":"Dell Latitude 7320","341":"Dell Latitude 5401","342":"Dell Latitude 5400","343":"Dell Latitude 5420","344":"Dell Latitude 7410","347":"Dell Latitude 7430","348":"Dell Precision 5530","349":"Dell Latitude 5501","350":"Dell Latitude 5520","355":"Dell Latitude 5530"};this.producersIds={"0":"Wszyscy producenci"};this.lang=Shop.lang.name?Shop.lang.name:"pl_PL";this.$style=$('').appendTo('head');this.insertStyle();if(Shop.pageType.split(' ').includes('shop_basket')){if(typeof GlobalSoolutionSoobasket!='undefined'&&typeof forceStandardEasyProtect=='undefined'){this.basketSoobasket();}
else{this.basketIndex();}
return true;}
if(Shop.pageType.split(' ').includes('shop_basket_address')){this.basketAddress();return true;}
if(Shop.pageType.split(' ').includes('shop_basket_step3')){this.basketStep3();return true;}
if(this.addEasyProtectToProductIndex&&Shop.pageType.split(' ').includes('shop_product')){this.productIndex();return true;}
if(Shop.pageType.split(' ').includes('shop_infopage')&&Shop.pageId==this.infoPageId){this.insertInfoPageStyle();}
let protectionFromProductIndex=[];if(localStorage.appEasyProtectProtectionFromProductIndex){protectionFromProductIndex=JSON.parse(localStorage.appEasyProtectProtectionFromProductIndex);}
if(protectionFromProductIndex.length>0){this.loadCurrency().then(()=>Promise.all([this.loadBasketInfo(),this.loadCurrencyRate(),])).then(()=>this.addProtectionFromProductIndex(true)).catch((reason)=>this.errorHandler(reason));}
return true;};App.prototype.basketIndex=function basketIndex(){this.preloadAddedProtection().then(()=>this.loadCurrency()).then(()=>Promise.all([this.loadProtection(),this.loadBasketInfo(),this.loadInfoPage(),this.loadCurrencyRate(),])).then(()=>this.addProtectionFromProductIndex()).then(()=>this.checkExceedingProtection()).then(()=>this.loadProductOptions()).then(()=>this.addProtectionToBasket()).catch((reason)=>this.errorHandler(reason));};App.prototype.basketAddress=function basketAddress(){this.loadCurrency().then(()=>Promise.all([this.loadProtection(),this.loadBasketInfo(),this.loadInfoPage(),this.loadCurrencyRate(),])).then(()=>this.addProtectionFromProductIndex()).then(()=>this.checkExceedingProtection()).then(()=>{let protectionData=[];if(localStorage.appEasyProtectProtectionData){protectionData=JSON.parse(localStorage.appEasyProtectProtectionData);}
$(`#additional_${this.checkboxEnableFieldId}`).val(protectionData.length==0&&localStorage.appEasyProtectEnableEasyProtect==='true'?"Tak":"");}).catch((reason)=>this.errorHandler(reason));};App.prototype.basketStep3=function basketStep3(){this.loadCurrency().then(()=>Promise.all([this.loadProtection(),this.loadBasketInfo(),this.loadInfoPage(),this.loadCurrencyRate(),])).then(()=>this.addProtectionFromProductIndex()).then(()=>this.checkExceedingProtection()).catch((reason)=>this.errorHandler(reason));};App.prototype.productIndex=function productIndex(){this.loadCurrency().then(()=>Promise.all([this.loadProtection(),this.loadBasketInfo(),this.loadInfoPage(),this.loadCurrencyRate(),])).then(()=>this.addProtectionFromProductIndex()).then(()=>this.addProtectionToProductIndex()).catch((reason)=>this.errorHandler(reason));};App.prototype.basketSoobasket=function basketSoobasket(){this.loadCurrency().then(()=>Promise.all([this.loadProtection(),this.loadBasketInfo(),this.loadInfoPage(),this.loadCurrencyRate(),])).then(()=>this.addProtectionFromProductIndex()).then(()=>this.checkExceedingProtection()).then(()=>this.loadProductOptions()).then(()=>this.waitForSoobasket()).then((response)=>{if(response==='fallback'){return this.preloadAddedProtection().then(()=>this.addProtectionToBasket());}
return this.addProtectionToSoobasket();}).catch((reason)=>this.errorHandler(reason));};App.prototype.preloadAddedProtection=function preloadAddedProtection(){return new Promise((resolve,reject)=>{let protectionRows=[];let productsTable=$(`#box_basketlist .productlist > tbody > tr[data-product-id]`);productsTable.each((index,tableRow)=>{tableRow=$(tableRow);if(tableRow.data('basket-product-id')==undefined){if(tableRow.find('.prodremove').length==0||tableRow.find('.prodremove').attr('href')=='')return true;let productBasketId=tableRow.find('.prodremove').attr('href').split("/").pop();tableRow.attr('data-basket-product-id',productBasketId);}
if(tableRow.data('product-id')==this.productId){protectionRows.push(tableRow);}});if(protectionRows.length>0){let protectionData=[];if(localStorage.appEasyProtectProtectionData){protectionData=JSON.parse(localStorage.appEasyProtectProtectionData);}
for(let key in protectionRows){let protectionRow=protectionRows[key];let mxInfoPageUrl=protectionRow.find(`td.name > a`);mxInfoPageUrl.attr('href',`/${this.lang}/i/easy-protect/${this.infoPageId}`);mxInfoPageUrl.attr('title',this.getTranslation('infoPageText'));mxInfoPageUrl.attr('target','_blank').attr('rel','noreferrer');let variants=protectionRow.find(`td.name .variant`).html().split('; ');protectionRow.find(`td.name .variant`).html(`${variants[1]}; ${variants[2]}`);let input=protectionRow.find(`td.quantity input`);input.attr('max',input.val());let basketProductId=0;let basketProtectionId=protectionRow.data('basket-product-id');for(let key2 in protectionData){let data=protectionData[key2];if(data.basketProtectionId!=basketProtectionId)continue;basketProductId=data.basketProductId;break;}
if(basketProductId!=0){protectionRow.attr('data-for-basket-product-id',basketProductId);let parentRow=$(`#box_basketlist .productlist > tbody > tr[data-basket-product-id=${basketProductId}]`);while(parentRow.next().data('product-id')==this.productId){parentRow=parentRow.next();}
protectionRow.insertAfter(parentRow);}}}
return resolve(true);});};App.prototype.loadProtection=function loadProtection(){return new Promise((resolve,reject)=>{this.waitFor(()=>{return typeof window.frontAPI==='object'&&typeof window.frontAPI.getProduct==='function';},()=>{frontAPI.getProduct((protection)=>{if('error_description'in protection)return reject(new Error('Protection not found'));if(!('options_configuration'in protection))return reject(new Error('Protection missing options'));if(protection.options_configuration.length!=4)return reject(new Error('Protection missing options'));this.protection=protection;return resolve(protection);},{id:this.productId,lang:this.lang,currency:this.currency});});});};App.prototype.loadBasketInfo=function loadBasketInfo(){return new Promise((resolve,reject)=>{this.waitFor(()=>{return typeof window.frontAPI==='object'&&typeof window.frontAPI.getBasketInfo==='function';},()=>{frontAPI.getBasketInfo((basket)=>{this.basketInfo=basket;return resolve(basket);},{lang:this.lang,currency:this.currency});});});};App.prototype.loadInfoPage=function loadInfoPage(){return new Promise((resolve,reject)=>{this.waitFor(()=>{return typeof window.frontAPI==='object'&&typeof window.frontAPI.getPage==='function';},()=>{frontAPI.getPage((page)=>{if('error_description'in page)return reject(new Error('Infopage not found'));this.infoPageUrl=page.url;return resolve(page.url);},{id:this.infoPageId,lang:this.lang});});});};App.prototype.loadCurrencyRate=function loadCurrencyRate(){return new Promise((resolve,reject)=>{let link="https://mxapp2.maxserver.pl/appEasyProtect/getCurrencyRate.php";let postData={sessionId:this.sessionId,sessionToken:this.sessionToken,shopId:this.shopId,currency:this.currency};$.post(link,postData).done((response)=>{response=JSON.parse(response);if('error'in response)return reject(new Error(response.error));this.currencyRate=response.rate;return resolve(response.rate);}).fail((response)=>{return reject(new Error(response));});});};App.prototype.checkExceedingProtection=function checkExceedingProtection(){return new Promise((resolve,reject)=>{let promises=[];let protectionData=[];if(localStorage.appEasyProtectProtectionData){protectionData=JSON.parse(localStorage.appEasyProtectProtectionData);}
let noProtectionProductsQuantity={};for(let key in this.basketInfo.products){let basketProduct=this.basketInfo.products[key];if(basketProduct.product_id==this.productId)continue;let categoryId='category'in basketProduct?basketProduct.category.category_id:-1;let producerId='producer'in basketProduct?basketProduct.producer.producer_id:-1;if(!this.checkAllowProtection(basketProduct.product_id,categoryId,producerId))continue;if(basketProduct.id in noProtectionProductsQuantity){noProtectionProductsQuantity[basketProduct.id]+=basketProduct.quantity;}else{noProtectionProductsQuantity[basketProduct.id]=basketProduct.quantity;}}
loopLabel:for(let key in protectionData){let data=protectionData[key];if(data.basketProductId in noProtectionProductsQuantity){for(let key2 in this.basketInfo.products){let basketProduct=this.basketInfo.products[key2];if(basketProduct.id!=data.basketProtectionId)continue;if(noProtectionProductsQuantity[data.basketProductId]-basketProduct.quantity>=0){noProtectionProductsQuantity[data.basketProductId]-=basketProduct.quantity;break loopLabel;}
if(noProtectionProductsQuantity[data.basketProductId]>0){let newQuantity=noProtectionProductsQuantity[data.basketProductId];noProtectionProductsQuantity[data.basketProductId]=0;promises.push(new Promise((resolve,reject)=>{frontAPI.editBasketProductQuantity(()=>{basketProduct.quantity=newQuantity;return resolve(true);},{id:data.basketProtectionId,data:{quantity:newQuantity}});}));break loopLabel;}
promises.push(new Promise((resolve,reject)=>{frontAPI.removeFromBasket(()=>{protectionData.splice(key,1);return resolve(true);},{id:data.basketProtectionId});}));break loopLabel;}
protectionData.splice(key,1);localStorage.appEasyProtectProtectionData=JSON.stringify(protectionData);}
else{promises.push(new Promise((resolve,reject)=>{frontAPI.removeFromBasket(()=>{protectionData.splice(key,1);return resolve(true);},{id:data.basketProtectionId});}));}}
loopLabel:for(let key in this.basketInfo.products){let basketProduct=this.basketInfo.products[key];if(basketProduct.product_id!=this.productId)continue;for(let key2 in protectionData){let data=protectionData[key2];if(basketProduct.id!=data.basketProtectionId)continue;continue loopLabel;}
promises.push(new Promise((resolve,reject)=>{frontAPI.removeFromBasket(()=>{return resolve(true);},{id:basketProduct.id});}));}
if(promises.length>0){Promise.allSettled(promises).then(()=>{localStorage.appEasyProtectProtectionData=JSON.stringify(protectionData);location.replace(location.href);});return false;}
else{return resolve(true);}});};App.prototype.loadProductOptions=function loadProductOptions(prices=false){if(typeof this.protectionVariants!='object')this.protectionVariants=[];let currentPrices=[];if(prices===false){for(let key in this.basketInfo.products){let basketProduct=this.basketInfo.products[key];if(basketProduct.product_id==this.productId)continue;if(!currentPrices.includes(basketProduct.price_float))currentPrices.push(basketProduct.price_float);}}
else{switch(typeof prices){case'string':currentPrices.push(parseFloat(prices));break;case'number':currentPrices.push(prices);break;case'object':if(!Array.isArray(prices))return Promise.reject(new Error('Wrong prices type in loadProductOptions'));currentPrices=prices;break;default:return Promise.reject(new Error('Wrong prices type in loadProductOptions'));}}
let optionPriceRangeValues=[];let optionPriceRangeBrakets={};let optionTimePeriodValues=[];let optionTimePeriodNames={};for(let key in this.protection.options_configuration){let option=this.protection.options_configuration[key];if(option.id==this.optionPriceRangeId){for(let key2 in option.values){let optionValue=option.values[key2];let priceBraketsArray=optionValue.name.split(',').join('.').split('-');let priceBrakets={priceMin:parseFloat(priceBraketsArray[0])*this.currencyRate,priceMax:parseFloat(priceBraketsArray[1])*this.currencyRate,};let priceInBrakets=false;for(let key3 in currentPrices){let price=currentPrices[key3];if(priceBrakets.priceMin<=price&&price<=priceBrakets.priceMax){priceInBrakets=true;break;}}
if(priceInBrakets){optionPriceRangeValues.push(optionValue.id);optionPriceRangeBrakets[optionValue.id]=priceBrakets;}}}
if(option.id==this.optionTimePeriodId){for(let key2 in option.values){let optionValue=option.values[key2];optionTimePeriodValues.push(optionValue.id);optionTimePeriodNames[optionValue.id]=optionValue.name;}}}
let dataOptions=[];for(let key in optionPriceRangeValues){let optionPriceRangeValue=optionPriceRangeValues[key];for(let key2 in optionTimePeriodValues){let optionTimePeriodValue=optionTimePeriodValues[key2];let options={};options[this.optionPriceRangeId]=optionPriceRangeValue;options[this.optionTimePeriodId]=optionTimePeriodValue;dataOptions.push(options);}}
let promises=[];loopLabel:for(let key in dataOptions){let options=dataOptions[key];for(let key2 in this.protectionVariants){if(this.protectionVariants[key2].options[this.optionPriceRangeId]!=options[this.optionPriceRangeId])continue;if(this.protectionVariants[key2].options[this.optionTimePeriodId]!=options[this.optionTimePeriodId])continue;continue loopLabel;}
promises.push(new Promise((resolve,reject)=>{frontAPI.getProductOption((stock)=>{if('error_description'in stock)return resolve(stock);let priceBrakets=optionPriceRangeBrakets[options[this.optionPriceRangeId]];let protectionWariant={stockId:stock.id,options:options,price:stock.price.gross.final_float,priceMin:priceBrakets.priceMin,priceMax:priceBrakets.priceMax,timePeriod:optionTimePeriodNames[options[this.optionTimePeriodId]],};this.protectionVariants.push(protectionWariant);return resolve(protectionWariant);},{id:this.productId,data:{options:options},lang:this.lang,currency:this.currency});}));}
return Promise.all(promises);};App.prototype.addProtectionToBasket=function addProtectionToBasket(){return new Promise((resolve,reject)=>{let protectionExists=false;let protectionForms={};let productsTable=$(`#box_basketlist .productlist > tbody > tr[data-product-id]`);productsTable.each((index,tableRow)=>{tableRow=$(tableRow);if(tableRow.data('basket-product-id')==undefined){if(tableRow.find('.prodremove').length==0||tableRow.find('.prodremove').attr('href')=='')return true;let productBasketId=tableRow.find('.prodremove').attr('href').split("/").pop();tableRow.attr('data-basket-product-id',productBasketId);}
let basketProductId=tableRow.data('basket-product-id');let basketProduct=this.basketInfo.products.find((basketProduct)=>basketProduct.id==basketProductId);let productId=basketProduct.product_id;if(productId!=this.productId){let categoryId='category'in basketProduct?basketProduct.category.category_id:-1;let producerId='producer'in basketProduct?basketProduct.producer.producer_id:-1;if(!this.checkAllowProtection(productId,categoryId,producerId))return true;let protectionForm=this.createProtectionForm(tableRow);if(protectionForm!=false){protectionForms[basketProductId]=protectionForm;tableRow.find('.quantity input').on('change.maxProtection',(e)=>{this.changeMaxProtectionEvent(basketProductId);});this.changeMaxProtectionEvent(basketProductId);}}
else{protectionExists=true;tableRow.find(`td.name > a`).attr('href',this.infoPageUrl);tableRow.find('.quantity input').on('change.maxProtection',(e)=>{if(tableRow.data('basket-product-id')==undefined)return false;this.changeMaxProtectionEvent(tableRow.data('for-basket-product-id'));});}});if(!protectionExists&&this.checkboxEnableEasyProtect){localStorage.appEasyProtectEnableEasyProtect='false';if(Object.keys(protectionForms).length>0){let mxEnableEasyProtect=$(`
`).prependTo('#box_basketlist .summary-container');let checkbox=$(``).appendTo(mxEnableEasyProtect);checkbox.attr('id','mxEnableEasyProtect');checkbox.wrap(``);$(``).insertAfter(checkbox);let label=$(``).appendTo(mxEnableEasyProtect);label.html(this.getTranslation('checkboxEnableEasyProtectText'));checkbox.on('change.enableEasyProtect',(e)=>{if(checkbox.is(':checked')){localStorage.appEasyProtectEnableEasyProtect='true';productsTable.each((index,tableRow)=>{tableRow=$(tableRow);let basketProductId=tableRow.data('basket-product-id');let basketProduct=this.basketInfo.products.find((basketProduct)=>basketProduct.id==basketProductId);let productId=basketProduct.product_id;if(productId!=this.productId){if(basketProductId in protectionForms){let parentRow=tableRow;while(parentRow.next().data('product-id')==this.productId){parentRow=parentRow.next();}
protectionForms[basketProductId].insertAfter(parentRow);}}});}
else{localStorage.appEasyProtectEnableEasyProtect='false';productsTable.each((index,tableRow)=>{tableRow=$(tableRow);let basketProductId=tableRow.data('basket-product-id');let basketProduct=this.basketInfo.products.find((basketProduct)=>basketProduct.id==basketProductId);let productId=basketProduct.product_id;if(productId!=this.productId){if(basketProductId in protectionForms){protectionForms[basketProductId].detach();}}});}});}}
else{productsTable.each((index,tableRow)=>{tableRow=$(tableRow);let basketProductId=tableRow.data('basket-product-id');let basketProduct=this.basketInfo.products.find((basketProduct)=>basketProduct.id==basketProductId);let productId=basketProduct.product_id;if(productId!=this.productId){if(basketProductId in protectionForms){let parentRow=tableRow;while(parentRow.next().data('product-id')==this.productId){parentRow=parentRow.next();}
protectionForms[basketProductId].insertAfter(parentRow);}}});}
return resolve(true);});};App.prototype.checkAllowProtection=function checkAllowProtection(productId,categoryId,producerId){let blockCategory=false;let blockProducer=false;if(0 in this.categoriesIds){if(categoryId in this.categoriesIds){blockCategory=true;}}
else{if(!(categoryId in this.categoriesIds)){blockCategory=true;}}
if(0 in this.producersIds){if(producerId in this.producersIds){blockProducer=true;}}
else{if(!(producerId in this.producersIds)){blockProducer=true;}}
if(this.listType=='whitelist'){if(this.productIds.includes(productId))return true;}
else if(this.listType=='blacklist'){if(this.productIds.includes(productId))return false;}
if(blockCategory)return false;if(blockProducer)return false;return true;};App.prototype.createProtectionForm=function createProtectionForm(tableRow){let basketProductId=tableRow.data('basket-product-id');let basketProduct=this.basketInfo.products.find((basketProduct)=>basketProduct.id==basketProductId);let productId=basketProduct.product_id;let chossenProtectionVariants=this.protectionVariants.filter((variant)=>variant.priceMin<=basketProduct.price_float&&basketProduct.price_float<=variant.priceMax);if(chossenProtectionVariants.length==0)return false;chossenProtectionVariants.sort((a,b)=>a.price-b.price);let noProtectionQuantity=basketProduct.quantity;let protectionData=[];if(localStorage.appEasyProtectProtectionData){protectionData=JSON.parse(localStorage.appEasyProtectProtectionData);}
for(let key in protectionData){let data=protectionData[key];if(data.basketProductId!=basketProductId)continue;for(let key2 in this.basketInfo.products){let basketProtection=this.basketInfo.products[key2];if(basketProtection.id!=data.basketProtectionId)continue;noProtectionQuantity-=basketProtection.quantity;}}
if(noProtectionQuantity<=0)return false;let form=$(`