(function appEasyProtect($){let App=function App(){this.sessionId='f8f01ccd21e5811487bf253fc02a761f';this.sessionToken='ae2ff609638c80c0b7afd7947cd3e1bc1783f392d1ac3b9b31cef96a50b6897a';this.listType='whitelist';this.shopId=173;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":"podstawowa"}};this.productId=4383;this.optionPriceRangeId=36;this.optionTimePeriodId=37;this.optionToProductId=56;this.optionDataId=57;this.infoPageId=34;this.checkboxEnableFieldId=10;this.noOption=0;this.checkboxEnableEasyProtect=1;this.addEasyProtectToProductIndex=1;this.productIds=[4384,4385,4366,4367,4368,4371,4377,4378,4381,4345,4346,4348,4349,4350,4357,4358,4359,4361,4326,4329,4330,4331,4332,4333,4334,4335,4336,4337,4338,4339,4340,4342,4343,4306,4317,4318,4319,4322,4323,4324,4286,4235,4236,4237,4238,4239,4247,4250,4251,4252,4253,4254,4259,4261,4136,4137,4138,4164,4165,4166,4167,4169,4170,4194,4195,4196,4197,4198,4209,4211,4212,4216,4218,4219,4221,4222,4228,4230,4231,4232,4233,4234,4127,4077,4078,4079,4080,4081,4082,4083,4084,4126,4068,4069,4070,4071,4072,4034,4035,4038,4039,4040,4041,4044,4066,4067,4010,4011,4015,4019,4024,4025,4026,4031,4032,4033,3996,3997,3998,3999,4000,4001,4003,4007,4008,4009,3990,3991,3992,3966,3968,3969,3970,3971,3972,3973,3976,3987,3988,3989,3943,3944,3945,3946,3949,3951,3952,3953,3954,3957,3958,3959,3960,3961,3962,3963,3965,3923,3924,3925,3926,3927,3928,3929,3930,3935,3936,3940,3900,3901,3903,3904,3905,3918,3919,3920,3859,3860,3862,3863,3864,3865,3867,3868,3869,3870,3871,3872,3873,3874,3875,3876,3877,3899,3839,3840,3842,3843,3845,3853,3854,3855,3856,3857,3858,3826,3833,3836,3808,3810,3811,3812,3813,3814,3818,3778,3779,3780,3781,3782,3783,3784,3785,3786,3787,3788,3758,3759,3761,3767,3768,3769,3770,3734,3735,3736,3738,3739,3743,3744,3746,3747,3748,3749,3750,3751,3752,3726,3727,3728,3729,3730,3731,3732,3733,3694,3695,3697,3703,3705,3706,3707,3334,3335,3336,3337,3345,3354,3355,3356,3357,3360,3361,3362,3363,3366,3367,3368,3369,3370,3371,3372,3374,3375,3376,3377,3378,3379,3380,3381,3382,3383,3384,4193,4168,4014,3670,3671,3672,3673,3674,3675,3676,3677,3678,3680,3687,3690,3691,3692,3693,3601,3602,3611,3612,3616,3625,3627,3628,3629,3630,3631,3632,3633,3635,3636,3637,3638,3639,3640,3641,3642,3643,3644,3648,3649,3650,3654,3548,3549,3550,3551,3552,3553,3554,3555,3556,3561,3562,3563,3564,3565,3566,3572,3573,3580,3584,3585,3586,3587,3588,3589,3590,3591,3596,3597,3598,3599,3600,3493,3494,3496,3497,3498,3502,3504,3505,3507,3508,3509,3510,3512,3513,3514,3515,3516,3517,3523,3524,3525,3526,3527,3528,3529,3530,3531,3532,3533,3534,3535,3536,3537,3538,3539,3542,3543,3438,3439,3440,3441,3442,3449,3450,3455,3456,3457,3458,3459,3460,3461,3462,3463,3464,3465,3466,3467,3468,3469,3479,3482,3483,3487,3388,3389,3390,3391,3392,3394,3395,3396,3397,3398,3399,3400,3404,3405,3406,3407,3408,3409,3410,3411,3412,3415,3416,3417,3418,3419,3420,3422,3426,3428,3429,3430,3431,3432,3435,3436,3280,3281,3282,3283,3284,3287,3288,3289,3290,3291,3294,3295,3296,3297,3298,3299,3300,3301,3302,3304,3305,3306,3308,3309,3311,3312,3315,3316,3317,3318,3319,3320,3321,3325,3328,3329,3330,3331,3332,3333,3230,3231,3232,3233,3236,3238,3239,3247,3253,3255,3256,3259,3260,3261,3262,3263,3264,3275,3276,3277,3278,3279,3176,3177,3178,3179,3180,3181,3182,3183,3184,3185,3186,3187,3192,3193,3194,3202,3205,3206,3207,3209,3210,3211,3214,3215,3216,3218,3221,3222,3223,3224,3227,3229,3123,3124,3128,3131,3132,3133,3137,3138,3139,3140,3141,3143,3145,3146,3147,3150,3151,3152,3153,3154,3155,3156,3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,3167,3168,3169,3067,3068,3080,3081,3083,3086,3087,3088,3089,3091,3097,3099,3102,3104,3105,3107,3108,3109,3111,3121,3122,3010,3011,3012,3013,3014,3015,3017,3021,3022,3023,3024,3025,3029,3034,3035,3036,3037,3039,3040,3041,3042,3043,3044,3046,3047,3048,3049,3051,3052,2979,2981,2982,2983,2984,2985,2988,2989,2990,2992,2993,2994,2995,2996,2998,2999,3000,3001,3002,2915,2916,2917,2919,2925,2926,2927,2928,2930,2931,2934,2937,2938,2939,2942,2943,2944,2945,2946,2947,2949,2951,2952,2953,2853,2856,2858,2859,2860,2863,2864,2865,2866,2804,2806,2807,2809,2810,2811,2812,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824,2825,2826,2827,2828,2829,2830,2831,2832,2833,2837,2839,2840,2841,2842,2843,2844,2845,2846,2847,2848,2851,2852,2744,2745,2746,2747,2748,2749,2751,2752,2753,2754,2755,2762,2763,2764,2769,2770,2772,2773,2774,2775,2792,2798,2799,2734,2735,2738,2742,2743,2538,2544,2545,2546,2548,2549,2552,2553,2554,2555,2556,2557,2558,2565,2567,2482,2483,2484,2486,2490,2491,2505,2506,2507,2508,2509,2510,2512,2513,2516,2517,2518,2519,2520,2521,2524,2525,2526,2527,2528,2529,2530,2531,2534,2430,2431,2432,2435,2437,2438,2439,2440,2442,2444,2445,2452,2466,2467,2468,2469,2473,2474,2475,2476,2477,2478,2479,2480,2481,2379,2380,2381,2382,2383,2384,2385,2386,2387,2396,2397,2398,2399,2405,2406,2407,2408,2409,2410,2411,2412,2413,2414,2415,2416,2417,2418,2419,2425,2426,2427,2428,2328,2329,2330,2331,2332,2333,2341,2342,2344,2345,2346,2347,2348,2350,2351,2352,2353,2354,2355,2356,2357,2363,2364,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2275,2276,2277,2278,2279,2280,2281,2282,2283,2284,2286,2287,2288,2294,2298,2300,2305,2307,2308,2309,2311,2312,2313,2314,2315,2316,2317,2318,2319,2320,2321,2241,2242,2243,2244,2247,2248,2251,2252,2253,2255,2256,2257,2258,2259,2260,2262,2263,2264,2265,2266,2267,2268,2269,2270,2271,2272,2273,2274,2166,2167,2168,2171,2172,2173,2175,2176,2177,2178,2179,2180,2181,2182,2183,2184,2190,2191,2192,2193,2194,2195,2196,2197,2200,2201,2202,2203,2207,2208,2209,2210,2211,2213,2214,2215,2216,2217,2218,2113,2117,2118,2119,2120,2122,2125,2126,2127,2128,2129,2130,2131,2136,2139,2140,2144,2145,2146,2147,2148,2149,2151,2152,2153,2154,2155,2156,2157,2159,2160,2161,2162,2163,2164,2165,2063,2065,2066,2068,2069,2071,2072,2073,2074,2081,2082,2085,2087,2088,2089,2090,2091,2092,2093,2094,2095,2096,2097,2098,2099,2100,2101,2102,2103,2105,2106,2107,2108,2109,2110,2111,2009,2010,2012,2013,2015,2016,2017,2018,2019,2020,2021,2025,2026,2032,2033,2034,2036,2037,2040,2041,2042,2045,2046,2050,2051,2052,2055,2056,2057,2058,2059,1958,1959,1960,1961,1967,1968,1973,1974,1976,1977,1978,1979,1980,1981,1983,1985,1986,1987,1988,1989,1990,1993,1994,1995,1998,1999,2001,2002,2003,2004,2005,2006,2007,2008,1907,1908,1909,1910,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1933,1938,1940,1941,1942,1943,1944,1945,1946,1953,1954,1955,1956,1855,1856,1857,1858,1859,1861,1870,1871,1872,1873,1874,1875,1877,1879,1880,1881,1886,1887,1888,1889,1890,1891,1892,1893,1894,1897,1901,1903,1905,1851,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,1761,1762,1763,1776,1777,1778,1779,1780,1782,1783,1784,1785,1787,1788,1789,1706,1708,1711,1713,1715,1716,1717,1718,1719,1720,1721,1727,1728,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1743,1744,1745,1746,1747,1638,1639,1640,1641,1642,1646,1648,1649,1650,1651,1652,1653,1654,1655,1659,1662,1663,1664,1669,1670,1671,1673,1674,1675,1676,1677,1678,1679,1680,1681,1683,1684,1685,1687,1689,1690,1692,1694,1584,1585,1586,1587,1588,1594,1595,1596,1597,1599,1601,1602,1606,1608,1609,1610,1612,1614,1619,1623,1627,1628,1632,1633,1634,1635,1636,1637,1521,1523,1524,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,1536,1537,1538,1539,1540,1541,1542,1544,1545,1546,1547,1548,1549,1550,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1569,1573,1574,1579,1580,1581,1582,1583,1453,1454,1456,1458,1459,1460,1461,1462,1463,1466,1467,1470,1471,1473,1479,1481,1482,1484,1485,1486,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1501,1502,1503,1504,1505,1507,1508,1509,1510,1511,1513,1517,1518,1519,1374,1375,1376,1392,1393,1413,1414,1417,1420,1421,1423,1424,1427,1428,1429,1430,1431,1432,1434,1435,1436,1437,1438,1439,1440,1444,1445,1446,1447,1448,1450,1452,1313,1314,1315,1317,1318,1321,1322,1323,1324,1333,1334,1335,1336,1337,1340,1341,1342,1343,1345,1346,1347,1348,1360,1361,1362,1364,1369,1258,1259,1260,1261,1262,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1282,1283,1284,1285,1286,1287,1289,1290,1291,1292,1293,1294,1295,1296,1297,1299,1300,1301,1304,1306,1307,1308,1312,1205,1206,1207,1221,1222,1223,1224,1225,1226,1228,1229,1231,1236,1237,1238,1239,1240,1241,1242,1246,1247,1249,1251,1254,1257,1152,1153,1154,1155,1156,1157,1158,1160,1161,1162,1164,1165,1166,1167,1168,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1193,1194,1199,1200,1098,1099,1100,1102,1103,1105,1106,1109,1110,1111,1113,1116,1118,1121,1122,1125,1126,1127,1128,1132,1133,1135,1138,1148,1030,1031,1032,1033,1034,1037,1039,1041,1043,1044,1045,1046,1047,1049,1052,1053,1054,1061,1075,1082,1086,967,971,972,973,974,986,988,996,998,999,1000,1001,1002,1004,1005,1006,1007,1008,1009,1010,1011,1018,1019,1020,1021,1023,1027,915,933,864,865,867,868,869,870,871,882,883,884,885,886,889,890,891,892,893,894,801,802,803,804,805,808,809,819,820,824,826,827,830,831,837,838,839,847,848,849,850,851,852,853,733,734,736,737,738,739,741,744,745,750,751,755,756,771,777,778,779,780,781,782,785,786,787,788,792,797,798,678,679,680,681,685,686,688,689,690,692,693,694,695,696,697,699,700,701,704,708,709,710,711,712,713,714,715,716,717,718,719,721,722,723,724,725,726,727,728,729,730,731,732,645,646,650,651,652,653,654,656,658,659,660,661,662,663,664,665,666,669,672,673,674,675,676,677,577,579,581,583,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,622,623,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,542,543,544,545,546,547,548,549,551,552,553,554,555,556,557,558,560,561,562,563,564,565,567,568,569,570,571,572,487,488,489,490,491,492,493,494,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,522,387,388,390,391,392,393,394,395,396,397,398,399,400,401,369,370,371,373,374,378,379,380,381,382,383,384,386,279,281,282,283,284,285,286,287,288,289,291,292,293,294,295,296,297,298,299,300,302,303,304,305,306,308,330,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,269,270,271,273,274,275,276,277,170,171,172,173,179,180,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,130,131,133,135,136,139,141,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,95,96,97,47,48];this.categoriesIds={"0":"Wszystkie kategorie","14":"Akcesoria AGD","48":"Filtry do ekspresów","49":"Kawy i herbaty","70":"Przybory kuchenne","191":"Akcesoria","219":"Pozostałe","261":"Akcesoria AGD","282":"Czyszczenie i pielęgnacja","310":"Armatura","331":"Pojemniki, miski i butelki","354":"Świeczki i zapachy"};this.producersIds={"0":"Wszyscy producenci","49":"Joseph Joseph","67":"Blanco","71":"K&M","88":"Fiskars","101":"Mepal","102":"Mepal","103":"Vialli Design","104":"Brabantia","119":"Cereria Molla","126":"KAISER"};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);