(function appEasyProtect($){let App=function App(){this.sessionId='52d5b2ca8c52d5d676a82cbd1c216926';this.sessionToken='47a40a7d7b3a922799f0233ab673b2d081881bbf95d2ba2fe5c2f7b765d5af00';this.listType='whitelist';this.shopId=352;this.translations={"add_text":{"__default":"Dodaj"},"no_option_text":{"__default":"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":"podstawowa"}};this.productId=16100;this.optionPriceRangeId=119;this.optionTimePeriodId=120;this.optionToProductId=121;this.optionDataId=122;this.infoPageId=692;this.checkboxEnableFieldId=10;this.noOption=0;this.checkboxEnableEasyProtect=0;this.addEasyProtectToProductIndex=1;this.productIds=[14497,14555,14817,14818,14866,14867,14910,14921,14976,14996,15144,15209,15272,15326,15440,15455,15456,15546,15547,15570,15695,15696,15880,16002,16003,16012,16014,16015,16019,16020,16021,16022,16023,16024,16051,12154,12157,12158,12159,12166,12201,12202,12248,12249,12299,12508,12580,12581,12582,12583,12585,13100,13102,13153,13190,13254,13261,13499,13596,13601,13667,13668,14090,14150,14152,14254,14272,14273,14275,14276,14277,14302,14306,14308,14310,14317,14318,14319,14496,16110,16111,11687,11689,11690,11691,11693,11845,11846,11964,12133,9030,9441,10100,10322,10404,10683,10684,10685,10691,10692,10721,10722,10723,10724,10725,10726,11113,11114,11115,11116,11117,11118,11301,11302,11303,11304,11521,11540,11541,11542,11686,12681,12682,12683,12844,12934,13149,13220,13349,13352,13462,13463,13464,13465,13730,13731,13732,13733,13734,13735,13951,13953,13954,14304,14312,14369,14370,14371,14821,14822,14823,14824,14825,14826,14827,14828,14829,14830,14911,14912,14913,14914,14915,15072,15275,15276,15277,15528,16170,16171,16256,10362,10363,10364,10370,10371,10372,10374,10513,10514,10515,10595,10643,10644,10645,10646,10647,10654,10655,10656,10657,10658,10661,10662,10663,10672,10673,10674,10675,10676,10677,10678,10679,10680,10681,10805,10806,10807,11235,11236,11237,11238,11477,11647,11664,11762,11763,11764,11765,12555,12632,1527,2455,2456,2457,2459,2460,2461,2480,2490,2491,2492,4198,5455,5472,6430,6530,6907,7070,7311,7312,7313,7403,7617,7618,7619,8294,8295,8296,8297,8350,8355,8423,8780,8781,8782,9113,9223,9296,9396,9560,9561,9562,9563,9564,10201,10202,10203,10204,10205,10361,1353,1526,7870,9062,9063,9070,9077,9452,9453,9456,9938,10173,10174,10442,10704,10856,10857,10858,10860,13200,13201,13264,13481,13482,13483,13484,13527,13528,13529,13530,14106,14108,14244,14245,14286,14287,14683,14684,15255,15461,15462,15463,15562,15567,15700,15702,15703,15712,15713,15718,15879,16115,3412,5272,15105,15106,15107,15109,15110,15111,15112,15155,15156,15160,15161,15192,15359,15460,15468,15469,15470,15475,15497,15522,15527,15654,15662,15678,15679,15680,15681,15682,15694,15697,15707,15708,15716,15717,15729,15797,15821,15884,16154,16155,16156,16166,16210,16218,16251,16252,16259,16260,14384,14385,14386,14399,14400,14401,14454,14455,14456,14460,14461,14462,14501,14608,14616,14720,14721,14722,14723,14724,14725,14726,14727,14728,14729,14730,14731,14732,14768,14774,14775,14778,14780,14781,14782,14784,14785,14844,14845,14847,14848,15092,15093,15094,15095,15096,15097,15102,15103,15104,13736,13774,13890,13965,14080,14086,14089,14162,14196,14197,14199,14200,14201,14202,14203,14204,14205,14206,14207,14208,14209,14210,14223,14224,14225,14226,14227,14229,14230,14231,14232,14233,14234,14235,14236,14237,14238,14239,14240,14241,14243,14264,14265,14378,12270,12475,12503,12506,12532,12533,12534,12536,12598,12599,12600,12601,12628,12633,12668,12671,12694,12700,12701,12702,12703,12704,12790,12922,12932,12937,12938,12942,12955,12956,13053,13054,13158,13259,13306,13439,13441,13442,13452,13575,13582,13591,13686,13696,11596,11628,11629,11630,11631,11648,11665,11666,11714,11732,11739,11753,11754,11755,11759,11761,11766,11767,11768,11769,11770,11774,11775,11776,11777,11778,11779,11780,11781,11783,11859,11860,11862,11863,11927,11928,11929,11947,11950,11984,11985,11986,12014,12039,12074,12075,12189,12268,12269,10380,10381,10463,10464,10465,10492,10579,10580,10584,10625,10639,10696,10808,10844,10922,10974,10975,10976,11023,11048,11080,11081,11087,11088,11096,11098,11099,11100,11108,11262,11397,11418,11434,11481,11556,11559,11571,8419,8421,8696,8697,8698,8699,8715,8724,8725,8726,8727,8776,8777,8778,8783,8784,8785,8786,8916,8917,8918,9061,9089,9114,9132,9133,9244,9556,9626,9914,9924,9977,10095,10366,2474,2475,2555,3858,3861,3862,5255,5257,6579,6580,6784,6906,6992,6993,7043,7101,7102,7105,7106,7253,7285,7372,7404,7405,7469,7470,7471,7571,7572,7599,7634,7635,7636,7656,7791,7943,7959,7963,8141,8306,8349,2287,2288,2295,731,732,760,761,897,898,904,5453,5454,6039,6271,6357,6358,6429,6522,6809,6810,6934,7135,7345,7370,7569,7877,7960,7961,8380,8387,8528,8624,8660,8662,8668,8816,9071,9072,9073,9074,9075,9078,9096,9097,9110,9111,9156,9254,9255,9321,9322,9495,9499,352,509,513,517,519,522,524,557,568,602,603,605,607,608,610,632,633,647,648,655,682,705,730,11855,12052,12055,12056,12058,12059,12060,12061,12062,12063,12065,12078,12079,12106,12107,12141,12142,12144,12145,12148,12149,12150,12152,12153,12160,12161,12162,12163,12164,12170,12171,12172,12173,12174,12175,12183,12184,12297,12302,12306,12307,12308,12309,12310,12325,12427,12428,12437,12438,12489,9567,9572,9596,9646,9724,9725,9951,9952,9955,9956,9957,9958,10098,10099,10222,10375,10376,10535,10564,10615,10777,10778,10779,10790,10803,10967,10982,10983,10999,11000,11052,11069,11150,11154,11263,11264,11271,11323,11417,11437,11438,11458,11459,11460,11461,11462,11463,11546,11662,11854,14039,14065,14066,14077,14145,14154,14155,14294,14303,14366,14413,14477,14677,14687,14752,14755,14756,14757,14758,14764,14819,14868,14917,15133,15134,15135,15136,15137,15138,15139,15140,15141,15215,15324,15328,15389,15652,15663,15664,15709,15719,15828,15829,15830,15831,15849,15882,16175,16176,16177,12490,12491,12493,12510,12513,12514,12528,12542,12543,12568,12591,12612,12613,12614,12615,12621,12623,12658,12660,12661,12663,12749,12750,12785,12786,12787,12814,12815,12837,12900,13241,13255,13256,13282,13283,13284,13524,13525,13597,13598,13664,13672,13673,13757,13865,13866,13956,13957,13958,13959,10053,10057,10317,10693,10952,10953,11053,11054,11055,11121,11141,11439,11557,11558,11676,11696,11697,11877,12033,12046,12049,12050,12068,12586,12587,12644,12645,12838,12839,12840,12856,13066,13110,13112,13113,13185,13448,13669,13670,13876,13877,14305,14618,15322,15360,15649,15665,15666,15886,15972,623,624,625,626,627,628,667,697,702,703,4522,4523,4907,4929,4930,4931,4932,4965,6595,6658,6805,7011,7984,9365,9366,9367,9368,9369,9693,9694,9695,9696,9697,9698,9699,9700,9701,9702,9703,10018,10019,16597,16598,16512,16616,16617,16626,16627,16631,16634,16637,16668,16652,16654,17102,17103,17104,17105,17106,17107,17108,17109,17110,17206,17207,17209,17212,17215,17217,17218,17219,17220,17223,17224,17228,17229,17230,17232,17233,17250,17252,17276,17280,17283,17286,17289,17290,17292,17293,17294,17295,17296,17297,17299,17300,17303,17306,17308,17353,17355,17389,17408,17489,17490,14865,14869,15335,16345,16503,16514,16515,16593,16594,16696,17013,17017,17018,17019,17020,17021,17022,17032,17034,17035,17036,17037,17062,17063,17065,16672,17180,17188,17301,17302,17321,17322,17323,17324,17325,17326,17328,17329,17332,17334,17336,17338,17339,17340,17341,17345,17348,17349,17351,17352,17354,17356,17358,17359,17361,17370,17371,17372,17376,17380,17383,17386,17387,17388,17390,17401,17402,17403,17404,17405,17412,17413,17414,17423,17433,13600];this.categoriesIds={"391":"Aparaty fotograficzne","401":"Obiektywy","417":"Lampy błyskowe","447":"Oświetlenie filmowe","470":"Lampy studyjne","497":"Monitory, kalibratory"};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=$(` |
`);let mxWrapper=form.find('.mxWrapper');let mxLeftCol=$(``).appendTo(mxWrapper);let bigPurpleArrow=$(``).appendTo(mxWrapper);bigPurpleArrow.attr('src','https://mxapp2.maxserver.pl/appEasyProtect/gfx/bigPurpleArrow.png');bigPurpleArrow.wrap(``);let mxRightCol=$(``).appendTo(mxWrapper);let name=this.escapeHtml(this.protection.name);let tradeMark='';if(name.charCodeAt(name.length-1)==174){tradeMark=`${name.substr(-1, 1)}`;name=name.substr(0,name.length-1);}
if(name.charCodeAt(name.length-1)==8482){tradeMark=`${name.substr(-1, 1)}`;name=name.substr(0,name.length-1);}
let mxImage=$(``).appendTo(mxLeftCol);mxImage.wrap(``);let mxNameContainer=$(``).appendTo(mxLeftCol);let mxName=$(`${name}${tradeMark}
`).appendTo(mxNameContainer);let mxInfoPageUrl=$(`${this.getTranslation('infoPageText')}`).appendTo(mxNameContainer);mxInfoPageUrl.attr('href',this.infoPageUrl);mxInfoPageUrl.attr('target','_blank').attr('rel','noreferrer');mxInfoPageUrl.wrap(``);let smallPurpleArrow=$(``).insertBefore(mxInfoPageUrl);smallPurpleArrow.attr('src','https://mxapp2.maxserver.pl/appEasyProtect/gfx/smallPurpleArrow.png');smallPurpleArrow.wrap(``);let mxQuantityWrap=$(``).appendTo(mxRightCol);let mxQuantity=$(``).appendTo(mxQuantityWrap);for(let i=1;i<=noProtectionQuantity;i++){mxQuantity.append(``);}
let mxOptions=$(``).appendTo(mxRightCol);if(this.noOption==1){let mxOption=$(``).appendTo(mxOptions);mxOption.attr('name',`radio_${basketProductId}`);mxOption.attr('id',`radio_${basketProductId}_no_option`);mxOption.attr('value',`0`);mxOption.wrap(``);let label=$(``).insertAfter(mxOption);label.attr('for',`radio_${basketProductId}_no_option`);label.append(this.getTranslation('noOptionText'));}
for(let key in chossenProtectionVariants){let chossenVariant=chossenProtectionVariants[key];let mxOption=$(``).appendTo(mxOptions);mxOption.attr('name',`radio_${basketProductId}`);mxOption.attr('id',`radio_${basketProductId}_${chossenVariant.stockId}`);mxOption.attr('value',chossenVariant.stockId);mxOption.wrap(``);let label=$(``).insertAfter(mxOption);label.attr('for',`radio_${basketProductId}_${chossenVariant.stockId}`);label.append(`${chossenVariant.timePeriod} `);label.append(`${this.priceFormat(chossenVariant.price)}`);}
let mxSum=$(``).appendTo(mxRightCol);let mxAction=$(``).appendTo(mxRightCol);let mxButtonAdd=$(`${this.getTranslation('protectionAddText')}
`).appendTo(mxAction);mxQuantity.on('change',(e)=>{let quantity=parseFloat($(e.target).val());let stockId=parseFloat(mxOptions.find('input:checked').val());if(stockId==0){mxButtonAdd.stop().animate({'opacity':0.3});mxSum.text(this.priceFormat(0));}
else{mxButtonAdd.stop().animate({'opacity':1});let price=0;for(let key in chossenProtectionVariants){let chossenVariant=chossenProtectionVariants[key];if(stockId==chossenVariant.stockId){price=chossenVariant.price;break;}}
let quantity=mxQuantity.val();mxSum.text(this.priceFormat(price*quantity));}
for(let key in this.$style.get(0).sheet.cssRules){let rule=this.$style.get(0).sheet.cssRules[key];if(rule.selectorText!='.protectionForm .mxRightCol .mxSum')continue;let width=mxSum.get(0).getBoundingClientRect().width;if(parseFloat(rule.style.minWidth){let quantity=parseFloat(mxQuantity.val());let stockId=parseFloat($(e.target).val());if(stockId==0){mxAction.addClass('mxHidden');mxButtonAdd.stop().animate({'opacity':0.3});mxSum.text(this.priceFormat(0));}
else{mxAction.removeClass('mxHidden');mxButtonAdd.stop().animate({'opacity':1});let price=0;for(let key in chossenProtectionVariants){let chossenVariant=chossenProtectionVariants[key];if(stockId==chossenVariant.stockId){price=chossenVariant.price;break;}}
mxSum.text(this.priceFormat(price*quantity));}
for(let key in this.$style.get(0).sheet.cssRules){let rule=this.$style.get(0).sheet.cssRules[key];if(rule.selectorText!='.protectionForm .mxRightCol .mxSum')continue;let width=mxSum.get(0).getBoundingClientRect().width;if(parseFloat(rule.style.minWidth){let quantity=parseFloat(mxQuantity.val());let stockId=parseFloat(mxOptions.find('input:checked').val());if(stockId==0)return false;let options={};for(let key in chossenProtectionVariants){let chossenVariant=chossenProtectionVariants[key];if(stockId==chossenVariant.stockId){options=chossenVariant.options;break;}}
let query={data:{stock_id:stockId,quantity:quantity,options:options,}};query.data.options[this.optionToProductId]=`${basketProduct.name}`;let hasVariant=0;if(basketProduct.variant!=''){hasVariant=1;query.data.options[this.optionToProductId]+=` (${basketProduct.variant})`;}
query.data.options[this.optionDataId]=`${basketProduct.stock_id}, ${hasVariant}`;let wait=$('').appendTo('head');frontAPI.addToBasket((response)=>{if(response.added.length>0){let protectionData=[];if(localStorage.appEasyProtectProtectionData){protectionData=JSON.parse(localStorage.appEasyProtectProtectionData);}
let protectionExisted=false;for(let key in protectionData){let data=protectionData[key];if(data.basketProductId!=basketProduct.id)continue;if(data.basketProtectionId!=response.added[0].id)continue;protectionExisted=true;break;}
if(!protectionExisted){protectionData.push({basketProductId:basketProduct.id,basketProtectionId:response.added[0].id,});localStorage.appEasyProtectProtectionData=JSON.stringify(protectionData);}
location.replace(location.href);}
else{if(response._flash_messenger.error.length>0)shoper.alert(response._flash_messenger.error[0],'');if(response._flash_messenger.warning.length>0)shoper.alert(response._flash_messenger.warning[0],'');if(response._flash_messenger.info.length>0)shoper.alert(response._flash_messenger.info[0],'');}
wait.remove();},query);});return form;};App.prototype.changeMaxProtectionEvent=function changeMaxProtectionEvent(basketProductId){let maxProtection=$(`#box_basketlist .productlist > tbody > tr[data-basket-product-id=${basketProductId}] .quantity input`).val();let noProtectionQuantity=maxProtection;let basketProtectionIds=[];let protectionData=[];if(localStorage.appEasyProtectProtectionData){protectionData=JSON.parse(localStorage.appEasyProtectProtectionData);}
for(let key in protectionData){let data=protectionData[key];if(data.basketProductId!=basketProductId)continue;basketProtectionIds.push(data.basketProtectionId);}
if(basketProtectionIds.length==0)return false;let protectionsTable=$(`#box_basketlist .productlist > tbody > tr[data-product-id=${this.productId}]`);protectionsTable.each((index2,tableRow)=>{tableRow=$(tableRow);if(!basketProtectionIds.includes(tableRow.data('basket-product-id')))return true;noProtectionQuantity-=tableRow.find('.quantity input').val();});if(noProtectionQuantity<0){noProtectionQuantity=maxProtection;protectionsTable.each((index2,tableRow)=>{tableRow=$(tableRow);if(!basketProtectionIds.includes(tableRow.data('basket-product-id')))return true;let input=tableRow.find('.quantity input');if(noProtectionQuantity-input.val()>0){noProtectionQuantity-=input.val();input.attr('max',input.val());return true;}
if(noProtectionQuantity>0){input.attr('max',noProtectionQuantity);noProtectionQuantity=0;return true;}
input.attr('max',0);});$('#box_basketlist .innerbox > form').get(0).reportValidity();}
else{protectionsTable.each((index2,tableRow)=>{tableRow=$(tableRow);if(!basketProtectionIds.includes(tableRow.data('basket-product-id')))return true;let input=tableRow.find('.quantity input');input.attr('max',input.val()*1+noProtectionQuantity);});}};App.prototype.addProtectionToProductIndex=function addProtectionToProductIndex(){return new Promise((resolve,reject)=>{frontAPI.getProduct((product)=>{if('error_description'in product)return reject(new Error('Product not found'));let categoryId='category'in product?product.category.id:-1;let producerId='producer'in product?product.producer.id:-1;if(!this.checkAllowProtection(product.id,categoryId,producerId))return resolve(true);let mxEasyProtectContainer=$(``).insertBefore('.productdetails-more-details');mxEasyProtectContainer.hide();let mxHeader=$(`${this.getTranslation('productIndexText2')}
`).appendTo(mxEasyProtectContainer);let mxOptions=$(``).appendTo(mxEasyProtectContainer);let mxInfoPageUrl=$(`${this.getTranslation('infoPageText')}`).appendTo(mxEasyProtectContainer);mxInfoPageUrl.attr('href',this.infoPageUrl);mxInfoPageUrl.attr('target','_blank').attr('rel','noreferrer');mxInfoPageUrl.wrap(``);let mxSmallGreyArrow=$(``).insertAfter(mxInfoPageUrl);mxSmallGreyArrow.attr('src','https://mxapp2.maxserver.pl/appEasyProtect/gfx/bigPurpleArrow.png');mxSmallGreyArrow.wrap(``);let price=parseFloat($('#box_productfull .price .main-price').eq(0).text().replaceAll(/[^\d,.-]/g,'').replaceAll(',','.'));this.changeProductStockEvent(mxEasyProtectContainer,mxOptions,price).catch((reason)=>this.errorHandler(reason));let prevPrice=price;let observer=new MutationObserver(()=>{let price=parseFloat($('#box_productfull .price .main-price').eq(0).text().replaceAll(/[^\d,.-]/g,'').replaceAll(',','.'));if(price==prevPrice)return false;prevPrice=price;this.changeProductStockEvent(mxEasyProtectContainer,mxOptions,price).catch((reason)=>this.errorHandler(reason));});observer.observe($('#box_productfull .price .main-price').get(0),{childList:true});$('#box_productfull .addtobasket').on('click',(e)=>{let option=mxOptions.find('input:checked');if(option.length==1&&option.val()!=0){let protectionFromProductIndex=[];if(localStorage.appEasyProtectProtectionFromProductIndex){protectionFromProductIndex=JSON.parse(localStorage.appEasyProtectProtectionFromProductIndex);}
let object={protection:{},product:{},otherProductQuantities:{}};object.protection.stockId=parseFloat(option.val());object.product.stockId=parseFloat($('#box_productfull .addtobasket-container [name="stock_id"]').val());object.product.quantity=parseFloat($('#box_productfull .addtobasket-container [name="quantity"]').val());for(let key in this.protectionVariants){let variant=this.protectionVariants[key];if(variant.stockId==option.val()){object.protection.options=variant.options;break;}}
for(let key in this.basketInfo.products){let basketProduct=this.basketInfo.products[key];object.otherProductQuantities[basketProduct.id]=basketProduct.quantity;}
protectionFromProductIndex.push(object);localStorage.appEasyProtectProtectionFromProductIndex=JSON.stringify(protectionFromProductIndex);}});return resolve(true);},{id:Shop.pageId});});};App.prototype.changeProductStockEvent=function changeProductStockEvent(mxEasyProtectContainer,mxOptions,price){return this.loadProductOptions(price).then(()=>{let chossenProtectionVariants=this.protectionVariants.filter((variant)=>variant.priceMin<=price&&price<=variant.priceMax);mxOptions.empty();if(chossenProtectionVariants.length==0){mxEasyProtectContainer.hide();}
else{chossenProtectionVariants.sort((a,b)=>a.price-b.price);mxEasyProtectContainer.show();{let mxOption=$(``).appendTo(mxOptions);mxOption.attr('for',`mx_easy_protect_radio_no_option`);let mxOptionInput=$(``).appendTo(mxOption);mxOptionInput.attr('name',`mx_easy_protect_radio`);mxOptionInput.attr('id',`mx_easy_protect_radio_no_option`);mxOptionInput.attr('value',`0`);mxOptionInput.attr('checked',`checked`);let mxOptionLabel=$(``).appendTo(mxOption);let mxOptionText=$(`${this.getTranslation('productIndexNoOptionText')}
`).appendTo(mxOption);let mxOptionPrice=$(`/bezpłatna/
`).appendTo(mxOption);}
for(let key in chossenProtectionVariants){let chossenVariant=chossenProtectionVariants[key];let mxOption=$(``).appendTo(mxOptions);mxOption.attr('for',`mx_easy_protect_radio_${chossenVariant.stockId}`);let mxOptionInput=$(``).appendTo(mxOption);mxOptionInput.attr('name',`mx_easy_protect_radio`);mxOptionInput.attr('id',`mx_easy_protect_radio_${chossenVariant.stockId}`);mxOptionInput.attr('value',chossenVariant.stockId);let mxOptionLabel=$(``).appendTo(mxOption);let mxOptionText=$(`${this.getTranslation('productIndexOptionText')}
`).appendTo(mxOption);let mxOptionName=$(`EasyProtect® ${chossenVariant.timePeriod}
`).appendTo(mxOption);let mxOptionPrice=$(`/${this.priceFormat(chossenVariant.price)}/
`).appendTo(mxOption);}
let mxRwdTree=$(``).appendTo(mxOptions);$(``).appendTo(mxRwdTree);$(``).appendTo(mxRwdTree);$(``).appendTo(mxOptions);}});};App.prototype.addProtectionFromProductIndex=function addProtectionFromProductIndex(skipRefresh=false){return new Promise((resolve,reject)=>{let protectionFromProductIndexes=[];if(localStorage.appEasyProtectProtectionFromProductIndex){protectionFromProductIndexes=JSON.parse(localStorage.appEasyProtectProtectionFromProductIndex);}
if(protectionFromProductIndexes.length>0){let promises=[];for(let key in protectionFromProductIndexes){let protectionFromProductIndex=protectionFromProductIndexes[key];let correctBasketProduct=null;for(let key2 in this.basketInfo.products){let basketProduct=this.basketInfo.products[key2];if(basketProduct.stock_id!=protectionFromProductIndex.product.stockId)continue;if(basketProduct.quantity==protectionFromProductIndex.otherProductQuantities[basketProduct.id])continue;protectionFromProductIndex.otherProductQuantities[basketProduct.id]+=protectionFromProductIndex.product.quantity;correctBasketProduct=basketProduct;break;}
if(correctBasketProduct==null)continue;promises.push(new Promise((resolve,reject)=>{let query={data:{stock_id:protectionFromProductIndex.protection.stockId,quantity:protectionFromProductIndex.product.quantity,options:protectionFromProductIndex.protection.options,}};query.data.options[this.optionToProductId]=`${correctBasketProduct.name}`;let hasVariant=0;if(correctBasketProduct.variant!=''){hasVariant=1;query.data.options[this.optionToProductId]+=` (${correctBasketProduct.variant})`;}
query.data.options[this.optionDataId]=`${correctBasketProduct.stock_id}, ${hasVariant}`;let wait=$('').appendTo('head');frontAPI.addToBasket((response)=>{if(response.added.length>0){protectionFromProductIndexes.splice(key,1);localStorage.appEasyProtectProtectionFromProductIndex=JSON.stringify(protectionFromProductIndexes);let protectionData=[];if(localStorage.appEasyProtectProtectionData){protectionData=JSON.parse(localStorage.appEasyProtectProtectionData);}
let protectionExisted=false;for(let key in protectionData){let data=protectionData[key];if(data.basketProductId!=correctBasketProduct.id)continue;if(data.basketProtectionId!=response.added[0].id)continue;protectionExisted=true;break;}
if(!protectionExisted){protectionData.push({basketProductId:correctBasketProduct.id,basketProtectionId:response.added[0].id,});localStorage.appEasyProtectProtectionData=JSON.stringify(protectionData);}
return resolve(true);}
else{if(response._flash_messenger.error.length>0)shoper.alert(response._flash_messenger.error[0],'');if(response._flash_messenger.warning.length>0)shoper.alert(response._flash_messenger.warning[0],'');if(response._flash_messenger.info.length>0)shoper.alert(response._flash_messenger.info[0],'');}
wait.remove();},query);}));}
Promise.all(promises).then(()=>{if(skipRefresh){return resolve(true);}
else{location.replace(location.href);}});return true;}
else{return resolve(true);}});};App.prototype.waitForSoobasket=function waitForSoobasket(){return new Promise((resolve,reject)=>{let waitingFunction=()=>{if($('#box_basketlist').is(':visible')){return resolve('fallback');}
else if($('.el-table .el-table__row').length==0){setTimeout(waitingFunction,100);}
else{let protectionRows=[];let productsTable=$('.el-table .el-table__row');productsTable.each((index,tableRow)=>{tableRow=$(tableRow);for(let className of tableRow.get(0).classList){let types={'data-basket-product-id':'basket_product_id_','data-product-id':'product_id_',};for(let type in types){if(className.indexOf(types[type])!=-1){tableRow.attr(type,className.slice(types[type].length));}}}
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(`.cell > .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(`.cell > .name .variant`).html().split('; ');protectionRow.find(`.cell > .name .variant`).html(`${variants[1]}; ${variants[2]}`);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=$(`.el-table .el-table__row.basket_product_id_${basketProductId}`);while(parentRow.next().data('product-id')==this.productId){parentRow=parentRow.next();}
protectionRow.insertAfter(parentRow);}}}
return resolve('loaded');}};waitingFunction();});};App.prototype.addProtectionToSoobasket=function addProtectionToSoobasket(){return new Promise((resolve,reject)=>{let protectionExists=false;let protectionForms={};let protectionInputs={};let productsTable=$(`.el-table .el-table__row`);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){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.createProtectionFormSoobasket(tableRow);if(protectionForm!=false){protectionForms[basketProductId]=protectionForm;protectionInputs[basketProductId]={product:tableRow.find('.quantity-input input').eq(0),protection:[],};}}
else{protectionExists=true;tableRow.find(`.cell > .name > a`).attr('href',this.infoPageUrl);protectionInputs[tableRow.data('for-basket-product-id')].protection.push(tableRow.find('.quantity-input input').eq(0));tableRow.find('.quantity-input').each((index2,item)=>{item=$(item);let orgInput=item.find('input');let mxQuantity=item.clone().addClass('quantity-input-ep').insertAfter(item);item.addClass('quantity-input-org').hide();});}});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){let protectionInput=protectionInputs[tableRow.data('for-basket-product-id')];let noProtectionQuantity=protectionInput.product.val();for(let key in protectionInput.protection){noProtectionQuantity-=protectionInput.protection[key].val();}
tableRow.find('.quantity-input-ep input').val(basketProduct.quantity).attr('data-max',basketProduct.quantity+noProtectionQuantity);if(basketProduct.quantity<=1){tableRow.find('.quantity-input-ep .el-input-number__decrease').addClass('is-disabled');}else{tableRow.find('.quantity-input-ep .el-input-number__decrease').removeClass('is-disabled');}
if(noProtectionQuantity<=0){tableRow.find('.quantity-input-ep .el-input-number__increase').addClass('is-disabled');}else{tableRow.find('.quantity-input-ep .el-input-number__increase').removeClass('is-disabled');}
tableRow.find('.quantity-input-ep input').on('change',(e)=>{let value=Math.min(Math.max(1,$(e.currentTarget).val()),$(e.currentTarget).data('max'));let input=tableRow.find('.quantity-input-org input').eq(0);if(value==input.val())return false;input.val(value);input.get(0).dispatchEvent(new Event('change'));});tableRow.find('.quantity-input-ep .el-input-number__decrease').on('click',(e)=>{if($(e.currentTarget).is('.is-disabled'))return false;let input=tableRow.find('.quantity-input-org input').eq(0);input.val(input.val()-1);input.get(0).dispatchEvent(new Event('change'));});tableRow.find('.quantity-input-ep .el-input-number__increase').on('click',(e)=>{if($(e.currentTarget).is('.is-disabled'))return false;let input=tableRow.find('.quantity-input-org input').eq(0);input.val(parseInt(input.val())+1);input.get(0).dispatchEvent(new Event('change'));});}});if(this.checkboxEnableEasyProtect){if(Object.keys(protectionForms).length>0){let mxEnableEasyProtect=$(``).prependTo('.el-form > .el-row + .el-row + .first-part-info > .el-col:last-of-type');mxEnableEasyProtect.wrap(``);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')){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 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){let parentRow=tableRow;while(parentRow.next().data('product-id')==this.productId){parentRow=parentRow.next();}
protectionForms[basketProductId].insertAfter(parentRow);}}}});}
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){protectionForms[basketProductId].detach();}}});}});if(protectionExists)checkbox.prop('checked',true).change();}}
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 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){let parentRow=tableRow;while(parentRow.next().data('product-id')==this.productId){parentRow=parentRow.next();}
protectionForms[basketProductId].insertAfter(parentRow);}}}});}
shoper.addEvent("soobasket:refresh",(e,basket)=>{this.basketInfo=basket;this.checkExceedingProtection().then(()=>{productsTable.each((index,tableRow)=>{tableRow=$(tableRow);let basketProductId=tableRow.data('basket-product-id');let basketProduct=this.basketInfo.products.find((basketProduct)=>basketProduct.id==basketProductId);if(basketProduct===undefined){if(basketProductId in protectionForms){protectionForms[basketProductId].remove();delete protectionForms[basketProductId];}
productsTable=productsTable.filter(i=>i!=index);return true;}
let productId=basketProduct.product_id;if(productId!=this.productId){if(basketProductId in protectionForms){let protectionInput=protectionInputs[basketProductId];let noProtectionQuantity=protectionInput.product.val();for(let key in protectionInput.protection){noProtectionQuantity-=protectionInput.protection[key].val();}
if(noProtectionQuantity>0){let mxQuantity=protectionForms[basketProductId].find('.mxQuantity').empty();for(let i=1;i<=noProtectionQuantity;i++){mxQuantity.append(``);}}
if(!this.checkboxEnableEasyProtect||$('#mxEnableEasyProtect').is(':checked')){if(noProtectionQuantity>0){let parentRow=tableRow;while(parentRow.next().data('product-id')==this.productId){parentRow=parentRow.next();}
protectionForms[basketProductId].insertAfter(parentRow);}
else{protectionForms[basketProductId].detach();}}}}
else{let protectionInput=protectionInputs[tableRow.data('for-basket-product-id')];let noProtectionQuantity=protectionInput.product.val();for(let key in protectionInput.protection){noProtectionQuantity-=protectionInput.protection[key].val();}
tableRow.find('.quantity-input-ep input').val(basketProduct.quantity).attr('data-max',basketProduct.quantity+noProtectionQuantity);if(basketProduct.quantity<=1){tableRow.find('.quantity-input-ep .el-input-number__decrease').addClass('is-disabled');}else{tableRow.find('.quantity-input-ep .el-input-number__decrease').removeClass('is-disabled');}
if(noProtectionQuantity<=0){tableRow.find('.quantity-input-ep .el-input-number__increase').addClass('is-disabled');}else{tableRow.find('.quantity-input-ep .el-input-number__increase').removeClass('is-disabled');}}});}).catch((reason)=>this.errorHandler(reason));});shoper.addEvent("soobasket:beforeorder",(e,basket)=>{let protectionData=[];if(localStorage.appEasyProtectProtectionData){protectionData=JSON.parse(localStorage.appEasyProtectProtectionData);}
if(protectionData.length==0&&$('#mxEnableEasyProtect').is(':checked')){basket.additional_fields[this.checkboxEnableFieldId]='Tak';}else{delete basket.additional_fields[this.checkboxEnableFieldId];}});return resolve(true);});};App.prototype.createProtectionFormSoobasket=function createProtectionFormSoobasket(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;}}
let form=$(` |
`);let mxWrapper=form.find('.mxWrapper');let mxLeftCol=$(``).appendTo(mxWrapper);let bigPurpleArrow=$(``).appendTo(mxWrapper);bigPurpleArrow.attr('src','https://mxapp2.maxserver.pl/appEasyProtect/gfx/bigPurpleArrow.png');bigPurpleArrow.wrap(``);let mxRightCol=$(``).appendTo(mxWrapper);let name=this.escapeHtml(this.protection.name);let tradeMark='';if(name.charCodeAt(name.length-1)==174){tradeMark=`${name.substr(-1, 1)}`;name=name.substr(0,name.length-1);}
if(name.charCodeAt(name.length-1)==8482){tradeMark=`${name.substr(-1, 1)}`;name=name.substr(0,name.length-1);}
let mxImage=$(``).appendTo(mxLeftCol);mxImage.wrap(``);let mxNameContainer=$(``).appendTo(mxLeftCol);let mxName=$(`${name}${tradeMark}
`).appendTo(mxNameContainer);let mxInfoPageUrl=$(`${this.getTranslation('infoPageText')}`).appendTo(mxNameContainer);mxInfoPageUrl.attr('href',this.infoPageUrl);mxInfoPageUrl.attr('target','_blank').attr('rel','noreferrer');mxInfoPageUrl.wrap(``);let smallPurpleArrow=$(``).insertBefore(mxInfoPageUrl);smallPurpleArrow.attr('src','https://mxapp2.maxserver.pl/appEasyProtect/gfx/smallPurpleArrow.png');smallPurpleArrow.wrap(``);let mxQuantityWrap=$(``).appendTo(mxRightCol);let mxQuantity=$(``).appendTo(mxQuantityWrap);for(let i=1;i<=noProtectionQuantity;i++){mxQuantity.append(``);}
let mxOptions=$(``).appendTo(mxRightCol);if(this.noOption==1){let mxOption=$(``).appendTo(mxOptions);mxOption.attr('name',`radio_${basketProductId}`);mxOption.attr('id',`radio_${basketProductId}_no_option`);mxOption.attr('value',`0`);mxOption.wrap(``);let label=$(``).insertAfter(mxOption);label.attr('for',`radio_${basketProductId}_no_option`);label.append(this.getTranslation('noOptionText'));}
for(let key in chossenProtectionVariants){let chossenVariant=chossenProtectionVariants[key];let mxOption=$(``).appendTo(mxOptions);mxOption.attr('name',`radio_${basketProductId}`);mxOption.attr('id',`radio_${basketProductId}_${chossenVariant.stockId}`);mxOption.attr('value',chossenVariant.stockId);mxOption.wrap(``);let label=$(``).insertAfter(mxOption);label.attr('for',`radio_${basketProductId}_${chossenVariant.stockId}`);label.append(`${chossenVariant.timePeriod} `);label.append(`${this.priceFormat(chossenVariant.price)}`);}
let mxSum=$(``).appendTo(mxRightCol);let mxAction=$(``).appendTo(mxRightCol);let mxButtonAdd=$(`${this.getTranslation('protectionAddText')}
`).appendTo(mxAction);mxQuantity.on('change',(e)=>{let quantity=parseFloat($(e.target).val());let stockId=parseFloat(mxOptions.find('input:checked').val());if(stockId==0){mxButtonAdd.stop().animate({'opacity':0.3});mxSum.text(this.priceFormat(0));}
else{mxButtonAdd.stop().animate({'opacity':1});let price=0;for(let key in chossenProtectionVariants){let chossenVariant=chossenProtectionVariants[key];if(stockId==chossenVariant.stockId){price=chossenVariant.price;break;}}
let quantity=mxQuantity.val();mxSum.text(this.priceFormat(price*quantity));}
for(let key in this.$style.get(0).sheet.cssRules){let rule=this.$style.get(0).sheet.cssRules[key];if(rule.selectorText!='.protectionForm .mxRightCol .mxSum')continue;let width=mxSum.get(0).getBoundingClientRect().width;if(parseFloat(rule.style.minWidth){let quantity=parseFloat(mxQuantity.val());let stockId=parseFloat($(e.target).val());if(stockId==0){mxAction.addClass('mxHidden');mxButtonAdd.stop().animate({'opacity':0.3});mxSum.text(this.priceFormat(0));}
else{mxAction.removeClass('mxHidden');mxButtonAdd.stop().animate({'opacity':1});let price=0;for(let key in chossenProtectionVariants){let chossenVariant=chossenProtectionVariants[key];if(stockId==chossenVariant.stockId){price=chossenVariant.price;break;}}
mxSum.text(this.priceFormat(price*quantity));}
for(let key in this.$style.get(0).sheet.cssRules){let rule=this.$style.get(0).sheet.cssRules[key];if(rule.selectorText!='.protectionForm .mxRightCol .mxSum')continue;let width=mxSum.get(0).getBoundingClientRect().width;if(parseFloat(rule.style.minWidth){let quantity=parseFloat(mxQuantity.val());let stockId=parseFloat(mxOptions.find('input:checked').val());if(stockId==0)return false;let options={};for(let key in chossenProtectionVariants){let chossenVariant=chossenProtectionVariants[key];if(stockId==chossenVariant.stockId){options=chossenVariant.options;break;}}
let query={data:{stock_id:stockId,quantity:quantity,options:options,}};query.data.options[this.optionToProductId]=`${basketProduct.name}`;let hasVariant=0;if(basketProduct.variant!=''){hasVariant=1;query.data.options[this.optionToProductId]+=` (${basketProduct.variant})`;}
query.data.options[this.optionDataId]=`${basketProduct.stock_id}, ${hasVariant}`;let wait=$('').appendTo('head');frontAPI.addToBasket((response)=>{if(response.added.length>0){let protectionData=[];if(localStorage.appEasyProtectProtectionData){protectionData=JSON.parse(localStorage.appEasyProtectProtectionData);}
let protectionExisted=false;for(let key in protectionData){let data=protectionData[key];if(data.basketProductId!=basketProduct.id)continue;if(data.basketProtectionId!=response.added[0].id)continue;protectionExisted=true;break;}
if(!protectionExisted){protectionData.push({basketProductId:basketProduct.id,basketProtectionId:response.added[0].id,});localStorage.appEasyProtectProtectionData=JSON.stringify(protectionData);}
location.replace(location.href);}
else{if(response._flash_messenger.error.length>0)shoper.alert(response._flash_messenger.error[0],'');if(response._flash_messenger.warning.length>0)shoper.alert(response._flash_messenger.warning[0],'');if(response._flash_messenger.info.length>0)shoper.alert(response._flash_messenger.info[0],'');}
wait.remove();},query);});return form;};App.prototype.errorHandler=function errorHandler(reason){switch(reason){case'ExceedingProtection':console.log(reason);break;default:console.error(reason);break;}};App.prototype.insertStyle=function insertStyle(){this.$style.append(`
.protectionForm .protectionFormTd {
padding: 0;
}
.protectionForm .mxWrapper {
padding: 10px 30px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
}
.protectionForm .mxLeftCol {
display: grid;
grid: auto / 85px auto;
gap: 5px;
}
.protectionForm .mxLeftCol .mxImage {
align-self: center;
justify-self: center;
}
.protectionForm .mxLeftCol .mxNameContainer {
display: grid;
align-content: center;
gap: 10px;
}
.protectionForm .mxLeftCol .mxNameContainer .mxName {
display: block;
max-width: 350px;
line-height: 24px;
color: #666;
font-size: 21px;
font-weight: bold;
text-align: center;
}
.protectionForm .mxLeftCol .mxNameContainer .mxName .mxTradeMark {
margin-left: 3px;
font-size: 15px;
font-weight: normal;
vertical-align: text-top;
}
.protectionForm .mxLeftCol .mxNameContainer .mxInfoPageUrl {
text-align: center;
}
.protectionForm .mxLeftCol .mxNameContainer .mxInfoPageUrl a {
text-decoration: none;
font-size: 14px;
font-weight: bold;
}
.protectionForm .mxLeftCol .mxNameContainer .mxInfoPageUrl .mxSmallPurpleArrow img {
width: 19px;
}
.protectionForm .mxBigPurpleArrow {
width: 30px;
}
.protectionForm .mxRightCol {
position: relative;
display: flex;
align-items: center;
gap: 20px;
}
.protectionForm .mxRightCol .mxQuantityWrap {
position: relative;
display: flex;
align-items: center;
}
.protectionForm .mxRightCol .mxQuantityWrap::after {
content: "";
position: absolute;
display: block;
right: 10px;
width: 4px;
height: 4px;
margin-top: -2px;
transform: rotate(-45deg);
border-color: #392074;
border-style: solid;
border-width: 0 0 1px 1px;
pointer-events: none;
}
.protectionForm .mxRightCol .mxQuantity {
height: 30px;
line-height: 30px;
min-height: unset;
min-width: 45px;
padding: 0 18px 0 6px;
background: #dcdddf !important;
border: 1px solid #cac6d8;
border-radius: 5px;
color: #392074;
font-size: 15px;
font-weight: bold;
cursor: pointer;
}
.protectionForm .mxRightCol .mxQuantity:hover,
.protectionForm .mxRightCol .mxQuantity:focus {
border-color: #a49cba;
}
.protectionForm .mxRightCol .mxOptions {
display: grid;
gap: 5px;
}
.protectionForm .mxRightCol .mxOptions .mxOption {
}
.protectionForm .mxRightCol .mxOptions .mxOption input {
display: none !important;
}
.protectionForm .mxRightCol .mxOptions .mxOption label {
display: block;
line-height: 18px;
min-width: max-content;
padding: 6px 25px;
background: #dcdddf;
border: 1px solid #cac6d8;
border-radius: 6px;
font-size: 15px;
font-weight: bold;
text-align: center;
cursor: pointer;
}
.protectionForm .mxRightCol .mxOptions .mxOption label:hover {
border-color: #a49cba;
}
.protectionForm .mxRightCol .mxOptions .mxOption input:checked + label {
border-color: #a49cba;
}
.protectionForm .mxRightCol .mxOptions .mxOption .mxColor {
color: #392074;
}
.protectionForm .mxRightCol .mxSum {
min-width: 68px;
font-size: 16px;
font-weight: bold;
color: #392074;
text-align: center;
}
.protectionForm .mxRightCol .mxAction .mxButtonAdd {
line-height: 18px;
padding: 6px 15px;
border-radius: 6px;
background: #dcdddf;
border: 1px solid #cac6d8;
color: #392074;
font-size: 15px;
font-weight: bold;
text-align: center;
cursor: pointer;
}
.protectionForm .mxRightCol .mxAction:not(.mxHidden) .mxButtonAdd:hover {
border-color: #a49cba;
}
.protectionForm .mxRightCol .mxAction.mxHidden .mxButtonAdd {
cursor: default;
}
.wce_celltitles .protectionForm {
justify-content: center;
padding: 15px;
}
.wce_celltitles .protectionForm .mxWrapper {
flex-direction: column;
padding: 0;
}
.wce_celltitles .protectionForm .mxBigPurpleArrow {
display: none;
}
.el-table .protectionForm .protectionFormTd {
border-bottom: 1px solid #ebeef5;
}
.el-table .protectionForm .mxWrapper {
padding: 10px 20px 10px 10px;
}
.el-table .protectionForm .mxLeftCol {
grid: auto / 100px auto;
gap: 10px;
}
.el-table .protectionForm .mxLeftCol .mxImage img {
margin: 0 !important;
}
.el-table .protectionForm .mxLeftCol .mxNameContainer .mxInfoPageUrl .mxSmallPurpleArrow img {
margin: 0 !important;
}
.el-table .protectionForm .mxBigPurpleArrow img {
margin: 0 !important;
}
.mxEasyProtectContainer {
clear: both;
margin-top: 30px;
}
.mxEasyProtectContainer .mxText {
margin-bottom: 15px;
line-height: 15px;
color: #4D2F81;
font-size: 15px;
font-weight: bold;
}
.mxEasyProtectContainer .mxOptions {
margin-bottom: 15px;
}
.mxEasyProtectContainer .mxSmallGreyArrow {
display: inline-block;
margin-left: 10px;
}
.mxEasyProtectContainer .mxSmallGreyArrow img {
filter: grayscale(1);
height: 13px;
}
.mxEasyProtectContainer .mxInfoPageUrl {
font-size: 14px;
}
.mxEasyProtectContainer .mxInfoPageUrl a {
color: #4D2E81;
}
.mxEasyProtectContainer .mxOptions .mxOption {
display: block;
margin-bottom: 10px;
}
.mxEasyProtectContainer .mxOptions .mxOption .mxOptionInput {
display: none;
}
.mxEasyProtectContainer .mxOptions .mxOption .mxOptionLabel {
position: relative;
display: inline-block;
vertical-align: bottom;
width: 20px;
height: 21px;
margin-right: 10px;
background: url(https://mxapp2.maxserver.pl/appEasyProtect/gfx/purpleHexagon.svg) center no-repeat;
}
.mxEasyProtectContainer .mxOptions .mxOption .mxOptionLabel::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
border-radius: 4px;
width: 8px;
height: 8px;
transform: translate(-50%, -50%);
}
.mxEasyProtectContainer .mxOptions .mxOption .mxOptionInput:checked + .mxOptionLabel::before {
background: #4D2F81;
}
.mxEasyProtectContainer .mxOptions .mxOption .mxOptionText {
display: inline-block;
margin-left: 5px;
font-size: 14px;
font-weight: bold;
color: #737477;
}
.mxEasyProtectContainer .mxOptions .mxOption .mxOptionName {
display: inline-block;
margin-left: 5px;
font-size: 15px;
font-weight: bold;
color: #4D2F81;
}
.mxEasyProtectContainer .mxOptions .mxOption .mxOptionName span {
/* font-weight: normal; */
}
.mxEasyProtectContainer .mxOptions .mxOption .mxOptionPrice {
display: inline-block;
margin-left: 7px;
font-size: 14px;
color: #5B5B5B;
}
@media screen and (max-width: 1200px) {
}
@media screen and (min-width: 980px) and (max-width: 1200px) {
.protectionForm .mxLeftCol .mxNameContainer .mxName {
max-width: 260px;
}
.protectionForm .mxRightCol .mxOptions .mxOption label {
padding: 6px 20px;
}
.wce_celltitles .protectionForm .mxLeftCol .mxNameContainer .mxName {
max-width: 350px;
}
.wce_celltitles .protectionForm .mxRightCol .mxOptions .mxOption label {
padding: 6px 25px;
}
}
@media screen and (max-width: 979px) {
.protectionForm .mxWrapper {
flex-direction: column;
padding: 10px 8px;
}
.protectionForm .mxBigPurpleArrow {
display: none;
}
.el-table .protectionForm .mxWrapper {
flex-direction: row;
padding: 10px 20px 10px 10px;
}
.el-table .protectionForm .mxBigPurpleArrow {
display: block;
}
}
@media screen and (min-width: 768px) and (max-width: 979px) {
/*.protectionForm .mxRightCol .mxAction.mxHidden {
display: none;
}*/
.el-table .protectionForm .mxLeftCol .mxNameContainer .mxName {
max-width: 260px;
}
/*.el-table .protectionForm .mxRightCol .mxAction.mxHidden {
display: block;
}*/
.el-table .protectionForm .mxRightCol .mxOptions .mxOption label {
padding: 6px 20px;
}
}
@media screen and (max-width: 767px) {
.protectionForm .mxRightCol .mxOptions .mxOption label {
padding: 6px 20px;
}
.el-table .protectionForm {
display: flex;
width: 100%;
}
.el-table .protectionForm .protectionFormTd {
width: 100%;
}
.el-table .protectionForm .mxWrapper {
flex-direction: column;
padding: 10px 0;
}
.el-table .protectionForm .mxBigPurpleArrow {
display: none;
}
}
@media screen and (min-width: 481px) and (max-width: 767px) {
/*.protectionForm .mxRightCol .mxAction.mxHidden {
display: none;
}*/
}
@media screen and (max-width: 480px) {
.protectionForm .mxRightCol {
display: grid;
grid: auto 1fr auto / repeat(2, auto);
grid-template-areas:
"mxOptions mxQuantityWrap"
"mxOptions mxSum"
"mxOptions mxAction";
justify-items: center;
gap: 10px 20px;
}
.protectionForm .mxRightCol .mxQuantityWrap {
grid-area: mxQuantityWrap;
}
.protectionForm .mxRightCol .mxOptions {
grid-area: mxOptions;
height: 100%;
align-content: space-between;
}
.protectionForm .mxRightCol .mxSum {
grid-area: mxSum;
}
.protectionForm .mxRightCol .mxAction {
grid-area: mxAction;
}
.el-table .protectionForm .mxLeftCol {
grid: auto / 85px auto;
}
}
@media screen and (min-width: 980px) {
/*.wce_celltitles .protectionForm .mxRightCol .mxAction.mxHidden {
display: none;
}*/
}
`);};App.prototype.insertInfoPageStyle=function insertInfoPageStyle(){this.$style.append(`
.mxArticle .mxMainBanner img {
max-height: 100%;
}
.mxArticle .mxMainTitle {
color: #392074;
font-size: 4em;
text-align: center;
margin-bottom: 30px;
margin-top: 20px;
line-height: 1.3em;
font-weight: bold;
}
.mxArticle .mx_arrow_down {
text-align: center;
}
.mxArticle .mx_under_header_txt {
font-size: 1.4em;
line-height: 1.5em;
font-weight: 600;
text-align: center;
max-width: 640px;
margin: 0 auto;
margin-top: 10px;
}
.mxArticle .mxTitle {
font-size: 1.7rem;
font-weight: 600;
line-height: 1.5em;
text-align: center;
margin: 30px 0 10px 0;
color: #392074;
display: block; /*shoper konvertuje na span*/
}
.mxArticle .mxToolsRepairCost {
max-width: 880px;
margin: 20px auto;
text-align: center;
}
.mxArticle .mx_arrow_up {
text-align: center;
transform: rotate(180deg);
}
.mxArticle .mx_margin {
margin-bottom: 30px;
}
.mxArticle .mxAttributesHoneycomb {
max-width: 880px;
margin: 0 auto;
text-align: center;
}
.mxArticle .mxAttributesHoneycombBackground {
background-color: rgb(230, 231, 233);
padding: 50px 0;
}
.mxArticle .mxServiceSteps {
max-width: 880px;
margin: 50px auto;
text-align: center;
}
.mxArticle .mxInNumbers {
background-color: rgb(230, 231, 233);
padding: 20px 0;
}
.mxArticle .mxInNumbers .logo_img {
text-align: center;
}
.mxArticle .mxInNumbers .mxInNumbersHeader {
font-size: 1.7rem;
text-align: center;
color: rgb(96, 100, 108);
margin-bottom: 10px;
line-height: 1.3em;
font-weight: bold;
}
.mxArticle .mxInNumbers .mxInNumbersHeader .mxColor {
color: #392074;
}
.mxArticle .mxInNumbers .mx_inner_box {
display: grid;
justify-content: center;
grid-template-areas:
"first second third fourth"
". bottom_first bottom_second .";
}
.mxArticle .mxInNumbers .mx_tile {
text-align: center;
background-color: white;
padding: 10px;
height: 150px;
width: 150px;
border-radius: 30px;
margin: 25px;
}
.mxArticle .mxInNumbers .inside_box_tile {
text-align: center;
padding: 5px;
}
.mxArticle .mxInNumbers .mx_smaller_text {
display: block;
width: 80%;
margin: auto;
}
.mxArticle .mxInNumbers .mx_bolder_upper_text {
font-weight: 600;
font-size: 1rem;
color: #60646c;
}
.mxArticle .mxInNumbers .bolder_small_text {
font-weight: 600;
color: #60646c;
}
.mxArticle .mxInNumbers .over_ten_year.mx_tile {
grid-area: first;
}
.mxArticle .mxInNumbers .over_likes.mx_tile {
grid-area: second;
}
.mxArticle .mxInNumbers .every_five_minutes.mx_tile {
grid-area: third;
}
.mxArticle .mxInNumbers .service_points.mx_tile {
grid-area: fourth;
}
.mxArticle .mxInNumbers .mx_partenrs_tile.mx_tile {
grid-area: bottom_first;
}
.mxArticle .mxInNumbers .active_traders.mx_tile {
grid-area: bottom_second;
}
@media screen and (max-width: 1200px) {
}
@media screen and (min-width: 980px) and (max-width: 1200px) {
}
@media screen and (max-width: 979px) {
}
@media screen and (min-width: 768px) and (max-width: 979px) {
.mxArticle .mxInNumbers .mx_inner_box {
grid-template-areas:
"first second third"
"fourth bottom_first bottom_second";
}
}
@media screen and (max-width: 767px) {
}
@media screen and (min-width: 481px) and (max-width: 767px) {
.mxArticle .mxInNumbers .mx_inner_box {
grid-template-areas:
"first second"
"third fourth"
"bottom_first bottom_second";
}
}
@media screen and (max-width: 480px) {
.mxArticle .mxInNumbers .mx_inner_box {
grid-template-areas:
"first"
"second"
"third"
"fourth"
"bottom_first"
"bottom_second";
}
}
`);};App.prototype.getTranslation=function getTranslation(varName,escape=true,lang=this.lang){let translation='';if(lang in this.translations[varName]){translation=this.translations[varName][lang];}else{translation=this.translations[varName]['__default'];}
if(!escape)return translation;return this.escapeHtml(translation);};App.prototype.escapeHtml=function escapeHtml(unsafe){return unsafe.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");};App.prototype.priceFormat=function priceFormat(price,currency=this.currency,lang=this.lang){if(currency==undefined){throw new Error('Undefined currency');}
if(typeof this._priceFormater==='undefined'||this._priceFormaterLang!=lang||this._priceFormaterCurrency!=currency){this._priceFormaterLang=lang;this._priceFormaterCurrency=currency;this._priceFormater=new Intl.NumberFormat(lang.split('_').join('-'),{style:'currency',currency:currency});}
return this._priceFormater.format(price);};App.prototype.loadCurrency=function loadCurrency(){if('currency'in this)return Promise.resolve(this.currency);return new Promise((resolve,reject)=>{this.waitFor(()=>{return typeof Shop.values==='object'&&typeof Shop.values.currency==='string';},()=>{this.currency=Shop.values.currency;return resolve(this.currency);});});};App.prototype.waitFor=function waitFor(expr,callback,interval=0){if(!expr()){setTimeout(this.waitFor.bind(this,expr,callback,interval),interval);}
else{callback();}};setTimeout(()=>App.prototype.waitFor(()=>typeof Shop.pageType==='string',()=>new App()),0);})(jQuery);