{ "version": 3, "sources": [ "node_modules/browser-pack/_prelude.js", "cartridges/app_tjc/cartridge/js/addedmodal.js", "cartridges/app_tjc/cartridge/js/address-fields.js", "cartridges/app_tjc/cartridge/js/ajax.js", "cartridges/app_tjc/cartridge/js/applePay.js", "cartridges/app_tjc/cartridge/js/bonus-products-view.js", "cartridges/app_tjc/cartridge/js/chunks/pdp.js", "cartridges/app_tjc/cartridge/js/components/lazyload.js", "cartridges/app_tjc/cartridge/js/emailVerification.js", "cartridges/app_tjc/cartridge/js/flyinheader.js", "cartridges/app_tjc/cartridge/js/giftcert.js", "cartridges/app_tjc/cartridge/js/informmewhenavailable.js", "cartridges/app_tjc/cartridge/js/informmewhenavailablepdp.js", "cartridges/app_tjc/cartridge/js/minicart.js", "cartridges/app_tjc/cartridge/js/newsignin.js", "cartridges/app_tjc/cartridge/js/northbeam-datalayer.js", "cartridges/app_tjc/cartridge/js/page.js", "cartridges/app_tjc/cartridge/js/pages/account.js", "cartridges/app_tjc/cartridge/js/pages/checkout/address.js", "cartridges/app_tjc/cartridge/js/pages/checkout/billing.js", "cartridges/app_tjc/cartridge/js/pages/checkout/index.js", "cartridges/app_tjc/cartridge/js/pages/orderconfirmation.js", "cartridges/app_tjc/cartridge/js/pages/product/addToCart.js", "cartridges/app_tjc/cartridge/js/pages/product/availability.js", "cartridges/app_tjc/cartridge/js/pages/product/image.js", "cartridges/app_tjc/cartridge/js/pages/product/index.js", "cartridges/app_tjc/cartridge/js/pages/product/jewelryBox.js", "cartridges/app_tjc/cartridge/js/pages/product/productBundling.js", "cartridges/app_tjc/cartridge/js/pages/product/productNav.js", "cartridges/app_tjc/cartridge/js/pages/product/quickviewimage.js", "cartridges/app_tjc/cartridge/js/pages/product/variant.js", "cartridges/app_tjc/cartridge/js/paysafe.js", "cartridges/app_tjc/cartridge/js/pdpbundle.js", "cartridges/app_tjc/cartridge/js/pdpoverlay.js", "cartridges/app_tjc/cartridge/js/pdpprint.js", "cartridges/app_tjc/cartridge/js/progress.js", "cartridges/app_tjc/cartridge/js/pubnub.js", "cartridges/app_tjc/cartridge/js/qbfornonlivetv.js", "cartridges/app_tjc/cartridge/js/quickbuy.js", "cartridges/app_tjc/cartridge/js/quickview.js", "cartridges/app_tjc/cartridge/js/resetpassword.js", "cartridges/app_tjc/cartridge/js/risingauctions.js", "cartridges/app_tjc/cartridge/js/tabsaccount.js", "cartridges/app_tjc/cartridge/js/tjcplusactivation.js", "cartridges/app_tjc/cartridge/js/tooltip.js", "cartridges/app_tjc/cartridge/js/uniform.js", "cartridges/app_tjc/cartridge/js/util.js", "cartridges/app_tjc/cartridge/js/validator.js", "cartridges/app_tjc/cartridge/static/default/lib/jquery/zoomsl.js", "node_modules/asap/browser-asap.js", "node_modules/asap/browser-raw.js", "node_modules/promise/index.js", "node_modules/promise/lib/core.js", "node_modules/promise/lib/done.js", "node_modules/promise/lib/es6-extensions.js", "node_modules/promise/lib/finally.js", "node_modules/promise/lib/index.js", "node_modules/promise/lib/node-extensions.js", "node_modules/promise/lib/synchronous.js", "cartridges/app_tjc/cartridge/js/jquery-external.js" ], "names": [], "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7nBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACljDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC34EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACz4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5VA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACl+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACroCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC35DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClkCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5VA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5oBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/zBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3YA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC35BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC/NA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9DA;AACA;AACA", "file": "pdp.js", "sourceRoot": "", "sourcesContent": [ "(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()", "'use strict';\n\nfunction init() {\n var url = Urls.cartcount;\n\n $.ajax({\n url: url,\n type: 'GET',\n success: function (response) {\n var res = response;\n $('.added-count').text(res.cartcount);\n $('.addedModal').show();\n $('.addedModal .overlay-container').removeClass('overlay-container-off');\n $('#header').addClass('addtocart-overlay-active');\n\n },\n\n error: function (jqXHR, textStatus, errorThrown) {\n\n //console.log(jqXHR + textStatus + errorThrown);\n\n }\n\n });\n\n\n\n // Close the Overlay by clincking in the \"X\" button\n\n $('.addedoverlay-close').on('click', function () {\n $('.addedModal').hide();\n $('.header').removeClass('addtocart-overlay-active');\n $('.addedModal .overlay-container').removeClass('overlay-container-off');\n });\n $('.addedModal .overlay-container').addClass('overlay-container-on');\n\n}\n\n// Module public functions\nmodule.exports = {\n init: init\n};\n", "'use strict';\n\nvar ajax = require(3),\n util = require(46),\n progress = require(35);\n\nvar addressFields;\n\nvar regexAddress = {\n address1: /^[a-zA-Z0-9, \\- &]*$/,\n address2: /^[a-zA-Z0-9, \\- &]*$/,\n address3: /^[a-zA-Z0-9, \\- &]*$/,\n address4: /^[a-zA-Z0-9, \\- &]*$/,\n city: /^[a-zA-Z\\- &]*$/,\n postCode: /^[a-zA-Z0-9,\\s\\-&]{3,10}$/\n}\n\nfunction fillAddressFields($fields, data) {\n /*jslint unparam: true */\n $.each(['address1', 'address2', 'address3', 'address4', 'locality', 'city', 'postCode'], function (i, attribute) {\n $fields.find('input[name$=' + attribute + ']').val(data[attribute]);\n });\n /*jslint unparam: false */\n}\n\n/**\n * @function\n * @description Initializes the events on the address form (apply, cancel, delete)\n * @param {Array} addresses An array of addresses\n * @param {jQueryObject} $select the select field to alter\n */\nfunction addAddressesOptions(addresses, $select) {\n $select\n .val('')\n .click()\n .find('option[value!=\"\"]')\n .remove();\n $.each(addresses, function (i, address) {\n $select.append($('<option/>', {\n value: i,\n data: {\n address1: address.address1,\n address2: address.address2,\n address3: address.address3,\n address4: address.address4,\n city: address.town\n }\n }).text([address.address1, address.address2, address.town].join(', ')));\n });\n}\n\n\nfunction tooglePostalcodeSearchVisibility(countrySetting,\n $postCodeFormRow, $findMyAddressButton,\n $additionalAddresses, $addressesSelectFormRow, $addressesGroup) {\n \n var $postCodeData8 = $postCodeFormRow.find('.postcode-data8');\n var $innerColumn = $postCodeData8.parents('.inner-form-column');\n\n if (countrySetting.addressCheckEnabled) {\n $postCodeData8.attr('data-country', countrySetting.code);\n $postCodeFormRow.show();\n if ($postCodeFormRow.parents('.address').length > 0) {\n $postCodeFormRow.parents('.address').show();\n }\n if ($innerColumn.length > 0) {\n $innerColumn.find('.js-type-address-btn').addClass('d-none');\n $innerColumn.siblings('.manual-address').find('.type-address-btn').removeClass('d-none');\n $innerColumn.siblings('.manual-address').find('.addresses-select-group').removeClass('d-none');\n $innerColumn.find('.js-type-address-btn').find('.type-address-btn').css({'margin-top': '0px'});\n }\n $findMyAddressButton.show();\n $additionalAddresses.addClass('visually-hidden');\n $additionalAddresses.removeClass('visually-un-hidden');\n $addressesSelectFormRow.removeClass('visually-hidden');\n $additionalAddresses.find('.enable-find-my-address').show();\n } else {\n var $additionalAddressFields = $additionalAddresses.find('.input-text');\n if ($additionalAddressFields.length > 0) {\n $additionalAddressFields.each(function () {\n validateAdditionalAddressFiedinPopup(this);\n });\n }\n $postCodeData8.attr('data-country', '');\n $additionalAddresses.removeClass('visually-hidden');\n if (countrySetting.postalCodeRequired) {\n $postCodeFormRow.hide();\n $findMyAddressButton.hide();\n $additionalAddresses.find('.enable-find-my-address').hide();\n\n if ($postCodeData8.parents('.address.js-address').length > 0) {\n var $address = $postCodeData8.parents('.address.js-address');\n $address.hide();\n $address.siblings('.js-type-address-btn').removeClass('d-none');\n $address.parent().siblings('.js-type-address-btn').addClass('d-none');\n }\n\n if ($innerColumn.length > 0) {\n $innerColumn.find('.js-type-address-btn').removeClass('d-none');\n $innerColumn.find('.js-type-address-btn').find('.type-address-btn').css({'margin-top': '20px'});\n $innerColumn.siblings('.manual-address').find('.type-address-btn').addClass('d-none');\n $innerColumn.siblings('.manual-address').find('.addresses-select-group').addClass('d-none');\n }\n } else {\n $postCodeFormRow.hide();\n }\n $addressesSelectFormRow.addClass('visually-hidden');\n }\n\n $addressesGroup.find('.selected-address-summary').addClass('visually-hidden');\n $addressesGroup.find('h5').addClass('visually-hidden');\n $addressesGroup.find('.selected-address-summary span').empty();\n $addressesGroup.find('.addresses-select').removeClass('loqate-select');\n\n var $addAddressButton = $postCodeFormRow.closest('form').find('.apply-button');\n if ($addAddressButton.length > 0) {\n $addAddressButton.attr('disabled', false);\n }\n\n if($('.opcAddressListModelPopup').length > 0) {\n $('.xlt-addressForm').removeClass('not-scroll');\n }\n\n $('.additional-address-fields input[id^=\"dwfrm_address\"], .additional-address-fields input[id^=\"dwfrm_checkoutaddresses_shippingAddress_address\"]').on('keyup keydown change', function(){\n validateAdditionalAddressFiedinPopup(this);\n\n var $continueToPayment = $(this).closest('form').find('.submit-button:not(\".hidden\")');\n\n if ($continueToPayment.length === 0) {\n $continueToPayment = $(this).closest('form').find('.addOPCdeliverylocation');\n }\n\n if ($continueToPayment.length === 0) {\n $continueToPayment = $(this).closest('form').find('.apply-button');\n }\n\n if ($continueToPayment.length > 0) {\n $continueToPayment.prop('disabled' , false);\n }\n });\n\n}\n\nfunction updateBillingAddress() {\n if($('#use-billing-address').is(\":checked\")) {\n var addressid = $('.additional-address-fields').find(\"input[id$='address_addressid']\").val();\n var addressidhidden = $('#dwfrm_quickbuyaddress_shippingAddress_addressid').val();\n var address1 = $('.additional-address-fields').find(\"input[id$='address_address1']\").val();\n var address2 = $('.additional-address-fields').find(\"input[id$='address_address2']\").val();\n var address3 = $('.additional-address-fields').find(\"input[id$='address_address3']\").val();\n var address4 = $('.additional-address-fields').find(\"input[id$='address_address4']\").val();\n var city = $('.additional-address-fields').find(\"input[id$='address_city']\").val();\n var postValue = $('#dwfrm_quickbuyaddress_shippingAddress_address_postCode').val();\n var addressid = $('#dwfrm_quickbuyaddress_shippingAddress_addressid').val();\n\n var selectedCountry = $('#dwfrm_quickbuyaddress_shippingAddress_address_country option:selected').val();\n var selectedCountryValue = $('#uniform-dwfrm_quickbuyaddress_shippingAddress_address_country span').html();\n\n var selectedAddress = $('#delivery-address #customerAddress option:selected').val();\n var selectedAddressValue = $('#delivery-address #customerAddress option:selected').html();\n\n\n\n $('.customerAddressBilling').find(\"input[id$='address_addressid']\").val(addressid);\n $('.customerAddressBilling').find(\"input[id$='address_address1']\").val(address1);\n $('.customerAddressBilling').find(\"input[id$='address_address2']\").val(address2);\n $('.customerAddressBilling').find(\"input[id$='address_address3']\").val(address3);\n $('.customerAddressBilling').find(\"input[id$='address_address4']\").val(address4);\n $('.customerAddressBilling').find(\"input[id$='address_city']\").val(city);\n $('#dwfrm_quickbuyaddress_billingAddress_address_postCode').val(postValue);\n $('#dwfrm_quickbuyaddress_billingAddress_addressid').val(addressid);\n $('#dwfrm_quickbuyaddress_billingAddress_address_addressid').val(addressidhidden);\n\n $('#dwfrm_quickbuyaddress_billingAddress_address_country option[value=' + selectedCountry + ']').attr('selected','selected');\n $('#uniform-dwfrm_quickbuyaddress_billingAddress_address_country span').html(selectedCountryValue);\n\n $('.customerAddressBilling #customerAddress option[value=\"' + selectedAddress + '\"]').prop('selected', true);\n $('.customerAddressBilling .address-selector span').html(selectedAddressValue);\n }\n}\n\nfunction defaultBillingAddress(){\n if($('.customerAddressBilling .address-selector option:selected').length){\n var addressstring = $('.customerAddressBilling .address-selector option:selected').html();\n var addressID = $('.customerAddressBilling .address-selector option:selected').val();\n var addressarray = addressstring.split(',');\n\n if(!$('.customerAddressBilling').hasClass('address-populated')){\n var url = Urls.getUserAddress;\n $.ajax({\n url: url + \"?addressID=\" + addressID,\n type: 'GET',\n success: function (response) {\n $('.customerAddressBilling').find('#dwfrm_quickbuyaddress_billingAddress_addressid').val(response.id);\n $('.customerAddressBilling').find('#dwfrm_quickbuyaddress_billingAddress_address_addressid').val(response.id);\n $('.customerAddressBilling').find('#dwfrm_quickbuyaddress_billingAddress_address_address1').val(response.address1);\n if(response.address2 == \"null\" || response.address2 == \"\"){\n $('.customerAddressBilling').find('#dwfrm_quickbuyaddress_billingAddress_address_address2').val('');\n }\n else{\n $('.customerAddressBilling').find('#dwfrm_quickbuyaddress_billingAddress_address_address2').val(response.address2);\n }\n $('.customerAddressBilling').find('#dwfrm_quickbuyaddress_billingAddress_address_city').val(response.city);\n $('.customerAddressBilling').find('#dwfrm_quickbuyaddress_billingAddress_address_postCode').val(response.postalCode);\n $('.customerAddressBilling').addClass('address-populated');\n }\n });\n }\n\n\n }\n\n}\n\nfunction defaultShippingSddress() {\n if($('.shipping-address-selector .address-selector option:selected').length){\n var addressstring = $('.shipping-address-selector .address-selector option:selected').html();\n var addressID = $('.shipping-address-selector .address-selector option:selected').val();\n var addressarray = addressstring.split(',');\n\n if(!$('.shippingform').hasClass('address-populated') || $('#dwfrm_quickbuyaddress_shippingAddress_addressid').val() == \"\"){\n var url = Urls.getUserAddress;\n $.ajax({\n url: url + \"?addressID=\" + addressID,\n type: 'GET',\n success: function (response) {\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_addressid').val(response.id);\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_addressid').val(response.id);\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_address1').val(response.address1);\n if(response.address2 == \"null\" || response.address2 == \"\"){\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_address2').val('');\n }\n else{\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_address2').val(response.address2);\n }\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_city').val(response.city);\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_postCode').val(response.postalCode);\n $('.shippingform').addClass('address-populated');\n }\n });\n }\n\n\n /* $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_addressid').val(addressarray[0]);\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_addressid').val(addressarray[0]);\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_address1').val(addressarray[1]);\n //$('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_address2').val(addressarray[2]);\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_city').val(addressarray[2]);\n $('.shippingform').find('#dwfrm_quickbuyaddress_shippingAddress_address_postCode').val(addressarray[4]);*/\n }\n\n updateBillingAddress();\n\n}\n\nfunction sameAsShippingAddress() {\n $(\"select[id$='shippingAddress_address_addresses'], #delivery-address #customerAddress\").on('change', function(){\n updateBillingAddress();\n });\n\n $('.shippingform input').on('keyup', function() {\n var addressidhidden = $('#dwfrm_quickbuyaddress_shippingAddress_addressid').val();\n $('#dwfrm_quickbuyaddress_shippingAddress_address_addressid').val(addressidhidden);\n $('#dwfrm_quickbuyaddress_billingAddress_address_addressid').val(addressidhidden);\n updateBillingAddress();\n });\n\n $('#use-billing-address').on('change', function(){\n if($(this).is(\":checked\")) {\n updateBillingAddress();\n $('.checkout-billing-address .saved-address').addClass('hidden');\n $('.checkout-billing-address .add-billing-address').addClass('hidden');\n\n }\n else {\n /* $('.customerAddressBilling .additional-address-fields input[type=text]').each(function() {\n this.value = \"\";\n });*/\n $('.shippingform').removeClass('address-populated');\n $('.customerAddressBilling').removeClass('address-populated');\n defaultBillingAddress();\n $('.checkout-billing-address .saved-address').removeClass('hidden');\n // Auto fucts when text box having a value\n $(\".input-text\").each(function () {\n if( $(this).val().length > 0 ) {\n $(this).siblings(\".label\").addClass('focus-active');\n $(this).closest('.form-row').addClass('validation-success');\n }\n\n })\n\n }\n });\n\n $('#dwfrm_quickbuyaddress_billingAddress_addressid').on('keyup', function() {\n var address1 = $(this).val();\n $('#dwfrm_quickbuyaddress_billingAddress_address_addressid').val(address1);\n });\n}\n\nfunction updateCountryCode(countrySetting, $postCodeFormRow) {\n if (countrySetting.addressCheckEnabled) {\n $postCodeFormRow.find('.postcode-data8').attr('data-country', countrySetting.code);\n } else {\n $postCodeFormRow.find('.postcode-data8').attr('data-country', '');\n }\n}\n\n\n/**\n * @function\n * @description Initializes the events on the address form\n * @param {Element} $form The form which will be initialized\n */\nfunction initializeEvents($form) {\n $form.find('select[name$=country]').filter(function() {\n return !$(this).closest('.js-free-ring-sizer').length;\n }).each(function () {\n var $countrySelect = $(this),\n $cointainer = $countrySelect.parents('.form-row').closest('.xlt-addressForm'),\n $postCodeFormRow = $cointainer.find('.post-code-field'),\n $findMyAddressButton = $postCodeFormRow.find('button'),\n $postCodeInput = $postCodeFormRow.find('input'),\n $addressesSelectFormRow = $cointainer.find('.addresses-select'),\n $addressesGroup = $cointainer.find('.addresses-select-group'),\n $typeMyAddressButton = $addressesSelectFormRow.find('button'),\n $additionalAddresses = $cointainer.find('.additional-address-fields'),\n selectedCountry = $countrySelect.val(),\n countrySetting = util.getCountrySettings(selectedCountry);\n $findMyAddressButton.data('searchstarted', false);\n\n if ($('.post-code-field-opc').find('.validation-success').length === 0) {\n tooglePostalcodeSearchVisibility(countrySetting,\n $postCodeFormRow, $findMyAddressButton,\n $additionalAddresses, $addressesSelectFormRow, $addressesGroup);\n }\n\n if ($('.post-code-field-opc').find('.validation-success').length === 0) {\n updateCountryCode(countrySetting, $postCodeFormRow);\n }\n\n $countrySelect.on('change', function () {\n selectedCountry = $countrySelect.val();\n countrySetting = util.getCountrySettings(selectedCountry);\n $findMyAddressButton.data('searchstarted', false);\n\n updateCountryCode(countrySetting, $postCodeFormRow);\n\n tooglePostalcodeSearchVisibility(countrySetting,\n $postCodeFormRow, $findMyAddressButton,\n $additionalAddresses, $addressesSelectFormRow, $addressesGroup);\n });\n\n $findMyAddressButton.on('click', function () {\n if($('.quickbuy-preference-page').length){\n var existingalias = $('#existing-alias').val();\n var newalias = $(this).closest('.country-postal').find(\"[id$='_addressid']\").val().toLowerCase();\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid-error').remove();\n if(newalias.length){\n if(existingalias.indexOf(newalias) > -1){\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid-error').remove();\n var newDiv ='<div id=\"dwfrm_quickbuyaddress_shippingAddress_addressid-error\" class=\"error-msg\" style=\"display : block\">You are already using this address book alais.</div>';\n $(this).closest('.country-postal').find('.address-alias .field').append(newDiv);\n $(this).closest('.country-postal').find('.address-alias').addClass('validation-error');\n return;\n }\n }\n else{\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid-error').remove();\n var newDiv ='<label id=\"dwfrm_quickbuyaddress_shippingAddress_addressid-error\" class=\"error\" for=\"dwfrm_quickbuyaddress_shippingAddress_addressid\">Cannot be blank</label>'\n $(this).closest('.country-postal').find('.address-alias .field').append(newDiv);\n $(this).closest('.country-postal').find('.address-alias').addClass('validation-error');\n return;\n }\n }\n\n $('.additional-address-fields input[id^=\"dwfrm_address\"]').on('keyup keydown change', function(){\n validateAdditionalAddressFiedinPopup(this);\n });\n\n $(this).closest('.xlt-addressForm').find('.type-own-address').remove();\n\n /*Remove class for creating address in OPC delivery address Popup */\n if($('#opcDeliveryAddresses').length > 0){\n\n var opcexistingalias = $('#existing-alias').val();\n var opcnewalias = $(\"[id$='_addressid']\").val().toLowerCase();\n\n $('.additional-address-fields input[id^=\"dwfrm_checkoutaddresses_shippingAddress_address\"]').on('keyup keydown change', function(){\n validateAdditionalAddressFiedinPopup(this);\n });\n\n if(opcnewalias.length){\n if(opcexistingalias.indexOf(opcnewalias) > -1){\n $('#addressIDerror.error-msg').remove();\n $('.addAddressOpc div').first().addClass('validation-error');\n var newDiv ='<div id=\"addressIDerror\" class=\"error-msg\">You are already using this address book alais.</div>';\n $(\"#addressIDerror.error-msg\").show();\n $( \".addAddressOpc .field\" ).first().append(newDiv);\n return;\n }\n }\n\n\n /*$('.createOPCaddress .addOPCdeliverylocation').removeClass('visually-hidden');*/\n }\n\n $('.guestusershipping .addresses-select-group .form-row-select .type-address-btn button').on('click', function() {\n $(this).closest('.guestusershipping').find('.additional-address-fields').addClass('skip-hide');\n });\n\n /*$addressesSelectFormRow.hide();\n if(!($('.guestusershipping .additional-address-fields').hasClass('skip-hide'))) {\n $additionalAddresses.addClass('visually-hidden');\n }*/\n progress.show();\n util.removeGeneralFormError($form);\n ajax.getJson({\n url: $findMyAddressButton.data('url'),\n data: {postCode: $postCodeInput.val()},\n callback: function (response) {\n $addressesSelectFormRow.removeClass('visually-un-hidden');\n $additionalAddresses.removeClass('visually-un-hidden');\n if (response.error || response.length === 0) {\n if (response.error) {\n util.addGeneralFormError($form, response.error);\n }\n $addressesSelectFormRow.find('select').prop('disabled', true);\n $addressesSelectFormRow.find('.form-row').removeClass('validation-error');\n $additionalAddresses.addClass('visually-un-hidden');\n $additionalAddresses.removeClass('visually-hidden');\n $('<div class=\"type-own-address\"> We could not find your address, please check your postcode or enter address below: </div>').insertBefore($additionalAddresses);\n } else {\n if(!($('.guestusershipping .additional-address-fields').hasClass('skip-hide'))) {\n addAddressesOptions(response, $addressesSelectFormRow.find('select').prop('disabled', false));\n $addressesSelectFormRow.show();\n $addressesSelectFormRow.addClass('visually-un-hidden');\n $addressesSelectFormRow.removeClass('visually-hidden');\n }\n }\n progress.hide();\n $findMyAddressButton.data('searchstarted', true);\n\n sameAsShippingAddress();\n\n }\n });\n });\n\n sameAsShippingAddress();\n\n $postCodeInput.on('change', function () {\n $findMyAddressButton.data('searchstarted', false);\n });\n\n $typeMyAddressButton.on('click', function () {\n $addressesSelectFormRow.find('select').prop('disabled', true);\n $addressesSelectFormRow.find('.form-row').removeClass('validation-error');\n $additionalAddresses.removeClass('visually-hidden');\n $addressesSelectFormRow.removeClass('visually-un-hidden');\n $addressesSelectFormRow.addClass('visually-hidden');\n var $manualentry = $('.additional-address-fields').find('.manualentry').val(true);\n $additionalAddresses.addClass('visually-un-hidden');\n /*if($('#wrapper').hasClass('pt_checkout')) {\n $postCodeFormRow.find('.address-check-btn').css('display' , 'none');\n $postCodeFormRow.addClass('full-width-postcode');\n $addressesGroup.css('display' , 'none');\n\n if($('.guestusershipping').length > 0 || $('.opcnewusershipping').length > 0) {\n $('.shippingform .additional-address-fields').removeClass('visually-hidden');\n $('.shippingform .address-check-btn').css('display' , 'none');\n $('.shippingform .post-code-field').addClass('full-width-postcode');\n $('.shippingform .addresses-select-group').css('display' , 'none');\n }\n }*/\n var $additionalAddressFields = $additionalAddresses.find('.input-text');\n if ($additionalAddressFields.length > 0) {\n $additionalAddressFields.each(function () {\n validateAdditionalAddressFiedinPopup(this);\n });\n }\n\n $('.additional-address-fields input[id^=\"dwfrm_address\"], .additional-address-fields input[id^=\"dwfrm_checkoutaddresses_shippingAddress_address\"]').on('keyup keydown change', function(){\n validateAdditionalAddressFiedinPopup(this);\n\n var $saveButton = $('.opcAddressListModelPopup').find('.addOPCdeliverylocation');\n\n if ($saveButton.length > 0) {\n var isFormValid = $(this).closest('form').valid();\n $saveButton.prop('disabled' , !isFormValid);\n }\n });\n });\n\n $addressesSelectFormRow.find('select').on('change', function () {\n var $selectedOption = $addressesSelectFormRow.find('select option:selected');\n fillAddressFields($additionalAddresses, $selectedOption.data());\n $additionalAddresses.show();\n });\n\n $('.post-code-field input').keyup(function () {\n postcodeval();\n });\n\n $('body').on('change', '.shipping-address-selector #customerAddress', function() {\n $('.shippingform').removeClass('address-populated');\n defaultShippingSddress();\n\n });\n\n\n $('body').on('change', '.customerAddressBilling #customerAddress', function() {\n $('.customerAddressBilling').removeClass('address-populated');\n defaultBillingAddress();\n });\n\n });\n defaultShippingSddress();\n defaultBillingAddress();\n\n $('input[id^=\"dwfrm_quickbuyaddress_shippingAddress_address_\"]').on('keyup keydown change', function(){\n validateAddressField(this);\n });\n}\n\nfunction validateAddressField($this) {\n var inputValue = $($this).val();\n if (inputValue.length > 0) {\n var feildId = $($this).attr('id');\n //feildId = feildId.replace(\"dwfrm_address_\", \"\");\n var lastUnderscoreIndex = feildId.lastIndexOf('_');\n var textAfterLastUnderscore = feildId.substring(lastUnderscoreIndex + 1);\n var regExp = regexAddress[textAfterLastUnderscore];\n var reg = new RegExp(regExp, 'i');\n var test = reg.test(inputValue);\n var errlength = $('.address-form .checkout-addresses-form').find('.error-message');\n if (test) {\n $($this).closest('.form-row').find('.error-message').remove();\n } else {\n var errorMessage = \"Please provide a valid \" + textAfterLastUnderscore + \".\";\n var closesErrorEle = feildId + '-error'\n $($this).closest('.form-row').find('.error-message').remove();\n $($this).closest('.form-row').find('.error-msg').remove();\n if (!$($this).closest('.form-row').find('.error-message').length) {\n $('<div class=\"error-message\">' + errorMessage + '</div>').insertAfter($($this));\n }\n else{\n //$('checkout-addresses-form .error-msg:visible').remove();\n }\n $($this).closest('.form-row').find('.error-message').css('color', '#e30613');\n $($this).closest('.form-row').find('.addresscharacterlength').addClass('alert-danger');\n }\n }\n else{\n $($this).closest('.form-row').find('.error-message').remove();\n }\n}\n\nfunction validateAdditionalAddressFiedinPopup($this){\n var countvalue = $($this).attr('maxlength') - $($this).val().length;\n $($this).closest('.address-content').find('.addresscharacterlength .count').html(countvalue);\n if (countvalue < 1 ) {\n $($this).closest('.address-content').find('.addresscharacterlength').addClass('alert-danger');\n }\n else {\n $($this).closest('.address-content').find('.addresscharacterlength').removeClass('alert-danger');\n }\n var inputValue = $($this).val();\n if (inputValue.length > 0) {\n var feildId = $($this).attr('id');\n //feildId = feildId.replace(\"dwfrm_address_\", \"\");\n var lastUnderscoreIndex = feildId.lastIndexOf('_');\n var textAfterLastUnderscore = feildId.substring(lastUnderscoreIndex + 1);\n var regExp = regexAddress[textAfterLastUnderscore];\n var reg = new RegExp(regExp, 'i');\n var test = reg.test(inputValue);\n var errlength = $('.address-form').find('.error-message');\n if (test) {\n $($this).closest('.address-content').find('.error-message').remove();\n if (!errlength.length) {\n $($this).closest('.form-row').addClass('validation-success');\n $($this).siblings(\".label\").addClass('focus-active');\n $('.apply-button').removeClass('disabled');\n }\n else {\n $('.apply-button').addClass('disabled');\n }\n\n } else {\n var errorMessage = \"Please provide a valid \" + textAfterLastUnderscore + \".\";\n $($this).closest('.address-content').find('.error-message').remove();\n if (!$('.checkout-addresses-form .error-msg:visible').length) {\n $('<div class=\"error-message\">' + errorMessage + '</div>').insertAfter($($this));\n }\n else{\n $('checkout-addresses-form .error-msg:visible').remove();\n }\n $($this).closest('.address-content').find('.error-message').css('color', '#e30613');\n $($this).closest('.address-content').find('.addresscharacterlength').addClass('alert-danger');\n $('.apply-button').addClass('disabled');\n }\n }\n else{\n $($this).closest('.address-content').find('.error-message').remove();\n }\n}\n\nfunction postcodeval(){\n var postcodevalue = $('.post-code-field input').val();\n if(postcodevalue == \"\"){\n $('.address-check-btn button').attr('disabled','disabled');\n $('.apply-button').attr('disabled','disabled');\n $('.postcodeerror').css(\"display\",\"none\");\n }else{\n $('.address-check-btn button').removeAttr('disabled','disabled');\n $('.apply-button').removeAttr('disabled','disabled');\n }\n}\nfunction posterror(){\n $('.postcodeerror').css(\"display\",\"block\");\n $('.address-check-btn button').attr('disabled','disabled');\n $('.apply-button').attr('disabled','disabled');\n\n}\nfunction postsuccess(){\n\n $('.postcodeerror').css(\"display\",\"none\");\n}\n\naddressFields = {\n init: function ($form) {\n initializeEvents($form);\n },\n fillAddressFields: fillAddressFields,\n updateBillingAddress : updateBillingAddress\n};\n\nmodule.exports = addressFields;", "'use strict';\n\nvar progress = require(35),\n util = require(46);\n\nvar currentRequests = [];\n\n/**\n * @function\n * @description Ajax request to get json response\n * @param {Boolean} async Asynchronous or not\n * @param {String} url URI for the request\n * @param {Object} data Name/Value pair data request\n * @param {Function} callback Callback function to be called\n */\nvar getJson = function (options) {\n options.url = util.toAbsoluteUrl(options.url);\n // return if no url exists or url matches a current request\n if (!options.url || currentRequests[options.url]) {\n return;\n }\n\n currentRequests[options.url] = true;\n\n // make the server call\n /*jslint unparam: true */\n $.ajax({\n dataType: 'json',\n url: options.url,\n async: (options.async === undefined || options.async === null) ? true : options.async,\n data: options.data || {}\n })\n // success\n .done(function (response) {\n if (options.callback) {\n options.callback(response);\n }\n })\n // failed\n .fail(function (xhr, textStatus) {\n if (textStatus === 'parsererror') {\n /*eslint-disable no-alert */\n window.alert(Resources.BAD_RESPONSE);\n /*eslint-enable no-alert */\n }\n if (options.callback) {\n options.callback(null);\n }\n })\n // executed on success or fail\n .always(function () {\n // remove current request from hash\n if (currentRequests[options.url]) {\n delete currentRequests[options.url];\n }\n });\n /*jslint unparam: false */\n};\n/**\n * @function\n * @description ajax request to load html response in a given container\n * @param {String} url URI for the request\n * @param {Object} data Name/Value pair data request\n * @param {Function} callback Callback function to be called\n * @param {Object} target Selector or element that will receive content\n */\nvar load = function (options) {\n options.url = util.toAbsoluteUrl(options.url);\n // return if no url exists or url matches a current request\n if (!options.url || currentRequests[options.url]) {\n return;\n }\n\n currentRequests[options.url] = true;\n\n // make the server call\n /*jslint unparam: true */\n $.ajax({\n dataType: 'html',\n url: util.appendParamToURL(options.url, 'format', 'ajax'),\n data: options.data,\n xhrFields: {\n withCredentials: true\n }\n })\n .done(function (response) {\n // success\n if (options.target) {\n $(options.target).empty().html(response);\n }\n if (options.callback) {\n options.callback(response);\n }\n })\n .fail(function (xhr, textStatus) {\n // failed\n if (textStatus === 'parsererror') {\n /*eslint-disable no-alert */\n window.alert(Resources.BAD_RESPONSE);\n /*eslint-enable no-alert */\n }\n options.callback(null, textStatus);\n })\n .always(function () {\n progress.hide();\n // remove current request from hash\n if (currentRequests[options.url]) {\n delete currentRequests[options.url];\n }\n });\n /*jslint unparam: false */\n};\n\nexports.getJson = getJson;\nexports.load = load;\n", "'use strict';\n\nvar util = require(46);\nvar progress = require(35);\n\nfunction initApplePay(config, pageType) {\n config.action.oncouponcodechanged = Urls.oncouponcodechanged;\n config.action.getRequest = util.appendParamToURL(config.action.getRequest, 'pageType', pageType);\n\n if (window.ApplePaySession && window.ApplePaySession.canMakePayments() && typeof fetch === 'function') {\n // Hide Gpay button on PDP\n var googlePayDetails = document.querySelector('.googlePayDetails');\n if (googlePayDetails) {\n googlePayDetails.classList.add('d-none');\n }\n\n // Show Apple Pay button\n var applePayDetails = document.querySelector('.applePayDetails');\n if (applePayDetails) {\n applePayDetails.classList.remove('d-none');\n }\n\n // Show Apple Pay payment method on checkout.\n var applePayPaymentMethod = document.querySelector('.payment-method.apple-pay');\n if (applePayPaymentMethod) {\n applePayPaymentMethod.classList.remove('d-none');\n };\n\n var location = window.location;\n var ApplePaySession = window.ApplePaySession;\n\n /** Used version of ApplePaySession */\n var APPLE_PAY_VERSION = 1;\n\n /** CSS class name indicating an element was processed by a directive */\n var CLASS_PROCESSED = 'dw-apple-pay-processed';\n\n /** Name of the SKU element attribute indicating add to basket */\n var ATTR_SKU = 'sku';\n\n /** Left hand side of cookie indicating to update the Apple Pay request. */\n var UPDATE_REQUEST_COOKIE_LHS = '; dwapupreq=';\n\n /** Map of Demandware status names to Apple Pay status codes */\n var STATUSES = {\n Failure: ApplePaySession.STATUS_FAILURE,\n InvalidBillingPostalAddress: ApplePaySession.STATUS_INVALID_BILLING_POSTAL_ADDRESS,\n InvalidShippingPostalAddress: ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,\n InvalidShippingContact: ApplePaySession.STATUS_INVALID_SHIPPING_CONTACT,\n PINRequired: ApplePaySession.STATUS_PIN_REQUIRED,\n PINIncorrect: ApplePaySession.STATUS_PIN_INCORRECT,\n PINLockout: ApplePaySession.STATUS_PIN_LOCKOUT\n };\n\n if (location.protocol !== 'https:' || !ApplePaySession.supportsVersion(APPLE_PAY_VERSION)) {\n return;\n }\n var action = config.action;\n var inject = config.inject;\n\n /** Last value of the cookie indicating to update the Apple Pay request. */\n var lastUpdateRequestCookie;\n\n /** URL to which to redirect if the Apple Pay session is aborted. */\n var redirect;\n\n /** Latest Apple Pay request data to use to create a session. */\n var request;\n\n /** Request object that gets updated with new data from server responses. */\n var updatedRequest;\n\n /** Current Apple Pay session. */\n var session;\n\n function hasClass(element, className) {\n return (' ' + element.className + ' ').replace(/[\\t\\r\\n\\f]/g, ' ').indexOf(' ' + className + ' ') > -1;\n }\n\n function mapStatus(status) {\n if (status && STATUSES[status]) {\n return STATUSES[status];\n }\n return ApplePaySession.STATUS_FAILURE;\n }\n\n function handleResponse(response) {\n return response.json()\n .then(function (json) {\n if (response.status >= 200 && response.status < 300) {\n // Return success JSON response\n return json;\n }\n\n // Throw error with response status\n var err = new Error(json ? json.status : 'Request error');\n err.response = json;\n throw err;\n });\n }\n\n function postJson(url, data) {\n var json = data;\n if (typeof data === 'object') {\n json = JSON.stringify(data);\n } else if (typeof data !== 'string') {\n throw new Error('Data must be an object or a JSON string.');\n }\n return fetch(url, {\n method: 'POST',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json'\n },\n body: json\n }).then(handleResponse);\n }\n\n function getJson(url) {\n return fetch(url, {\n credentials: 'include',\n headers: {\n 'Accept': 'application/json'\n }\n }).then(handleResponse);\n }\n\n /* Filter out properties that are not from Event prototype,\n * and include all others as ownProperty to a new object.\n * @param {Event} e\n * @return {Object} object with relevant properties as ownProperty\n */\n function filterEvent(e) {\n var filteredEvent = {};\n for (var prop in e) {\n /* global Event */\n if (!Event.prototype.hasOwnProperty(prop)) {\n filteredEvent[prop] = e[prop];\n }\n }\n return filteredEvent;\n }\n\n /**\n * On successful creation of an order, submit it through a form\n * @param {String} formAction URL to which to POST form to\n */\n function submitOrder(formAction) {\n var form = document.createElement('form');\n form.action = formAction;\n form.method = 'post';\n\n document.body.appendChild(form);\n form.submit();\n }\n\n function doRedirect() {\n if (redirect) {\n // Redirect to last responded redirect\n location.href = redirect;\n }\n }\n\n function dispatchEvent(event) {\n if (!event || !event.name) {\n return;\n }\n document.body.dispatchEvent(new CustomEvent(event.name, {\n bubbles: true,\n detail: event.detail\n }));\n }\n\n function processServerResponse(response) {\n if (!response) {\n return;\n }\n // redirect could be an empty string\n if (typeof response.redirect !== 'undefined') {\n // set redirect URL\n redirect = response.redirect;\n }\n dispatchEvent(response.event);\n }\n\n function oncancelHandler(e) {\n setSession(null);\n\n postJson(action.cancel, {}).then(function (response) {\n processServerResponse(response);\n doRedirect();\n }, function (error) {\n processServerResponse(error.response);\n doRedirect();\n progress.hide();\n }).catch(function (err) {\n progress.hide();\n });\n\n progress.hide();\n }\n\n function onpaymentauthorizedHandler(e) {\n postJson(action.onpaymentauthorized, filterEvent(e)).then(function (response) {\n session.completePayment(ApplePaySession.STATUS_SUCCESS);\n processServerResponse(response);\n setSession(null);\n submitOrder(response.redirect);\n }, function (error) {\n session.completePayment(mapStatus(error.message));\n processServerResponse(error.response);\n window.dataLayer.push({\n 'event': 'ApplePayAuthorizationError',\n 'ecommerce': {\n 'errorText': error.message\n }\n });\n window.location.reload();\n progress.hide();\n });\n }\n\n function oncouponcodechangedHandler(e) {\n $.ajax({\n url: action.oncouponcodechanged,\n type: 'post',\n data: filterEvent(e),\n success: function (response) {\n var parseResponse = JSON.parse(response);\n if (parseResponse.couponStatus === 'OK') {\n session.completeCouponCodeChange({\n newTotal: JSON.parse(parseResponse.newTotal),\n newLineItems: JSON.parse(parseResponse.newLineItems)\n });\n } else {\n $.ajax({\n url: Urls.applePayRemoveCoupon,\n type: 'post',\n data: filterEvent(e),\n async: false,\n success: function () {\n session.completeCouponCodeChange({\n newTotal: JSON.parse(parseResponse.newTotal),\n newLineItems: JSON.parse(parseResponse.newLineItems),\n errors: [new ApplePayError(\"couponCodeInvalid\")]\n });\n },\n error: function (err) {\n progress.hide();\n }\n });\n }\n },\n error: function (err) {\n progress.hide();\n }\n });\n }\n\n function onpaymentmethodselectedHandler(e) {\n postJson(action.onpaymentmethodselected, filterEvent(e)).then(function (response) {\n // update updatedRequest with new server response\n updatedRequest = Object.assign(updatedRequest, response);\n session.completePaymentMethodSelection(response.total, response.lineItems);\n processServerResponse(response);\n }, function (error) {\n // No way to communicate error status on this event to Apple Pay\n session.completePaymentMethodSelection(\n updatedRequest.total, updatedRequest.lineItems);\n processServerResponse(error.response);\n progress.hide();\n }).catch(function (err) {\n progress.hide();\n });\n }\n\n function onshippingcontactselectedHandler(e) {\n postJson(action.onshippingcontactselected, filterEvent(e)).then(function (response) {\n // update updatedRequest with new server response\n updatedRequest = Object.assign(updatedRequest, response);\n session.completeShippingContactSelection(ApplePaySession.STATUS_SUCCESS,\n response.shippingMethods, response.total, response.lineItems);\n processServerResponse(response);\n }, function (error) {\n session.completeShippingContactSelection(mapStatus(error.message),\n [], updatedRequest.total, updatedRequest.lineItems);\n processServerResponse(error.response);\n showErrorMsg('Apple Pay is allowed only for UK delivery.');\n }).catch(function (err) {\n showErrorMsg('Apple Pay is allowed only for UK delivery.');\n });\n }\n\n function showErrorMsg(errorMsg) {\n var errorContainer = document.querySelector('.apple-pay-error');\n\n if (errorContainer) {\n errorContainer.innerHTML = errorMsg;\n errorContainer.classList.remove('d-none');\n };\n\n progress.hide();\n }\n\n function onshippingmethodselectedHandler(e) {\n postJson(action.onshippingmethodselected, filterEvent(e)).then(function (response) {\n // update updatedRequest with new server response\n updatedRequest = Object.assign(updatedRequest, response);\n session.completeShippingMethodSelection(ApplePaySession.STATUS_SUCCESS,\n response.total, response.lineItems);\n processServerResponse(response);\n }, function (error) {\n session.completeShippingMethodSelection(mapStatus(error.message),\n updatedRequest.total, updatedRequest.lineItems);\n processServerResponse(error.response);\n progress.hide();\n }).catch(function (err) {\n progress.hide();\n });\n }\n\n function onvalidatemerchantHandler(e) {\n postJson(action.onvalidatemerchant, Object.assign(filterEvent(e), {\n hostname: window.location.hostname\n })).then(function (response) {\n session.completeMerchantValidation(response.session);\n }, function (error) {\n session.abort();\n progress.hide();\n restoreApplePayBasket();\n }).catch(function (err) {\n progress.hide();\n restoreApplePayBasket();\n });\n }\n\n function setSession(s) {\n if (session) {\n session.oncancel = null;\n session.onpaymentauthorized = null;\n session.onpaymentmethodselected = null;\n session.onshippingcontactselected = null;\n session.onshippingmethodselected = null;\n session.onvalidatemerchant = null;\n session.oncouponcodechanged = null;\n }\n\n session = s;\n\n if (session) {\n session.oncancel = oncancelHandler;\n session.onpaymentauthorized = onpaymentauthorizedHandler;\n session.onpaymentmethodselected = onpaymentmethodselectedHandler;\n session.onshippingcontactselected = onshippingcontactselectedHandler;\n session.onshippingmethodselected = onshippingmethodselectedHandler;\n session.onvalidatemerchant = onvalidatemerchantHandler;\n session.oncouponcodechanged = oncouponcodechangedHandler;\n }\n }\n\n /**\n * Begins the ApplePaySession.\n */\n function createSession() {\n // fake the total amount to make it a valid request\n // if the basket is empty.\n // @TODO some basic addition should be calculated instead\n // to reflect a more reasonable amount\n // this relies on the SKU price to be available on render\n if (parseFloat(request.total.amount) === 0) {\n request.total.amount = '0.01';\n }\n setSession(new ApplePaySession(APPLE_PAY_VERSION, request));\n session.begin();\n\n // set updatedRequest to request\n updatedRequest = Object.assign({}, request);\n }\n\n /**\n * Prepares an Apple Pay basket, optionally\n * containing exclusively the product with the given SKU to buy.\n * @param {String} [sku] SKU of product to buy\n */\n function prepareBasket(sku) {\n var requestObj = {\n sku: sku,\n }\n\n var isMultiLevelProduct = false;\n var isGroupLevelProduct = false;\n\n var $productContainer = $('#live-tv-detail-main');\n\n if ($productContainer.length > 0) {\n var $liveTvProductOptions = $productContainer.find('.js-live-tv-product-options');\n var $liveTvProductSecondOptions = $productContainer.find('.js-live-tv-second-product-options');\n\n if ($liveTvProductOptions.length > 0 && $liveTvProductSecondOptions.length > 0) {\n isGroupLevelProduct = false;\n isMultiLevelProduct = true;\n } else if ($liveTvProductOptions.length > 0) {\n isGroupLevelProduct = true;\n isMultiLevelProduct = false;\n }\n\n var quantity = $('.js-live-tv-product-quantity').val();\n \n var $tile = $productContainer.find('.auction-product-data');\n var $selectField = $productContainer.find('.product-selection .input-select');\n var $selectedOption = $selectField.find('option:selected');\n var $selectedFirstOptionValue = $selectedOption.val();\n var $selectedFirstAuctionCode = $selectedOption.attr('data-auctioncode');\n var $selectedfirstPnP = $selectedOption.attr('data-pnp');\n var $selectsecondField = $productContainer.find('.second-variation .input-select');\n var $selectedSecondOption = $selectsecondField.find('option[selected=selected]');\n var $selectedSecondOptionValue = $selectedSecondOption.val();\n var $selectedSecondAuctionCode = $selectedSecondOption.attr('data-auctioncode');\n var $selectedSecondPnP = $selectedSecondOption.attr('data-pnp');\n\n var productID = $('input[name=productID]').val() || $('.product-id').length > 0 && $('.product-id').attr('data-value');\n var pnpValue = $tile.find('.tile-inner').length > 0 && $tile.find('.tile-inner').attr('data-pnp');\n var auctionCode = $tile.find('.tile-inner').length > 0 && $tile.find('.tile-inner').attr('data-auctioncode');\n\n var quantity = $('.js-live-tv-product-quantity').val();\n if(isMultiLevelProduct){\n if ($selectField.length > 0 && $selectedFirstOptionValue === 'null') {\n $selectField.addClass('border');\n return;\n } else {\n $selectField.removeClass('border');\n }\n \n if ($selectsecondField.length > 0 && $selectedSecondOptionValue === 'null') {\n $selectsecondField.addClass('border');\n return;\n } else {\n $selectsecondField.removeClass('border');\n }\n productID = $selectedSecondOptionValue;\n auctionCode = $selectedSecondAuctionCode;\n pnpValue = $selectedSecondPnP;\n }\n \n if(isGroupLevelProduct){\n if ($selectField.length > 0 && $selectedFirstOptionValue === 'null') {\n $selectField.addClass('border');\n return;\n } else {\n $selectField.removeClass('border');\n }\n productID = $selectField.length !== 0 ? $selectedFirstOptionValue : $tile.find('.product-id').data('value');\n auctionCode = $selectField.length !== 0 ? $selectedFirstAuctionCode : $tile.find('.tile-inner').data('auctioncode');\n pnpValue = $selectField.length !== 0 ? $selectedfirstPnP : $tile.find('.tile-inner').data('pnp');\n }\n \n var quantity = $productContainer.find('.quantity-selection .input-select').val();\n var auctionCodeApplicable = $(\"input[name='auctionCodeApplicable']\").val();\n var installments = $(\"input[name='installments']\").val();\n \n if ($('#live-tv-product-quantity').length > 0) {\n requestObj.format = 'ajax';\n requestObj.quantity = quantity;\n requestObj.itemPnP = pnpValue;\n requestObj.quickbuy = false;\n requestObj.channel = 'tjc';\n requestObj.pids = productID;\n requestObj.auctionCodeApplicable = auctionCodeApplicable;\n requestObj.auctionCodes = auctionCode;\n requestObj.isMobileApp = false;\n requestObj.isApplePayLtvCheckout = true;\n requestObj.installments = installments;\n }\n }\n\n var isWarrantyEligible = $('#isWarrantyEligible');\n if (isWarrantyEligible.length > 0 && isWarrantyEligible.val() === \"true\") {\n var qty = $('.pdp-product-quantity').val();\n var $addingToCartSection = $('.pdpForm');\n var isWarrantySelected = $addingToCartSection.find(\".warranty-section input[name='warrantyEnabled']\").prop(\"checked\");\n if (isWarrantySelected) {\n var warrantyQty = $('#warranty-total-quantity').val();\n requestObj.warrantyQty = warrantyQty;\n requestObj.isWarrantySelected = isWarrantySelected;\n requestObj.warrantyEnabled = isWarrantyEligible.val();\n requestObj.qty = qty;\n }\n }\n\n var isJewelryBox = $('.jewelrybox-packaging').length > 0;\n\n if (isJewelryBox) {\n var jewelrybox = $('input[name=\"jewelrybox\"]:checked').val();\n\n if (jewelrybox && jewelrybox != 'null') {\n requestObj.jewelrybox = jewelrybox;\n }\n }\n\n var pdpProdctQty = $('.pdp-product-quantity');\n if (pdpProdctQty.length > 0) {\n requestObj.qty = pdpProdctQty.val()\n }\n postJson(action.prepareBasket, requestObj).then(function (response) {\n processServerResponse(response);\n }, function (error) {\n try {\n session.abort();\n } catch (e) {\n // Swallow an error if Apple Pay throws when aborting session\n console.error(e);\n }\n processServerResponse(error.response);\n doRedirect();\n }).catch(function (err) {\n progress.hide();\n });\n }\n\n function validateInject(element, directive) {\n if (element.hasAttribute(ATTR_SKU)) {\n // No minimum total price required to inject for add to cart\n return !!request;\n }\n\n if (pageType === 'ltv') {\n return true;\n }\n\n // Inject only if request total price is positive\n return request && request.total && request.total.amount &&\n parseFloat(request.total.amount) > 0;\n }\n\n function createButton(element, directive) {\n // Create button element\n var button = document.createElement('button');\n button.type = 'button';\n\n // Compose button class name\n var className = '';\n if (directive.css) {\n className += directive.css;\n }\n\n // Copy attributes to button\n if (directive.copy) {\n if (element.getAttribute(ATTR_SKU)) {\n button.setAttribute(ATTR_SKU, element.getAttribute(ATTR_SKU));\n }\n if (element.className) {\n className += ' ' + element.className;\n }\n if (element.id) {\n var id = element.id;\n element.id = '';\n button.id = id;\n }\n }\n\n if (className) {\n button.className = className;\n }\n\n // Dynamically style the button\n if (directive.style) {\n var styleElement;\n if (directive.style.ref === 'this') {\n // Style reference is same element\n styleElement = element;\n } else if (directive.style.ref) {\n // Query style reference element\n styleElement = document.querySelector(directive.style.ref);\n }\n\n if (styleElement && directive.style.attr && 'getComputedStyle' in window) {\n // Copy declared style attributes to button\n var computedStyle = window.getComputedStyle(styleElement);\n var style = '';\n for (var i = 0; i < directive.style.attr.length; i++) {\n style += directive.style.attr[i] + ':' + computedStyle.getPropertyValue(directive.style.attr[i]) + ';';\n }\n button.style = style;\n }\n }\n\n // Add button click handler\n button.onclick = function () {\n\n var sizeVariation = $('.attribute.size-variations');\n\n if (sizeVariation.length > 0) {\n var selectedSwatch = sizeVariation.find('li.selected');\n if (selectedSwatch.length <= 0) {\n sizeVariation.find('span.error').removeClass('d-none');\n $('body,html').scrollTop(sizeVariation.offset().top);\n return false;\n }\n }\n\n // Show progress\n progress.show();\n // Create Apple Pay basket\n prepareBasket(button.getAttribute(ATTR_SKU));\n\n var productContainer = document.getElementById('live-tv-detail-main');\n\n if (productContainer) {\n var liveTvProductOptions = productContainer.querySelector('.js-live-tv-product-options');\n var liveTvProductSecondOptions = productContainer.querySelector('.js-live-tv-second-product-options');\n\n if (liveTvProductOptions && (liveTvProductOptions.value === 'null' || (liveTvProductOptions.value !== 'null' && liveTvProductSecondOptions && liveTvProductSecondOptions.value === 'null'))) {\n progress.hide();\n return;\n }\n }\n\n // Create Apple Pay session synchronously\n createSession();\n\n // Quit further event handling\n return false;\n };\n\n return button;\n }\n\n function process(element, directive) {\n if (hasClass(element, CLASS_PROCESSED)) {\n // Element has already been processed\n return;\n }\n\n if (!validateInject(element, directive)) {\n // Element is not valid for this directive\n return;\n }\n\n // Create button for element\n var button = createButton(element, directive);\n\n // Execute action for button\n switch (directive.action) {\n case 'after':\n element.parentNode.appendChild(button, element.nextSibling);\n break;\n case 'before':\n element.parentNode.insertBefore(button, element);\n break;\n case 'replace':\n element.parentNode.insertBefore(button, element);\n element.parentNode.removeChild(element);\n break;\n case 'append':\n element.appendChild(button);\n break;\n }\n\n // Mark element as processed\n element.className += ' ' + CLASS_PROCESSED;\n }\n\n function processDirectives() {\n if (!request) {\n // Quit processing without a valid request\n return;\n }\n\n var directive, elements;\n for (var i = 0; i < inject.directives.length; i++) {\n directive = inject.directives[i];\n elements = document.querySelectorAll(directive.query);\n if (elements && elements.length > 0) {\n for (var j = 0; j < elements.length; j++) {\n process(elements[j], directive);\n }\n }\n }\n\n if (inject.directives.length) {\n // Repeat processing in one second\n setTimeout(processDirectives, 1000);\n }\n }\n\n /**\n * Retrieves Apple Pay request info from the server.\n */\n function getRequest() {\n getJson(action.getRequest).then(function (response) {\n request = Object.assign({}, response.request);\n processDirectives();\n processServerResponse(response);\n }).catch(function (err) {\n processServerResponse(err.response);\n progress.hide();\n });\n }\n\n function getUpdateRequestCookie() {\n var cookie = '; ' + (document.cookie || '') + '; ';\n var start = cookie.indexOf(UPDATE_REQUEST_COOKIE_LHS);\n if (start < 0) {\n return '';\n }\n\n start += UPDATE_REQUEST_COOKIE_LHS.length;\n return cookie.substring(start, cookie.indexOf('; ', start));\n }\n\n function pollCookies() {\n var value = getUpdateRequestCookie();\n if (value && value !== lastUpdateRequestCookie) {\n lastUpdateRequestCookie = value;\n getRequest();\n }\n }\n\n // Kick off XHR to get initial Apple Pay request\n getRequest();\n\n // Poll for cookie to update Apple Pay request\n lastUpdateRequestCookie = getUpdateRequestCookie();\n setInterval(pollCookies, 200);\n\n function restoreApplePayBasket() {\n $.ajax({\n type: \"GET\",\n url: Urls.restoreqbbasketfromsession,\n data: {\n isApplePayLtvCheckout: true\n },\n success: function (data) {\n console.log(\"ApplePay Basket Restored\");\n },\n error: function () {\n console.log(\"Error in restoring existing basket in ApplePay\");\n return;\n }\n });\n }\n }\n};\n\nexports.init = function (pageType) {\n if (window._dw && window._dw.applepay) {\n initApplePay(window._dw.applepay, pageType);\n } else {\n document.addEventListener('applepay:config', function (e) {\n initApplePay(e.detail.config, pageType);\n });\n }\n}", "'use strict';\n\nvar ajax = require(3),\n util = require(46);\n\nvar selectedList = [],\n maxItems = 1,\n bliUUID = '';\n\n/**\n * @private\n * @function\n * description Gets a list of bonus products related to a promoted product\n */\nfunction getBonusProducts() {\n var o = {},\n i,\n len,\n p,\n a,\n alen,\n bp,\n opt;\n o.bonusproducts = [];\n\n for (i = 0, len = selectedList.length; i < len; i++) {\n p = {\n pid: selectedList[i].pid.toString(),\n qty: selectedList[i].qty,\n options: {}\n };\n bp = selectedList[i];\n if (bp.options) {\n for (a = 0, alen = bp.options.length; a < alen; a++) {\n opt = bp.options[a];\n p.options = {optionName: opt.name, optionValue: opt.value};\n }\n }\n o.bonusproducts.push({product: p});\n }\n return o;\n}\n\nvar selectedItemTemplate = function (data) {\n var attributes = '',\n attrID,\n attr;\n for (attrID in data.attributes) {\n if (data.attributes.hasOwnProperty(attrID)) {\n attr = data.attributes[attrID];\n attributes += '<li data-attribute-id=\"' + attrID + '\">\\n';\n attributes += '<span class=\"display-name\">' + attr.displayName + '</span>: ';\n attributes += '<span class=\"display-value\">' + attr.displayValue + '</span>\\n';\n attributes += '</li>';\n }\n }\n attributes += '<li class=\"item-qty\">\\n';\n attributes += '<span class=\"display-name\">Qty</span>: ';\n attributes += '<span class=\"display-value\">' + data.qty + '</span>';\n return [\n '<li class=\"selected-bonus-item\" data-uuid=\"' + data.uuid + '\" data-pid=\"' + data.pid + '\">',\n '<i class=\"remove-link fa fa-remove\" title=\"Remove this product\" href=\"#\"></i>',\n '<div class=\"item-name\">' + data.name + '</div>',\n '<ul class=\"item-attributes\">',\n attributes,\n '<ul>',\n '<li>'\n ].join('\\n');\n};\n\n// hide swatches that are not selected or not part of a Product Variation Group\nvar hideSwatches = function () {\n $('.bonus-product-item .swatches li').not('.selected').not('.variation-group-value').hide();\n // prevent unselecting the selected variant\n $('.bonus-product-item .swatches .selected').on('click', function () {\n return false;\n });\n};\n\n/**\n * @private\n * @function\n * @description Updates the summary page with the selected bonus product\n */\nfunction updateSummary() {\n var $bonusProductList = $('#bonus-product-list'),\n ulList,\n i,\n len,\n item,\n li,\n remain;\n if (selectedList.length === 0) {\n $bonusProductList.find('li.selected-bonus-item').remove();\n } else {\n ulList = $bonusProductList.find('ul.selected-bonus-items').first();\n for (i = 0, len = selectedList.length; i < len; i++) {\n item = selectedList[i];\n li = selectedItemTemplate(item);\n $(li).appendTo(ulList);\n }\n }\n\n // get remaining item count\n remain = maxItems - selectedList.length;\n $bonusProductList.find('.bonus-items-available').text(remain);\n if (remain <= 0) {\n $bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n } else {\n $bonusProductList.find('.select-bonus-item').removeAttr('disabled');\n }\n}\n\nfunction initializeGrid() {\n var $bonusProduct = $('#bonus-product-dialog'),\n $bonusProductList = $('#bonus-product-list'),\n bliData = $bonusProductList.data('line-item-detail'),\n cartItems;\n maxItems = bliData.maxItems;\n bliUUID = bliData.uuid;\n\n if (bliData.itemCount >= maxItems) {\n $bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n }\n\n cartItems = $bonusProductList.find('.selected-bonus-item');\n cartItems.each(function () {\n var ci = $(this),\n product = {\n uuid: ci.data('uuid'),\n pid: ci.data('pid'),\n qty: ci.find('.item-qty').text(),\n name: ci.find('.item-name').html(),\n attributes: {}\n },\n attributes = ci.find('ul.item-attributes li');\n attributes.each(function () {\n var li = $(this);\n product.attributes[li.data('attributeId')] = {\n displayName: li.children('.display-name').html(),\n displayValue: li.children('.display-value').html()\n };\n });\n selectedList.push(product);\n });\n\n $bonusProductList.on('click', '.bonus-product-item a[href].swatchanchor', function (e) {\n e.preventDefault();\n var url = this.href,\n $this = $(this);\n url = util.appendParamsToUrl(url, {\n 'source': 'bonus',\n 'format': 'ajax'\n });\n $.ajax({\n url: url,\n success: function (response) {\n $this.closest('.bonus-product-item').empty().html(response);\n hideSwatches();\n }\n });\n })\n .on('change', '.input-text', function () {\n $bonusProductList.find('.select-bonus-item').removeAttr('disabled');\n $(this).closest('.bonus-product-form').find('.quantity-error').text('');\n })\n .on('click', '.select-bonus-item', function (e) {\n e.preventDefault();\n if (selectedList.length >= maxItems) {\n $bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n $bonusProductList.find('.bonus-items-available').text('0');\n return;\n }\n\n var form = $(this).closest('.bonus-product-form'),\n detail = $(this).closest('.product-detail'),\n uuid = form.find('input[name=\"productUUID\"]').val(),\n qtyVal = form.find('input[name=\"Quantity\"]').val(),\n qty = (isNaN(qtyVal)) ? 1 : (+qtyVal),\n product,\n optionSelects;\n\n if (qty > maxItems) {\n $bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n form.find('.quantity-error').text(Resources.BONUS_PRODUCT_TOOMANY);\n return;\n }\n\n product = {\n uuid: uuid,\n pid: form.find('input[name=\"pid\"]').val(),\n qty: qty,\n name: detail.find('.product-name').text(),\n attributes: detail.find('.product-variations').data('attributes'),\n options: []\n };\n\n optionSelects = form.find('.product-option');\n\n optionSelects.each(function () {\n product.options.push({\n name: this.name,\n value: $(this).val(),\n display: $(this).children(':selected').first().html()\n });\n });\n selectedList.push(product);\n updateSummary();\n })\n .on('click', '.remove-link', function (e) {\n e.preventDefault();\n var container = $(this).closest('.selected-bonus-item'),\n uuid,\n i,\n len;\n if (!container.data('uuid')) {\n return;\n }\n\n uuid = container.data('uuid');\n len = selectedList.length;\n for (i = 0; i < len; i++) {\n if (selectedList[i].uuid === uuid) {\n selectedList.splice(i, 1);\n break;\n }\n }\n updateSummary();\n })\n .on('click', '.add-to-cart-bonus', function (e) {\n e.preventDefault();\n var url = util.appendParamsToUrl(Urls.addBonusProduct, {bonusDiscountLineItemUUID: bliUUID}),\n bonusProducts = getBonusProducts();\n if (bonusProducts.bonusproducts[0].product.qty > maxItems) {\n bonusProducts.bonusproducts[0].product.qty = maxItems;\n }\n // make the server call\n /*jslint unparam: true */\n $.ajax({\n type: 'POST',\n dataType: 'json',\n cache: false,\n contentType: 'application/json',\n url: url,\n data: JSON.stringify(bonusProducts)\n })\n .done(function () {\n // success\n window.location = Urls.cartShow;\n })\n .fail(function (xhr, textStatus) {\n // failed\n if (textStatus === 'parsererror') {\n /*eslint-disable no-alert */\n window.alert(Resources.BAD_RESPONSE);\n /*eslint-enable no-alert */\n } else {\n /*eslint-disable no-alert */\n window.alert(Resources.SERVER_CONNECTION_ERROR);\n /*eslint-enable no-alert */\n }\n })\n .always(function () {\n $bonusProduct.slideUp('slow');\n });\n /*jslint unparam: false */\n });\n}\n\nvar bonusProductsView = {\n /**\n * @function\n * @description Open the list of bonus products selection dialog\n */\n show: function (url) {\n var $bonusProduct = $('#bonus-product-dialog');\n // create the dialog\n ajax.load({\n url: url,\n target: $bonusProduct,\n callback: function () {\n initializeGrid();\n hideSwatches();\n $bonusProduct.slideDown('fast');\n util.scrollBrowser($bonusProduct.offset().top - 50);\n }\n });\n },\n /**\n * @function\n * @description Open bonus product promo prompt dialog\n */\n loadBonusOption: function () {\n var bonusDiscountContainer = document.querySelector('.bonus-discount-container'),\n uuid = $('.bonus-product-promo').data('lineitemid'),\n url = util.appendParamsToUrl(Urls.getBonusProducts, {\n bonusDiscountLineItemUUID: uuid,\n source: 'bonus'\n });\n\n if (!bonusDiscountContainer) {\n return;\n }\n this.show(url);\n\n // get the html from minicart, then trash it\n bonusDiscountContainer.parentNode.removeChild(bonusDiscountContainer.outerHTML);\n }\n};\n\nmodule.exports = bonusProductsView;\n", "var product = require(25);\nvar pdpoverlay = require(33);\nvar pdpprint = require(34);\nvar minicart = require(13);\nvar pdpbundle = require(32);\n\n$(document).ready(function () {\n product.init();\n pdpoverlay.init();\n pdpprint.init();\n minicart.init();\n pdpbundle.init();\n});", "var progress = require(35);\n\nwindow.loadedScripts = {};\n\nfunction loadScriptOnce(id, url, callback) {\n var scriptId = id ? id : url;\n if (window.loadedScripts[scriptId]) {\n return Promise.resolve();\n }\n \n return $.getScript(url)\n .done(function () {\n window.loadedScripts[scriptId] = true;\n document.dispatchEvent(new CustomEvent(scriptId));\n if (typeof callback === 'function') {\n callback();\n }\n })\n .fail(function () {\n console.error(\"Failed to load script:\", url);\n });\n}\n\nfunction observeLazyLoadingScripts() {\n // Define the element you want to observe\n var observer = new IntersectionObserver(function (entries, observer) {\n entries.forEach(function(entry) {\n if (entry.isIntersecting) {\n lazyLoadScript(entry.target);\n observer.unobserve(entry.target);\n }\n });\n });\n\n // Define the element you want to observe\n var elementsToObserve = document.querySelectorAll('.lazyload-script-js:not(.observed)');\n elementsToObserve.forEach(function (element) {\n observer.observe(element); \n });\n\n $(window).one('scroll', function() {\n var scriptToLoad = document.querySelectorAll('.lazyload-script-onscroll-js:not(.loaded)');\n scriptToLoad.forEach(lazyLoadScript);\n });\n}\n\nfunction lazyLoadScript(element) {\n $target = $(element);\n var lazySrc = $target.data('lazysrc');\n var scriptId = $target.data('id');\n loadScriptOnce(scriptId, lazySrc);\n\n $target.addClass('loaded observed');\n}\n\nfunction lazyLoadContent(lazyLoadContainer, callback, showProgressLoader) {\n if (!lazyLoadContainer.hasClass('loaded')) {\n lazyLoadContainer.addClass('loaded');\n if (showProgressLoader) {\n progress.show();\n }\n $.ajax({\n url: lazyLoadContainer.attr('data-url'),\n success: function (response) {\n lazyLoadContainer.replaceWith(response);\n if(window.yotpoWidgetsContainer){\n window.yotpoWidgetsContainer.initWidgets();\n }\n window.initRecommendationsCarousel();\n observeLazyLoadingScripts();\n window.globalcontentutils.init();\n },\n complete: function(){\n if (typeof callback === 'function') {\n callback();\n }\n },\n error: function (error) {\n console.error(\"Error loading content slots:\", error);\n }\n });\n } else {\n if (typeof callback === 'function') {\n callback();\n }\n }\n}\n\nwindow.observeLazyLoadingScripts = observeLazyLoadingScripts;\nwindow.loadScriptOnce = loadScriptOnce;\n\nmodule.exports = {\n observeLazyLoadingScripts: observeLazyLoadingScripts,\n lazyLoadContent: lazyLoadContent,\n lazyLoadScript: lazyLoadScript,\n loadScriptOnce: loadScriptOnce\n};", "/*\n This is the global file for data8 email validation\n*/\n\n'use strict';\n\nvar progress = require(35),\n \tvalidator = require(47),\n util = require(46);\n\nfunction verifyEmail(formSelector, email, buttonID, pageContext, enableButton) {\n if ($('#isEmailValidationEnabled').val() !== \"true\") return;\n\n setTimeout(function () {\n var regex = validator.regex;\n if (!regex.email.test(email)) {\n removeErrorMessage();\n return;\n }\n progress.show();\n $.ajax({\n url: util.appendParamsToUrl(Urls.emailAddressVerify, {\n emailId: email,\n pageContext: pageContext\n }),\n type: 'POST',\n success: function (response) {\n var responseCode = response && response.dataObj && response.dataObj.responseCode;\n var responseMessage = response && response.dataObj && response.dataObj.responseMessage || 'Please enter a valid email Address';\n var isValid = (\n (responseCode === \"Valid\") ||\n (responseCode === \"CatchAll\" && response.isValidCatchAllowed) ||\n (responseCode === \"Inconclusive\" && response.isInconclusiveAllowed) ||\n (responseCode === \"GreyListed\" && response.isGreyListedAllowed)\n );\n isValid ? markValidEmail(formSelector, buttonID, enableButton, pageContext) : markInvalidEmail(formSelector, responseMessage, buttonID, pageContext);\n progress.hide();\n },\n error: function () {\n markInvalidEmail(formSelector, \"Oops, system is unable to validate your Email Address.\", buttonID, pageContext);\n progress.hide();\n }\n });\n });\n}\n\nfunction markValidEmail(formSelector, buttonID, enableButton, pageContext) {\n $(formSelector).addClass('valid-email').removeClass('invalid-email');\n var formRow = (pageContext === 'product' ? '.inform-me-when-available-pdp' : formSelector) + ' .form-row';\n $(formRow).removeClass('validation-error').addClass('validation-success');\n $('.invalid-email-Message').remove();\n typeof enableButton === 'function' ? enableButton() : (buttonID ? buttonID.prop('disabled', false) : null);\n}\n\nfunction markInvalidEmail(formSelector, message, buttonID, pageContext) {\n $(formSelector).addClass('invalid-email').removeClass('valid-email');\n var formRow = (pageContext === 'product' ? '.inform-me-when-available-pdp' : formSelector) + ' .form-row';\n $(formRow).removeClass('validation-success').addClass('validation-error');\n if ($('.invalid-email-Message').length === 0) {\n var targetSelector = (pageContext === 'product')\n ? '.inform-me-when-available-pdp .field .focus-helper'\n : '.invalid-email .field .focus-helper';\n $('<div class=\"error-msg invalid-email-Message custom-error\" style=\"display:block;\">' + message + '</div>').insertAfter(targetSelector);\n }\n buttonID ? buttonID.prop('disabled', true) : null;\n}\n\nfunction removeErrorMessage() {\n if ($('.error-msg.invalid-email-Message').length > 0) {\n $('.error-msg.invalid-email-Message').remove();\n }\n}\n\nexports.verifyEmail = verifyEmail;\nexports.removeErrorMessage = removeErrorMessage;\n\n\n\n", "'use strict';\n\nvar initialized = false,\n $document = $(document),\n $html = $('html');\n\nfunction flyinheader() {\n\n // MENU FLYIN\n var openCloseFlyinHeader = function (open) {\n if (open) {\n $html.addClass('flyinheader-active');\n $('.header-wrapper').css('position', '').addClass('menu-opened');\n $('.header-content').css('position', 'unset');\n $('.header-menu').css('position', 'unset');\n $('.navigation').css('display', 'flex');\n if(pageContext.ns == \"cart\" && $('.cart-table tr').length > 0){\n $('.wrapper.pt_cart').css('overflow','unset');\n }else{\n $('.wrapper.pt_cart').css('overflow','hidden');\n }\n } else {\n $html.removeClass('flyinheader-active');\n $('.header-wrapper').css('position', '').removeClass('menu-opened');\n $('.header-content').css('position', '');\n $('.header-menu').css('position', '');\n $('.navigation').css('display', '');\n if(pageContext.ns == \"cart\" && $('.cart-table tr').length > 0){\n $('.wrapper.pt_cart').css('overflow','unset');\n }else{\n $('.wrapper.pt_cart').css('overflow','hidden');\n }\n }\n };\n\n $(document).on('click', '.flyinheader-trigger,.flyinheader-close-trigger', function (e) {\n openCloseFlyinHeader($(e.currentTarget).hasClass('flyinheader-trigger'));\n });\n\n window.matchMedia('(max-width: 1140px)').addListener(function (e) {\n if (!e.matches && $html.hasClass('flyinheader-active')) {\n openCloseFlyinHeader(false);\n }\n });\n\n initialized = !initialized;\n\n}\n\nmodule.exports = {\n init: function () {\n //if (!initialized) {\n flyinheader();\n //}\n }\n};", "'use strict';\n\nvar ajax = require(3),\n util = require(46);\n\nvar setAddToCartHandler = function (e) {\n e.preventDefault();\n var form = $(this).closest('form'),\n\n options = {\n url: util.ajaxUrl(form.attr('action')),\n method: 'POST',\n cache: false,\n data: form.serialize()\n };\n /*jslint unparam: true */\n $.ajax(options).done(function (response) {\n var id,\n $errorEl;\n if (response.success) {\n ajax.load({\n url: Urls.minicartGC,\n data: {lineItemId: response.result.lineItemId},\n callback: function (resp) {\n if (window.minicart && typeof window.minicart.show === 'function') {\n window.minicart.show(resp);\n }\n form.find('input,textarea').val('');\n }\n });\n } else {\n form.find('span.error').hide();\n for (id in response.errors.FormErrors) {\n if (response.errors.FormErrors.hasOwnProperty(id)) {\n $errorEl = $('#' + id).addClass('error').removeClass('valid').next('.error');\n if (!$errorEl || $errorEl.length === 0) {\n $errorEl = $('<span for=\"' + id + '\" generated=\"true\" class=\"error\" style=\"\"></span>');\n $('#' + id).after($errorEl);\n }\n $errorEl.text(response.errors.FormErrors[id].replace(/\\\\'/g, '\\'')).show();\n }\n }\n }\n }).fail(function (xhr, textStatus) {\n // failed\n if (textStatus === 'parsererror') {\n /*eslint-disable no-alert */\n window.alert(Resources.BAD_RESPONSE);\n /*eslint-enable no-alert */\n } else {\n /*eslint-disable no-alert */\n window.alert(Resources.SERVER_CONNECTION_ERROR);\n /*eslint-enable no-alert */\n }\n });\n /*jslint unparam: false */\n};\n\nexports.init = function () {\n $('#AddToBasketButton').on('click', setAddToCartHandler);\n};\n", "'use strict';\n\n/**\n * @private\n * @function\n * @description Binds events to the cart page (edit item's details, bonus item's actions, coupon code entry)\n */\nfunction initializeEvents() {\n $('#cart-table')\n .on('click', '.inform-me-when-available button', function () {\n informmewhenavailable();\n $( document ).ajaxComplete(function( event, xhr, settings ) {\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n informmewhenavailable();\n });\n });\n}\nfunction informmewhenavailable() {\n\n $('#cart-table')\n .on('click', '.inform-me-when-available button', function () {\n var $this = $(this),\n $informBox = $this.parents('.inform-me-when-available'),\n $formRow = $informBox.find('.field'),\n $formField = $formRow.find('input.input-text');\n\n var email = $informBox.find('input').val();\n if(email == \"\") {\n $informBox.addClass('validation-error');\n if($formRow.find('.error-msg.null-validation').length == 0) {\n $formRow.append('<div class=\"error-msg null-validation\" style=\"display:block;\">Cannot be blank</div>');\n\n }\n return false;\n }else{\n $informBox.find('.error-msg.null-validation').remove();\n }\n if($formRow.find('.error-msg').length>0){\n return false;\n }\n $informBox.find('.error-msg').remove();\n $formRow.removeClass('validation-error');\n $.ajax({\n type: 'post',\n url: $this.data('url'),\n data: {\n email: $informBox.find('input').val(),\n pid: $this.data('pid')\n }\n }).done(function (response) {\n if (response.success) {\n $informBox.html('<div class=\"message success-form\"><div class=\"message-inner\">' +\n '<div class=\"message-content\">' + response.message + '</div></div></div>');\n } else {\n $formRow.find('.field').append('<div class=\"error-msg\">' + response.message + '</div>');\n $formRow.addClass('validation-error');\n }\n var url = Urls.InformProductRemove;\n $.ajax({\n type: 'post',\n url: url,\n data: {\n pid: $this.data('pid')\n },\n success: function (response) {\n var res = response;\n if(res.removed == \"true\" ){\n $( \"#primary .cart\" ).load(\" .cart > *\" );\n $( \".xlt-header .header-bag\" ).load(\" .header-bag > *\" );\n\n }\n },\n error: function (jqXHR, textStatus, errorThrown) {\n //console.log(jqXHR + textStatus + errorThrown);\n }\n });\n });\n });\n}\n\nexports.init = function () {\n initializeEvents();\n informmewhenavailable();\n};\n", "'use strict';\n\n/**\n * @private\n * @function\n * @description Binds events to the cart page (edit item's details, bonus item's actions, coupon code entry)\n */\n\nvar emailVerification = require(8);\n\nfunction initializeEvents() {\n // for logged in customers\n if ($('#enableButton').val() == 'true') {\n $(\"#informMeButton\").prop(\"disabled\", false);\n }\n if ($('#enableButton').val() == 'false') {\n $(\"#informMeButton\").prop(\"disabled\", true);\n $('#notifyMe_helptext').html(\"We will inform you as soon as this product is back in stock!\");\n var icon = $('<i class=\"fa fa-check-circle\"></i>');\n $(\"#informMeButton\").text('').prepend(icon).append(\" Notified\");\n\n }\n\n $(document).on('click', '.js-inform-me-btn', function () {\n var $this = $(this),\n $informBox = $this.parents('.inform-me-when-available-pdp');\n if ($('#inputEmail').length > 0 && !isValidEmail($('#inputEmail').val())) {\n return;\n }\n\n $.ajax({\n type: 'post',\n url: $this.data('url'),\n data: {\n email: $('#inputEmail').length > 0 ? $('#inputEmail').val().toLowerCase() : null,\n pid: $this.data('pid')\n }\n }).done(function (response) {\n if (response.success) {\n // for logged in customers\n var element = $(\"#notifyMe_helptext\");\n element.html(response.message);\n\n $(\"#informMeButton\").prop(\"disabled\", true);\n\n var icon = $('<i class=\"fa fa-check-circle\"></i>');\n $(\"#informMeButton\").text('').prepend(icon).append(\" Notified\");\n\n } else {\n var alreadyDisplayedMessage =\n $informBox.find('.field .inform-me-message-fail') === 0 ? true : false;\n if (!alreadyDisplayedMessage) {\n $informBox.html('<div class=\"inform-me-message-fail\" style=\"display: block;\">' +\n Resources.INFORM_ME_FAIL + '</div>');\n }\n }\n\n });\n });\n\n $(document).on('ready', function () {\n $(document).on(\"keypress\", \".pdpForm\", function (e) {\n if (e.key == 'Enter' && $('.js-inform-me-btn').length > 0) {\n e.preventDefault();\n\n if (!isValidEmail($('#inputEmail').val())) {\n invalidEmail($('#inputEmail').val());\n return false;\n } else {\n $('.js-inform-me-btn').removeAttr('disabled');\n $('.js-inform-me-btn').trigger('click');\n }\n }\n });\n });\n\n\n\n\n $(document).on('focusout', '#inputEmail', function () {\n var $this = $(this);\n var $emailID = $this.val().trim();\n if (!$emailID || !isValidEmail($emailID)) {\n invalidEmail($emailID);\n return;\n }\n $this.parents('.form-row').addClass('validation-success');\n emailVerification.verifyEmail(\n '.email-data8',\n $emailID,\n $('#informMeButton'),\n pageContext.ns,\n null\n );\n });\n\n $(document).on('focusin', '#inputEmail', function () {\n emailVerification.removeErrorMessage();\n });\n\n function invalidEmail(email) {\n var $notifyMeButton = $('.inform-me-when-available-pdp button');\n var $informBox = $notifyMeButton.parents('.inform-me-when-available-pdp');\n var $formRow = $informBox.find('.form-row');\n\n $formRow.addClass('validation-error');\n if ($formRow.find('.error-msg').length === 0) {\n if (email === '') {\n $formRow.find('.field').append('<div class=\"error-msg invalid-email-Message\">Cannot be blank</div>');\n } else {\n $formRow.find('.field').append('<div class=\"error-msg invalid-email-Message\">Must be valid email address.</div>');\n }\n $notifyMeButton.attr('disabled', true);\n $formRow.find('.error-msg').show();\n }\n return;\n }\n\n\n function isValidEmail(email) {\n return /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/.test(email);\n }\n}\n\nexports.init = function () {\n initializeEvents();\n};", "'use strict';\n\nvar bonusProductsView = require(5);\n\nvar minicart = {\n init: function () {\n this.$el = $('.header-bag');\n },\n /**\n * @function\n * @description Shows the given content in the mini cart\n * @param {String} A HTML string with the content which will be shown\n */\n show: function (html) {\n this.$el.find('.header-bag-link').html(html);\n this.$el.addClass('bag-with-products');\n this.init();\n bonusProductsView.loadBonusOption();\n }\n};\n\nmodule.exports = minicart;\n", "'use strict';\n\nvar util = require(46),\n ajax = require(3),\n validator = require(47),\n page = require(16),\n progress = require(35),\n flyinheader = require(9),\n ratimer = require(41),\n tjcplusactivation = require(43);\n\nfunction ViewHide(pre, show){\n var view,hide;\n var arr = [\"title\", \"content\", \"field\", \"button\"];\n\n $.each( arr, function( index, value ){\n hide = \".\"+pre+\"-\"+value;\n $(hide).addClass(\"d-none\");\n hide = \"\";\n });\n\n $.each( arr, function( index, value ){\n view = \".\"+show+\"-\"+value;\n $(view).removeClass(\"d-none\");\n view = \"\";\n });\n}\n\nfunction initializeEvents() {\n\n /* auto focus on submit */\n if($('.personal-fileds select.input-select').val()) {\n $('.personal-fileds select.input-select').trigger('blur');\n }\n /* code added for TW-1455 Likelist signin journey*/\n $('.pdp-main').on('click', '.product-wishlist-link', function () {\n\n $('.product-wishlist').addClass('wishlist');\n });\n $('.xlt-searchresults').on('click', '.wishlist-button', function () {\n\n $('.product-tile-buttons').addClass('wishlist');\n\n });\n //$('body').on('click', '.sigin-model-button, .live-tv-add-to-cart-form a.home-page-login-bid-now, .live-tv-add-to-cart-form a.login-live-tv, #checkout-form button.checkout-login-class, a#ra-login-button, a.login-class' , function (e) {\n $(\".sigin-model-button, .live-tv-add-to-cart-form a.home-page-login-bid-now, .live-tv-add-to-cart-form a.login-live-tv, #checkout-form button.checkout-login-class, a.ra-login-btn, a.login-class\").on(\"click\", function(e) {\n e.preventDefault();\n var isHeaderSignIn = $(this).hasClass('header-addnamelink');\n /* ProductIDPLP added for TW-1455 Likelist signin journey*/\n if (!isHeaderSignIn) {\n var ProductIDPLP = $(this).closest('.wishlist').find('.wishlistplp-pid').text();\n if (ProductIDPLP == \"\") {\n ProductIDPLP = $('.wishlist-pid').text();\n }\n if ( (pageContext.ns == 'product' || pageContext.ns == 'search' ) && (ProductIDPLP != \"\") ) {\n if ( window.location.href.indexOf('?source=likelist') < 0) {\n if ( window.location.href.indexOf('#') > -1 || pageContext.ns == 'product' ) {\n var oldurl = window.location.href.split('#');\n var url = oldurl[0] + \"?source=likelist&pid=\"+ ProductIDPLP;\n window.history.pushState({},'',url);\n }\n else{\n var url = window.location.href + \"?source=likelist&pid=\"+ ProductIDPLP;\n window.history.pushState({},'',url);\n }\n } else {\n var oldurl = window.location.href.split('?source=likelist&pid=');\n var url = oldurl[0] + \"?source=likelist&pid=\"+ ProductIDPLP;\n window.history.pushState({},'',url);\n }\n } else if (pageContext.ns == 'cart') {\n if ( window.location.href.indexOf('?source') < 0) {\n var url = window.location.href + \"?source=signin\";\n window.history.pushState({},'',url);\n } else {\n var oldurl = window.location.href.split('?source=signin');\n var url = oldurl[0] + \"?source=signin\";\n window.history.pushState({},'',url);\n }\n }\n } else {\n if (pageContext.ns == 'cart' && window.location.href.indexOf('?source=signin') > -1) {\n var oldurl = window.location.href.split('?source=signin');\n var url = oldurl[0];\n window.history.pushState({},'',url);\n }\n }\n var cgid = '',pid='',pipeline='',cid='';\n if (pageContext.ns == 'search') {\n cgid = $('.new-register-direction').val();\n } else if (pageContext.ns == 'product'){\n if ($('body').data('shopcontext') === 'auctionshop' && $('.ra-details-wrapper').length > 0) {\n pid = $('.ra-details-wrapper').data('itemid');\n } else {\n pid = $('.product-code-pdp .product-id').text().trim();\n }\n } else if (pageContext.ns == 'livetv' || pageContext.ns == 'account'){\n var pathName = window.location.pathname;\n pipeline = pathName.split('/')[pathName.split('/').length-1]\n if (new RegExp(/C[0-9]+/gmi).test(pipeline)) {\n pipeline = 'Account-Show';\n }\n } else if (pageContext.ns == 'content'){\n var cgidvalue = $('.new-register-direction').val();\n var cidvalue = $('.new-cid-register-direction').val();\n if (cgidvalue != \"null\") {\n cgid = cgidvalue;\n } else if (cidvalue != \"null\"){\n cid = cidvalue;\n } else {\n var pathName = window.location.pathname;\n pipeline = pathName.split('/')[pathName.split('/').length-1];\n if (pipeline == 'Search-Show'){\n cgid = window.location.search.split('=')[1];\n } else {\n cid = window.location.search.split('=')[1];\n }\n }\n }\n var url = util.appendParamsToUrl(Urls.oldRegPage,{\n 'pagecontext':pageContext.ns,\n 'cgid':cgid,\n 'pid':pid,\n 'pipeline':pipeline,\n 'cid':cid,\n 'emailid':'',\n 'fromPopUpRegister' : 'no',\n 'newSignin':'newSignin'});\n window.location.href = url;\n\n });\n if($('.pt_account_login, .pt_checkout_login').length > 0 && $(window).width() <= 767) {\n $(window).load(function() {\n setTimeout(function(){\n $(window).scrollTop($('.account-container').offset().top - 20);\n }, 100);\n });\n }\n\n $('form#RegistrationForm #onbeforeunload-button').on('click', function() {\n setTimeout(function () {\n\t\t\tif($('form#RegistrationForm .validation-success').length == 6 && $('.form-row.validation-error').length === 0) {\n\t\t $('form#RegistrationForm').addClass('btn-loader');\n\t\t }\n\t\t}, 150);\n });\n\n $('form#RegistrationForm #onbeforeunload-button').on('click', function(event) {\n\t\tvar button = $(this);\n\t\tvar $form = $(event.target).closest('form#RegistrationForm');\n\n\t\t$('<input>')\n\t\t\t.attr({\n\t\t\t\ttype: 'hidden', \n\t\t\t\tname: button.attr('name'),\n\t\t\t\tvalue: button.attr('value')\n\t\t\t})\n\t\t\t.appendTo($form);\n\n\t\tevent.preventDefault();\n\t\tif (window.SitePreferences.EnableGoogleRecaptchaRegistration) {\n\t\t\thandleRecaptchaRegistration($form);\n\t\t} else {\n\t\t\t$form.trigger('submit');\n\t\t}\n\t});\n\n\tfunction handleRecaptchaRegistration($form) {\n\t\tgrecaptcha.ready(function () {\n\t\t\tgrecaptcha.execute(window.SitePreferences.SiteKeyGoogleRecaptchaV3, { action: 'formSubmit' }).then(function (token) {\n\t\t\t\t$(\".grecaptcharesponse-js\").val(token);\n\t\t\t\t$form.trigger('submit');\n\t\t\t});\n\t\t});\n\t}\n\n if($('.pt_account_login, .pt_checkout_login').length > 0){\n if($('.error-form.message .message-content:visible').length > 0 && window.loginErrorPunch != true){\n\n if ($('#RegistrationForm').is(':visible')) {\n window.dataLayer.push({\n 'event': 'user-signup-fail',\n 'method': 'onsite',\n 'validation-error': $('.error-form.message .message-content').text().trim()\n });\n } else {\n window.dataLayer.push({\n 'event': 'loginError',\n 'subevent': $('#iswebcustomer').val() === 'false' ? 'user-signin-Tv account-fail' : 'user-signin-fail',\n 'method': 'onsite',\n 'validation-error': $('.error-form.message .message-content').text().trim()\n });\n }\n window.loginErrorPunch = true;\n }\n }\n}\n/* Passed ProductIDPLP for TW-1455 Likelist signin journey*/\nfunction signInForCustoer(ProductIDPLP, isHeaderSignIn) {\n $('.checkpw-button .singn-button').off('click').on('click', function(e){\n flyinheader.init();\n e.preventDefault();\n $('.focus-helper').css('display','none');\n $('.error-msg').css('display','none');\n\n\n var url = Urls.newLogin;\n var $form = $(this).closest('form');\n var emailid = $form.find('.email-value').text();\n var pwd = $form.find('.form-row-password input').val();\n if ($form.find('.form-row-password .error').length > 0){\n $form.find('.form-row-password .error').remove();\n }\n if (pwd == '') {\n var newDiv ='<div class=\"error\" style=\"color:#E30613;\">Cannot be blank <div>'\n $form.find('.form-row-password').append(newDiv);\n return;\n }\n\n progress.show();\n var data = $form.serialize();\n url = util.appendParamsToUrl(url,{'emailid':emailid , 'password':pwd});\n $.ajax({\n url: url,\n type: 'POST',\n data: data,\n success: function (response) {\n try {\n var parseResponse = JSON.parse(response);\n if (parseResponse.loginstatus && !parseResponse.tvcustomer){\n if(parseResponse.isTJCPlusMember){\n $('.plus-subscription-class').remove();\n }\n var prevUrl = window.location.href;\n\n $.ajax({\n url: prevUrl,\n type: 'GET',\n success: function (loginresponse) {\n try {\n if(pageContext.ns == \"cart\" && !isHeaderSignIn){\n window.location.href = Urls.opcStartNode;\n }else if(pageContext.ns == 'product' && $('.wishlist').length <=0 ){\n window.location.reload();\n } else if (isHeaderSignIn){\n window.location.reload();\n }\n /* code added for TW-1455 Likelist signin journey*/\n else if(pageContext.ns == 'product' && $('.wishlist').length > 0){\n var ProductID = $('.pdp-main .wishlist-pid').text();\n url = Urls.wishlistadd;\n url = util.appendParamsToUrl(url,{pid : ProductID,source : 'productdetail'});\n window.location.href = url;\n }else if(pageContext.ns == 'search' && $('.wishlist').length > 0){\n url = Urls.wishlistadd;\n url = util.appendParamsToUrl(url,{pid : ProductIDPLP,source : 'productdetail'});\n window.location.href = url;\n\n }else{\n //updating header user name\n var headerSelector = $(\".header-wrapper:not(.header-wrapper-menu) .header-inner\", loginresponse);\n var headerDOM = headerSelector.html();\n $(\".header-wrapper:not(.header-wrapper-menu) .header-inner\").html(headerDOM);\n\n //updating product tiles\n var tileSelector = $(\"#ajaxRefresh\", loginresponse);\n var tileDOM = tileSelector.html();\n $(\"#ajaxRefresh\").html(tileDOM);\n\n //$( \".header .header-inner\" ).load(\" .header-inner > *\" );\n //$( \".search-result-content #search-result-items\" ).load(\" #search-result-items > *\" );\n $( \"#ra-details-wrapper .ra-details-bottom\" ).load(\" .ra-details-bottom > *\" );\n //$( \".main-wrapper #ajaxRefresh\" ).load(\" #ajaxRefresh > *\" );\n $( \".main-wrapper .cart\" ).load(\" .cart > *\" );\n $('.product-wishlist-link').removeClass('login-class');\n $('.wishlist-button').removeClass('sigin-model-button');\n if (window.dialog) {\n window.dialog.close();\n }\n progress.hide();\n }\n } catch (b) {\n //console.log(b);\n }\n }\n });\n }\n\n else if(parseResponse.loginstatus && parseResponse.tvcustomer){\n var prevUrl = Urls.opcStartNode;\n window.location.href = util.appendParamsToUrl(Urls.setnewPassword,{'emailid':emailid , 'PasswordResetEmail': parseResponse.PasswordResetEmail, 'prevUrl' : prevUrl});\n progress.hide();\n }\n else {\n if ($form.find('.login-error-message').hasClass('d-none')){\n $form.find('.login-error-message').removeClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-content').addClass('d-none')\n }\n if (!$('.newsignin-box-inner .guest-checkout-button').hasClass('d-none')){\n $('.newsignin-box-inner .guest-checkout-button').addClass('d-none')\n }\n if ($form.find('.form-row-password .error').length > 0){\n $form.find('.form-row-password .error').remove();\n }\n var newDiv ='<div class=\"error\" style=\"color:#E30613;\">The password is incorrect<div>'\n $form.find('.form-row-password').append(newDiv);\n $('.form-row-new').removeClass('validation-success');\n $('.form-row-new').addClass('validation-error');\n progress.hide();\n }\n } catch (b) {\n //console.log(b);\n }\n }\n });\n\n\n $( document ).ajaxComplete(function( event, xhr, settings ) {\n //ratimer.reInitTimeCountersPDP();\n ratimer.reInitTimeCounters();\n menuclick();\n tjcplusactivation.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n $('.rising-action-btn-group').removeClass('hidebutton');\n });\n\n });\n}\n\nfunction forgotPwdClick() {\n $('.forgot-pin a, .resend-button .button,forgotpw-button a').on('click',function(e){\n e.preventDefault();\n var url = Urls.forgotPassword;\n var $form = $(this).closest('form');\n var emailid = $form.find('.email-value').text();\n url = util.appendParamToURL(url,'emailid',emailid);\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n try {\n var parseResponse = JSON.parse(response);\n if (parseResponse.mailHasSend){\n enteredWrongEmail();\n if ($form.find('.forgotpw-title').hasClass('d-none')){\n $form.find('.forgotpw-title').removeClass('d-none');\n }\n if ($form.find('.forgotpw-content').hasClass('d-none')) {\n $form.find('.forgotpw-content').removeClass('d-none');\n }\n if (!$form.find('.checkpw-content .edit-button').hasClass('d-none')){\n $form.find('.checkpw-content .edit-button').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-content').addClass('d-none');\n }\n if (!$form.find('.checkpw-content').hasClass('d-none')){\n $form.find('.checkpw-content').addClass('d-none');\n }\n if (!$form.find('.checkpw-button').hasClass('d-none')){\n $form.find('.checkpw-button').addClass('d-none');\n }\n if ($form.find('.forgotpw-button').hasClass('d-none')){\n $form.find('.forgotpw-button').removeClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkpw-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkpw-title').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-title').addClass('d-none')\n }\n if (!$form.find('.form-row-password').hasClass('d-none')){\n $form.find('.form-row-password').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-content').addClass('d-none')\n }\n if ($('.newsignin-box-inner .guest-checkout-button').hasClass('d-none')){\n $('.newsignin-box-inner .guest-checkout-button').removeClass('d-none')\n }\n } else {\n $form.find('.login-error-message').removeClass('d-none');\n }\n\n $('.pwemail').html(emailid);\n } catch (b) {\n //console.log(b);\n }\n }\n });\n });\n}\n\n/**Start - Script to display the modal popup in registration page when you click \"Shopped on our TV channel but not on our website?\" **/\n$( \"#tvconnect-modelbox\" ).dialog({\n autoOpen: false,\n dialogClass: \"tvconnectdialog\",\n modal: true,\n height: 'auto',\n resizable: true,\n});\n\n$( \"#tvconnect\" ).click(function() {\n $(this).closest('form');\n $( \"#tvconnect-modelbox\" ).dialog( \"open\" );\n});\n\nfunction editbuttonclick() {\n $('body').on('click','.returning-customers form .checkpw-content .edit-button, .wrong-email-link', function(e){\n var $form1 = $(this).closest('form');\n if (!$form1.find('.checkpw-content').hasClass('d-none')){\n $form1.find('.checkpw-content').addClass('d-none');\n }\n if ($form1.find('.checkemail-field').hasClass('d-none')){\n $form1.find('.checkemail-field').removeClass('d-none');\n }\n if (!$form1.find('.form-row-password').hasClass('d-none')){\n $form1.find('.form-row-password').addClass('d-none');\n }\n if ($form1.find('.form-row-button .checkemail-button').hasClass('d-none')){\n $form1.find('.form-row-button .checkemail-button').removeClass('d-none');\n }\n if (!$form1.find('.checkpw-button').hasClass('d-none')){\n $form1.find('.checkpw-button').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkpw-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkpw-title').addClass('d-none');\n }\n if ($('.newsignin-box-inner .checkemail-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-title').removeClass('d-none')\n }\n if (!$form1.find('.forgotpw-title').hasClass('d-none')){\n $form1.find('.forgotpw-title').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-content').hasClass('d-none')) {\n $form1.find('.forgotpw-content').addClass('d-none');\n }\n if (!$form1.find('.guest-checkout-button').hasClass('d-none')) {\n $form1.find('.guest-checkout-button').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-button').hasClass('d-none')){\n $form1.find('.forgotpw-button').addClass('d-none');\n }\n $.each($form1.find('.error'),function(){$(this).remove()});\n });\n}\n/**End**/\n\nfunction enteredWrongEmail() {\n $('body').on('click','.guest-checkout-button a', function(e){\n var $form1 = $(this).closest('form');\n if ($('.checkemail-title').hasClass('d-none')){\n $('.checkemail-title').removeClass('d-none');\n }\n if ($('.checkemail-content').hasClass('d-none')){\n $('.checkemail-content').removeClass('d-none');\n }\n if ($('.edit-button').hasClass('d-none')){\n $('.edit-button').removeClass('d-none');\n }\n if ($form1.find('.checkemail-button').hasClass('d-none')){\n $form1.find('.checkemail-button').removeClass('d-none');\n }\n if ($form1.find('.checkemail-field').hasClass('d-none')){\n $form1.find('.checkemail-field').removeClass('d-none');\n }\n if (!$form1.find('.forgotpw-title').hasClass('d-none')){\n $form1.find('.forgotpw-title').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-content').hasClass('d-none')) {\n $form1.find('.forgotpw-content').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-button').hasClass('d-none')){\n $form1.find('.forgotpw-button').addClass('d-none');\n }\n });\n}\n\nfunction disguisePassword(){\n $('.icon-password').off('click').on('click', function () {\n var $this = $(this), $passwordField = $this.closest('.form-row-password').find('.input-text');\n\n if (!$this.hasClass('show')) {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'password');\n } else {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'text');\n }\n $this.toggleClass('show');\n });\n}\n\n\nfunction menuclick(){\n$(document).ready(function(){\n $('.menu-category li .menu-item-toggle').unbind().click(function (e) {\n e.preventDefault();\n var $parentLi = $(e.target).closest('li');\n $parentLi.siblings('li.active').removeClass('active').find('.menu-item-toggle.active').click()\n .removeClass('fa-minus active').addClass('fa-plus');\n $parentLi.toggleClass('active');\n $(e.target).toggleClass('active');\n if ($(e.target).hasClass('fa-minus') || $(e.target).hasClass('fa-plus')){\n $(e.target).toggleClass('fa-plus fa-minus');\n }\n });\n\n });\n}\n\nexports.init = function () {\n initializeEvents();\n};", "'use strict';\n\nvar util = require(46),\n ajax = require(3);\n\n\nfunction init() {\n var userStatus = $('#userStatus').val() === 'true' ? 'Registered user' : 'Guest user';\n\n /**Cart: View cart items */\n $(document).off('cart:viewCart').on('cart:viewCart', function () {\n try {\n var items = [];\n var itemsData = [];\n var value = 0;\n $(\".cart-gtm4-row\").each(function () {\n var item = $(this).data(\"gtm4\");\n value += item.price ? new Number(item.price * item.quantity) : 0;\n items.push(item);\n itemsData.push({\n \"item\": item.item_id,\n \"quantity\": item.quantity,\n \"price\": item.price,\n \"unique_id\": item.item_id\n });\n });\n window.dataLayer.push({\n 'event': 'view_cart',\n 'ecommerce': {\n \"currency\": \"GBP\",\n \"value\": value.toFixed(2),\n \"items\": items\n }\n });\n if (window.SitePreferences.NORTHBEAM_ENABLED) {\n window.Northbeam.fireCustomGoal(\"view_cart\", {\n 'ecommerce': {\n \"currency\": \"GBP\",\n \"value\": value,\n \"items\": items\n }\n });\n }\n _etmc.push([\"trackCart\", { \"cart\": itemsData }]);\n } catch (b) {\n //console.log(b);\n }\n });\n}\n\nfunction pushNBDataFromPurchase() {\n if (!window.SitePreferences.NORTHBEAM_ENABLED) {\n return;\n }\n\n try {\n var $nbDataHolder = $('#nbDataHolder');\n var purchase = $nbDataHolder.data('nbpurchase');\n var products = $nbDataHolder.data('nbtransactionproducts');\n var orderCategory = $nbDataHolder.data('nbordercategory');\n var urls = Urls.addlogs;\n\n $.ajax({\n type: \"GET\",\n url: urls + \"?logFileName=Northbeam&logData=pushNBDataFromPurchase data: \" + JSON.stringify(purchase),\n success: function () {\n var attempts = 0;\n var maxAttempts = 50;\n var interval = setInterval(function () {\n if (window.Northbeam && typeof window.Northbeam.firePurchaseEvent === 'function') {\n clearInterval(interval);\n try {\n window.Northbeam.firePurchaseEvent(purchase);\n var updatedUrl = util.appendParamsToUrl(Urls.northbeamPixelUpdate, {\n purchase: JSON.stringify(purchase)\n });\n $.ajax({\n url: updatedUrl,\n type: 'GET'\n });\n } catch (error) {\n $.ajax({\n type: 'GET',\n url: urls + \"?logFileName=Northbeam&logData=firePurchaseEvent failed with error:\" + error.message\n });\n }\n } else if (++attempts >= maxAttempts) {\n clearInterval(interval);\n $.ajax({\n type: 'GET',\n url: urls + \"?logFileName=Northbeam&logData=Northbeam object not found for the order number : \" + purchase.id + \" firePurchaseEvent failed.\"\n });\n }\n }, 200);\n }\n });\n // AWIN integration\n pushToNBAWINDataLayer(purchase, products, orderCategory);\n } catch (error) {\n //console.error(\"Error in pushNBDataFromPurchase: \", error);\n }\n}\n\nfunction pushToNBAWINDataLayer(purchase, products, orderCategory) {\n if (window.SitePreferences.NORTHBEAM_ENABLED) {\n try {\n var productCoupons = (purchase.coupon) ? purchase.coupon + \",\" : \"\";\n $(products).each(function (index, value) {\n if (value.coupon) {\n productCoupons += value.coupon;\n if (index + 1 < products.length && productCoupons != \"\") {\n productCoupons += \",\";\n }\n }\n });\n window.Northbeam.fireCustomGoal(\"order_transactionDetails\", {\n 'transactionTotal': '' + purchase.totalPrice,\n 'transactionCurrency': 'GBP',\n 'transactionID': '' + purchase.id,\n 'transactionParts': orderCategory + ':' + purchase.totalPrice,\n 'transactionPromoCode': '' + productCoupons,\n 'transactionProducts': products,\n 'transactionCustomerGroup': orderCategory\n });\n } catch (b) {\n //console.log(b);\n }\n }\n}\n\n\n// used primarily in the checkout to send each stage of checkout to gtm\n// JSON is rendered in gtm_checkout.isml\nfunction pushCheckoutStepToNBDataLayer(data) {\n if (window.SitePreferences.NORTHBEAM_ENABLED) {\n /*eslint-disable no-undef */\n window.Northbeam.fireCustomGoal(\"checkout\", data);\n }\n}\n\n// grabs and parses the json data to pass into the gtm\nfunction getNBData() {\n var nbJSON = document.getElementById('northbeam_checkout').dataset.nb;\n var eventCallback = document.getElementById('northbeam_eventCallback').dataset.eventcallback;\n // we can't pass double quotes into a data variable\n nbJSON = nbJSON.replace(/'/g, '\"');\n nbJSON = JSON.parse(nbJSON);\n // we cannot store functions in json, so convert the callback function accordingly\n if (eventCallback !== '') {\n nbJSON.ecommerce.eventCallback = function () {\n document.location = eventCallback;\n };\n }\n return nbJSON;\n}\n\n// only available on the final step of the checkout process\nfunction getPayNowNBData() {\n var nbJSON = document.getElementById('northbeam_checkout-paynow').dataset.nb;\n // we can't pass double quotes into a data variable\n nbJSON = nbJSON.replace(/'/g, '\"');\n nbJSON = JSON.parse(nbJSON);\n return nbJSON;\n}\n\nmodule.exports = {\n init: init,\n pushNBDataFromPurchase: pushNBDataFromPurchase,\n pushCheckoutStepToNBDataLayer: pushCheckoutStepToNBDataLayer,\n getNBData: getNBData,\n getPayNowNBData: getPayNowNBData\n};", "'use strict';\n\nvar util = require(46);\n\nvar page = {\n title: '',\n type: '',\n params: util.getQueryStringParams(window.location.search.substr(1)),\n redirect: function (newURL) {\n setTimeout(function () {\n window.location.href = newURL;\n }, 0);\n },\n refresh: function () {\n setTimeout(function () {\n window.location.assign(window.location.href);\n }, 500);\n }\n\n};\n\nmodule.exports = page;\n", "'use strict';\n\nvar giftcert = require(10),\n util = require(46),\n page = require(16),\n ajax = require(3),\n progress = require(35),\n addressFields = require(2),\n tabs = require(42),\n resetPassword = require(40),\n quickbuy = require(38),\n qbfornonlivetv = require(37),\n newsignin = require(14),\n tjcplusactivation = require(43),\n TPromise = require(51),\n orderconfirmation = require(21);\nvar account;\n\nfunction initFacebookSkip() {\n $('#skip').on('click', function () {\n if ($(this).is(\":checked\")) {\n $('#dwfrm_login_pin').val('Password123');\n $('.fbpassword').addClass(\"visually-hidden\");\n } else {\n $('#dwfrm_login_pin').val('');\n $('.fbpassword').removeClass(\"visually-hidden\");\n }\n });\n}\n/**\n * @private\n * @function\n * @description Binds the events of the order history\n */\nfunction initOrderHistory() {\n var $table = $('.order-history-items'),\n $overviewRows = $table.find('.order-overview');\n $table.on('click', 'tr.order-overview', function () {\n var $orderOverviewRow = $(this),\n $orderDetailsContainer = $orderOverviewRow.next('tr').find('.slide-container'),\n rowToggle = function () {\n $orderOverviewRow.toggleClass('active')\n .find('button i').toggleClass('fa-plus fa-minus');\n $orderOverviewRow.add($orderDetailsContainer).toggleClass('collapsed expanded');\n $orderDetailsContainer.slideToggle();\n };\n\n if ($orderOverviewRow.hasClass('collapsed')) {\n var yotpoOrderId = $orderOverviewRow.attr('data-yotpo-order-id');\n var sfccOrderId = $orderOverviewRow.attr('data-order-id');\n var amsOrderStatus = $orderOverviewRow.attr('data-ams-order-status');\n\n if (yotpoOrderId && amsOrderStatus && amsOrderStatus === 'Dispatched') {\n starRatingInitializer(yotpoOrderId, sfccOrderId);\n }\n $overviewRows.filter('.expanded').click();\n if ($orderDetailsContainer.find('.order-summary-table').length === 0) {\n progress.show();\n ajax.load({\n url: $orderDetailsContainer.data('url'),\n target: $orderDetailsContainer,\n callback: function () {\n progress.hide();\n initCertificatePopup();\n initYotpoReview();\n rowToggle();\n if (yotpoOrderId && amsOrderStatus && amsOrderStatus === 'Dispatched') {\n setTimeout(function () {\n starRatingHandlers((typeof (window.Yotpo) !== 'undefined' && typeof (window.Yotpo.historyFetch) !== 'undefined') ? window.Yotpo.historyFetch : false);\n }, 500);\n $orderOverviewRow.next('.order-details').find('.order-products-table').find('.cart-row').each(function (index) {\n $(this).find('td').addClass('pb-0');\n if (index !== 0) {\n $(this).find('td').addClass('pb-md-3 pt-md-4');\n } else {\n $(this).find('td').addClass('pb-md-4');\n }\n });\n\n var $cartRow = $orderOverviewRow.next('.order-details').find('.order-products-table').find('.cart-row');\n if (window.innerWidth < 768 && $cartRow.length > 0) {\n $cartRow.addClass('pb-0 pb-md-3');\n }\n } else {\n var yotpoSection = $orderOverviewRow.next('.order-details').find('.js-customer-give-rating-section');\n if (yotpoSection.length > 0) {\n yotpoSection.remove();\n }\n }\n }\n });\n } else {\n rowToggle();\n }\n } else {\n rowToggle();\n }\n });\n}\n\nfunction starRatingInitializer(yotpoOrderId, sfccOrderId) {\n var url = Urls.YotpoGetReviewList;\n\n url = util.appendParamsToUrl(url, {\n 'emailID': '' + customer.emailID,\n 'pagecontext': pageContext.type,\n 'orderID': sfccOrderId\n });\n\n if (yotpoOrderId) {\n url = util.appendParamsToUrl(url, {\n 'yotpoOrderId': '' + yotpoOrderId,\n });\n }\n\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n if (typeof (response) == 'object') {\n window.Yotpo = response;\n window.Yotpo.historyFetch = true;\n window.Yotpo.reviewedProduct = [];\n } else {\n //console.error(\"Yotpo Review Response Error\", url);\n window.Yotpo = {};\n window.Yotpo.historyFetch = false;\n window.Yotpo.reviewedProduct = [];\n }\n },\n error: function (jqXHR, textStatus, errorThrown) {\n //console.error(\"Yotpo Review AJAX Error\", url, jqXHR, textStatus, errorThrown);\n }\n });\n}\nfunction starRatingHandlers(initializeFlag) {\n if (!initializeFlag || typeof (initializeFlag) === 'undefined') {\n $('.customer-give-rating-section:visible').remove();\n //console.error(\"Yotpo Review stars are remove due to API respone error\");\n }\n var $thisRatingParent, $thisRatingParentTop, thisProductID, allStars, $selectedElement, loopBreaker = false;\n $('.customer-give-rating-section:visible .customer-give-rating:not(.older)').each(function (index, value) {\n $thisRatingParent = $(this);\n $thisRatingParentTop = $thisRatingParent.parents('.customer-give-rating-section');\n thisProductID = $thisRatingParent.data(\"productid\");\n loopBreaker = false;\n allStars = $thisRatingParent.find('.star-regular').length;\n\n var fulfilledProductIDs = Yotpo.FulfilledProductIDs;\n for (var i = 0; i < fulfilledProductIDs.length; i++) {\n var value = fulfilledProductIDs[i];\n if (parseInt(value.product_id) === thisProductID) {\n var ratingStars = window.innerWidth < 768 ? $thisRatingParent.parents('.js-yotpo-rating-row').attr('data-yotpo-rating') : $thisRatingParent.parents('.cart-row').attr('data-yotpo-rating');\n if (ratingStars && value.yotpo_rating) {\n $thisRatingParentTop.find('.rating-section-title').text('You Rated');\n window.Yotpo.reviewedProduct.push(thisProductID);\n\n for (var itr = 0; itr < parseInt(ratingStars); itr++) {\n var $selectedElement = $thisRatingParent.find('.rating').eq(itr);\n if ($selectedElement.hasClass('star-regular')) {\n $selectedElement.removeClass('star-regular').addClass('star');\n $thisRatingParent.addClass('older').css('cursor', 'default');\n loopBreaker = true;\n }\n }\n } else {\n continue;\n }\n }\n if (loopBreaker) {\n break;\n }\n }\n });\n\n $('.customer-give-rating:not(.older) .rating').off('mouseenter.ratinghandler').on('mouseenter.ratinghandler', function () {\n var $this = $(this),\n $thisRatingParent = $this.parents('.customer-give-rating'),\n starSelected = parseInt($this.index()),\n allStars = $thisRatingParent.find('.rating').length,\n $selectedElement, itr;\n var $thisRatingParentTop = $this.parents('.customer-give-rating-section');\n\n var $reviewContainer = $thisRatingParentTop.next('.js-review-container');\n if ($reviewContainer.length > 0 && !$reviewContainer.hasClass('visible')) {\n for (itr = 0; itr < allStars; itr++) {\n $selectedElement = $thisRatingParent.find('.rating:eq(' + itr + ')');\n if (itr <= starSelected) {\n if ($selectedElement.hasClass('star-regular')) {\n $selectedElement.removeClass('star-regular').addClass('star');\n }\n } else {\n if ($selectedElement.hasClass('star')) {\n $selectedElement.removeClass('star').addClass('star-regular');\n }\n }\n }\n }\n }).off('mouseleave.ratinghandler').on('mouseleave.ratinghandler', function () {\n var $this = $(this),\n $thisRatingParent = $this.parents('.customer-give-rating'),\n parentHoverFlag = $($thisRatingParent).parents('.js-customer-give-rating-section').next('.js-review-container').hasClass('visible');\n\n if (!parentHoverFlag) {\n $thisRatingParent.find('.star').removeClass('star').addClass('star-regular');\n }\n });\n\n $('.customer-give-rating:not(.older) .rating').off('click.ratinghandler').on('click.ratinghandler', function () {\n var $this = $(this),\n $thisRatingParent = $this.parents('.customer-give-rating'),\n $thisRatingParentTop = $this.parents('.customer-give-rating-section');\n\n $thisRatingParent.css('cursor', 'default');\n\n //$('.rating.star').removeClass('active star').addClass('star-regular');\n $(this).addClass('star-regular').nextAll('.star-regular').addClass('star-regular');\n $(this).addClass('active star').removeClass('star-regular').prevAll('.star-regular, .star').addClass('active star').removeClass('star-regular');\n\n var $closeButton = $thisRatingParent.next('.js-close-button');\n if ($closeButton.length > 0) {\n $closeButton.removeClass('d-none');\n }\n\n $thisRatingParentTop.addClass('border-bottom-0');\n var $reviewContainer = $thisRatingParentTop.next('.js-review-container');\n if ($reviewContainer.length > 0 && !$reviewContainer.hasClass('visible')) {\n $reviewContainer.toggleClass('d-none visible');\n }\n });\n}\n\n/**\n * @private\n * @function\n * @description Binds the events on the address form (edit, create, delete)\n */\nfunction initAddressEvents() {\n $('#addresses').on('click', '.delete', function (ev) {\n ev.preventDefault();\n /*eslint-disable no-alert */\n if (window.confirm(String.format(Resources.CONFIRM_DELETE, Resources.TITLE_ADDRESS))) {\n $.ajax({\n url: util.appendParamToURL($(this).attr('href'), 'format', 'ajax'),\n dataType: 'json'\n }).done(function (data) {\n if (data.status.toLowerCase() === 'ok') {\n page.redirect(Urls.addressesList);\n } else if (data.message.length > 0) {\n //window.alert(data.message);\n $(\"#deleteaddressmodel\").dialog({\n dialogClass: 'deleteaddressmodel',\n open: function (event, ui) {\n $('body').css('overflow', 'hidden');\n if ($('#deleteaddressmodel').hasClass('d-none')) {\n $('#deleteaddressmodel').removeClass('d-none');\n $('#deleteaddress-confirmationtext').html(data.message);\n }\n $('#deleteaddressmodel').css('min-height', 'unset');\n },\n close: function () {\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n },\n modal: true\n });\n } else {\n page.refresh();\n }\n });\n }\n /*eslint-enable no-alert */\n });\n}\n/**\n * @private\n * @function\n * @description Binds the events of the payment methods list (delete card)\n */\nfunction initPaymentEvents() {\n $('.add-card').on('click', function (e) {\n e.preventDefault();\n if (window.dialog) {\n window.dialog.open({\n url: $(e.target).attr('href')\n });\n }\n });\n\n var paymentList = $('.payment-list');\n if (paymentList.length === 0) {\n return;\n }\n\n util.setDeleteConfirmation(paymentList, String.format(Resources.CONFIRM_DELETE, Resources.TITLE_CREDITCARD));\n\n $('form[name=\"payment-remove\"]').on('submit', function (e) {\n e.preventDefault();\n // override form submission in order to prevent refresh issues\n var button = $(this).find('.delete'),\n data;\n $('<input/>').attr({\n type: 'hidden',\n name: button.attr('name'),\n value: button.attr('value') || 'delete card'\n }).appendTo($(this));\n data = $(this).serialize();\n $.ajax({\n type: 'POST',\n url: $(this).attr('action'),\n data: data\n })\n .done(function () {\n page.redirect(Urls.paymentsList);\n });\n });\n}\n/**\n * @private\n * @function\n * @description init events for Contact Us Page\n */\nfunction initContactUsEvents() {\n // Restrict Contact Us form copy/paste and drop\n $('form.contactus-form .input-textarea, form.contactus-form .input-text').on('copy paste drop', function (e) {\n e.preventDefault();\n });\n}\n/**\n * @private\n * @function\n * @description init events for the loginPage\n */\nfunction initLoginPage() {\n //o-auth binding for which icon is clicked\n $('.item').on('click', '.oAuthIcon', function (e) {\n $('.OAuthProvider').val($(e.delegateTarget).attr('id'));\n });\n}\n\nfunction handleRecaptcha($form) {\n grecaptcha.ready(function () {\n grecaptcha.execute(window.SitePreferences.SiteKeyGoogleRecaptchaV3, { action: 'formSubmit' }).then(function (token) {\n $(\".grecaptcharesponse-js\").val(token);\n loginForm($form);\n }.bind(this));\n }.bind(this));\n}\n\nfunction handleRecaptchaResetPassword($form) {\n grecaptcha.ready(function () {\n grecaptcha.execute(window.SitePreferences.SiteKeyGoogleRecaptchaV3, { action: 'formSubmit' }).then(function (token) {\n $(\".grecaptcharesponse-js\").val(token);\n $form.trigger(\"submit\");\n }.bind(this));\n }.bind(this));\n}\n\n/**\n * @private\n * @function\n * @description init events for the loginPage\n */\nfunction initGoogleRecaptchaV3() {\n \t$('.login-submit-js').off('click').on('click', function (event) {\n event.preventDefault();\n var button = $(this);\n var $form = $(event.target).closest('.login-form');\n if ($form.valid()) {\n $('<input>')\n .attr({\n type: 'hidden', \n name: button.attr('name'),\n value: button.attr('value')\n })\n .appendTo($form);\n\n if (window.SitePreferences.EnableGoogleRecaptchaLogin) {\n handleRecaptcha($form);\n } else {\n loginForm($form); \n }\n }\n });\n\n $('.resetpassword-js').off('click').on('click', function (event) {\n event.preventDefault();\n var button = $(this);\n var $form = $(event.target).closest('.reset-password-form');\n $('<input>')\n .attr({\n type: 'hidden', \n name: button.attr('name'),\n value: button.attr('value')\n })\n .appendTo($form);\n\n if (window.SitePreferences.EnableGoogleRecaptchaLogin) {\n handleRecaptchaResetPassword($form);\n } else {\n $form.trigger(\"submit\");\n }\n });\n}\n\nfunction loginForm($form) {\n $form.trigger(\"submit\");\n $('input.input-text').attr('disabled', 'disabled');\n $form.addClass('btn-loader');\n}\n\n/**\n * @private\n * @function\n * @description Set the \"empty\" select value color in the new registration (TJC-613)\n */\nfunction initSelectElements() {\n var greyPlaceholder = $('<div class=\"text-grey-placeholder\"></div>').hide().appendTo('body').css('color'),\n greyDark = $('<div class=\"text-grey-dark\"></div>').hide().appendTo('body').css('color'),\n handleSelect;\n\n\n handleSelect = function ($element) {\n $element.css('color', ['', '0'].indexOf($element.siblings().first().val()) > -1 ? greyPlaceholder : greyDark);\n };\n\n $('.selector > span').each(function () {\n handleSelect($(this));\n });\n\n $('.selector > span').bind('DOMSubtreeModified', function () {\n handleSelect($(this));\n });\n\n $('.selector').append('<span class=\"caret\"><i class=\"fa fa-caret-down\" aria-hidden=\"true\"></i></span>');\n}\n/**\n * @private\n * @function\n * @description Fix the layout and behavior of the address select for the new registration (TJC-613)\n */\nfunction accountAddressSelect() {\n var $buttonBillingAddress = $('.checkout-billing-address .address-check-btn > button'),\n $buttonShippingAddress = $('.checkout-shipping-address .address-check-btn > button'),\n $buttonBillingAddressZipInput = $buttonBillingAddress.parent().siblings('.field').children('input'),\n $buttonShippingAddressZipInput = $buttonShippingAddress.parent().siblings('.field').children('input'),\n $addressSelect = $('.addresses-select'),\n $addressSelectRow = $addressSelect.children().first(),\n $typeAddressButton = $addressSelect.children().last().find('button'),\n $additionaFields = $('.additional-address-fields');\n\n if ($buttonBillingAddressZipInput.val() === '') {\n $buttonBillingAddress.prop('disabled', true);\n }\n if ($buttonShippingAddressZipInput.val() === '') {\n $buttonShippingAddress.prop('disabled', true);\n }\n\n $buttonBillingAddressZipInput.on('change keydown keyup', function () {\n if ($buttonBillingAddressZipInput.val() === '') {\n $buttonBillingAddress.prop('disabled', true);\n } else {\n $buttonBillingAddress.prop('disabled', false);\n }\n });\n\n $buttonShippingAddressZipInput.on('change keydown keyup', function () {\n if ($buttonShippingAddressZipInput.val() === '') {\n $buttonShippingAddress.prop('disabled', true);\n } else {\n $buttonShippingAddress.prop('disabled', false);\n }\n });\n\n $buttonBillingAddressZipInput.on('click', function () {\n $addressSelect.removeClass('visually-hidden');\n $typeAddressButton.appendTo('.type-address-btn');\n });\n $buttonShippingAddressZipInput.on('click', function () {\n $addressSelect.removeClass('visually-hidden');\n $typeAddressButton.appendTo('.type-address-btn');\n });\n\n $typeAddressButton.on('click', function () {\n $addressSelect.addClass('visually-hidden');\n $additionaFields.removeClass('visually-hidden');\n });\n\n $addressSelectRow.addClass('form-row-with-button');\n $addressSelectRow.append('<div class=\"button-container type-address-btn\"></div>');\n\n $(\"#addnewCardQb\").click(function () {\n var add1 = $('#dwfrm_quickbuyaddress_billingAddress_address_address1').val(),\n add2 = $('#dwfrm_quickbuyaddress_billingAddress_address_address2').val(),\n city = $('#dwfrm_quickbuyaddress_billingAddress_address_city').val(),\n postcode = $('#dwfrm_quickbuyaddress_billingAddress_address_postCode').val(),\n country = $('#dwfrm_quickbuyaddress_billingAddress_address_country option:selected').val();\n\n if (!((add1.length > 0 || add2.length > 0) && city.length > 0 && postcode.length > 0 && country.length > 0)) {\n\n if ($(\"#addnewcard-billingerror\").hasClass('d-none')) {\n $(\"#addnewcard-billingerror\").removeClass('d-none');\n $('#addnewcard-billingerror').html(\"Please enter a valid billing address.\");\n }\n }\n else {\n if (!$(\"#addnewcard-billingerror\").hasClass('d-none')) {\n $(\"#addnewcard-billingerror\").addClass('d-none');\n }\n if ($(\"#qbaddnewcard\").hasClass('d-none')) {\n $(\"#qbaddnewcard\").removeClass('d-none');\n }\n else {\n $(\"#qbaddnewcard\").addClass('d-none');\n }\n //unhide the add a new card div fields\n /*window.dialog.open({\n url: Urls.addCard,\n options:{\n dialogClass:'add-new-card-dialog'\n }\n });*/\n }\n\n });\n\n $('body').on('change', '.activate-quickbuy-box .input-checkbox', function () {\n if ($('.activate-quickbuy-box .input-checkbox').is(':checked')) {\n $('button.activate-quickbuy').html('Activate & Checkout');\n }\n else {\n $('button.activate-quickbuy').html('Activate');\n }\n });\n\n $('.activate-quickbuy, .activate-tjcplus-membership').off('click').on('click', function (e) {\n e.preventDefault();\n progress.show('#qb-activation-page');\n var isActivateQuickBuy = $(e.target).hasClass('activate-quickbuy');\n var isTJCPlusContext = $(this).data('istjcpluscontext') != undefined ? $(this).data('istjcpluscontext') : false;\n\n if ($('#delivery-box .error').length > 0) {\n $('#delivery-box .error').remove();\n }\n if ($('#payment-form .error').length > 0) {\n $('#payment-form .error').remove();\n }\n if ($('#qbpaysafecard .error').length > 0) {\n $('#qbpaysafecard .error').remove();\n }\n if ($('.address-selector .error').length > 0) {\n $('.address-selector .error').remove();\n }\n\n var isValid = true;\n\n if (!isTJCPlusContext && ($('.deliveryList').val() == \"\" || $('.deliveryList').val() == null)) {\n var newDiv = '<div class=\"error\" style=\"color: #FFF;background: #E30613;width: 17.8rem;padding: 6px 8px;margin-top: 5px;\">Required.<div>';\n $('#delivery-box').append(newDiv);\n isValid = false;\n progress.hide();\n }\n\n if ($('.mobile-no input + .error-msg').length) {\n isValid = false;\n progress.hide();\n }\n\n if ($('#dwfrm_quickbuyaddress_shippingAddress_addressid + .error-msg').length) {\n isValid = false;\n progress.hide();\n }\n\n $(\".deliveryList\").change(function () {\n if (!$('.deliveryList').val() == \"\" || !$('.deliveryList').val() == null) {\n $('#delivery-box .error').remove();\n }\n });\n\n if ($('.quickbuytac').length > 0 && $('.quickbuytac').val == \"true\") {\n $('.QB-tc label').css('color', 'red');\n $('.QB-tc div.checker').css('border', '1px solid #c20000');\n isValid = false;\n progress.hide();\n }\n else {\n $('.QB-tc label').css('color', '#2c163d');\n $('.QB-tc div.checker').css('border', '1px solid #b9addb');\n }\n\n if ($('#qb-activation-page #dwfrm_quickbuyaddress_customer_quickbuytac').length && !$('#qb-activation-page #dwfrm_quickbuyaddress_customer_quickbuytac').is(':checked')) {\n $('.QB-tc label').css('color', 'red').css('font-weight', 'bold');\n $('.QB-tc div.checker').css('border', '3px solid #c20000');\n isValid = false;\n progress.hide();\n }\n else {\n $('.QB-tc label').css('color', '#2c163d');\n $('.QB-tc div.checker').css('border', '1px solid #b9addb');\n }\n\n\n /*if( $('#existing-paysafe-cvv').val() == \"\" || $('#existing-paysafe-cvv').val() == null){\n var newDiv ='<div class=\"error\" style=\"color: #FFF;background: #E30613;width: 6rem;padding: 6px 8px;margin-top: 5px;\">Required.<div>';\n $('.qbpaysafecard').append(newDiv);\n isValid = false;\n }*/\n\n /*if( $('#customerAddress').val() == \"\" || $('#customerAddress').val() == null){\n var newDiv ='<div class=\"error\" style=\"color: #FFF;background: #E30613;width: 17.8rem;padding: 6px 8px;margin-top: 5px;\">Required.<div>';\n $('.address-selector').append(newDiv);\n isValid = false;\n }*/\n\n if ($('#addnewCardQb').hasClass('new-card-empty')) {\n var newDiv = '<div class=\"error\" style=\"color: #E30613;width: 17.8rem;\">Add new Card<div>';\n $('#payment-form').append(newDiv);\n isValid = false;\n progress.hide();\n }\n\n var $form = $(this).closest('form');\n $form.validate();\n if (!$form.valid() || !isValid) {\n progress.hide();\n $('.activate-quickbuy').css('pointer-events', 'auto');\n $('.activate-quickbuy').css('cursor', 'pointer');\n $('.activate-quickbuy').css('opacity', '1');\n $('html, body, .checkout-addresses-form').animate({\n scrollTop: $('.validation-error').offset().top - 200\n }, 400);\n\n return;\n }\n //var quickbuytac = $('#dwfrm_quickbuyaddress_customer_quickbuytac').val();\n //var quickbuytac = $('#dwfrm_quickbuyaddress_customer_quickbuytac').val();\n if ($('#use-billing-address').is(\":checked\")) {\n var samebillingaddress = true;\n }\n else {\n var samebillingaddress = false;\n }\n var includeorder = $('.activate-quickbuy-box .input-checkbox').is(':checked');\n var existingCards = $(\"#existing-paysafe-card option:selected\").val();\n var deliveryoption = $('#dwfrm_quickbuyaddress_deliveryoption').val();\n //Paysafe 3DS2 implementation starts here\n if (window.SitePreferences.Paysafe_3ds2_Enabled && !isActivateQuickBuy) {\n try {\n progress.show('#qb-activation-page');\n $('.progress-loader').css('top', '65% !important');\n var accountId = window.SitePreferences.PAYSAFE_MID,\n environment = window.SitePreferences.PAYSAFE_ENVIRONMENT,\n authenticationPurpose = 'PAYMENT_TRANSACTION',\n cardBin = null, paymentToken = null;\n var btoa = window.btoa,\n apiKey = btoa(window.SitePreferences.PAYSAFE_SINGLE_USE_TOKEN);\n var selectedCardDetails = JSON.parse($(\"#existing-paysafe-card option:selected\").val());\n if (selectedCardDetails != null) {\n paymentToken = selectedCardDetails.paymentToken;\n cardBin = selectedCardDetails.cardBin;\n }\n /*if (selectedPaymentMethod == 'BudgetPay') {\n authenticationPurpose = 'INSTALMENT_TRANSACTION';\n }*/\n\n var options = { accountId: accountId, card: { cardBin: cardBin }, environment: environment };\n paysafe.threedsecure.start(apiKey, options, function (deviceFingerprintingId, startError) {\n if (startError) {\n var lastDigits, id, cardType;\n lastDigits = $('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits;\n id = $('.paysafemodelbox').data(\"paysafeselectedcard\").id;\n cardType = $('.paysafemodelbox').data(\"paysafeselectedcard\").cardType;\n\n var url = Urls.paysafe3DSecure2LogInfo;\n var data = {\n 'lastDigits': lastDigits,\n 'txnID': id,\n 'callNode': 'GENERAL_ERRORS',\n 'cardType': cardType,\n 'code': startError.code,\n 'displayMessage': startError.displayMessage,\n 'detailedMessage': startError.detailedMessage\n };\n url = util.appendParamsToUrl(url, data);\n $.ajax({\n type: \"GET\",\n url: url,\n success: function (data) {\n if (data.returnStatus !== undefined && data.returnStatus) {\n return;\n }\n },\n error: function (f) {\n progress.hide();\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n progress.hide();\n $paymentMethodsWarning.text(\"Technical issues prevent processing your payment. Please try later or use another payment method.\").parent().show();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n } else if (deviceFingerprintingId !== undefined) {\n // 3DS2 Next Step\n var url = Urls.paysafe3DSecure2Authenticate;\n url = util.appendParamsToUrl(url, {\n 'deviceFingerprintingId': deviceFingerprintingId,\n 'authenticationPurpose': authenticationPurpose,\n 'paymentToken': paymentToken\n });\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n progress.hide();\n response = JSON.parse(response)\n if (typeof (response) == 'object') {\n var responseObj = response.dataObj;\n if (responseObj.sdkChallengePayload != undefined && responseObj.sdkChallengePayload != '') {\n // go for challange\n var sdkChallengePayload = responseObj.sdkChallengePayload;\n var options = { sdkChallengePayload: sdkChallengePayload, environment: environment };\n try {\n paysafe.threedsecure.challenge(apiKey, options, function (resultId, error) {\n if (resultId !== undefined) {\n var url = Urls.paysafe3DSecure2GetAuthDetails;\n var data = { authenticationId: resultId };\n $.ajax({\n url: url,\n type: 'POST',\n data: data,\n success: function (response2Obj) {\n if (response2Obj !== undefined) {\n //{status: 'COMPLETED', threeDResult: 'U', errorMsg: 'AUTH_FAILED_U', sdkChallengePayload: ''}\n if (response2Obj.dataObj !== undefined) {\n var finalStatus = response2Obj.dataObj.status;\n var finalthreeDResult = response2Obj.dataObj.threeDResult;\n var finalerrorMsg = response2Obj.dataObj.errorMsg;\n if (finalStatus == 'COMPLETED' && finalerrorMsg == 'AUTH_OK_A_Y') {\n continueToPlaceOrder();\n } else if (finalthreeDResult == 'U') {\n if (window.SitePreferences.AllowStatusCodeU) {\n continueToPlaceOrder();\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request could not be completed by the bank due to technical reasons. Please try again or use a different card\");\n var totalPricee = $('.order-total.order-full-total td')[1];\n var $gtmpricee;\n if (totalPricee) {\n $gtmpricee = totalPricee.textContent;\n } else {\n $gtmpricee = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmpricee\n }\n });\n }\n }\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request has been declined by the Bank. Try using a different Card or Payment Option\");\n var totalPrice12 = $('.order-total.order-full-total td')[1];\n var $gtmprice52;\n if (totalPrice12) {\n $gtmprice52 = totalPrice12.textContent;\n } else {\n $gtmprice52 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice52\n }\n });\n }\n //console.log('authentication was unsuccessful in the 2nd step and unable to proceed your request');\n }\n }\n }\n },\n error: function () {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while calling the getpaysafe3dsauthdetails endpoint');\n }\n });\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while executing the challenge method and did not get authentication id');\n }\n });\n } catch (e) {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error was thrown while executing the challenge flow ' + e);\n }\n } else {\n if (responseObj !== undefined) {\n var finalthreeDResult = responseObj.threeDResult;\n if (finalthreeDResult == 'Y' || finalthreeDResult == 'A') {\n continueToPlaceOrder();\n } else if (finalthreeDResult == 'U') {\n if (window.SitePreferences.AllowStatusCodeU) {\n continueToPlaceOrder();\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request could not be completed by the bank due to technical reasons. Please try again or use a different card\");\n var totalPrice1 = $('.order-total.order-full-total td')[1];\n var $gtmprice5;\n if (totalPrice1) {\n $gtmprice5 = totalPrice1.textContent;\n } else {\n $gtmprice5 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice5\n }\n });\n }\n }\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request has been declined by the Bank. Try using a different Card or Payment Option\");\n var totalPrice13 = $('.order-total.order-full-total td')[1];\n var $gtmprice53;\n if (totalPrice13) {\n $gtmprice53 = totalPrice13.textContent;\n } else {\n $gtmprice53 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice53\n }\n });\n }\n }\n }\n }\n }\n },\n error: function () {\n progress.hide();\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while calling paysafe 3ds auth endpoint');\n }\n });\n } else {\n progress.hide();\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while calling start method and unable to generate devicefp id');\n }\n });\n } catch (e) {\n progress.hide();\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('Initial Catch of 3ds2 ' + e);\n }\n //Paysafe 3DS2 implementation ends here\n }\n else {\n continueToPlaceOrder();\n }\n function continueToPlaceOrder() {\n var data = $form.serialize();\n\n if (isTJCPlusContext) {\n var url = Urls.tjcpluscheckout;\n } else {\n var url = Urls.activateQuickbuy;\n }\n\n $('.activate-quickbuy').css('pointer-events', 'none');\n $('.activate-quickbuy').css('cursor', 'default');\n $('.activate-quickbuy').css('opacity', '0.5');\n\n\n var clickOnChangeButton = false;\n if ($(this).hasClass('change-quickbuy')) {\n clickOnChangeButton = true;\n }\n\n $.ajax({\n url: url + \"?samebillingaddress=\" + samebillingaddress + \"&includeorder=\" + includeorder + \"&existingCards=\" + existingCards + \"&deliveryoption=\" + deliveryoption,\n data: data,\n dataType: 'json',\n type: 'POST',\n beforeSend: function () { progress.show('#qb-activation-page'); },\n success: function (response) {\n progress.hide();\n if (!response.success && response.data) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(response.data);\n if (response.errorCode) {\n $(\".quantity-error\").html(response.message).addClass('active');\n $('.testingTJCPLUS #dwfrm_quickbuyaddress').scrollTop(0);\n\n if (response.errorCode == \"5\") {\n $('.activate-tjcplus-membership').prop(\"disabled\", true);\n }\n }\n }\n else if (response.success) {\n if ((response.data != \"\") && response.data == \"ordersuccessfull\") {\n $('.showActivateQBModel').hide();\n $('.showActivateQBModel + .ui-widget-overlay').hide();\n $(\"#QBactivateconfirm\").dialog({\n dialogClass: 'QBactivateconfirm',\n resizable: true,\n open: function (event, ui) {\n if ($('#QBactivateconfirm').hasClass('d-none')) {\n $('#QBactivateconfirm').removeClass('d-none');\n $('#quickBuyActivateConfirmation').removeClass('d-none');\n $('#activation-success').addClass('d-none');\n $('body').css('overflow', 'hidden');\n $('#qborder-number').html(response.Orderno);\n }\n $('#QBactivateconfirm').css('min-height', 'unset');\n $(\"#qbConfirm-close\").on('click', function () {\n if (window.dialog) {\n window.dialog.close();\n }\n });\n if (response.gtmPurchase) {\n var gtmPurchase = JSON.stringify(response.gtmPurchase),\n gtmProducts = JSON.stringify(response.gtmProducts);\n $(\"#quickBuyConfirmation #gtmDataHolder\").attr('data-gtmPurchase', gtmPurchase);\n $(\"#quickBuyConfirmation #gtmDataHolder\").attr('data-gtmProducts', gtmProducts);\n /*window.dataLayer.push({\n 'event':'purchase',\n 'ecommerce': {\n 'purchase': {\n 'actionField': JSON.parse(gtmPurchase),\n 'products': JSON.parse(gtmProducts)\n }\n }\n });*/\n orderconfirmation.init();\n dataLayer.push({ 'event': 'QBOrderConfirmation' });\n }\n if (response.nbpurchase) {\n var nbpurchase = JSON.stringify(response.nbpurchase),\n nbtransactionproducts = JSON.stringify(response.nbtransactionproducts),\n nbordercategory = JSON.stringify(response.nbordercategory);\n $(\"#quickBuyConfirmation #nbDataHolder\").attr('data-nbpurchase', nbpurchase);\n $(\"#quickBuyConfirmation #nbDataHolder\").attr('data-nbtransactionproducts', nbtransactionproducts);\n $(\"#quickBuyConfirmation #nbDataHolder\").attr('data-nbordercategory', nbordercategory);\n /*window.dataLayer.push({\n 'event':'purchase',\n 'ecommerce': {\n 'purchase': {\n 'actionField': JSON.parse(gtmPurchase),\n 'products': JSON.parse(gtmProducts)\n }\n }\n });*/\n orderconfirmation.init();\n }\n },\n close: function () {\n $('.ui-tooltip').each(function (index) {\n $(this).remove();\n });\n\n var url = Urls.restoreqbbasketfromsession;\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n //do something\n }\n });\n $('body').css('overflow', 'x-hidden');\n url = window.location.href.split('#')[0];\n window.location.href = url.split('?')[0];\n },\n modal: true\n });\n }/* else if (clickOnChangeButton && (response.data != \"\") && (response.data == \"Quick Buy Activated\" || response.data == \"Saved\")){\n redirectLocation();\n }*/\n else {\n $(\"#QBactivateconfirm\").dialog({\n dialogClass: 'QBactivateconfirm',\n open: function (event, ui) {\n if ($('#QBactivateconfirm').hasClass('d-none')) {\n $('#QBactivateconfirm').removeClass('d-none');\n $('#activation-success').html(response.data);\n }\n //$('.ui-dialog-titlebar-close').hide();\n $('#QBactivateconfirm').css('min-height', 'unset');\n setTimeout(function () { \n if (window.dialog) {\n window.dialog.close();\n }\n redirectLocation();\n }, 2000);\n },\n modal: true\n });\n }\n\n $(\"#qbConfirm-close\").on('click', function () {\n if (window.dialog) {\n window.dialog.close();\n }\n });\n }\n else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Something didn't work. Please contact customer care on 0344 375 2525.\");\n }\n }\n $('.activate-quickbuy').css('pointer-events', 'auto');\n $('.activate-quickbuy').css('cursor', 'pointer');\n $('.activate-quickbuy').css('opacity', '1');\n //var parseRes = JSON.parse(response);\n //window.location.href = parseRes.redirectURL\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n },\n error: function () {\n progress.hide();\n }\n });\n }\n });\n}\n\nfunction redirectLocation() {\n var pageURL = window.location.href,\n pageContext = util.getParamFromUrl('pagecontext', pageURL);\n if (pageContext == '') {\n pageContext = $(\"input[name='pagecontext']\").val();\n }\n if (pageContext == 'storefront') {\n window.location.href = Urls.homePage;\n } else if (pageContext == 'livetv') {\n window.location.href = Urls.watchtvpage;\n } else if (pageContext == 'wishlist') {\n window.location.href = Urls.wishlist;\n } else if (pageContext == 'product') {\n var redirect = Urls.getProductUrl;\n var pid = util.getParamFromUrl('pid', pageURL);\n redirect = util.appendParamsToUrl(redirect, {\n 'pid': pid\n });\n window.location.href = redirect;\n } else {\n location.reload(true);\n }\n}\n\n/**\n * @private\n * @function\n * @description Binds the events of registration input tooltips\n */\nfunction initIconTooltips() {\n\n // only in the registration page!\n $('.registration .icon-tooltip > .field').bind('click', function (event) {\n var $this = $(this),\n offset = $this.offset(),\n width = $this.width(),\n start = (offset.left + width) - 29,\n maxWidth = $(document).width() <= 767 ? 'width: ' + $this.first().width() - 40 + 'px;' : '',\n aClass = 'a' + (Math.random() + 1).toString(36).substring(7),\n tooltips,\n tooltipText,\n $fieldset,\n $element,\n $closeIcon,\n arrowRight;\n\n if (event.pageX >= start) {\n event.preventDefault();\n\n tooltips = $this.children('.tooltip-msg');\n tooltipText = $this.children('input').data('tooltip-text');\n\n if (tooltips.length > 0) {\n tooltips.remove();\n } else {\n $this.append('<div class=\"tooltip-msg\" style=\"' + maxWidth + '\">' +\n tooltipText +\n '<span class=\"close-icon fa fa-times\"></span></div>');\n\n $element = $('.tooltip-msg');\n $fieldset = $this.closest('fieldset');\n\n $element.css('top', ($this.outerHeight() / 2) - ($element.outerHeight() / 2));\n $element.css('right', -($element.outerWidth() + 14));\n $element.addClass(aClass);\n\n arrowRight = ($element.outerWidth() - 10);\n\n if (($fieldset.position().left + $fieldset.outerWidth() - 10) <\n ($element.position().left + $element.outerWidth())) {\n $element.css('position', 'relative');\n $element.css('right', 0);\n $element.css('white-space', 'normal');\n $element.css('padding-right', 20);\n $element.addClass('tooltip-msg-mobile');\n\n $closeIcon = $element.find('.close-icon');\n $closeIcon.css('position', 'absolute');\n $closeIcon.css('top', 4);\n $closeIcon.css('right', -($element.outerWidth() - 25));\n\n arrowRight = (($element.outerWidth() / 2) - 5);\n }\n\n $('<style>.' + aClass + ':before {right: ' +\n arrowRight + 'px !important;}</style>').appendTo('head');\n }\n }\n });\n\n $('.registration .icon-tooltip > .field').bind('mousemove', function (event) {\n var $this = $(this),\n offset = $this.offset(),\n start = (offset.left + $this.width()) - 29;\n\n if (event.pageX >= start && event.pageX <= start + 25) {\n $this.addClass('tooltip-hover');\n } else {\n $this.removeClass('tooltip-hover');\n }\n });\n\n $('.registration .icon-tooltip > .field').bind('mouseout', function () {\n $(this).removeClass('tooltip-hover');\n });\n}\n\nfunction initYotpoReview() {\n $('.js-submit-yotpo-review').on('click', function (e) {\n e.preventDefault();\n\n var $customerGiveRatingSection = $(this).parents('.js-review-container').siblings('.js-customer-give-rating-section');\n var starRating = $customerGiveRatingSection.find('.rating.star.active').length;\n var $reviewSubjectInput = $(this).parents('.js-review-container').find('.js-yotpo-review-subject');\n var $reviewCommentInput = $(this).parents('.js-review-container').find('.js-yotpo-review-content');\n var productID = $(this).data('product-id');\n var orderID = $(this).data('order-id');\n\n if ($reviewSubjectInput.val() === '') {\n $reviewSubjectInput.parent('.form-group').addClass('validation-error');\n $reviewSubjectInput.siblings('.error').addClass('d-block').text(Resources.GLOBAL_REQUIRED_FIELD);\n return;\n } else {\n $reviewSubjectInput.parent('.form-group').removeClass('validation-error');\n $reviewSubjectInput.siblings('.error').removeClass('d-block');\n }\n\n if ($reviewCommentInput.val() === '') {\n $reviewCommentInput.parent('.form-group').addClass('validation-error');\n $reviewCommentInput.siblings('.error').addClass('d-block').text(Resources.GLOBAL_REQUIRED_FIELD);\n return;\n } else {\n $reviewCommentInput.parent('.form-group').removeClass('validation-error');\n $reviewCommentInput.siblings('.error').removeClass('d-block');\n }\n\n $.ajax({\n url: Urls.yotpoReviewSubmit,\n data: {\n orderID: orderID,\n productID: productID,\n reviewSubject: $reviewSubjectInput.val(),\n reviewComment: $reviewCommentInput.val(),\n starRating: starRating\n },\n type: 'POST',\n success: function () {\n $customerGiveRatingSection.find('.rating-section-title').text(Resources.YOTPO_SUBMITTED_REVIEW);\n $customerGiveRatingSection.find('.customer-give-rating').addClass('older');\n $customerGiveRatingSection.find('.js-close-button').addClass('d-none');\n $customerGiveRatingSection.siblings('.js-review-container').toggleClass('d-none visible');\n $customerGiveRatingSection.toggleClass('border-bottom-0');\n $customerGiveRatingSection.find('.customer-give-rating .rating').off('mouseenter.ratinghandler mouseleave.ratinghandler click.ratinghandler');\n },\n error: function () {\n //console.log(\"Error in Submiting Review\");\n }\n });\n });\n\n $('.js-close-button').on('click', function () {\n $(this).toggleClass('d-none');\n $(this).parents('.js-customer-give-rating-section').toggleClass('border-bottom-0');\n $(this).parents('.js-customer-give-rating-section').next('.js-review-container').toggleClass('d-none visible');\n $(this).parents('.js-customer-give-rating-section').find('.rating.star').toggleClass('star active star-regular');\n });\n\n $('.js-yotpo-review-subject').on('change', function () {\n validateInput($(this));\n });\n\n $('.js-yotpo-review-content').on('change', function () {\n validateInput($(this));\n });\n\n}\n\nfunction validateInput(inputElement) {\n var inputValue = inputElement.val();\n if (inputValue !== '') {\n inputElement.parent('.form-group').addClass('validation-success').removeClass('validation-error');\n inputElement.siblings('.error').addClass('d-none');\n } else {\n inputElement.parent('.form-group').removeClass('validation-success').addClass('validation-error');\n inputElement.siblings('.error').removeClass('d-none').text(Resources.GLOBAL_REQUIRED_FIELD);\n }\n}\n\nfunction initCertificatePopup() {\n $('.certificate-popup').each(function () {\n $(this).on('click', function (e) {\n e.preventDefault();\n progress.show();\n var dialog = $(\"#product-certificate-dialog\");\n var url = $(e.target).attr('href');\n dialog.dialog({\n modal: true,\n title: \"New\",\n dialogClass: \"authenticity-popup\",\n show: { delay: 3000 },\n open: function (event, ui) {\n $('#printSection').remove();\n $('body').addClass('certificate-popup-show');\n $('#product-certificate-content').load(url, function () { });\n setTimeout(function () {\n if (window.SitePreferences.SIRV_ENABLED) {\n var certificateImage = $('.only-for-pdf .product-image img');\n $(certificateImage).removeAttr('data-options');\n $(certificateImage).attr('src', $(certificateImage).data('src'));\n };\n // certificate PDF function\n $(\"#card\").off('click').on('click', function () {\n $('body').css('overflow-x', 'visible');\n $('.pt_productcertificate').css('overflow', 'visible');\n $('.only-for-pdf').css('display', 'block');\n $('.only-for-pdf').find('.certificate-column').css('max-height', '100%');\n html2canvas(document.getElementById(\"pdfgroup\"), { useCORS: true }).then(function (canvas) {\n var imgData = canvas.toDataURL('img/png');\n var doc = new jsPDF('p', 'mm', [300, 300]);\n doc.addImage(imgData, 'PNG', 20, 20, 0, 0);\n doc.save('certificate.pdf');\n printElement(document.getElementById(\"pdfgroup\"));\n $('#printSection').remove();\n });\n $('.only-for-pdf').css('display', 'none');\n $('body').css('overflow-x', 'hidden');\n $('.pt_productcertificate').css('overflow', 'hidden');\n });\n\n // certificate print function\n document.getElementById(\"btnPrint\").onclick = function () {\n printElement(document.getElementById(\"pdfgroup\"));\n window.print();\n }\n function printElement(elem, append, delimiter) {\n var domClone = elem.cloneNode(true);\n var $printSection = document.getElementById(\"printSection\");\n if (!$printSection) {\n var $printSection = document.createElement(\"div\");\n $printSection.id = \"printSection\";\n document.body.appendChild($printSection);\n }\n if (append !== true) {\n $printSection.innerHTML = \"\";\n }\n else if (append === true) {\n if (typeof (delimiter) === \"string\") {\n $printSection.innerHTML += delimiter;\n }\n else if (typeof (delimiter) === \"object\") {\n $printSection.appendChlid(delimiter);\n }\n }\n $printSection.appendChild(domClone);\n }\n }, 3000)\n },\n close: function (event, ui) {\n progress.hide();\n $('#product-certificate-content').empty();\n dialog.dialog('destroy');\n $('body').removeClass('certificate-popup-show');\n },\n // buttons: {\n // No: function () {\n // $(this).dialog(\"destroy\");\n // }\n // }\n });\n });\n });\n}\n\n\n/**\n * @private\n * @function\n * @description Binds the events of the order, address and payment pages\n */\nfunction initializeEvents() {\n // Product Subscription\n if (window.ProductSubscription && typeof window.ProductSubscription.initAccountEvents === 'function') {\n window.ProductSubscription.initAccountEvents();\n }\n initOrderHistory();\n initAddressEvents();\n initGoogleRecaptchaV3();\n initPaymentEvents();\n initCertificatePopup();\n initYotpoReview();\n initLoginPage();\n initSelectElements();\n initFacebookSkip();\n initContactUsEvents();\n if ($('.registration-alt').length > 0) {\n initIconTooltips();\n accountAddressSelect();\n }\n if ($('.quickbuy-preference-page').length > 0) {\n initIconTooltips();\n accountAddressSelect();\n\n }\n addressFields.init($('.address-form'));\n addressFields.init($('#RegistrationForm'));\n\n addressFields.init($('.country-postal'));\n\n tabs.init();\n resetPassword.init();\n\n // Omit HTML tags from name input fields\n $('.first-name').focusout(function () {\n $('#dwfrm_profile_customer_firstname').val($('#dwfrm_profile_customer_firstname').val().replaceAll(/<(“[^â€]*â€|'[^’]*’|[^'â€>])*>/ig, ''));\n });\n\n $('.last-name').focusout(function () {\n $('#dwfrm_profile_customer_lastname').val($('#dwfrm_profile_customer_lastname').val().replaceAll(/<(“[^â€]*â€|'[^’]*’|[^'â€>])*>/ig, ''));\n });\n\n\n $('.sameBillingCheckbox input[type=\"checkbox\"]').click(function () {\n if ($(this).prop(\"checked\") == true) {\n $(\".checkout-billing-address .saved-address\").addClass(\"hidden\");\n }\n else if ($(this).prop(\"checked\") == false) {\n $(\".checkout-billing-address .saved-address\").removeClass(\"hidden\");\n }\n });\n\n\n\n $('.add-new-address').click(function () {\n\n // Auto fucts when text box having a value\n setTimeout(function () {\n $(\".input-text\").each(function () {\n if ($(this).val().length >= 1) {\n $(this).siblings(\".label\").addClass('focus-active');\n $(this).closest('.form-row').addClass('validation-success');\n $('.postcodeinput input').focus();\n $('.postcodeinput input').blur();\n }\n\n })\n }, 500);\n\n\n if ($(this).closest('.address-boxes').find('.shippingform').length) {\n if ($('.shippingform').is(':visible')) {\n $('.shipping-address-selector #customerAddress').trigger('change');\n //$('.customerAddressBilling #customerAddress').trigger('change');\n }\n else {\n if ($(this).hasClass('shipping-new-address')) {\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid').val('');\n }\n\n if ($(this).hasClass('billing-new-address')) {\n $('#dwfrm_quickbuyaddress_billingAddress_addressid').val('');\n }\n }\n }\n\n if ($(this).closest('.address-boxes').find('.billingform').length) {\n if ($('.billingform').is(':visible')) {\n $('.customerAddressBilling #customerAddress').trigger('change');\n }\n else {\n if ($(this).hasClass('shipping-new-address')) {\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid').val('');\n }\n\n if ($(this).hasClass('billing-new-address')) {\n $('#dwfrm_quickbuyaddress_billingAddress_addressid').val('');\n }\n }\n }\n\n //Remove disabled attribute if there is a value in postCode\n if ($(\"#dwfrm_quickbuyaddress_shippingAddress_address_postCode\").val() != \"\") { $(\".address-check-btn button\").removeAttr(\"disabled\"); }\n\n var $addbillingaddress = $(this).closest('.address-boxes').find('.add-billing-address');\n if ($addbillingaddress.hasClass(\"hidden\"))\n $addbillingaddress.removeClass(\"hidden\");\n else\n $addbillingaddress.addClass(\"hidden\");\n });\n\n $('body').on('change', '#dwfrm_quickbuyaddress_deliveryoption', function (e) {\n if ($('#includeOrderBasket').length > 0) {\n var shippingMethodID = $(this).val();\n var url = Urls.updateqbshippingmethod;\n url = util.appendParamToURL(url, 'shippingMethodID', shippingMethodID);\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n $('#includeOrderBasket').html(response);\n require(45)();\n qbfornonlivetv.addWarrantyQB();\n /*Hide warranty details in QB popup in home page and live Tv page*/\n if (pageContext.ns == 'storefront' || pageContext.ns == 'livetv') {\n $('.showActivateQBModel .qbwarrantydetails').hide()\n }\n }\n });\n }\n });\n\n $(\"select#existing-paysafe-card\").change(function () {\n var selectedCountry = JSON.parse($(this).children(\"option:selected\").val());\n var selectedExpiryMonth = selectedCountry.cardExpiry.month;\n var selectedExpiryYear = selectedCountry.cardExpiry.year;\n var expiry = \"Expiry: \" + selectedExpiryMonth + \"/\" + selectedExpiryYear;\n $('#cardExpiry').val(expiry);\n });\n\n $('.change-method').on('click', function () {\n if ($(this).attr(\"class\") == 'change-method') {\n var selectDialog = $('.dialog-change-service');\n }\n\n if ($(this).attr(\"class\") == 'end-membership-method') {\n var selectDialog = $('.dialog-end-service');\n }\n\n selectDialog.dialog({\n modal: true,\n dialogClass: \"tjc-customer-support\",\n open: function (event, ui) {\n $('.ui-widget-overlay').on('click', function () {\n $('.tjc-customer-support').find('.ui-dialog-content').dialog('close');\n });\n },\n buttons: [\n {\n text: \"OK\",\n click: function () {\n $(this).dialog(\"close\");\n }\n }\n ]\n });\n });\n\n $('.manage-membership-button').on('click', function () {\n $('.membership-change').show();\n });\n\n $(window).on('click scroll', function (event) {\n if (!$(event.target).closest('.manage-membership-button, .membership-change').length) {\n $('.membership-change').hide();\n }\n });\n\n $('.subscriptions-button.add-to-cart').on('click', function (e) {\n e.preventDefault();\n var redirectURL = $(this).attr('href');\n var pid = $(this).data('pid');\n $.ajax({\n url: Urls.tjcplusbasketdetails,\n type: 'GET',\n success: function (response) {\n var responseJson = JSON.parse(response);\n if (responseJson.containsTJCPlusProduct) {\n if (responseJson.subscriptionDuration == \"1\") {\n var existingProductDialog = $('.existing-product.monthly');\n }\n if (responseJson.subscriptionDuration == '12') {\n var existingProductDialog = $('.existing-product.yearly');\n }\n existingProductDialog.dialog({\n modal: true,\n dialogClass: \"existing-tjcplus-product\",\n buttons: [\n {\n text: \"Go to cart\",\n click: function () {\n window.location.href = Urls.cartShow;\n }\n },\n {\n text: \"OK\",\n click: function () {\n $(this).dialog(\"close\");\n }\n }\n ]\n });\n }\n else {\n window.location.href = redirectURL;\n }\n }\n });\n });\n\n $('.account-tab-heading').on('click', function () {\n $('.account-tab-heading').removeClass('active');\n $(this).addClass('active');\n $('[data-content]').removeClass('active');\n $('[data-content=' + $(this).data('tab') + ']').addClass('active');\n });\n}\n\naccount = {\n init: function () {\n initializeEvents();\n giftcert.init();\n quickbuy.init();\n qbfornonlivetv.init();\n newsignin.init();\n tjcplusactivation.init();\n },\n initCartLogin: function () {\n initLoginPage();\n },\n initSelectElements: function () {\n initSelectElements();\n }\n};\n\nmodule.exports = account;\n", "'use strict';\n\nvar addressFields = require(2),\n account = require(17),\n\temailVerification = require(8),\n tabs = require(42),\n ajax = require(3),\n util = require(46),\n progress = require(35);\n\nvar address;\nvar giftReceiptSelected = false;\nvar debounce;\n\nfunction addShowAddressFieldsEvent($radioGroup) {\n $radioGroup.on('change', function () {\n var toggleFlag = $radioGroup.filter(':checked').hasClass('alternative-address');\n $radioGroup.parents('fieldset').find('.alternative-address-fields').toggleClass('visually-hidden', !toggleFlag);\n });\n}\n\nfunction initializeEvents() {\n\tvar $checkoutAddressesForm = $('.checkout-addresses-form'),\n\t\t$isOPCPage = $checkoutAddressesForm.find('input[name$=isOPCPage]'),\n\t\t$submitButton = $checkoutAddressesForm.find('.submit-button'),\n\t\t$addAddressButton_MyAccount = $('.address-form .billingform .form-row-button .field').find('.apply-button'),\n\t\t$billingAddressRadioGroup = $checkoutAddressesForm.find('input:radio[name=billing-address]'),\n\t\t$customerAddressField = $checkoutAddressesForm.find('.custAddress .customer-address').text(),\n\t\t$shippingAddressRadioGroup = $checkoutAddressesForm.find('input:radio[name=shipping-address]');\n\n\t\tif(!$customerAddressField){\n\t\t\t$submitButton.prop('disabled' , true);\n\t\t}else{\n\t\t\t$submitButton.prop('disabled' , false);\n\t\t}\n\t\t$addAddressButton_MyAccount.prop('disabled' , true);\n\t\t\n\taddShowAddressFieldsEvent($billingAddressRadioGroup);\n\taddShowAddressFieldsEvent($shippingAddressRadioGroup);\n\taddressFields.init($checkoutAddressesForm);\n\n\tif ($isOPCPage.length > 0 && $isOPCPage.val() != \"true\") {\n\t\t$checkoutAddressesForm.on('submit', function (e) {\n\t\t\tvar $selectedBillingOption = $billingAddressRadioGroup.filter(':checked'),\n\t\t\t\t$billingAddressFields = $billingAddressRadioGroup.parents('fieldset').find('.alternative-address-fields'),\n\t\t\t\t$additionalBillingAddressFields = $billingAddressFields.find('.additional-address-fields'),\n\t\t\t\t$selectedShippingOption = $shippingAddressRadioGroup.filter(':checked'),\n\t\t\t\t$shippingAddressFields = $shippingAddressRadioGroup.parents('fieldset').find('.alternative-address-fields'),\n\t\t\t\t$additionalShippingAddressFields = $shippingAddressFields.find('.additional-address-fields'),\n\t\t\t\tisValid = $checkoutAddressesForm.valid(),\n\t\t\t\t$billingAddToAddressBookCheckBox = $billingAddressFields.find('input[name$=addToAddressBook]'),\n\t\t\t\t$shippingAddToAddressBookCheckBox = $shippingAddressFields.find('input[name$=addToAddressBook]'),\n\t\t\t\t$billingFindButton = $billingAddressFields.find('.post-code-field button'),\n\t\t\t\t$shippingFindButton = $shippingAddressFields.find('.post-code-field button'),\n\t\t\t\t$billingPostCodeInput = $billingAddressFields.find('.post-code-field input'),\n\t\t\t\t$shippingPostCodeInput = $shippingAddressFields.find('.post-code-field input'),\n\t\t\t\tselectedBillingOptionData = $selectedBillingOption.data('address'),\n\t\t\t\tselectedShippingOptionData = $selectedShippingOption.data('address');\n\n\t\t\tif (!$selectedBillingOption.hasClass('alternative-address')) {\n\t\t\t\t$billingAddressFields.find('input[name$=addressid]').val(selectedBillingOptionData.ID);\n\t\t\t\t$billingAddressFields.find('select[name$=country]')\n\t\t\t\t\t.val(selectedBillingOptionData.countryCode).click();\n\t\t\t\t$billingPostCodeInput.val(selectedBillingOptionData.postCode);\n\t\t\t\taddressFields.fillAddressFields($additionalBillingAddressFields, selectedBillingOptionData);\n\t\t\t\tif ($billingAddToAddressBookCheckBox.prop('checked')) {\n\t\t\t\t\t$billingAddToAddressBookCheckBox.click();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$billingAddressFields.find('input[name$=addressid]').val('dwfrm_alternative-address');\n\t\t\t}\n\t\t\tif ($selectedShippingOption.hasClass('use-billing-address')) {\n\t\t\t\t$shippingAddressFields.find('input[name$=addressid]').val('dwfrm_use-billing-address');\n\t\t\t\t$shippingAddressFields.find('select[name$=country]')\n\t\t\t\t\t.val($billingAddressFields.find('select[name$=country]').val()).click();\n\t\t\t\t$shippingPostCodeInput.val($billingAddressFields.find('.post-code-field input').val());\n\t\t\t\t/*jslint unparam: true */\n\t\t\t\t$.each(['address1', 'address2', 'address3', 'address4', 'locality', 'city', 'postCode'], function (i, attribute) {\n\t\t\t\t\tvar value = $additionalBillingAddressFields.find('input[name$=' + attribute + ']').val();\n\t\t\t\t\t$additionalShippingAddressFields.find('input[name$=' + attribute + ']').val(value);\n\t\t\t\t});\n\t\t\t\t/*jslint unparam: false */\n\t\t\t\tif ($shippingAddToAddressBookCheckBox.prop('checked')) {\n\t\t\t\t\t$shippingAddToAddressBookCheckBox.click();\n\t\t\t\t}\n\t\t\t} else if (!$selectedShippingOption.hasClass('alternative-address')) {\n\t\t\t\t$shippingAddressFields.find('input[name$=addressid]').val(selectedShippingOptionData.ID);\n\t\t\t\t$shippingAddressFields.find('select[name$=country]')\n\t\t\t\t\t.val(selectedShippingOptionData.countryCode).click();\n\t\t\t\t$shippingPostCodeInput.val(selectedShippingOptionData.postCode);\n\t\t\t\taddressFields.fillAddressFields($additionalShippingAddressFields, selectedShippingOptionData);\n\t\t\t\tif ($shippingAddToAddressBookCheckBox.prop('checked')) {\n\t\t\t\t\t$shippingAddToAddressBookCheckBox.click();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$shippingAddressFields.find('input[name$=addressid]').val('dwfrm_alternative-address');\n\t\t\t}\n\n\t\t\tif (isValid !== $checkoutAddressesForm.valid()) {\n\t\t\t\te.preventDefault();\n\t\t\t\t$checkoutAddressesForm\n\t\t\t\t\t.append($('<input/>', { type: 'hidden', name: $submitButton.attr('name'), value: 'save' }))\n\t\t\t\t\t.submit();\n\t\t\t}\n\n\t\t\tif (!$billingAddressFields.hasClass('visually-hidden') && $billingFindButton.is(':visible') &&\n\t\t\t\t$billingPostCodeInput.val() !== '' && !$billingFindButton.data('searchstarted')) {\n\t\t\t\t$billingFindButton.click();\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\tif (!$shippingAddressFields.hasClass('visually-hidden') && $shippingFindButton.is(':visible') &&\n\t\t\t\t$shippingPostCodeInput.val() !== '' && !$shippingFindButton.data('searchstarted')) {\n\t\t\t\t$shippingFindButton.click();\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t});\n\t}\n\n\t$('select.country').on('click', function () {\n\t\tif ($(\"#isWarrantyOnCart\").length > 0 && $(\"#isWarrantyOnCart\").val() == \"true\") {\n\t\t\tif ($(this).closest('.xlt-addressForm').hasClass('checkout-shipping-address') && $('.checkout-shipping-address .warrantyAddressMessage').length == 0) {\n\t\t\t\t$('.checkout-shipping-address select.country').parents('.form-row').after('<span class=\"warrantyAddressMessage\" style=\"display: block;font-weight: bold;font-size: 13px;color: #E30613;text-align: justify;line-height: 14px;\">Warranty is only for UK customers. Please remove warranty from your order, for EU delivery.</span>');\n\t\t\t} else if ($(this).closest('.xlt-addressForm').hasClass('checkout-billing-address') && $('.checkout-billing-address .warrantyAddressMessage').length == 0) {\n\t\t\t\t$('.checkout-billing-address select.country').parents('.form-row').after('<span class=\"warrantyAddressMessage\" style=\"display: block;font-weight: bold;font-size: 13px;color: #E30613;text-align: justify;line-height: 14px;\">Warranty is only for UK customers. Please remove warranty from your order, for EU delivery.</span>');\n\t\t\t}\n\t\t}\n\t});\n\n\t/*\n ---- Data8 email verification\n */\n\t$('.email-fileds .first-email, .detail-email .first-email').on('focusout', function () {\n\t\tvar $this = $(this);\n var $emailID = $this.val().trim();\n\t\tif($emailID){\n\t\t\temailVerification.verifyEmail(\n\t\t\t\t'.email-fileds',\n\t\t\t\t$emailID,\n\t\t\t\tnull,\n\t\t\t\tpageContext.ns,\n\t\t\t\tnull\n\t\t\t);\n\t\t}\n\t});\n\t\n\t$('.email-fileds .first-email, .detail-email .first-email').on('focusin', function () {\n emailVerification.removeErrorMessage();\n });\n\n\t$('.reduced-register-container #onbeforeunload-button, .guestDetails .xlt-continueShopping, .delivery-address .xlt-continueShopping').off('click').on('click', function (e) {\n\t\tif ($('.email-fileds').hasClass('invalid-email')) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t});\n\t/*End Loqate Email Validation*/\n\n\t$('.post-code-field .postcode-data8').on('keyup', function () {\n\n\t\tvar $thisForm = $(this).closest('.xlt-addressForm');\n\t\tvar $inputValue = $('.post-code-field .postcode-data8').val();\n\t\tif($inputValue && ($thisForm.find('.additional-address-fields').hasClass('visually-hidden'))){\n\t\t\t$addAddressButton_MyAccount.prop('disabled' , true);\n\t\t}else{\n\t\t\t$addAddressButton_MyAccount.prop('disabled' , false);\n\t\t}\n\t\tif ($(this).val().length >= 3) {\n\t\t\tfetchAddress($(this));\n\t\t\tif ($('.opcAddressListModelPopup').length > 0 && $thisForm.find('.additional-address-fields').hasClass('visually-hidden')) {\n\t\t\t\t$thisForm.addClass('not-scroll');\n\t\t\t}\n\t\t} else {\n\t\t\t$(this).siblings('.data8-autocomplete-list').empty();\n\t\t\tif ($('.opcAddressListModelPopup').length > 0) {\n\t\t\t\t$thisForm.removeClass('not-scroll');\n\t\t\t}\n\t\t}\n\n\t\tif ($(this).val().length > 0) {\n\t\t\tif ($(this).siblings('.postal-clear').length == 0) {\n\t\t\t\t$(this).closest('.field').append('<span class=\"postal-clear\">CLEAR</span>');\n\t\t\t}\n\t\t\t$('.postal-clear').on('click', function () {\n\t\t\t\t$(this).closest('.field').find('input').val('').focus();\n\t\t\t\t$(this).closest('.field').find('ul.data8-autocomplete-list').empty();\n\t\t\t\t$(this).remove();\n\t\t\t});\n\t\t} else {\n\t\t\t$(this).closest('.field').find('.postal-clear').remove();\n\t\t}\n\t});\n\n\t$(document).on('click', '.js-address-autocomplete-item', function (event) {\n\t\tevent.stopImmediatePropagation();\n\t\tvar hasSubAddresses = $(this).attr('data-has-sub-addresses') === 'true';\n\n\t\tif (hasSubAddresses) {\n\t\t\tdrillDownAddresses($(this));\n\t\t} else {\n\t\t\tretrieveAddress($(this));\n\t\t}\n\t});\n\n}\n\nvar $submitButton = $('.checkout-addresses-form').find('.submit-button'),\n $addAddressButton_MyAccount = $('.address-form .billingform .form-row-button .field').find('.apply-button');\n$('.type-address-btn .field .button').on('click' , function(){\n\t$submitButton.prop('disabled' , false);\n})\n$('.showmore').on('click' , function(){\n $submitButton.prop('disabled' , true);\n $addAddressButton_MyAccount.prop('disabled' , false); // to enable 'Add Address' button when user clicks 'Type My Address' button (My account section -> Address Book -> Add address).\n})\n\n// changing the input-field color to red when the user enter wrong address (Checkout)\n$('.post-code-field-opc').off('focusout').on('focusout' , function(){\n\tvar $addressList = $('.post-code-field-opc').find('.data8-autocomplete-list').text();\n\tif(!($addressList) && $addressList == \"\"){\n\t\tvar $formData = $(this).closest('form'),\n\t\tisValid = $formData.valid();\n\t\tif($formData.find('.selected-address-summary').hasClass('visually-hidden')){\n\t\t\t$formData.find('.post-code-field-opc .form-row').removeClass('validation-success')\n\t\t\t$formData.find('.post-code-field-opc .form-row').addClass('validation-error')\n\t\t\t$formData.find('.post-code-field-opc .form-row .field').append('<div class=\"error-msg\">Please select valid address</div>');\n\t\t}\n\t\t\n\t\tif(isValid == \"false\" || isValid == false){\n\t\t\treturn false;\n\t\t}\n\t}\n})\n\n// changing the input-field color to red when the user enter wrong address (My account section -> Address Book -> Add address)\n$('.post-code-field').off('focusout').on('focusout' , function(){\n\tvar $addressList = $('.post-code-field').find('.data8-autocomplete-list').text();\n\tif(!($addressList) && $addressList == \"\"){\n\t\tvar isValid;\n\t\tvar $formData = $(this).closest('form');\n\t\t\n\t\t// Find all input fields except those in the modal container\n\t\tvar isSweepStakesPage = $formData.parents('.sweepstakes-entry');\n\t\tif (isSweepStakesPage.length > 0) {\n\t\t\tvar $visibleFields = $formData.find('input, select').not('.modal-container input, .modal-container select');\n\t\t\tisValid = $visibleFields.valid();\n\t\t} else {\n\t\t\tisValid = $formData.valid();\n\t\t}\n\n\t\tif($formData.find('.selected-address-summary').hasClass('visually-hidden')){\n\t\t\t$formData.find('.post-code-field .form-row').removeClass('validation-success');\n\t\t\t$formData.find('.post-code-field .form-row').addClass('validation-error');\n\t\t\t$formData.find('.post-code-field .form-row').find('.error-msg').remove();\n\t\t\t$formData.find('.post-code-field .form-row .field').append('<div class=\"error-msg\">Please select valid address</div>');\n\t\t}\n\t\t\n\t\tif(isValid == \"false\" || isValid == false){\n\t\t\treturn false;\n\t\t}\n\t}\n})\n\nfunction accountAddressSelect() {\n var $buttonBillingAddress = $('.checkout-billing-address .address-check-btn > button'),\n $buttonShippingAddress = $('.checkout-shipping-address .address-check-btn > button'),\n $buttonBillingAddressZipInput = $buttonBillingAddress.parent().siblings('.field').children('input'),\n $buttonShippingAddressZipInput = $buttonShippingAddress.parent().siblings('.field').children('input'),\n $addressSelect = $('.addresses-select'),\n $addressSelectRow = $addressSelect.children().first(),\n $typeAddressButton = $addressSelect.children().last().find('button'),\n $additionaFields = $('.additional-address-fields'),\n $isOPCPage = $('.checkout-addresses-form').find('input[name$=isOPCPage]');\n\n if ($buttonBillingAddressZipInput.val() === '') {\n $buttonBillingAddress.prop('disabled', true);\n }\n if ($buttonShippingAddressZipInput.val() === '') {\n $buttonShippingAddress.prop('disabled', true);\n }\n\n $buttonBillingAddressZipInput.on('change keydown keyup', function () {\n if ($buttonBillingAddressZipInput.val() === '') {\n $buttonBillingAddress.prop('disabled', true);\n } else {\n $buttonBillingAddress.prop('disabled', false);\n }\n });\n\n $('body').on('change keydown keyup', $buttonShippingAddressZipInput, function () {\n if ($buttonShippingAddressZipInput.val() === '') {\n $buttonShippingAddress.prop('disabled', true);\n } else {\n $buttonShippingAddress.prop('disabled', false);\n }\n });\n\n $buttonBillingAddressZipInput.on('click', function () {\n $addressSelect.removeClass('visually-hidden');\n if ($('.checkout-billing-address .addresses-select .button-container.type-address-btn button').length < 1) {\n $typeAddressButton.appendTo('.type-address-btn');\n }\n });\n $buttonShippingAddressZipInput.on('click', function () {\n $addressSelect.removeClass('visually-hidden');\n if ($('.checkout-shipping-address .addresses-select .button-container.type-address-btn button').length < 1) {\n $typeAddressButton.appendTo('.type-address-btn');\n }\n if ($('.checkout-shipping-address .addresses-select .button-container button').length > 0) {\n $('.checkout-shipping-address .addresses-select .form-row-button.type-address-btn').css({ 'display': 'none' });\n }\n });\n\n $typeAddressButton.on('click', function () {\n //$addressSelect.addClass('visually-hidden');\n if (!$('#wrapper').hasClass('pt_checkout')) {\n $additionaFields.removeClass('visually-hidden');\n }\n });\n\n $addressSelectRow.addClass('form-row-with-button');\n $addressSelectRow.append('<div class=\"button-container type-address-btn\"></div>');\n\n //Gift Receipt Functionality\n $(\"div[id$='_shippingAddress_isGift']\").on('click', function () {\n if ($(\"div[id$='_shippingAddress_isGift'] span\").hasClass('checked')) {\n if ($isOPCPage.val() != \"true\") {\n $('.gift-recipient-name').show();\n $('.gift-message-text').show();\n }\n $('.gift-content').show();\n $('.gift-content .gift-recipient-name').removeClass('validation-error');\n $('.gift-recipient-name').find('input').addClass('required');\n $(\"div[id$='_shippingAddress_addToAddressBook']\").closest('.form-row-checkbox').hide();\n if ($(\"div[id$='_shippingAddress_addToAddressBook'] span\").hasClass('checked')) {\n giftReceiptSelected = true;\n $(\"div[id$='_shippingAddress_addToAddressBook'] span\").removeClass('checked');\n $(\"div[id$='_shippingAddress_addToAddressBook'] input\").val(false);\n }\n } else {\n if ($isOPCPage.val() != \"true\") {\n $('.gift-recipient-name').hide();\n $('.gift-message-text').hide();\n }\n $('.gift-content').hide();\n $('.gift-content .gift-recipient-name').removeClass('validation-error');\n $('.gift-recipient-name').find('input').removeClass('required');\n $(\"div[id$='_shippingAddress_addToAddressBook']\").closest('.form-row-checkbox').show();\n if (giftReceiptSelected) {\n $(\"div[id$='_shippingAddress_addToAddressBook'] span\").addClass('checked')\n }\n $(\"div[id$='_shippingAddress_addToAddressBook'] input\").val(true);\n }\n });\n\n updateGiftReceiptForOrder();\n\n}\n\nfunction updateGiftReceiptForOrder() {\n var $isOPCPage = $('.checkout-addresses-form').find('input[name$=isOPCPage]');\n if ($(\"div[id$='_shippingAddress_isGift'] span\").hasClass('checked')) {\n if ($isOPCPage.val() != \"true\") {\n $('.gift-recipient-name').show();\n $('.gift-message-text').show();\n }\n $('.gift-content').show();\n $('.gift-recipient-name').find('input').addClass('required');\n $(\"div[id$='_shippingAddress_addToAddressBook']\").closest('.form-row-checkbox').hide();\n if ($(\"div[id$='_shippingAddress_addToAddressBook'] span\").hasClass('checked')) {\n giftReceiptSelected = true;\n $(\"div[id$='_shippingAddress_addToAddressBook'] span\").removeClass('checked');\n $(\"div[id$='_shippingAddress_addToAddressBook'] input\").val(false);\n }\n } else {\n if ($isOPCPage.val() != \"true\") {\n $('.gift-recipient-name').hide();\n $('.gift-message-text').hide();\n }\n $('.gift-content').hide();\n $('.gift-recipient-name').find('input').removeClass('required');\n $(\"div[id$='_shippingAddress_addToAddressBook']\").closest('.form-row-checkbox').show();\n if (giftReceiptSelected) {\n $(\"div[id$='_shippingAddress_addToAddressBook'] span\").addClass('checked');\n $(\"div[id$='_shippingAddress_addToAddressBook'] input\").val(true);\n }\n }\n}\n\nfunction handleSuccess($el, response) {\n\tvar $form = $el.closest('.xlt-addressForm');\n\tvar typeOwnAddressInput = $form.find('.type-own-address');\n\tvar allAddresses = response.serviceStatus ? response.dataObj : [];\n\n\tif (typeOwnAddressInput.length > 0) {\n\t\ttypeOwnAddressInput.remove();\n\t}\n\n\tvar $ulList = $el.siblings('.data8-autocomplete-list');\n\t$ulList.empty().prepend('<li class=\"firsttext\">' + Resources.DATA8_KEEP_TYPING + '</li>');\n\n\t$.each(allAddresses, function (index, address) {\n\t\tvar secondLine = \"\";\n\t\tvar subAddressesCount = address.Description && parseInt(address.Description);\n\t\tvar subAddressesCountText = ' Addresses';\n\n\t\tif (subAddressesCount && subAddressesCount > 1) {\n\t\t\tsecondLine = \"<span class='more-addresses'>\" + subAddressesCount + subAddressesCountText + \"</span>\";\n\t\t}\n\n\t\tvar $li = $('<li>').addClass(\"js-address-autocomplete-item\")\n\t\t\t.attr('data-8-id', address.Id)\n\t\t\t.attr('data-has-sub-addresses', address.Type && subAddressesCount && subAddressesCount > 1);\n\n\t\tvar $span = $('<span>').addClass('js-first-line-address first-line-address').text(address.Text);\n\n\t\t$li.append($span);\n\t\tif (subAddressesCount > 1) {\n\t\t\t$li.append(secondLine);\n\t\t}\n\t\t$ulList.append($li);\n\t});\n}\n\nfunction handleError($el, error) {\n\tvar $form = $el.closest('.xlt-addressForm');\n\tif ($form.find('.type-own-address').length === 0) {\n\t\t$('<div class=\"type-own-address\">' + Resources.DATA8_ADDRESS_NOT_FOUND + '</div>').insertBefore($additionalAddresses);\n\t}\n\tvar $additionalAddresses = $form.find('.additional-address-fields');\n\t$additionalAddresses.removeClass('visually-hidden');\n\t$(document).trigger('checkout:addressError');\n}\n\nfunction fetchAddress($el){\n\ttry {\n\t\tvar pageContextRetrieve = pageContext.ns;\n\t\tvar addressSuggestion = $el.val();\n\t\tvar country = $el.attr('data-country');\n\t\tif (debounce) {\n\t\t\tclearTimeout(debounce);\n\t\t}\n\t\tdebounce = setTimeout(function() {\n\t\t\t$.ajax({\n\t\t\t\turl: Urls.addressFinder,\n\t\t\t\ttype: 'POST',\n\t\t\t\tdata: {\n\t\t\t\t\tuserText: addressSuggestion,\n\t\t\t\t\tcountryCode: country,\n\t\t\t\t\tpageContext: pageContextRetrieve\n\t\t\t\t},\n\t\t\t\tsuccess: function (response) {\n\t\t\t\t\thandleSuccess($el, response);\n\t\t\t\t},\n\t\t\t\terror: function (error) {\n\t\t\t\t\thandleError($el, error);\n\t\t\t\t}\n\t\t\t});\n\t\t}, 500);\n\t\t\t\n\t} catch (b) {\n\t\tconsole.log(\"fetchAddress__\" + b);\n\t}\n}\n\nfunction displaySubAddresses(dataObj, $selectedItem, $ulList) {\n\tvar jsonObj = dataObj;\n\t$ulList.find('li.accurate-address').remove();\n\t$ulList.find('li.firsttext').remove();\n\n\tif ($selectedItem.parent().hasClass('active')) {\n\t\t$selectedItem.parent().removeClass('active');\n\t}\n\n\t$selectedItem.siblings().hide()\n\t$selectedItem.show();\n\t$selectedItem.find('span').hide();\n\n\t$ulList.find('.selected-postal').remove();\n\n\tvar $liSelectedPostal = $('<li>').addClass('selected-postal');\n\tvar $span = $('<span>').addClass('js-first-line-address first-line-address').text($selectedItem.find('.js-first-line-address').text());\n\n\t$liSelectedPostal.append($span);\n\t$ulList.prepend($liSelectedPostal);\n\n\t$ulList.find('li.selected-postal').on('click', function () {\n\t\tresetAutocomplete($ulList);\n\t});\n\n\tvar $innerUnorderedList = $('<ul>');\n\n\t$.each(jsonObj, function (index, address) {\n\t\tvar subAddressesCount = address.Description && parseInt(address.Description);\n\t\tvar $addressListItem = $('<li>');\n\t\tvar subAddressesCountText = ' Addresses';\n\n\t\t$addressListItem.addClass('js-address-autocomplete-item');\n\t\t$addressListItem.attr('data-8-id', address.Id)\n\t\t\t.attr('data-has-sub-addresses', address.Type && subAddressesCount && subAddressesCount > 1)\n\t\t\t.append($('<span>').addClass('js-first-line-address first-line-address').text(address.Text));\n\t\t\n\t\tif (subAddressesCount && subAddressesCount > 1) {\n\t\t\t$addressListItem.append($('<span>').addClass('second-line-address').text(subAddressesCount + subAddressesCountText));\n\t\t}\n\n\t\t$innerUnorderedList.append($addressListItem).addClass('active');\n\t});\n\t$selectedItem.append($innerUnorderedList);\n}\n\nfunction updateAddressFields(dataObj, $form) {\n\tvar jsonObj = dataObj[0];\n\n\tvar $addressSelect = $form.find('.addresses-select');\n\tvar line1 = jsonObj.Line1;\n\tvar line2 = jsonObj.Line2;\n\tvar line3 = jsonObj.Line3;\n\tvar line4 = jsonObj.Line4;\n\tvar city = jsonObj.City;\n\tvar postalCode = jsonObj.PostalCode;\n\n\t// Update form fields with verified address details\n\t$form.find('.postcode-data8').val('');\n\t$form.find('.postal-clear').remove();\n\t$form.find('.post-code-field label').removeClass('focus-active');\n\t$addressSelect.each(function() {\n\t\t$(this).find(\"[id$='summary_address_line1']\").text(line1);\n\t\t$(this).find(\"[id$='summary_address_line2']\").text(line2);\n\t\tline3 ? $(this).find(\"[id$='summary_address_line3']\").text(line3) : $(this).find(\"[id$='summary_address_line3']\").text('');\n\t\tline4 ? $(this).find(\"[id$='summary_address_line4']\").text(line4) : $(this).find(\"[id$='summary_address_line4']\").text('');\n\t\t$(this).find(\"[id$='summary_address_city']\").text(city);\n\t\t$(this).find(\"[id$='summary_address_postalcode']\").text(postalCode);\n\t\t$addressSelect.find('.new-label').addClass(\"focus-active\");\n\t});\n\n\t$submitButton.prop('disabled' , false); //enable 'continue to payment' button when the address is correct.\n\t$addAddressButton_MyAccount.prop('disabled' , false); //enable 'add address' button when the address is correct.\n\n\tvar $address1 = $form.find(\"input[id$='address_address1']\");\n\tif (line1) {\n\t\t$address1.val(line1);\n\t\t$address1.siblings('.label').addClass('focus-active');\n\t\t$address1.closest('.form-row').addClass('validation-success');\n\t} else {\n\t\t$address1.val('');\n\t}\n\tvar $address2 = $form.find(\"input[id$='address_address2']\");\n\tif (line2) {\n\t\t$address2.val(line2);\n\t\t$address2.siblings('.label').addClass('focus-active');\n\t\t$address2.closest('.form-row').addClass('validation-success');\n\t} else {\n\t\t$address2.val('');\n\t}\n\tvar $address3 = $form.find(\"input[id$='address_address3']\");\n\tif (line3) {\n\t\t$address3.val(line3);\n\t\t$address3.siblings('.label').addClass('focus-active');\n\t\t$address3.closest('.form-row').addClass('validation-success');\n\n\t} else {\n\t\t$address3.val('');\n\t}\n\tvar $address4 = $form.find(\"input[id$='address_address4']\");\n\tif (line4) {\n\t\t$address4.val(line4);\n\t\t$address4.siblings('.label').addClass('focus-active');\n\t\t$address4.closest('.form-row').addClass('validation-success');\n\t} else {\n\t\t$address4.val('');\n\t}\n\tvar $city = $form.find(\"input[id$='address_city']\");\n\tif (city) {\n\t\t$city.val(city);\n\t\t$city.siblings('.label').addClass('focus-active');\n\t\t$city.closest('.form-row').addClass('validation-success');\n\n\t} else {\n\t\t$city.val('');\n\t}\n\tvar $postalCode = $form.find(\"input[id$='address_postCode']\");\n\tif (postalCode) {\n\t\t$postalCode.val(postalCode);\n\t\t$postalCode.siblings('.label').addClass('focus-active');\n\t\t$postalCode.closest('.form-row').addClass('validation-success');\n\t} else {\n\t\t$postalCode.val('');\n\t}\n\t$form.find('#data8-autocomplete-list').empty();\n\t$form.find('.addresses-select').addClass('loqate-select');\n\t$form.find('.addresses-select-group h5').removeClass('visually-hidden');\n\t$form.find('.addresses-select-group .selected-address-summary').removeClass('visually-hidden');\n\t$addressSelect.removeClass('visually-hidden');\n\t$addressSelect.show(); \n\t$form.find('.addOPCdeliverylocation').prop( \"disabled\", false );\n\t$form.find('.editOPCdeliverylocation').prop( \"disabled\", false );\n\tif($('.opcAddressListModelPopup').length > 0) {\n\t\t$form.removeClass('not-scroll');\n\t}\n\t$form.find('.additional-address-fields').removeClass('visually-un-hidden');\n\t$form.find('.additional-address-fields').addClass('visually-hidden');\n\taddressFields.updateBillingAddress();\n\n\tvar $parent = $addressSelect.parent().siblings('.parent');\n\tvar $typeAddressBtn = $parent && $parent.find('.js-type-address-btn');\n\tif ($parent.length > 0 && $typeAddressBtn.length > 0) {\n\t\t$parent.find('.js-type-address-btn').addClass('d-none');\n\t\t$typeAddressBtn.removeClass('d-none');\n\t\ttabs.initTabs();\n\t}\n}\n\nfunction resetAutocomplete($ulList) {\n\t$ulList.find('ul.active').siblings().show();\n\t$ulList.find('ul.active').parent().siblings().show();\n\tif ($ulList.find('ul.active').parent().parent('ul').siblings('.js-first-line-address').length > 0) {\n\t\t$ulList.find('.selected-postal').find('.js-first-line-address').text($ulList.find('ul.active').parent().parent('ul').siblings('.js-first-line-address').text());\n\t} else {\n\t\t$ulList.find('.selected-postal').remove();\n\t}\n\tif ($ulList.find('ul.active').parent().parent('ul').length > 0) {\n\t\t$ulList.find('ul.active').parent().parent('ul').addClass('active');\n\t}\n\n\t$ulList.find('ul.active').last().remove();\n\t\n\t$ulList.find('li.firsttext').remove();\n\t$ulList.prepend('<li class=\"firsttext\">' + Resources.DATA8_KEEP_TYPING + '</li>');\n}\n\nfunction drillDownAddresses($selectedItem) {\n\tvar addressId = $selectedItem.data(\"8-id\");\n\tvar $ulList = $selectedItem.closest('.data8-autocomplete-list');\n\n\tvar countryCode = $ulList.siblings('.postcode-data8').attr('data-country');\n\n\ttry {\n\t\tvar pageContextDrillDown = pageContext.ns;\n\t\t$.ajax({\n\t\t\turl: Urls.accurateAddress,\n\t\t\ttype: 'POST',\n\t\t\tdata: {\n\t\t\t\taddressId: addressId,\n\t\t\t\tcountryCode: countryCode,\n\t\t\t\tpageContext: pageContextDrillDown\n\t\t\t},\n\t\t\tsuccess: function (response) {\n\t\t\t\tif (response.dataObj.length > 0) {\n\t\t\t\t\tdisplaySubAddresses(response.dataObj, $selectedItem, $ulList);\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function (error) {\n\t\t\t\tconsole.log(\"Accurate Address__\" + error);\n\t\t\t}\n\t\t});\n\n\t} catch (error) {\n\t\tconsole.error(\"Accurate Address__\" + error);\n\t}\n}\nfunction retrieveAddress($selectedItem) {\n\tretrieveAddressWithCallback($selectedItem, updateAddressFields)\n}\n\nfunction retrieveAddressWithCallback($selectedItem, successCallback) {\n\tvar $form = $selectedItem.closest('.xlt-addressForm');\n\tvar selectedAddressId = $selectedItem.data(\"8-id\");\n\n\tvar countryCode = $form.find('.postcode-data8').attr('data-country');\n\n\ttry {\n\t\tvar pageContextNs = pageContext.ns;\n\t\t$.ajax({\n\t\t\turl: Urls.addressVerify,\n\t\t\ttype: 'POST',\n\t\t\tdata: {\n\t\t\t\tselectedAddressId: selectedAddressId,\n\t\t\t\tcountryCode: countryCode,\n\t\t\t\tpageContext: pageContextNs\n\t\t\t},\n\t\t\tsuccess: function (response) {\n\t\t\t\tif (response.dataObj.length > 0) {\n\t\t\t\t\tsuccessCallback(response.dataObj, $form);\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function (error) {\n\t\t\t\tconsole.log(\"Verify Location\" + error);\n\t\t\t}\n\t\t});\n\t} catch (error) {\n\t\tconsole.error(\"Verify Location\" + error);\n\t}\n}\n\naddress = {\n\tinit: function () {\n\t\tinitializeEvents();\n\t\taccountAddressSelect();\n\t\taccount.initSelectElements();\n\t},\n\tdrillDownAddresses: drillDownAddresses,\n\tretrieveAddress: retrieveAddress,\n\tretrieveAddressWithCallback: retrieveAddressWithCallback,\n\tfetchAddress: fetchAddress\n};\n\nmodule.exports = address;\n", "'use strict';\n\nvar informMeWhenAvailable = require(11),\n nbDataLayer = require(15);\n\n\nvar $paymentMethodsWarning = $('.payment-methods-warning'),\n $paymentMethod = $('input[name=dwfrm_billing_paymentMethods_selectedPaymentMethodID]'),\n $lastSelectedPaymentMethod,\n $formSubmitOrder = $('.checkout-billing'),\n $buttonSubmitOrder = $('.paynow'),\n $descriptionContainers = $('.payment-method-description'),\n $description,\n $tjcCredit = $('.credit-input'),\n $tjcCreditAvailable = $('.credit-available'),\n $tjcCreditApplyButton = $('.credit-apply-button');\n\nfunction showPaymentMethodDescription(selectedPaymentMethod) {\n $description = $descriptionContainers.filter('.' + selectedPaymentMethod.val().toLowerCase());\n $description.addClass('active');\n\n if (selectedPaymentMethod.val().toLowerCase() === 'budgetpay') {\n $('.order-totals-budgetpay').show();\n $('.order-totals-budgetpay-heading').show();\n $('.order-totals-heading').hide();\n } else {\n $('.order-totals-budgetpay').hide();\n $('.order-totals-budgetpay-heading').hide();\n $('.order-totals-heading').show();\n }\n\n if ($description && $description.length > 0 && $.trim($description.html()).length > 0) {\n $description.show();\n $description = null;\n }\n $lastSelectedPaymentMethod = selectedPaymentMethod;\n}\n\nfunction isDecimal(number) {\n return new RegExp(/^[-+]?[0-9]+\\.[0-9]+$/).test(number) === true;\n}\n\nfunction initializeEvents() {\n $formSubmitOrder.on('submit', function () {\n if ($paymentMethod.filter(':checked').length === 1) {\n $buttonSubmitOrder.addClass('disabled');\n return true;\n } else if ($paymentMethod.filter(':checked').length > 1) {\n $paymentMethod = $paymentMethod.not('#dwfrm_billing_paymentMethods_selectedPaymentMethodID_TJCCredit');\n $buttonSubmitOrder.addClass('disabled');\n return true;\n }\n $paymentMethodsWarning.show();\n return false;\n });\n $paymentMethod.on('change', function () {\n $paymentMethodsWarning.hide();\n if ($lastSelectedPaymentMethod && $lastSelectedPaymentMethod.val() !== $(this).val()) {\n if ($descriptionContainers.filter('.active').length > 0) {\n $descriptionContainers.filter('.active').removeClass('active').hide(function () {\n showPaymentMethodDescription($(this));\n }.bind(this));\n } else {\n showPaymentMethodDescription($(this));\n }\n\n\n } else if (!$lastSelectedPaymentMethod) {\n showPaymentMethodDescription($(this));\n }\n });\n $tjcCredit.on('keyup', function () {\n if (isNaN($(this).val()) === false || isDecimal($(this).val()) === true) {\n $tjcCreditApplyButton.show();\n var subtotal = $tjcCredit.data('subtotal'),\n newCreditBalance = subtotal - $(this).val();\n if ($(this).val() < 0) {\n return;\n }\n if (newCreditBalance <= 0) {\n $tjcCreditAvailable.parent().hide();\n $(this).val(subtotal);\n $tjcCreditApplyButton.html($tjcCredit.data('paynowlabel'));\n } else {\n $tjcCreditAvailable.parent().show();\n $tjcCreditAvailable.html('£ ' + newCreditBalance.toFixed(2));\n $tjcCreditApplyButton.html($tjcCredit.data('applylabel'));\n }\n } else {\n $tjcCreditApplyButton.hide();\n }\n });\n\n informMeWhenAvailable.init();\n}\n\n// for each checkout step, we need to send gtm data\nfunction sendGTMCheckoutData() {\n try {\n // we store it in a placeholder div in gtm_checkout.isml\n if (window.gtmDatalayer && typeof window.gtmDatalayer.getGTMData === 'function') {\n var gtmJSON = window.gtmDataLayer.getGTMData();\n if(gtmJSON.ecommerce.checkout !== null && gtmJSON.ecommerce.checkout.actionField !== null && gtmJSON.ecommerce.checkout.actionField.step === 2){\n window.gtmDataLayer.pushCheckoutStepToDataLayer(gtmJSON);\n }\n }\n } catch (e) {\n // eslint-disable-next-line no-console\n //console.log(e);\n }\n}\n\nfunction sendNBCheckoutData() {\n try {\n // we store it in a placeholder div in gtm_checkout.isml\n var nbJSON = nbDataLayer.getNBData();\n nbDataLayer.pushCheckoutStepToNBDataLayer(nbJSON);\n } catch (e) {\n // eslint-disable-next-line no-console\n // console.log(e);\n }\n}\n\n/**\n * @function\n * @description loads Payment methods\n */\nexports.init = function () {\n initializeEvents();\n sendGTMCheckoutData();\n sendNBCheckoutData();\n};\n", "'use strict';\n\nvar address = require(18),\n applePay = require(4),\n billing = require(19),\n tabs = require(42),\n util = require(46),\n paysafe = require(31),\n progress = require(35),\n validator = require(47),\n continueCheckout = \"\",\n paymentTriggeredClass = \"\",\n paymentErrorMessage = \"\",\n paymentErrorType = \"\",\n pageAJAXRefreshFlag = false;\n\nfunction initialFunction(){\n var tjcCreditsFlag = false;\n if (window.carousel && typeof window.carousel.init === 'function') {\n window.carousel.init();\n }\n\n\tvar allowedClearpayCountries = 'GB';\n\n var couponstatus = $('.couponstatus').text();\n var already=couponstatus.search(\"COUPON_ALREADY_IN_BASKET:COUPON_ALREADY_IN_BASKET\");\n var correct=couponstatus.search(\"OK\");\n\n if(already >= 0) {\n $('.cart-coupon-code-button').addClass('opened');\n $('.cart-coupon-code').addClass('opened');\n $('.cart-coupon-code .error-msg').css(\"display\",\"block\");\n $('.cart-coupon-code .error-msg .already').css(\"display\",\"block\");\n $('.cart-coupon-code .error-msg .active').css(\"display\",\"none\");\n $('input').on('focus', function() {\n $('.cart-coupon-code .error-msg').css(\"display\",\"none\");\n $('.cart-coupon-code .error-msg .already').css(\"display\",\"none\");\n });\n }\n\n else if(correct >= 0) {\n $('.cart-coupon-code .error-msg .already').css(\"display\",\"none\");\n $('.cart-coupon-code .error-msg .active').css(\"display\",\"none\");\n $('.cart-coupon-code .error-msg').css(\"display\",\"none\");\n $('.cart-coupon-code .form-row').removeClass('validation-error');\n }\n\n else {\n if($('.cart-coupon-code .form-row').hasClass('validation-error')) {\n $('.cart-coupon-code-button').addClass('opened');\n $('.cart-coupon-code').addClass('opened');\n $('.cart-coupon-code .error-msg').css(\"display\",\"block\");\n }\n $('.cart-coupon-code .error-msg .already').css(\"display\",\"none\");\n $('.cart-coupon-code .error-msg .active').css(\"display\",\"block\");\n $('input').on('focus', function() {\n $('.cart-coupon-code .error-msg').css(\"display\",\"none\");\n $('.cart-coupon-code .error-msg .active').css(\"display\",\"none\");\n });\n }\n\n $('.cart-coupon-code-button').off('click').on('click',function(){\n couponButton();\n });\n\n function couponButton(){\n $('.cart-coupon-code-button').toggleClass('opened');\n $('.cart-coupon-code').toggleClass('opened');\n }\n\n // override enter key for coupon code entry\n $('form input[name$=\"_couponCode\"]').on('keydown', function (e) {\n var invalidChars = /[^\\w\\s-]/; // Matches any character that is not alphanumeric, space, or hyphen\n var keyPressed = e.key;\n if (invalidChars.test(keyPressed)) {\n e.preventDefault();\n return false; // Prevent the key from being entered\n }\n });\n\n $('.gift-receipt .gift-content .field textarea').attr('maxlength','160');\n $('.gift-receipt .gift-content .field textarea').on('keyup keydown',function(){\n $('.gift-receipt .gift-content .message-count .count').html(160 - $(this).val().length);\n });\n\n validateFieldsCount();\n\n /* Made hidden on UI\n * $(window).scroll(function(){\n var scroll = $(window).scrollTop();\n if (scroll >= 100){ $('.fixed-content').css('display','unset'); }\n else { $('.fixed-content').css('display','none'); }\n });*/\n\n if($('#useThisOPCDeliverylocation .customerAddresses').length > 0){\n var addressFormValue = $('.checkout-shipping-address .customerAddresses .input-radio:checked').attr('data-address');\n if(typeof addressFormValue === 'undefined')\n addressFormValue = $('.checkout-shipping-address .customerAddresses .input-radio:first').attr('data-address');\n fillAddressFields(addressFormValue, '.checkout-shipping-address');\n }\n\n if($('#useThisOPCBillinglocation .customerAddresses').length > 0){\n var addressFormValue = $('.checkout-billing-address .customerAddresses .input-radio:checked').attr('data-address');\n if(typeof addressFormValue === 'undefined')\n addressFormValue = $('.checkout-billing-address .customerAddresses .input-radio:first').attr('data-address');\n fillAddressFields(addressFormValue, '.checkout-billing-address');\n }else{\n fillAddressFields(null, null,'.checkout-shipping-address', '.checkout-billing-address');\n }\n\n $('.js-clearpay-checkout-button').on('click', function (e) {\n\t\te.preventDefault();\n\t\t$(this).toggleClass('active');\n\t\tvar $formData = $(this).closest('form');\n\t\tvar $formErrorContainer = $('.error-form');\n\t\tprogress.show();\n\t\t$.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: util.appendParamToURL(Urls.opcPlaceOrder, 'format', 'ajax'),\n\t\t\tdata: $formData.serialize(),\n\t\t\tsuccess: function(data) {\n\t\t\t\tif (data.countryCode && data.token && AfterPay) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tAfterPay.initialize({\n\t\t\t\t\t\t\tcountryCode: data.countryCode\n\t\t\t\t\t\t});\n\t\t\t\t\t\tAfterPay.redirect({\n\t\t\t\t\t\t\ttoken: data.token\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tprogress.hide();\n\t\t\t\t\t\tconsole.log(error);\n\t\t\t\t\t\tif ($formErrorContainer.length > 0) {\n\t\t\t\t\t\t\t$formErrorContainer.removeClass('d-none').empty().text(Resources.CLEARPAY_DEFAULT_ERROR_MESSAGE);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ($formErrorContainer.length > 0) {\n\t\t\t\t\t\t$formErrorContainer.removeClass('d-none').empty().text(Resources.CLEARPAY_DEFAULT_ERROR_MESSAGE);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprogress.hide();\n\t\t\t},\n\t\t\terror: function(f) {\n\t\t\t\tprogress.hide();\n\t\t\t\tconsole.log(f.statusText + \" \" + f.status)\n\t\t\t\t\n\t\t\t\tif ($formErrorContainer.length > 0) {\n\t\t\t\t\t$formErrorContainer.removeClass('d-none').empty().text(Resources.CLEARPAY_DEFAULT_ERROR_MESSAGE);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n\n $('.payment-method-wrapper .payment-method input[type$=radio]').on('change',function(){\n var thisClass = $('.payment-method-wrapper .payment-method input[type$=radio]:checked').closest('.payment-method').attr('class'),\n $billingClass = $('.payment-method-wrapper .billing'),\n $orderTotalsBudgetpay = $('.cartSummary .cart-order-totals .order-totals-table .order-totals-budgetpay'),\n $orderTotalsForBudgetPay = $('.order-totals-table .order-full-total td'),\n $budgetPayDescription = $('.tac .msg-budgetpay'),\n $budgetPayDetails = $('.payment-method-wrapper .budgetpayDetails'),\n $applePayDetails = $('.payment-method-wrapper .applePayDetails'),\n $googlePayDetails = $('.payment-method-wrapper .google-pay-details'),\n $checkoutPlaceOrderButton = $('.payment-methods .cart-checkout .xlt-continueCheckout'),\n $checkoutSummaryButton = $('.order-summary .xlt-continueCheckout'),\n $budgetpayLabelImage = $('.payment-method-wrapper .payment-method.budgetpay .label-image img'),\n $paypalLabelImage = $('.payment-method-wrapper .payment-method.paypal .label-image img'),\n $paypalcreditLabelImage = $('.payment-method-wrapper .payment-method.paypal-credit .label-image img'),\n $googlePayLabelImage = $('.payment-method-wrapper .payment-method.google-pay .label-image img'),\n $paypalbutton = $('.payment-method-wrapper .payment-method.paypal .paypal-button'),\n $paypalcreditbutton = $('.payment-method-wrapper .payment-method.paypal-credit .paypal-credit-button'),\n $applePayLabelImage = $('.payment-method-wrapper .payment-method.apple-pay .label-image img');\n paymentTriggeredClass = thisClass;\n $('.countrycheckopc .options li').each(function() {\n\t\t\t$(this).removeClass('hidden');\n\t\t});\n var $clearpayDescription = $('.payment-method-description.clearpay'); \n if(typeof thisClass === 'undefined' && tjcCreditsFlag == false){\n $billingClass.removeClass('tjccredit Paysafe apple-pay BudgetPay paypal paypal-credit clearpay');\n $billingClass.css({'display':'none'});\n $orderTotalsForBudgetPay.find('.order-totals-budgetpay-heading').hide();\n $orderTotalsForBudgetPay.find('.order-totals-heading').show();\n $clearpayDescription.hide();\n $budgetPayDescription.hide();\n $budgetPayDetails.hide();\n $orderTotalsBudgetpay.hide();\n $checkoutPlaceOrderButton.show();\n $checkoutSummaryButton.show();\n $applePayDetails.hide();\n $googlePayDetails.hide();\n $applePayLabelImage.show();\n $googlePayLabelImage.show();\n $budgetpayLabelImage.show();\n $paypalLabelImage.show();\n $paypalcreditLabelImage.show();\n $paypalbutton.hide();\n $paypalcreditbutton.hide();\n }else if(thisClass.indexOf(\"paysafe\") != -1){\n $clearpayDescription.hide();\n\t\t\t$billingClass.removeClass('tjccredit Paysafe apple-pay BudgetPay paypal paypal-credit clearpay').addClass('Paysafe');\n $billingClass.css({'display':'block'});\n $orderTotalsForBudgetPay.find('.order-totals-budgetpay-heading').hide();\n $orderTotalsForBudgetPay.find('.order-totals-heading').show();\n $budgetPayDescription.hide();\n $budgetPayDetails.hide();\n $orderTotalsBudgetpay.hide();\n setTimeout(function(){ $('#existing-paysafe-cvv:visible').trigger('click'); }, 500);\n $checkoutPlaceOrderButton.show();\n $checkoutSummaryButton.show();\n $applePayDetails.hide();\n $googlePayDetails.hide();\n $applePayLabelImage.show();\n $googlePayLabelImage.show();\n $budgetpayLabelImage.show();\n $paypalLabelImage.show();\n $paypalcreditLabelImage.show();\n $paypalbutton.hide();\n $paypalcreditbutton.hide();\n var paySafeDetails = $('.paysafe-card-details.Paysafe');\n\n if (paySafeDetails.length > 0) {\n var secureData = paySafeDetails.data('3dsecure');\n var psTotalAmount = paySafeDetails.data('ordertotalvalue');\n\n if (secureData && psTotalAmount) {\n secureData.threeDS.amount = getFormatedAmount(psTotalAmount);\n paySafeDetails.attr('data-3dsecure', JSON.stringify(secureData));\n }\n }\n tjcCreditsFlag = false;\n }else if(thisClass.indexOf(\"apple-pay\") != -1){\n $clearpayDescription.hide();\n\t\t\t$billingClass.removeClass('Paysafe tjccredit BudgetPay paypal paypal-credit clearpay').addClass('apple-pay');\n $billingClass.css({'display':'none'});\n $orderTotalsForBudgetPay.find('.order-totals-budgetpay-heading').hide();\n $orderTotalsForBudgetPay.find('.order-totals-heading').show();\n $budgetPayDescription.hide();\n $budgetPayDetails.hide();\n $orderTotalsBudgetpay.hide();\n $checkoutPlaceOrderButton.hide();\n $checkoutSummaryButton.hide();\n $googlePayDetails.hide();\n $applePayDetails.show();\n $applePayLabelImage.hide();\n $googlePayLabelImage.show();\n $budgetpayLabelImage.show();\n $paypalLabelImage.show();\n $paypalcreditLabelImage.show();\n tjcCreditsFlag = false;\n }else if(thisClass.indexOf(\"budgetpay\") != -1){\n $clearpayDescription.hide();\n\t\t\t$billingClass.removeClass('tjccredit Paysafe apple-pay paypal paypal-credit clearpay').addClass('BudgetPay');\n $billingClass.css({'display':'block'});\n $orderTotalsForBudgetPay.find('.order-totals-budgetpay-heading').show();\n $orderTotalsForBudgetPay.find('.order-totals-heading').hide();\n $budgetPayDescription.show();\n $budgetPayDetails.show();\n $orderTotalsBudgetpay.show();\n setTimeout(function(){ $('#existing-paysafe-cvv:visible').trigger('focus'); $('#existing-paysafe-cvv:visible').trigger('click'); }, 500);\n $checkoutPlaceOrderButton.show();\n $checkoutSummaryButton.show();\n $applePayDetails.hide();\n $googlePayDetails.hide();\n $applePayLabelImage.show();\n $googlePayLabelImage.show();\n $budgetpayLabelImage.show();\n $paypalLabelImage.show();\n $paypalcreditLabelImage.show();\n $paypalbutton.hide();\n $paypalcreditbutton.hide();\n var budgetPayDetails = $('.paysafe-card-details.BudgetPay');\n\n if (budgetPayDetails.length > 0) {\n var secureData = budgetPayDetails.data('3dsecure');\n var bpTotalAmount = budgetPayDetails.data('bpvalue');\n\n if (secureData && bpTotalAmount) {\n secureData.threeDS.amount = getFormatedAmount(bpTotalAmount);\n budgetPayDetails.attr('data-3dsecure', JSON.stringify(secureData));\n }\n }\n tjcCreditsFlag = false;\n }else if(thisClass.indexOf(\"clearpay\") != -1){\n\t\t\t$billingClass.removeClass('tjccredit Paysafe apple-pay paypal paypal-credit').addClass('clearpay');\n\t\t\t$billingClass.css({'display':'block'});\n\t\t\t$clearpayDescription.show();\n\t\t\t$('.payment-method-wrapper .payment-method.google-pay').addClass('order6');\n\t\t\t$budgetPayDescription.hide();\n\t\t\t$budgetPayDetails.hide();\n\t\t\t$orderTotalsBudgetpay.hide();\n\t\t\t$paypalbutton.hide();\n\t\t\t$paypalcreditbutton.hide();\n\t\t\t$applePayDetails.hide();\n\t\t\t$googlePayDetails.hide();\n\t\t\t$('.countrycheckopc .options li').each(function() {\n\t\t\t\tvar countryCode = $(this).attr('rel');\n\t\t\t\tif (allowedClearpayCountries.indexOf(countryCode) < 0) {\n\t\t\t\t\t$(this).addClass('hidden');\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (!$('.billing .checkout-billing-address .checker input').prop('checked')) {\n\t\t\t\t$('.billing .checkout-billing-address .checker input').trigger('click');\n\t\t\t}\n\t\t}else if(thisClass.indexOf(\"paypal-credit\") != -1){\n $clearpayDescription.hide();\n\t\t\t$billingClass.removeClass('tjccredit Paysafe apple-pay paypal BudgetPay clearpay').addClass('paypal-credit');\n $billingClass.css({'display':'block'});\n $orderTotalsForBudgetPay.find('.order-totals-budgetpay-heading').hide();\n $orderTotalsForBudgetPay.find('.order-totals-heading').show();\n $budgetPayDescription.hide();\n $budgetPayDetails.hide();\n $orderTotalsBudgetpay.hide();\n $checkoutPlaceOrderButton.show();\n $checkoutSummaryButton.hide();\n $applePayDetails.hide();\n $googlePayDetails.hide();\n $applePayLabelImage.show();\n $googlePayLabelImage.show();\n $budgetpayLabelImage.show();\n $paypalLabelImage.show();\n $paypalcreditLabelImage.hide();\n $paypalbutton.hide();\n $paypalcreditbutton.show();\n tjcCreditsFlag = false;\n }else if(thisClass.indexOf(\"paypal\") != -1){\n $clearpayDescription.hide();\n\t\t\t$billingClass.removeClass('tjccredit Paysafe apple-pay BudgetPay paypal-credit clearpay').addClass('paypal');\n $billingClass.css({'display':'block'});\n $orderTotalsForBudgetPay.find('.order-totals-budgetpay-heading').hide();\n $orderTotalsForBudgetPay.find('.order-totals-heading').show();\n $budgetPayDescription.hide();\n $budgetPayDetails.hide();\n $orderTotalsBudgetpay.hide();\n $checkoutPlaceOrderButton.show();\n $checkoutSummaryButton.hide();\n $applePayDetails.hide();\n $googlePayDetails.hide();\n $applePayLabelImage.show();\n $googlePayLabelImage.show();\n $budgetpayLabelImage.show();\n $paypalLabelImage.hide();\n $paypalcreditLabelImage.show();\n $paypalbutton.show();\n $paypalcreditbutton.hide();\n tjcCreditsFlag = false;\n }else if(thisClass.indexOf(\"google-pay\") != -1){\n $clearpayDescription.hide();\n\t\t\t$billingClass.removeClass('tjccredit Paysafe apple-pay BudgetPay paypal paypal-credit clearpay');\n $billingClass.css({'display':'none'});\n $orderTotalsForBudgetPay.find('.order-totals-budgetpay-heading').hide();\n $orderTotalsForBudgetPay.find('.order-totals-heading').show();\n $budgetPayDescription.hide();\n $budgetPayDetails.hide();\n $orderTotalsBudgetpay.hide();\n $checkoutPlaceOrderButton.hide();\n $checkoutSummaryButton.hide();\n $applePayDetails.hide();\n $applePayLabelImage.show();\n $googlePayLabelImage.hide();\n $budgetpayLabelImage.show();\n $paypalLabelImage.show();\n $paypalcreditLabelImage.show();\n $googlePayDetails.show();\n $googlePayDetails.find('.google-pay-details-bottom').show();\n $paypalbutton.hide();\n $paypalcreditbutton.hide();\n tjcCreditsFlag = false;\n }\n });\n\n $('.billing .checkout-billing-address .checker input').on('change',function(){\n billingClassFields($(this).prop('checked'));\n });\n billingClassFields($('.billing .checkout-billing-address .checker input').prop('checked'));\n\n $('.paysafe-card-details').find('#existing-paysafe-card').val($('.paysafe-card-details .paysafemodelbox').attr('data-paysafeSelectedCard'));\n var selectLable = $('#existing-paysafe-card').find('option:selected').text();\n $('.paysafe-card-details').find('.selector span:first').html(selectLable);\n\n var $tjcCredit = $('.credit-input'),\n $tjcCreditDetails = $('.tjc-credit-details'),\n $tjcCreditAvailable = $('.credit-available'),\n $tjcCreditApplyButton = $('.credit-apply-button');\n $tjcCredit.on('keyup', function () {\n var $value = $(this).val();\n var validValue = $value.match(/^\\d*\\.?\\d{0,2}$/);\n var $billingClass = $('.payment-method-wrapper .billing');\n var $checkoutPlaceOrderButton = $('.payment-methods .cart-checkout .xlt-continueCheckout');\n var $checkoutSummaryButton = $('.order-summary .xlt-continueCheckout');\n\n if ((isNaN($value) === false || isDecimal($value) === true) && validValue) {\n $tjcCreditApplyButton.show();\n var subtotal = $tjcCredit.data('subtotal'),\n newCreditBalance = subtotal - $value;\n if ($value < 0) {\n $tjcCreditDetails.addClass('has-error');\n tjcCreditsFlag = false;\n return;\n }\n $tjcCreditDetails.removeClass('has-error');\n\n if (newCreditBalance <= 0) {\n $tjcCreditAvailable.parent().hide();\n $(this).val(subtotal);\n tjcCreditsFlag = true;\n\n $billingClass.addClass('tjccredit').removeClass('Paysafe').removeClass('apple-pay').removeClass('BudgetPay').removeClass('paypal').removeClass('paypal-credit');\n $billingClass.css({'display':'block'});\n $checkoutPlaceOrderButton.show();\n $checkoutSummaryButton.show();\n $tjcCreditApplyButton.html($tjcCredit.data('paynowlabel'));\n } else {\n $tjcCreditAvailable.parent().show();\n $tjcCreditAvailable.html('£ ' + newCreditBalance.toFixed(2));\n tjcCreditsFlag = false;\n $tjcCreditApplyButton.html($tjcCredit.data('applylabel'));\n }\n } else {\n $(this).val($value.slice(0, -1));\n }\n });\n\n $('.xlt-cart-coupon-form input').blur(function(){\n if(!$(this).val()){\n $(this).parents('form-row').addClass(\"validation-error\");\n } else{\n $(this).parents('form-row').removeClass(\"validation-error\");\n }\n });\n\n var couponFormClass = $('.xlt-cart-coupon-form .form-row').attr('class');\n if(couponFormClass.indexOf(\"validation-error\") != -1){\n couponButton();\n }\n\n $(\".gift-receipt .gift-description\").insertAfter($(\".gift-receipt .is-gift .field label .tooltip\"));\n\n if($('#currentUserAddressExist').val() == \"true\" || $('#showGuestChangeButton').val() == 'true'){\n $(\".gift-receipt .gift-content .field-inner-text\").insertAfter($(\".gift-receipt .gift-content .input-text\"));\n $(\".gift-save-button\").off('click').on('click', function(e){\n $('.delivery-address .xlt-continueShopping').trigger('click');\n });\n }\n\n if($('#showGuestChangeButton').val() == 'true'){\n var guestDetailTitle = $('.guestDetails .detail-title select').val(),\n guestDetailFirst = $('.guestDetails .detail-first-name input').val(),\n guestDetailSecond = $('.guestDetails .detail-last-name input').val(),\n guestDetailEmail = $('.guestDetails .detail-email input').val(),\n guestDetailMobile = $('.guestDetails .detail-mobile input').val(),\n guestAddressCountry = $('.checkout-shipping-address .selector span:first').text(),\n guestAddressPostCode = $('.checkout-shipping-address input[name$=postCode]').val(),\n guestAddressAddress1 = $('.checkout-shipping-address input[name$=address1]').val(),\n guestAddressAddress2 = $('.checkout-shipping-address input[name$=address2]').val(),\n guestAddressCity = $('.checkout-shipping-address input[name$=city]').val();\n\n $('#guestDetails .guestShowDetails .custName span').html(guestDetailTitle+' '+guestDetailFirst+' '+guestDetailSecond);\n $('#guestDetails .guestShowDetails .custEmail span').html(guestDetailEmail);\n $('#guestDetails .guestShowDetails .custMobile span').html(guestDetailMobile);\n\n $('#guestDetailsAddress .preferredAddress .custName span').html(guestDetailFirst+' '+guestDetailSecond);\n var guestLabel = guestAddressAddress1;\n guestLabel += guestAddressAddress2 ? ', ' + guestAddressAddress2 : '';\n guestLabel += ', ' + guestAddressCity;\n guestLabel += guestAddressCountry ? ', ' + guestAddressCountry : '';\n guestLabel += guestAddressPostCode ? ', ' + guestAddressPostCode : '';\n $('#guestDetailsAddress .preferredAddress .custAddress span').html(guestLabel);\n\n $('.gift .gift-receipt .gift-content .gift-recipient-name .gift-save-button').removeClass('visually-hidden');\n\n $('.guesteditdetails').off('click').on('click',function(){\n $('#guestDetails').addClass('hidden');\n $('.guestDetails fieldset').removeClass('hidden');\n $('#guestDetailsAddress').removeClass('hidden');\n $('.checkout-shipping-address .opcAddressFields').addClass('hidden');\n $('.additional-address-fields').removeClass('visually-hidden');\n $('.xlt-continueShopping').removeClass('hidden');\n $('.guesteditdetails').addClass('hidden');\n $('.js-checkoutaddress-email').removeClass('hidden');\n $('.guesteditaddress').removeClass('hidden');\n $('.guest-details-button').removeClass('hidden');\n $('.xlt-continueShopping').removeAttr('disabled');\n\n $('.checkout-billing-methods #cart-shippingmethod-form').addClass('freezeSection');\n $('.payment .paymentMethod').addClass('freezeSection');\n $('.couponsList').addClass('freezeSection');\n\n var email = $('input[id^=\"dwfrm_checkoutaddresses_customerinfo_email_\"]').val();\n $('input[id^=\"dwfrm_login_username_\"]').val(email);\n\n freezeSectionEvent();\n });\n\n $('.guesteditaddress').off('click').on('click',function(){\n var $guestCustomerForm = $('.guestDetails').closest('form');\n if ($guestCustomerForm.length > 0) {\n if (!($guestCustomerForm.valid()) && $(\".delivery .validation-error\").length > 0) {\n $('html, body').animate({scrollTop: $(\".delivery .validation-error\").offset().top-60}, 500);\n return;\n }\n }\n var $countrySelect = $guestCustomerForm.find('select[name$=country]');\n if ($countrySelect.length > 0) {\n $('.checkout-shipping-address .opcAddressFields').removeClass('hidden');\n }\n $guestCustomerForm.find('select[name$=country]').trigger(\"change\");\n $('.xlt-continueShopping').removeClass('hidden');\n $('.xlt-continueShopping').removeAttr('disabled');\n $('.guesteditdetails').removeClass('hidden');\n $('.guesteditaddress').addClass('hidden');\n $('#guestDetails').removeClass('hidden');\n $('.guestDetails fieldset').addClass('hidden');\n $('.guest-details-button').addClass('hidden');\n var guestDetailTitle = $('.guestDetails .detail-title select').val(),\n guestDetailFirst = $('.guestDetails .detail-first-name input').val(),\n guestDetailSecond = $('.guestDetails .detail-last-name input').val(),\n guestDetailEmail = $('.guestDetails .detail-email input').val(),\n guestDetailMobile = $('.guestDetails .detail-mobile input').val();\n\n $('#guestDetails .guestShowDetails .custName span').html(guestDetailTitle+' '+guestDetailFirst+' '+guestDetailSecond);\n $('#guestDetails .guestShowDetails .custEmail span').html(guestDetailEmail);\n $('#guestDetails .guestShowDetails .custMobile span').html(guestDetailMobile);\n\n $('.checkout-billing-methods #cart-shippingmethod-form').addClass('freezeSection');\n $('.payment .paymentMethod').addClass('freezeSection');\n $('.couponsList').addClass('freezeSection');\n\n var email = $('input[id^=\"dwfrm_checkoutaddresses_customerinfo_email_\"]').val();\n $('input[id^=\"dwfrm_login_username_\"]').val(email);\n\n freezeSectionEvent();\n });\n }\n\n var giftCheckedFlag = false;\n //if($('#currentUserAddressExist').val() == \"true\"){\n if($('.gift-receipt .is-gift .checker input.input-checkbox').prop('checked')){\n $('.gift-content').addClass('visually-hidden');\n var giftMessageText = $('.gift-receipt .gift-content .gift-message-text .input-textarea').val();\n var giftRecipientName = $('.gift-receipt .gift-content .gift-recipient-name .input-text').val();\n var joinText = (giftMessageText.length > 22)?'...':'';\n $('.gift-receipt .gift-content-with-message .gift-to-name .gift-to-name-content').html(giftRecipientName);\n $('.gift-receipt .gift-content-with-message .gift-to-message .gift-to-message-content').html(giftMessageText.slice(0, 22)+joinText);\n $('.gift-content-with-message').removeClass('visually-hidden');\n giftCheckedFlag = true;\n }else{\n $('.gift-content').removeClass('visually-hidden');\n $('.gift-receipt .gift-content .gift-message-text .input-textarea').val(\"\");\n $('.gift-receipt .gift-content .gift-recipient-name .input-text').val(\"\");\n giftCheckedFlag = false;\n }\n $(\".gift-edit-button\").off('click').on('click', function(e){\n $('.gift-content').removeClass('visually-hidden');\n $('.gift-content-with-message').addClass('visually-hidden');\n });\n $(\".gift-receipt div[id$='_shippingAddress_isGift']\").on('click' , function(){\n if(!$('.gift-receipt .is-gift .checker input.input-checkbox').prop('checked') && giftCheckedFlag){\n $('.delivery-address .xlt-continueShopping').trigger('click');\n }\n });\n //}\n\n $(\"div[id$='_shippingAddress_isGift']\").on('click' , function(){\n var addressSubmitVisible = $('.xlt-addressForm button.xlt-continueShopping').is(\":visible\") && !$('.xlt-addressForm button.xlt-continueShopping').hasClass(\"visually-hidden\");\n if(addressSubmitVisible == false || addressSubmitVisible == \"false\"){\n if ($(\"div[id$='_shippingAddress_isGift'] span\").hasClass('checked')){\n $('.checkout-billing-methods #cart-shippingmethod-form').addClass('freezeSection');\n $('.payment .paymentMethod').addClass('freezeSection');\n //$('form.xlt-continueCheckout').addClass('freezeSection');\n //$('.cart-coupon-code').addClass('freezeSection');\n $('.couponsList').addClass('freezeSection');\n freezeSectionEvent();\n }else{\n $('.checkout-billing-methods #cart-shippingmethod-form').removeClass('freezeSection');\n $('.payment .paymentMethod').removeClass('freezeSection');\n //$('.cart-coupon-code').removeClass('freezeSection');\n $('.couponsList').removeClass('freezeSection');\n $('.customFreezeMessageDeliveryAddress').hide();\n $('.gift-content .gift-recipient-name').removeClass('validation-error');\n //freezeSectionEventAction();\n }\n }\n });\n\n $('.checkout-addresses-form').off('submit').on('submit', function(e){\n /*e.preventDefault();*/\n var $formData = $(this).closest('form'),\n $formActionURL = $formData.attr('action'),\n isValid = $formData.valid(),\n url = Urls.opcAddressResponse,\n urlRedirect = Urls.opcredirect;\n\n var emailInput = $('input[id^=\"dwfrm_login_username_\"]');\n if ($('.js-checkout-login').length > 0 && !$('.js-checkout-login').hasClass('hidden') && emailInput.length > 0) {\n var inputEmail = (emailInput.val() !== undefined) ? emailInput.val().trim() : \"\";\n if (inputEmail === \"\") {\n isValid = false;\n emailInput.focus();\n emailInput.blur();\n } else {\n $('input[id^=\"dwfrm_checkoutaddresses_customerinfo_email_\"]').val(inputEmail);\n if (!validateEmail(inputEmail)) {\n return false;\n }\n }\n }\n\n if(document.URL.indexOf('isGuestUser=true') > 0){\n urlRedirect = util.appendParamToURL(urlRedirect,'isGuestUser',true);\n }\n\n //if Session timeout redirect to login page\n $.ajax({\n type: \"GET\",\n url: urlRedirect,\n success: function(data) {\n $(document).trigger('checkout:deliveryOption');\n try {\n if(!data.status){\n window.location.href = Urls.opcStartNode;\n return false;\n }\n } catch (b) {\n //console.log(b);\n }\n },\n error: function(f) {\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n\n if(document.URL.indexOf('isGuestUser=true') > 0){\n url = util.appendParamToURL(url,'isGuestUser',true);\n }\n\n if(isValid == \"true\" || isValid == true){\n var $addressFields = $('.checkout-shipping-address .opcAddressFields .additional-address-fields');\n if($addressFields.find('.city input').val().length < 1 && $addressFields.find('.address1 input').val().length < 1){\n //$('.checkout-shipping-address .opcAddressFields .post-code-field .address-check-btn button').trigger('click');\n $('html, body').animate({scrollTop: $(\".delivery .opcAddressFields\").offset().top-60}, 500);\n return false;\n }\n progress.show();\n $.ajax({\n type: \"POST\",\n url: url,\n data: $formData.serialize(),\n success: function(data) {\n try {\n $('.xlt-opcPageContent').html(data);\n reInitialFunction();\n $('.account-signin').addClass('hidden');\n } catch (b) {\n //console.log(b);\n }\n progress.hide();\n },\n error: function(f) {\n //console.log(f.statusText + \" \" + f.status)\n }\n });\n }else{\n var $addressFields = $('.checkout-shipping-address .opcAddressFields .additional-address-fields');\n if($addressFields.find('.city input').val().length < 1 && $addressFields.find('.address1 input').val().length < 1 && $addressFields.find('.postCode input').val().length > 0){\n //$('.checkout-shipping-address .opcAddressFields .post-code-field .address-check-btn button').trigger('click');\n $('html, body').animate({scrollTop: $(\".delivery .opcAddressFields\").offset().top-60}, 500);\n }\n opcFormValidation();\n /*$.each(['.guestDetails', '.delivery-address'], function (i, attribute) {\n if($(attribute).find('.validation-error').length > 0){\n $(attribute).find('.required-indicator').css('display','unset');\n }else{\n $(attribute).find('.required-indicator').css('display','none');\n }\n });*/\n if($('.sections.delivery .additional-address-fields').hasClass('visually-hidden')){\n if (window.matchMedia(\"(max-width: 480px)\").matches) {\n $('html, body').animate({scrollTop: $(\".sections.delivery\").offset().top-60}, 500);\n }else{\n if($('.guestDetails').length > 0){\n $('html, body').animate({scrollTop: $(\".delivery .validation-error\").offset().top-60}, 500);\n }else{\n $('html, body').animate({scrollTop: $(\"html, body\").offset().top-60}, 500);\n }\n }\n }else{\n if(window.matchMedia(\"(max-width: 480px)\").matches && $(\".gift-content\").is(\":visible\")){\n $('html, body').animate({scrollTop: $(\".sections.delivery\").offset().top-60}, 500);\n }else{\n $('html, body').animate({scrollTop: $(\".delivery .validation-error\").offset().top-60}, 500);\n }\n }\n progress.hide();\n }\n return false;\n });\n\n $('.checkout-billing-methods input[type$=radio]').on('change',function(){\n /*e.preventDefault();*/\n var $formData = $(this).closest('form'),\n $formActionURL = $formData.attr('action'),\n isValid = $formData.valid(),\n url = Urls.opcUpdateShippingMethod;\n\n if(document.URL.indexOf('isGuestUser=true') > 0){\n url = util.appendParamToURL(url,'isGuestUser',true);\n }\n giftCheck();\n\n progress.show();\n $.ajax({\n type: \"POST\",\n url: url,\n data: $formData.serialize(),\n success: function(data) {\n try {\n if(!data.status){\n //if Session timeout redirect to login page\n window.location.href = Urls.opcStartNode;\n }else{\n pageAJAXRefreshFlag = true;\n $('.checkout-shipping-address .xlt-continueShopping').removeAttr('disabled');\n $('.checkout-shipping-address .xlt-continueShopping').trigger('click');\n }\n\n } catch (b) {\n //console.log(b);\n }\n },\n error: function(f) {\n //console.log(f.statusText + \" \" + f.status)\n }\n });\n });\n\n $('.xlt-cart-coupon-form').on('submit',function(){\n /*e.preventDefault();*/\n var $formData = $(this).closest('form'),\n $formActionURL = $formData.attr('action'),\n isValid = $formData.valid(),\n url = Urls.opcApplyCouponCode;\n\n if(document.URL.indexOf('isGuestUser=true') > 0){\n url = util.appendParamToURL(url,'isGuestUser',true);\n }\n giftCheck();\n\n if(isValid == \"true\" || isValid == true){\n progress.show();\n $.ajax({\n type: \"POST\",\n url: url,\n data: $formData.serialize(),\n success: function(data, textStatus , xhr) {\n try {\n var ct = xhr.getResponseHeader(\"content-type\") || \"\";\n if((ct.indexOf(\"text/json\")>-1) && !data.status){\n //if Session timeout redirect to login page\n window.location.href = Urls.opcStartNode;\n }else{\n var mobileCheckoutSummaryTopSectionResponse = $(data).filter('.sections-col-mobile');\n if (mobileCheckoutSummaryTopSectionResponse.length > 0) {\n $('.sections-col-div.sections-col-mobile').replaceWith(mobileCheckoutSummaryTopSectionResponse);\n }\n\n var paymentMethodSection = $(data).filter('.sections-col-div-60').find('.payment-methods');\n if (paymentMethodSection.length > 0) {\n $('.sections-col-div-60 .payment-methods').replaceWith(paymentMethodSection);\n }\n\n var checkoutSummaryTopSectionResponse = $(data).filter('.js-checkout-summary-top');\n if (checkoutSummaryTopSectionResponse.length > 0) {\n $('.js-checkout-summary-top').replaceWith(checkoutSummaryTopSectionResponse);\n }\n\n var $contactDetailsForm = $('.js-contact-details .checkout-addresses-form');\n var isContactDetailsFormValid = $contactDetailsForm.valid();\n\n var responseContactDetailsForm = $(data).filter('.sections-col-div-60').find('.js-contact-details');\n if (isContactDetailsFormValid && responseContactDetailsForm.length > 0 && $('.guesteditaddress').length > 0 && !$('.guesteditaddress').hasClass('hidden')) {\n $('.js-contact-details').replaceWith(responseContactDetailsForm);\n }\n\n pageAJAXRefreshFlag = true;\n reInitialFunction();\n $('.xlt-continueShopping.submit-button').attr('disabled', false);\n $('.cart-coupon-code-button').addClass('opened');\n $('.cart-coupon-code').addClass('opened');\n if(!$('.guestaddressmodelbox.guesteditdetails').hasClass('hidden')) {\n $('.account-signin').hide()\n }\n /*$('.delivery-address .xlt-continueShopping').trigger('click');*/\n }\n } catch (b) {\n //console.log(b);\n }\n $(document).trigger('checkout:promoCodeError');\n progress.hide();\n },\n error: function(f) {\n //console.log(f.statusText + \" \" + f.status);\n $(document).trigger('checkout:promoCodeError');\n }\n });\n }else{\n progress.hide();\n }\n return false;\n });\n\n $('.xlt-coupon-items-list .couponAction').each(function(){\n $(this).off('click').on('click',function(){\n var $formData = $(this).closest('form'),\n $formActionURL = $formData.attr('action'),\n isValid = $formData.valid(),\n url = Urls.opcRemoveCouponCode;\n\n if(document.URL.indexOf('isGuestUser=true') > 0){\n url = util.appendParamToURL(url,'isGuestUser',true);\n }\n\n giftCheck();\n\n if(isValid == \"true\" || isValid == true) {\n progress.show();\n $.ajax({\n type: \"POST\",\n url: url,\n data: $formData.serialize(),\n success: function(data, textStatus , xhr) {\n try {\n var ct = xhr.getResponseHeader(\"content-type\") || \"\";\n if((ct.indexOf(\"text/json\")>-1) && !data.status) {\n //if Session timeout redirect to login page\n window.location.href = Urls.opcStartNode;\n } else {\n var mobileCheckoutSummaryTopSectionResponse = $(data).filter('.sections-col-mobile');\n if (mobileCheckoutSummaryTopSectionResponse.length > 0) {\n $('.sections-col-div.sections-col-mobile').replaceWith(mobileCheckoutSummaryTopSectionResponse);\n }\n\n var checkoutSummaryTopSectionResponse = $(data).filter('.js-checkout-summary-top');\n if (checkoutSummaryTopSectionResponse.length > 0) {\n $('.js-checkout-summary-top').replaceWith(checkoutSummaryTopSectionResponse);\n }\n\n var paymentMethodSection = $(data).filter('.sections-col-div-60').find('.payment-methods');\n if (paymentMethodSection.length > 0) {\n $('.sections-col-div-60 .payment-methods').replaceWith(paymentMethodSection);\n }\n pageAJAXRefreshFlag = true;\n reInitialFunction();\n $('.xlt-continueShopping.submit-button').attr('disabled', false);\n progress.hide();\n }\n } catch (b) {\n //console.log(b);\n }\n },\n error: function(f) {\n //console.log(f.statusText + \" \" + f.status)\n }\n });\n } else {\n progress.hide();\n }\n return false;\n });\n });\n\n $('.tjc-credit-details .credit-apply-button').on('click', function(e){\n e.preventDefault();\n var $creditInputField = $('.tjc-credit-details .credit-input'),\n tjcCredit = $creditInputField.val(),\n url = Urls.opcApplyCredit,\n creditValue = tjcCredit,\n creditTotal = $creditInputField.attr('data-subtotal'),\n creditAvalilable = $creditInputField.attr('data-creditavailable'),\n newCreditBalance = creditTotal - creditValue,\n userCreditBalance = creditAvalilable - creditValue;\n\n if(document.URL.indexOf('isGuestUser=true') > 0){\n url = util.appendParamToURL(url,'isGuestUser',true);\n }\n giftCheck();\n\n $('.pay-now').attr('disabled',true);\n //if Session timeout redirect to login page\n $.ajax({\n type: \"GET\",\n url: Urls.opcredirect,\n success: function(data) {\n try {\n if(!data.status){\n window.location.href = Urls.opcStartNode;\n return false;\n }\n $('.pay-now').attr('disabled',false);\n } catch (b) {\n //console.log(b);\n }\n },\n error: function(f) {\n $('.pay-now').attr('disabled',false);\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n\n $('.payment-method-wrapper .payment-method .field').find('input[name$=paymentMethods_selectedPaymentMethodID]:checked').val(\"TJCCredit\");\n if(tjcCreditsFlag == true){\n if(newCreditBalance <= 0 && userCreditBalance >= 0){\n var $formData = $('form.checkout-billing');\n $('#tjcCreditsFlag').val(tjcCreditsFlag);\n $('.tjc-credit-details .credit-apply-button').css('pointer-events','none');\n $('.tjc-credit-details .credit-apply-button').attr('disabled',true);\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').addClass('freezeSection');\n progress.show();\n $formData.trigger('submit');\n }else{\n tjcCreditsFlag == false;\n $tjcCreditDetails.addClass('has-error');\n }\n }else if(tjcCredit > 0 && userCreditBalance >= 0 && tjcCreditsFlag == false){\n progress.show();\n $.ajax({\n type: \"GET\",\n url: url,\n data: {'tjcCredit':tjcCredit, 'tjcCreditsFlag':tjcCreditsFlag},\n success: function(data) {\n try {\n //$('.delivery-address .xlt-continueShopping').trigger('click');\n $('.xlt-opcPageContent').html(data);\n pageAJAXRefreshFlag = true;\n reInitialFunction();\n progress.hide();\n } catch (b) {\n //console.log(b);\n }\n },\n error: function(f) {\n // console.log(f.statusText + \" \" + f.status)\n }\n });\n }else{\n $tjcCreditDetails.addClass('has-error');\n }\n return false;\n });\n\n /*##### Start OPC delivery address model popup box #####*/\n $('.addressmodelbox').off('click').on('click', function(e){\n var url = Urls.opcAddressList,\n addressType = $(this).attr('data-addressType');\n\n\t\tvar billingForm = $(e.target).closest('.checkout-addresses-form');\n\t\tvar isClearpayPaymentMethod = billingForm && billingForm.hasClass('clearpay');\n\t\tif (isClearpayPaymentMethod) {\n\t\t\turl = util.appendParamsToUrl(url, {\n\t\t\t\tallowedCountries: allowedClearpayCountries,\n\t\t\t});\n\t\t}\n\n giftCheck();\n\n //if Session timeout redirect to login page\n $.ajax({\n type: \"GET\",\n url: Urls.opcredirect,\n success: function(data) {\n try {\n if(!data.status){\n window.location.href = Urls.opcStartNode;\n return false;\n }\n } catch (b) {\n //console.log(b);\n }\n },\n error: function(f) {\n // console.log(f.statusText + \" \" + f.status)\n }\n });\n\n\n progress.show();\n if (window.dialog) {\n window.dialog.open({\n url: url,\n options:{\n dialogClass:'opcAddressListModelPopup',\n open: function(event,ui){\n\n var sUniformStyled = 'uniformstyled';\n $(['input:checkbox', 'input:radio', '.opc .existing-card-section #existing-paysafe-card']).each(function () {\n $(this + ':not(.' + sUniformStyled + ')').not('.no-uniform').addClass(sUniformStyled).uniform();\n });\n\n $('body').css('overflow-y','hidden');\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n\n address.init();\n validator.init();\n \n $(\".opcAddressListModelPopup .ui-dialog-titlebar-close\").hide(); /*Hide the close icon*/\n progress.hide();\n \n /*##### Start - Enable/Disable the links when you click the radio button #####*/\n var $checkedstatus = $(\"#opcDeliveryAddresses input:radio[name=opcdeliveryaddresses]\").filter(':checked');\n \n if($checkedstatus.prop(\"checked\")){\n $checkedstatus.parents('.form-row-radio').find(\".buttonlinks\").removeClass(\"hidden\");\n }\n \n var isBillingAddress = false;\n $('.address-make-default').attr('data-addressType',addressType);\n $('.opcAddressListModelPopup .editOPCaddress .addAddressOpc .editOPCdeliverylocation').attr('data-addressType',addressType);\n if(addressType == 'billing'){\n $('.opcAddressListModelPopup .addressbooklist .buttonlinks').addClass('billing-address');\n isBillingAddress = true;\n }else{\n $('.opcAddressListModelPopup .addressbooklist .buttonlinks').addClass('delivery-address');\n isBillingAddress = false;\n }\n\n var $saveButton = $('.opcAddressListModelPopup').find('.addOPCdeliverylocation');\n \n $(\"#opcDeliveryAddresses input[name$=opcdeliveryaddresses]\").click(function() {\n var $this = $(this),\n $tile = $this.parents('.form-row-radio');\n $('#opcDeliveryAddresses .form-row-radio').find(\".buttonlinks\").addClass(\"hidden\");\n $tile.find(\".buttonlinks\").removeClass(\"hidden\");\t \t\t \n });\n /*##### End - Enable/Disable the links when you click the radio button #####*/\n \n /*##### Start - close the dialog/section when you click cancel button in the popup #####*/\n $('#opcDeliveryAddresses .closedeliverypopup').on('click', function(e){\n if (window.dialog) {\n window.dialog.close();\n }\n });\n \n $('#setDefaultaddress-section .address-create').on('click', function(e){\n e.preventDefault();\n $('#setDefaultaddress-section').addClass('visually-hidden');\n \n if($('#addOPCAddress-section').hasClass('visually-hidden')){\n $('#addOPCAddress-section').removeClass('visually-hidden')\n }\t\n $(\".country\").trigger('blur'); \n\n var additionalBillingAddressFields = $('#opcDeliveryAddresses .additional-address-fields');\n var isFormValid = $(additionalBillingAddressFields).closest('form').valid();\n\n $saveButton.prop('disabled' , !isFormValid);\n\t\t\t\t\t\t\tif (isClearpayPaymentMethod) {\n\t\t\t\t\t\t\t\t$('.addAddressOpc .countrycheckopc .options li').each(function() {\n\t\t\t\t\t\t\t\t\tvar countryCode = $(this).attr('rel');\n\t\t\t\t\t\t\t\t\tif (allowedClearpayCountries.indexOf(countryCode) < 0) {\n\t\t\t\t\t\t\t\t\t\t$(this).addClass('hidden');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n });\n \n editOPCaddress(); // Edit the OPC address in billing and delivery popup\n\n\n\n\t\t\t\t\t$('.post-code-field-opc').off('focusout').on('focusout' , function(){\n\t\t\t\t\t\tvar $addressList = $('.post-code-field-opc').find('.data8-autocomplete-list').text();\n\t\t\t\t\t\tif(!($addressList) && $addressList == \"\"){\n\t\t\t\t\t\t\tvar $formData = $(this).closest('form'),\n\t\t\t\t\t\t\tisValid = $formData.valid();\n\t\t\t\t\t\t\tif($formData.find('.selected-address-summary').hasClass('visually-hidden')){\n\t\t\t\t\t\t\t\t$formData.find('.post-code-field-opc .form-row').removeClass('validation-success')\n\t\t\t\t\t\t\t\t$formData.find('.post-code-field-opc .form-row').addClass('validation-error')\n\t\t\t\t\t\t\t\t$formData.find('.post-code-field-opc .form-row .field').append('<div class=\"error-msg\">Please select valid address</div>');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(isValid == \"false\" || isValid == false){\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t \t\t\n\t \t\t$('.addOPCdeliverylocation').off('click').on('click', function(e){\n\t\t\t\t\t\tvar $formData = $(this).closest('form');\n\t\t\t\t\t\tvar url = Urls.opcAddAddress;\n\n\t\t\t\t\t\tvar addressid = $formData.find('input[id*=\"addressid\"]').val();\n\t\t\t\t\t\tvar address1 = $formData.find('input[id*=\"address1\"]').val();\n\t\t\t\t\t\tvar address2 = $formData.find('input[id*=\"address2\"]').val();\n\t\t\t\t\t\tvar address3 = $formData.find('input[id*=\"address3\"]').val();\n\t\t\t\t\t\tvar address4 = $formData.find('input[id*=\"address4\"]').val();\n\t\t\t\t\t\tvar country = $formData.find('select[id*=\"address_country\"]').val();\n\t\t\t\t\t\tvar city = $formData.find('input[id*=\"city\"]').val();\n\t\t\t\t\t\tvar postCode = $formData.find('input[id*=\"postCode\"]').val(); \n\t\t\t\t\t\tvar addresses = $formData.find('input[id*=\"address_addresses\"]').val();\n\t\t\t\t\t\tvar manualentry = $formData.find('input[id*=\"manualentry\"]').val();\n\t\t\t\t\t\tvar isGift=($('.gift-receipt .is-gift .checker input.input-checkbox').prop('checked') && $('.gift-receipt .gift-content-with-message .gift-to-name .gift-to-name-content').html().length > 1)?true:false;\n\t\t\t\t\t\tvar manualentry=$('#addOPCAddress-section .manualentry').val();\n\t\t\t\t\t\tprogress.show($('#opcDeliveryAddresses'));\n\t\t\t\t\t\tvar phoneNumber = $('.phone-value').text().replace(/^\\s+|\\s+$/g,'');\n\t\t\t\t\t\tvar isValid = $formData.valid();\n\t\t\t\t\t\tif (isValid) {\n\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\t\turl: url,\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t'country':country,\n\t\t\t\t\t\t\t\t\t'addressid':addressid,\n\t\t\t\t\t\t\t\t\t'postCode':postCode,\n\t\t\t\t\t\t\t\t\t'address1':address1,\n\t\t\t\t\t\t\t\t\t'address2':address2,\n\t\t\t\t\t\t\t\t\t'address3':address3,\n\t\t\t\t\t\t\t\t\t'address4':address4,\n\t\t\t\t\t\t\t\t\t'city':city,\n\t\t\t\t\t\t\t\t\t'addresses':addresses,\n\t\t\t\t\t\t\t\t\t'isBillingAddress':isBillingAddress,\n\t\t\t\t\t\t\t\t\t'isGift':isGift,\n\t\t\t\t\t\t\t\t\t'manualEntry':manualentry\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tsuccess: function(data) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t$formData.find('.address-alias .input-text').on('focusin', function() {\n\t\t\t\t\t\t\t\t\t\t\t$formData.find('.address-alias .field .error-msg').remove();\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tif(data.success == false){\n\t\t\t\t\t\t\t\t\t\t\tif (data.errors && data.errors) {\n\t\t\t\t\t\t\t\t\t\t\t\t$formData.find('.error-msg').remove();\n\t\t\t\t\t\t\t\t\t\t\t\t$formData.find('.form-row.validation-error').removeClass('validation-error');\n\t\t\t\t\t\t\t\t\t\t\t\tfor (var id in data.errors) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (data.errors.hasOwnProperty(id)) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar formErrorMessage = $('<div>', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tid: id + '-error',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclass: 'error-msg',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttext: data.errors[id].replace(/\\\\'/g, '\\''),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcss: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'block'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar $formField = $formData.find('input[id*=\"'+ id + '\"]');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$formField.closest('.form-row').addClass('validation-error')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$formField.siblings('.focus-helper').hide().after(formErrorMessage);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t$formData.find('.address-alias .field').append('<div class=\"error-msg\" style=\"display:block\">' + data.data + '</div>');\n\t\t\t\t\t\t\t\t\t\t\t\t$formData.find('.address-alias').removeClass('validation-success');\n\t\t\t\t\t\t\t\t\t\t\t\t$formData.find('.address-alias .field .input-text').css('border','2px solid #c20000');\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tprogress.hide();\n\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\tvar AddressJSONStringValue, address; \n\t\t\t\t\t\t\t\t\t\t\tif(isBillingAddress == true || isBillingAddress == \"true\"){\n\t\t\t\t\t\t\t\t\t\t\t\t$('#useThisOPCBillinglocation').html(data);\n\t\t\t\t\t\t\t\t\t\t\t\tif($('#useThisOPCBillinglocation .customerAddresses').length > 0){\n\t\t\t\t\t\t\t\t\t\t\t\t\tAddressJSONStringValue = $('.checkout-billing-address .customerAddresses .input-radio:checked').attr('data-address');\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar addressFormValue = AddressJSONStringValue;\n\t\t\t\t\t\t\t\t\t\t\t\t\tfillAddressFields(addressFormValue, '.checkout-billing-address');\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar address = JSON.parse(AddressJSONStringValue),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taddressCountry = \"\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t$('.checkout-billing-address select.country').val(address.countryCode);\n\t\t\t\t\t\t\t\t\t\t\t\t\taddressCountry = $('.checkout-billing-address select.country option:selected').attr('label');\n\t\t\t\t\t\t\t\t\t\t\t\t\t$('.checkout-billing-address .styledSelect').text(addressCountry);\n\t\t\t\t\t\t\t\t\t\t\t\t\t//var label = address.ID;\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar label = address.address1;\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel += address.address2 ? ', ' + address.address2 : '';\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel += ', ' + address.city;\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel += addressCountry ? ', ' + addressCountry : '';\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel += address.postCode ? ', ' + address.postCode : '';\n\t\t\t\t\t\t\t\t\t\t\t\t\t$('.checkout-billing-address #useThisOPCBillinglocation .preferredAddress .custAddress span').html(label);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tprogress.hide();\n\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t$('.xlt-opcPageContent').html(data);\n\t\t\t\t\t\t\t\t\t\t\t\t$('#currentCheckoutStep').val('0.0');\n\t\t\t\t\t\t\t\t\t\t\t\treInitialFunction();\n\t\t\t\t\t\t\t\t\t\t\t\tif($('#currentUserAddressExist').val() == \"false\"){\n\t\t\t\t\t\t\t\t\t\t\t\t\t$('.delivery-address .xlt-continueShopping').click();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdialog.close();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} catch (b) {\n\t\t\t\t\t\t\t\t\t\t//console.log(b);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ($('#currentCheckoutStep').val() === '0.0') {\n\t\t\t\t\t\t\t\t\t\tshowPhoneSection(phoneNumber);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\terror: function(f) {\n\t\t\t\t\t\t\t\t\tprogress.hide();\n\t\t\t\t\t\t\t\t\tconsole.log(f.statusText + \" \" + f.status);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$formData.find('.focus-helper').hide();\n\t\t\t\t\t\t\tprogress.hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t \t\t\n\t \t\t$('.hide-createaddress').on('click', function(e){\n\t\t\t\t\t\t$saveButton.prop('disabled' , true);\n\t \t\t\te.preventDefault();\n\t \t\t\t$('.type-own-address').remove();\n\t \t\t\t$('#addOPCAddress-section').addClass('visually-hidden');\n\t \t\t\t$('#editOPCAddress-section').addClass('visually-hidden');\n\t \t\t\t\n\t \t\t\tif($('#setDefaultaddress-section').hasClass('visually-hidden')){\n\t \t\t\t\t$('#setDefaultaddress-section').removeClass('visually-hidden')\n\t \t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$('.addAddressOpc .form-row').removeClass('validation-error');\n\t \t\t\t$('.addAddressOpc .error-msg').hide();\n\t\t\t\t\t\t\n\t \t\t\t\t/*$('.additional-address-fields').addClass('visually-hidden');\n\t \t\t\t\t$('.additional-address-fields').removeClass('visually-un-hidden');\n\t $('.type-address-btn-new').css('display' , 'block');\n\t $('.addresses-select-group').css('display' , 'none');\n\t $('.address-check-btn').css('display' , 'block');\n $('.post-code-field').removeClass('full-width-postcode'); */\n\n\n });\n /*##### End - close the dialog/section when you click cancel button in the popup #####*/\n\n usethisOPCDeliveryLocation(); /*##### Set the default delivery address #####*/\n\n },\n close:function() {\n\n $('body').css('overflow-y','auto');\n }\n }\n });\n }\n });\n /*##### End OPC delivery address model popup box #####*/\n\n /*##### Start PaySafe Card model popup box #####*/\n $('.paysafe-card-details .paysafemodelbox').off('click').on('click', function(e){\n var url = Urls.opcPaySafeCard_PopUp,\n paysafeCardsList = $(this).attr('data-paysafeCardsList'),\n paysafeCardsJSONList = JSON.parse(paysafeCardsList),\n paysafeSelectedCard = $(this).attr('data-paysafeSelectedCard'),\n thisSelectedMethod = $('.payment-method-wrapper .payment-method input[type$=radio]:checked').closest('.payment-method').attr('class'),\n isForgetCardEnabled = $('#isForgetCardEnabled'),\n forgetCardFlag = \"false\";\n forgetCardFlag = (isForgetCardEnabled.val()==\"true\")?(thisSelectedMethod.indexOf(\"paysafe\") != -1)?\"Paysafe\":(thisSelectedMethod.indexOf(\"budgetpay\") != -1)?\"Budgetpay\":\"false\":\"false\";\n\n giftCheck();\n\n progress.show();\n if (window.dialog) {\n window.dialog.open({\n url: url,\n options:{\n dialogClass:'opcAddressListModelPopup',\n open: function(event,ui){\n $('body').css('overflow-y','hidden');\n $(\".opcAddressListModelPopup .ui-dialog-titlebar-close\").hide(); /*Hide the close icon*/\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n\n\n paysafeCardsJSONList.forEach(function(itemValues){\n var tempLabel = itemValues.cardType+': **** **** **** <b>'+itemValues.lastDigits+'</b> , Expiry: <b>'+itemValues.cardExpiry.month+'/'+itemValues.cardExpiry.year+'</b>';\n var checkedFlag = \"\";\n if(JSON.stringify(itemValues) == paysafeSelectedCard){checkedFlag=\"checked\"}\n var temp = \"<div class='form-row form-row-no-indent form-row-radio clearfix'><div class='field'>\";\n temp += \"<input class='input-radio' id='\"+itemValues.id+\"' type='radio' name='opcpaysafeCard' value='\"+JSON.stringify(itemValues)+\"' title='PaySafe cards' \"+checkedFlag+\"/><label style='text-transform: uppercase;' for='\"+itemValues.id+\"'>\"+tempLabel+\"</label>\";\n temp += \"</div><div class='buttonlinks hidden'><a href='javascript:void(0)' class='address-make-default'>Use this card</a>\";\n if(forgetCardFlag==\"Paysafe\"){\n temp += \"<a href='javascript:void(0)' data-forgetfrom='paysafe' class='address-edit paysafe'>Use and forget</a></div>\";\n }else if(forgetCardFlag==\"Budgetpay\"){\n temp += \"<a href='javascript:void(0)' data-forgetfrom='budgetpay' data-messageClass='BP\"+itemValues.id+\"' style='opacity: 0.5;' class='address-edit paysafe'>Use and forget</a>\";\n temp += \"<p class='BP\"+itemValues.id+\"' style='color:#E30613;display:none;'>You cannot delete this card as it is associated with Budgetpay order.</p></div>\";\n }\n temp += \"</div>\";\n $(\"#opcPaySafeCards .cardList\").append(temp);\n });\n\n var sUniformStyled = 'uniformstyled';\n $(['input:checkbox', 'input:radio', '.opc .existing-card-section #existing-paysafe-card']).each(function () {\n $(this + ':not(.' + sUniformStyled + ')').not('.no-uniform').addClass(sUniformStyled).uniform();\n });\n\n progress.hide();\n\n /*##### Start - Enable/Disable the links when you click the radio button #####*/\n var $checkedstatus = $(\"#opcPaySafeCards input:radio[name=opcpaysafeCard]\").filter(':checked');\n if($checkedstatus.prop(\"checked\")){\n $checkedstatus.parents('.form-row-radio').find(\".buttonlinks\").removeClass(\"hidden\");\n }\n\n $(\"#opcPaySafeCards input[name$=opcpaysafeCard]\").click(function() {\n var $this = $(this),\n $tile = $this.parents('.form-row-radio');\n $('#opcPaySafeCards .form-row-radio').find(\".buttonlinks\").addClass(\"hidden\");\n $tile.find(\".buttonlinks\").removeClass(\"hidden\");\n });\n /*##### End - Enable/Disable the links when you click the radio button #####*/\n\n /*##### Start - close the dialog/section when you click cancel button in the popup #####*/\n $('#opcPaySafeCards .closedeliverypopup').on('click', function(e){\n $(\".opcAddressListModelPopup .ui-dialog-titlebar-close\").trigger('click');\n });\n /*##### End - close the dialog/section when you click cancel button in the popup #####*/\n\n $('#opcPaySafeCards .address-make-default').off('click').on('click', function(e){\n e.preventDefault();\n progress.show();\n var opcPaySafeSelectedCards = $('#opcPaySafeCards input[name$=opcpaysafeCard]:checked').val();\n\n var itemValues = JSON.parse(opcPaySafeSelectedCards);\n var tempLabel = itemValues.cardType+': **** **** **** <b>'+itemValues.lastDigits+'</b>, Expiry: <b>'+itemValues.cardExpiry.month+'/'+itemValues.cardExpiry.year+'</b>';\n var cardType = itemValues.cardType;\n $('#existing-paysafe-cvv').val(\"\");\n if(cardType === \"Visa\" || cardType === \"MasterCard\"){\n $('#existing-paysafe-cvv').attr({maxLength: 3});\n }\n else{\n $('#existing-paysafe-cvv').attr({maxLength: 4});\n }\n $('.paysafe-card-details .paysafemodelbox').attr('data-paysafeSelectedCard',opcPaySafeSelectedCards);\n $('.paysafe-card-details .credit-card-box .firstCard').html(tempLabel);\n\n $('.paysafe-card-details').find('.selector #existing-paysafe-card').val(opcPaySafeSelectedCards);\n var selectLable = $('#existing-paysafe-card').find('option:selected').text();\n $('.paysafe-card-details').find('.selector span:first').html(selectLable);\n\n $('.paysafe-card-details .existing-card-section').css({'display':'block'});\n $('.paysafe-card-details .new-card-form').addClass('input-wrapper');\n $('.paysafe-card-details .opcPaySafeHeader .title').text('Default Card');\n $(\".opcAddressListModelPopup .ui-dialog-titlebar-close\").trigger('click');\n\n $('#uniform-existing-paysafe-forget span').removeClass('checked');\n $('#existing-paysafe-forget').prop('checked',false);\n\n enableCheckoutButton(true);\n progress.hide();\n });\n\n $('#opcPaySafeCards .address-create-container').off('click').on('click', function(e){\n e.preventDefault();\n progress.show();\n $('.paysafe-card-details').find('#existing-paysafe-card').val(\"newCard\");\n var selectLable = $('#existing-paysafe-card').find('option:selected').text();\n $('.paysafe-card-details').find('.selector span:first').html(selectLable);\n\n $('.paysafe-card-details .existing-card-section').css({'display':'none'});\n $('.paysafe-card-details .new-card-form').removeClass('input-wrapper');\n $('.paysafe-card-details .opcPaySafeHeader .title').text('New Card');\n $(\".opcAddressListModelPopup .ui-dialog-titlebar-close\").trigger('click');\n enableCheckoutButton(true);\n progress.hide();\n });\n\n $('#opcPaySafeCards .address-edit').off('click').on('click', function(e){\n e.preventDefault();\n if($(this).attr('data-forgetfrom')==\"paysafe\"){\n progress.show();\n var opcPaySafeSelectedCards = $('#opcPaySafeCards input[name$=opcpaysafeCard]:checked').val();\n\n var itemValues = JSON.parse(opcPaySafeSelectedCards);\n var tempLabel = itemValues.cardType+': **** **** **** <b>'+itemValues.lastDigits+'</b>, Expiry: <b>'+itemValues.cardExpiry.month+'/'+itemValues.cardExpiry.year+'</b>';\n $('.paysafe-card-details .paysafemodelbox').attr('data-paysafeSelectedCard',opcPaySafeSelectedCards);\n $('.paysafe-card-details .credit-card-box .firstCard').html(tempLabel);\n\n $('.paysafe-card-details').find('#existing-paysafe-card').val(opcPaySafeSelectedCards);\n var selectLable = $('#existing-paysafe-card').find('option:selected').text();\n $('.paysafe-card-details').find('.selector span:first').html(selectLable);\n\n $('.paysafe-card-details .existing-card-section').css({'display':'block'});\n $('.paysafe-card-details .new-card-form').addClass('input-wrapper');\n $('.paysafe-card-details .opcPaySafeHeader .title').text('Default Card');\n $(\".opcAddressListModelPopup .ui-dialog-titlebar-close\").trigger('click');\n\n $('#uniform-existing-paysafe-forget span').addClass('checked');\n $('#existing-paysafe-forget').prop('checked',true);\n\n enableCheckoutButton(true);\n }else if($(this).attr('data-forgetfrom')==\"budgetpay\"){\n $(\".\"+$(this).attr('data-messageClass')).show();\n }\n progress.hide();\n });\n },\n close:function() {\n $('body').css('overflow-y','auto');\n }\n }\n });\n }\n });\n /*##### End PaySafe Card model popup box #####*/\n\n $('.payment-method-wrapper .input-radio').on('click', function(){\n var classList = $(this).closest('.payment-method').attr('class');\n //$('fieldset .xlt-continueCheckout').prop('disabled',true);\n //$('form.xlt-continueCheckout').addClass('freezeSection');\n freezeSectionEvent();\n\n if(classList.indexOf(\"budgetpay\") != -1 || classList.indexOf(\"paysafe\") != -1){\n continueCheckout = \"card\";\n\n enableCheckoutButton(true);\n $('#existing-paysafe-cvv').on('keyup keydown',function(){\n var maxlength = $('#existing-paysafe-cvv').attr('maxlength');\n if($(this).val().length >= maxlength && continueCheckout==\"card\"){\n enableCheckoutButton(true);\n }else{\n enableCheckoutButton(false);\n }\n });\n }else{\n continueCheckout = \"non-card\";\n enableCheckoutButton(true);\n }\n });\n\n $(\"#existing-paysafe-cvv\").keypress(function (e) {\n if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {\n return false;\n }\n });\n\n $('form.xlt-continueCheckout').off('submit').on('submit',function(){\n var url = Urls.opcredirect;\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').addClass('freezeSection');\n\n if(document.URL.indexOf('isGuestUser=true') > 0){\n url = util.appendParamToURL(url,'isGuestUser',true);\n }\n\n //if Session timeout redirect to login page\n $.ajax({\n type: \"GET\",\n url: url,\n success: function(data) {\n try {\n if(!data.status){\n window.location.href = Urls.opcStartNode;\n return false;\n }\n } catch (b) {\n //console.log(b);\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n }\n },\n error: function(f) {\n //console.log(f.statusText + \" \" + f.status);\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n }\n });\n\n var addressFormValid = $('.checkout-addresses-form').valid();\n if(addressFormValid == false || addressFormValid == \"false\"){\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n return false;\n }\n\n var $checkoutBilling = '.checkout-billing-address',\n $checkoutShipping = '.checkout-shipping-address',\n $checkoutBillingCountry = $($checkoutBilling).find('.opcAddressFields .selector .input-select.country'),\n $checkoutBillingPostal = $($checkoutBilling).find('.opcAddressFields .additional-address-fields .postCode .input-text'),\n $checkoutBillingAddress1 = $($checkoutBilling).find('.opcAddressFields .additional-address-fields .address1 .input-text'),\n $checkoutBillingCity = $($checkoutBilling).find('.opcAddressFields .additional-address-fields .city .input-text'),\n $checkoutBillingasShipping = $('.billing .checkout-billing-address .checker input').prop('checked');\n\n if(($checkoutBillingCountry.val() == \"\" || $checkoutBillingPostal.val() == \"\" || $checkoutBillingAddress1.val() == \"\" || $checkoutBillingCity.val() == \"\")){\n billingClassFields($checkoutBillingasShipping);\n\n if(($checkoutBillingCountry.val() == \"\" || $checkoutBillingPostal.val() == \"\" || $checkoutBillingAddress1.val() == \"\" || $checkoutBillingCity.val() == \"\")){\n billingClassFields(false);\n $('.billing .checkout-billing-address .checker input').prop('checked',false);\n $('.billing .checkout-billing-address .checker span').removeClass('checked');\n $('.checkout-billing-address').parents('form').valid();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n $('html, body').animate({scrollTop: $(\".checkout-billing-address\").offset().top-60}, 500);\n return false;\n }\n }\n\n var newCard = $('.paysafe-card-details').find('#existing-paysafe-card'),\n newCardVisible = $('.paysafe-card-details').find('.new-card-form'),\n paysafeToken = $('.paysafe-card-details').find('.paysafe-token'),\n selectedCard = $('.paysafe-card-details').find('#existing-paysafe-card');\n if((newCard.val() !== 'newCard' && !newCardVisible.is(':visible'))){\n if(paysafeToken.val() == \"\"){\n paysafeToken.val(selectedCard.val());\n }\n }\n\n progress.show();\n\n var $formData = $('form.checkout-billing'),\n url = $formData.attr('action');\n\n if(document.URL.indexOf('isGuestUser=true') > 0){\n $formData.attr('action',$formData.attr('action')+'?isGuestUser=true')\n }\n\n $('#tjcCreditsFlag').val('false');\n $formData.trigger('submit');\n\n return false;\n });\n}\n\nfunction validateFieldsCount(){\n $('.additional-address-fields input[id^=\"dwfrm_checkoutaddresses_shippingAddress_address\"]').on('keyup keydown change', function(){\n validateAdditionalAddressFied(this);\n });\n\n $('.checkout-shipping-address .address-check-btn button').off('click').on('click', function(){\n $('.checkout-shipping-address .type-address-btn').off('click').on('click', function(){\n validateAllAddressFied();\n });\n $('.checkout-shipping-address .addresses-select select').on('change', function(){\n validateAllAddressFied();\n });\n });\n}\n\nfunction validateAllAddressFied(){\n $('.additional-address-fields input[id^=\"dwfrm_checkoutaddresses_shippingAddress_address\"]').each(function(){\n validateAdditionalAddressFied(this);\n });\n}\n\nfunction validateAdditionalAddressFied($this){\n var countvalue = $($this).attr('maxlength') - $($this).val().length;\n $($this).closest('.address-content').find('.addresscharacterlength .count').html(countvalue);\n if (countvalue < 1 ) {\n $($this).closest('.address-content').find('.addresscharacterlength').addClass('alert-danger');\n }\n else {\n $($this).closest('.address-content').find('.addresscharacterlength').removeClass('alert-danger');\n }\n}\n\nfunction giftCheck(){\n var giftRecipient = ($('.gift-receipt .is-gift .checker input.input-checkbox').prop('checked') && $('.gift-receipt .gift-content .gift-recipient-name .input-text').val().length > 1)?false:true;\n if(giftRecipient){\n $('.gift-receipt .is-gift .checker input.input-checkbox').prop('checked',false);\n $('.gift-receipt .is-gift .checker input.input-checkbox').val(false);\n $('.gift-receipt .is-gift .checker span').removeClass('checked');\n $(\"div[id$='_shippingAddress_isGift']\").trigger('click');\n }\n}\n\nfunction usethisOPCDeliveryLocation(){\n $('.buttonlinks .address-make-default').off('click').on('click', function(e){\n e.preventDefault();\n var url = Urls.usethisOPCDeliveryLocation,\n $addressType = $(this).attr('data-addressType'),\n addressFormValue = $(this).attr('data-address');\n var addressID = $('#opcDeliveryAddresses input[name$=opcdeliveryaddresses]:checked').val();\n url = util.appendParamToURL(url,'AddressID',addressID);\n\n if($addressType == 'delivery'){\n progress.show();\n $.ajax({\n type: \"POST\",\n url: url,\n success: function(data) {\n try {\n $('#useThisOPCDeliverylocation').html(data);\n $('#currentCheckoutStep').val('0.0');\n reInitialFunction();\n if($('#currentUserAddressExist').val() == \"false\"){\n // $('.delivery-address .xlt-continueShopping').trigger('click');\n }\n if (window.dialog) {\n window.dialog.close();\n }\n showPhoneSection();\n } catch (b) {\n //console.log(\"setDefaultAddressOPC\" + b);\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n //console.log(\"setDefaultAddressOPC\" + textStatus + errorThrown)\n }\n });\n }else if($addressType == 'billing'){\n fillAddressFields(addressFormValue, '.checkout-billing-address');\n var address = JSON.parse(addressFormValue),\n addressCountry = \"\";\n //var label = address.ID;\n $('.checkout-billing-address select.country').val(address.countryCode);\n addressCountry = $('.checkout-billing-address select.country option:selected').attr('label');\n $('.checkout-billing-address .styledSelect').text(addressCountry);\n var label = address.address1;\n label += address.address2 ? ', ' + address.address2 : '';\n label += ', ' + address.city;\n label += addressCountry ? ', ' + addressCountry : '';\n label += address.postCode ? ', ' + address.postCode : '';\n $('.checkout-billing-address #useThisOPCBillinglocation .preferredAddress .custAddress span').html(label);\n $('.opcAddressListModelPopup .closedeliverypopup').trigger('click');\n }\n });\n}\n\nfunction showPhoneSection(phoneNumber) {\n if (phoneNumber) {\n $('.phone-input-section input').val(phoneNumber);\n }\n $('.phone-input-section').removeClass('hidden');\n $('.phone-value').addClass('hidden');\n $('.delivery-address .xlt-continueShopping').removeClass('hidden');\n $('#useThisOPCDeliverylocation .preferredAddress .custName span:first').addClass('hidden');\n progress.hide();\n setTimeout(function() {\n $('html').stop(true, false).animate({ scrollTop: 0 }, \"fast\");\n }, 500);\n}\n\nfunction editOPCaddress(){\n $('#setDefaultaddress-section .address-edit').on('click', function(e){\n e.preventDefault();\n $('#setDefaultaddress-section').addClass('visually-hidden');\n\n if($('#editOPCAddress-section').hasClass('visually-hidden')){\n $('#editOPCAddress-section').removeClass('visually-hidden')\n }\n\n var url = Urls.opcEditaddress,\n addressID = $('#opcDeliveryAddresses input[name$=opcdeliveryaddresses]:checked').val(),\n url = util.appendParamToURL(url,'AddressID',addressID);\n progress.show();\n $.ajax({\n type: \"POST\",\n url: url,\n success: function(data) {\n try {\n $('#editOPCAddress').html(data);\n /*$('<div class=\"form-row form-row-button type-address-btn-new\"> <a class=\"button-new showmore\">Enter Address Manually </a> </div>').insertAfter(\".editOPCaddress .post-code-field\");*/\n $('<div class=\"form-row form-row-button enable-find-my-address\"><a class=\"showmore\">Use Address Finder </a></div>').insertAfter(\".editOPCaddress .address-content-last\");\n progress.hide();\n //reInitialFunction();\n address.init()\n validator.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n $('.countrycheck select.country').trigger('blur');\n $('.editOPCaddress .editOPCdeliverylocation').off('click').on('click', function(e){\n var $formData = $(this).closest('form');\n var addressID = $('#opcDeliveryAddresses input[name$=opcdeliveryaddresses]:checked').val();\n var isEnterAddressManullyActive = $formData.find('.addresses-select').hasClass('visually-hidden');\n \n var url = Urls.opcSaveEditaddress;\n url = util.appendParamToURL(url,'AddressID',addressID);\n\n if (isEnterAddressManullyActive) {\n $formData.validate({\n ignore: \".postcode-data8\"\n });\n }\n if($formData.find('.selected-address-summary').hasClass('visually-hidden') && !isEnterAddressManullyActive){\n e.preventDefault();\n $formData.find('.post-code-field .form-row').removeClass('validation-success').addClass('validation-error');\n $formData.find('.post-code-field .form-row .field').append('<div class=\"error-msg\">Please select valid address</div>');\n return false;\n } else {\n $formData.find('.post-code-field .form-row').removeClass('validation-success').removeClass('validation-error');\n }\n\n var isValid = $formData.valid();\n\n if(isValid == \"false\" || isValid == false){\n return false;\n }\n\n $.ajax({\n type: \"POST\",\n data: $formData.serialize(),\n url: url,\n success: function(data) {\n try {\n if (window.dialog) {\n window.dialog.close();\n }\n $('.checkout-shipping-address .addressmodelbox').trigger('click');\n } catch (b) {\n //console.log(\"EditOPCAddress\" + b);\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n //console.log(\"EditOPCAddress\" + textStatus + errorThrown)\n }\n });\n });\n } catch (b) {\n // console.log(b);\n }\n },\n error: function(f) {\n // console.log(f.statusText + \" \" + f.status)\n }\n });\n });\n}\n\nfunction billingClassFields(checkedFlag){\n var $billingClass = $('.billing .checkout-billing-address');\n if(checkedFlag == true || checkedFlag == \"true\"){\n $billingClass.find('.opcDeliveryAddress').css({'display':'none'});\n $billingClass.find('#useThisOPCBillinglocation').css({'display':'none'});\n $billingClass.find('.opcAddressFields').css({'display':'none'});\n if($('#useThisOPCDeliverylocation .customerAddresses').length > 0){\n var addressFormValue = $('.checkout-shipping-address .customerAddresses .input-radio:checked').attr('data-address');\n if(typeof addressFormValue === 'undefined')\n addressFormValue = $('.checkout-shipping-address .customerAddresses .input-radio:first').attr('data-address');\n fillAddressFields(addressFormValue, '.checkout-billing-address');\n var address = JSON.parse(addressFormValue),\n addressCountry = \"\";\n $('.checkout-billing-address select.country').val(address.countryCode);\n addressCountry = $('.checkout-billing-address select.country option:selected').attr('label');\n $('.checkout-billing-address .styledSelect').text(addressCountry);\n //var label = address.ID;\n var label = address.address1;\n label += address.address2 ? ', ' + address.address2 : '';\n label += ', ' + address.city;\n label += addressCountry ? ', ' + addressCountry : '';\n label += address.postCode ? ', ' + address.postCode : '';\n $('.checkout-billing-address #useThisOPCBillinglocation .preferredAddress .custAddress span').html(label);\n }else{\n fillAddressFields(null, null,'.checkout-shipping-address', '.checkout-billing-address');\n }\n }else{\n $billingClass.find('.opcDeliveryAddress').css({'display':'block'});\n $billingClass.find('#useThisOPCBillinglocation').css({'display':'block'});\n $billingClass.find('.opcAddressFields').css({'display':'block'});\n }\n}\n\nfunction fillAddressFields(addressFormValue, parentClass, fromForm, toForm){\n if(parentClass!=null){\n var JSONaddressFormValue = JSON.parse(addressFormValue);\n $(parentClass).find('.opcAddressFields .input-select.country').val(JSONaddressFormValue.countryCode);\n var selectLable = $(parentClass).find('.opcAddressFields .input-select.country option:selected').attr('label');\n $(parentClass).find('.opcAddressFields .selector span').html(selectLable);\n //$(parentClass).find('.opcAddressFields .post-code-field .input-text').val(JSONaddressFormValue.postCode);\n $(parentClass).find('.opcAddressFields .additional-address-fields .address1 .input-text').val(JSONaddressFormValue.address1);\n $(parentClass).find('.opcAddressFields .additional-address-fields .address2 .input-text').val(JSONaddressFormValue.address2);\n $(parentClass).find('.opcAddressFields .additional-address-fields .address3 .input-text').val(JSONaddressFormValue.address3);\n $(parentClass).find('.opcAddressFields .additional-address-fields .address4 .input-text').val(JSONaddressFormValue.address4);\n $(parentClass).find('.opcAddressFields .additional-address-fields .city .input-text').val(JSONaddressFormValue.city);\n $(parentClass).find('.opcAddressFields .additional-address-fields .postCode .input-text').val(JSONaddressFormValue.postCode);\n }else{\n var countryCode = $(fromForm).find('.opcAddressFields .input-select.country').val(),\n selectLable = $(fromForm).find('.opcAddressFields .input-select.country option:selected').attr('label'),\n postCode = $(fromForm).find('.opcAddressFields .post-code-field .input-text').val();\n\n $(toForm).find('.opcAddressFields .input-select.country').val(countryCode);\n $(toForm).find('.opcAddressFields .selector span').html(selectLable);\n $(toForm).find('.opcAddressFields .post-code-field .input-text').val(postCode);\n\n $.each(['address1', 'address2', 'address3', 'address4', 'locality', 'city', 'postCode'], function (i, attribute) {\n var value = $(fromForm).find('.additional-address-fields input[name$=' + attribute + ']').val();\n $(toForm).find('.additional-address-fields input[name$=' + attribute + ']').val(value);\n });\n }\n}\n\nfunction isDecimal(number) {\n return new RegExp(/^[-+]?[0-9]+\\.[0-9]+$/).test(number) === true;\n}\n\nfunction checkoutStepFunction() {\n $('.checkout-billing-methods #cart-shippingmethod-form').addClass('freezeSection');\n $('.payment .paymentMethod').addClass('freezeSection');\n //$('form.xlt-continueCheckout').addClass('freezeSection');\n //$('.cart-coupon-code').addClass('freezeSection');\n $('.couponsList').addClass('freezeSection');\n switch($('#currentCheckoutStep').val()){\n case \"0.0\":\n $('.couponsList').removeClass('freezeSection');\n if($('#continueButtonShow').val() == \"true\" && $('#checkoutError').val() == \"false\"){\n paymentErrorMessage = \"\";\n paymentErrorType = \"\";\n $('.xlt-continueShopping button submit-button').find();\n $('.xlt-continueShopping button submit-button').addClass('visible');\n if ($('.phone-input-section').length === 0) {\n $('.delivery-address .xlt-continueShopping').trigger('click');\n }\n }else if($('#currentUserAddressExist').val() == \"true\" && $('#checkoutError').val() == \"true\"){\n if($('.checkout-summary form.checkout-billing .billing-error').length >= 1){\n paymentErrorMessage = $('.checkout-summary form.checkout-billing .billing-error').text();\n paymentErrorType = \"billing-error\";\n }else if($('.checkout-summary form.checkout-billing .error-form').length >= 1){\n paymentErrorMessage = $('.checkout-summary form.checkout-billing .error-form').text();\n paymentErrorType = \"error-form\";\n }\n $('.delivery-address .xlt-continueShopping').trigger('click');\n }\n break;\n case \"1.0\":\n $('.checkout-billing-methods #cart-shippingmethod-form').removeClass('freezeSection');\n $('.xlt-continueShopping button submit-button').removeClass('visible');\n $('.xlt-continueShopping button submit-button').addClass('hidden');\n $('.payment .paymentMethod').removeClass('freezeSection');\n //$('.cart-coupon-code').removeClass('freezeSection');\n $('.couponsList').removeClass('freezeSection');\n if ($('.post-code-field-opc').find('.validation-success').length === 0) {\n $('.opcAddressFields .additional-address-fields').removeClass('visually-hidden');\n }\n if(typeof paymentErrorMessage !== 'undefined' && typeof paymentErrorType !== 'undefined' && paymentErrorType != \"\" && paymentErrorMessage != \"\"){\n if($('.checkout-summary form.checkout-billing .'+paymentErrorType).length < 2){\n $('.checkout-summary form.checkout-billing').prepend(\"<div class='\"+paymentErrorType+\"'>\"+paymentErrorMessage+\"</div>\");\n var totalPrice = $('.order-total.order-full-total td')[1];\n var $gtmprice;\n if (totalPrice) {\n $gtmprice = totalPrice.textContent;\n } else {\n $gtmprice = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'Payment Error',\n 'errorMessage': paymentErrorType+': '+paymentErrorMessage.trim(),\n 'price': $gtmprice\n }\n });\n }\n }\n var couponFormClass = $('.xlt-cart-coupon-form .form-row').attr('class');\n if(couponFormClass.indexOf(\"validation-error\") == -1 && typeof pageAJAXRefreshFlag !== 'undefined' && pageAJAXRefreshFlag == true){\n $('html, body').animate({scrollTop: $(\"#checkout-billing-methods\").offset().top-60}, 500);\n pageAJAXRefreshFlag = false;\n }else{\n $(\"html\").stop(true, false).animate({ scrollTop: 0 }, \"fast\");\n var couponErrorActive = $('.xlt-cart-coupon-form .form-row .error-msg .active:visible').length,\n couponErrorAlready = $('.xlt-cart-coupon-form .form-row .error-msg .already:visible').length,\n couponErrorMessage = '';\n if(couponErrorActive > 0){\n couponErrorMessage = $('.xlt-cart-coupon-form:visible .form-row .error-msg .active').text();\n }else if(couponErrorAlready > 0){\n couponErrorMessage = $('.xlt-cart-coupon-form:visible .form-row .error-msg .already').text();\n }else{\n couponErrorMessage = $('.xlt-cart-coupon-form:visible .form-row .error-msg .couponstatus').text();\n }\n if(couponErrorMessage != '' && couponErrorMessage != 'null'){\n $(document).trigger('checkout:promoCodeError');\n }\n }\n break;\n default:\n break;\n }\n}\n\nfunction enableCheckoutButton(flagValue){\n if($('#isOPCPage').val() == \"true\" && flagValue == true && typeof continueCheckout !== 'undefined'){\n if(continueCheckout == \"card\"){\n if($('#existing-paysafe-card').val() == \"newCard\" || $('#existing-paysafe-card').length == 0){\n var cardNumberValid = $('.new-card-form #cardNumber').hasClass('success'),\n cardExpiryValid = $('.new-card-form #cardExpiry').hasClass('success'),\n cardCVVValid = $('.new-card-form #cardCVC').hasClass('success');\n if(cardNumberValid && cardExpiryValid && cardCVVValid){\n $('fieldset .xlt-continueCheckout').prop('disabled',false);\n $('form.xlt-continueCheckout').removeClass('freezeSection');\n freezeSectionEventAction();\n }else{\n //$('fieldset .xlt-continueCheckout').prop('disabled',true);\n //$('form.xlt-continueCheckout').addClass('freezeSection');\n freezeSectionEvent();\n }\n }else{\n if($('#existing-paysafe-cvv').val().length > 0){\n $('fieldset .xlt-continueCheckout').prop('disabled',false);\n $('form.xlt-continueCheckout').removeClass('freezeSection');\n freezeSectionEventAction();\n }else{\n //$('fieldset .xlt-continueCheckout').prop('disabled',true);\n //$('form.xlt-continueCheckout').addClass('freezeSection');\n freezeSectionEvent();\n }\n }\n }else if(continueCheckout == \"non-card\"){\n $('fieldset .xlt-continueCheckout').prop('disabled',false);\n $('form.xlt-continueCheckout').removeClass('freezeSection');\n freezeSectionEventAction();\n }else{\n //$('fieldset .xlt-continueCheckout').prop('disabled',true);\n //$('form.xlt-continueCheckout').addClass('freezeSection');\n freezeSectionEvent();\n }\n }else if($('#isOPCPage').val() == \"true\" && flagValue == false){\n //$('fieldset .xlt-continueCheckout').prop('disabled',true);\n //$('form.xlt-continueCheckout').addClass('freezeSection');\n freezeSectionEvent();\n }\n}\n\nfunction freezeSectionEvent(){\n $('.freezeSection').parent('div, fieldset').off('click').on('click',function(e){\n freezeSectionEventAction();\n });\n}\nfunction freezeSectionEventAction(){\n var addressFormValid = $('.checkout-addresses-form').valid(),\n addressSubmitVisible = $('.xlt-addressForm button.xlt-continueShopping').is(\":visible\") && !$('.xlt-addressForm button.xlt-continueShopping').hasClass(\"visually-hidden\");\n if(addressFormValid == false || addressFormValid == \"false\"){\n opcFormValidation();\n if ($(\".delivery .required-indicator:visible\").length > 0) {\n $('html').stop(true, false).animate({scrollTop: $(\".delivery .required-indicator:visible\").offset().top-70}, 500);\n }\n $('.checkout-billing-methods #cart-shippingmethod-form').addClass('freezeSection');\n $('.payment .paymentMethod').addClass('freezeSection');\n return false;\n }else{\n var formFields = \"\";\n $.each(['.guestDetails', '.delivery-address'], function (i, attribute) {\n if($(attribute).find('.validation-error').length > 0){\n }else{\n $(attribute).find('.required-indicator').css('display','none');\n }\n });\n if(formFields.indexOf(\".guestDetails\") > -1){\n }else{\n $('.customFreezeMessageDeliveryContact').hide();\n }\n if(formFields.indexOf(\".delivery-address\") > -1){\n }else{\n $('.customFreezeMessageDeliveryAddress').hide();\n }\n }\n if(addressSubmitVisible == true || addressSubmitVisible == \"true\"){\n $(\".xlt-addressForm button.xlt-continueShopping\").css({'box-shadow':'0 0 10px #BBBBBB','font-weight':'bold'});\n $('html').stop(true, false).animate({scrollTop: $(\".xlt-addressForm button.xlt-continueShopping\").offset().top-10}, 500);\n return false;\n }\n if(typeof continueCheckout !== 'undefined'){\n if(continueCheckout == \"card\"){\n if($('#existing-paysafe-card').val() == \"newCard\" || $('#existing-paysafe-card').length == 0){\n var cardNumberValid = $('.new-card-form #cardNumber').hasClass('success'),\n cardExpiryValid = $('.new-card-form #cardExpiry').hasClass('success'),\n cardCVVValid = $('.new-card-form #cardCVC').hasClass('success');\n if(cardNumberValid && cardExpiryValid && cardCVVValid){\n $('.paymentMethod').find('.required-indicator').css('display','none');\n $('.customFreezeMessagePayment').hide();\n }else{\n $('.paymentMethod').find('.required-indicator').css('display','unset');\n if($('.customFreezeMessagePayment:visible').length < 1){\n $(\"<div style='margin-bottom:10px;' class='customErrorMessage customFreezeMessagePayment'>Please complete payment details</div>\").insertBefore( \".payment .paymentMethod legend:first\");\n }\n if ($(\".required-indicator:visible\").length > 0) {\n $('html').stop(true, false).animate({scrollTop: $(\".required-indicator:visible\").offset().top-70}, 500);\n }\n }\n }else{\n if($('#existing-paysafe-cvv').val().length > 0){\n $('.paymentMethod').find('.required-indicator').css('display','none');\n $('.customFreezeMessagePayment').hide();\n $('.existing-card-options #existing-paysafe-cvv').removeClass('validation-error');\n $('.existing-card-options .cvv-input-error').hide();\n }else{\n $('.paymentMethod').find('.required-indicator').css('display','unset');\n $('.existing-card-options #existing-paysafe-cvv').addClass('validation-error');\n $('.existing-card-options .cvv-input-error').show();\n if($('.customFreezeMessagePayment:visible').length < 1){\n $(\"<div style='margin-bottom:10px;' class='customErrorMessage customFreezeMessagePayment'>Please complete payment details</div>\").insertBefore( \".payment .paymentMethod legend:first\");\n }\n if ($(\".required-indicator:visible\").length > 0) {\n $('html').stop(true, false).animate({scrollTop: $(\".required-indicator:visible\").offset().top-70}, 500);\n }\n }\n }\n }else if(continueCheckout == \"non-card\"){\n $('.paymentMethod').find('.required-indicator').css('display','none');\n $('.customFreezeMessagePayment').hide();\n }\n return false;\n }\n}\nfunction opcFormValidation(){\n var formFields = \"\",\n customFreezeFlag = false;\n $.each(['.guestDetails', '.delivery-address'], function (i, attribute) {\n if($(attribute).find('.validation-error').length > 0){\n $(attribute).find('.required-indicator').css('display','unset');\n formFields += attribute;\n }else{\n $(attribute).find('.required-indicator').css('display','none');\n }\n });\n if(formFields.indexOf(\".guestDetails\") > -1 && !customFreezeFlag){\n if($('.customFreezeMessageDeliveryContact:visible').length < 1){\n $(\"<div style='margin-bottom:20px;' class='customErrorMessage customFreezeMessageDeliveryContact'>Please complete contact details</div>\").insertBefore( \".delivery .guestDetails legend:first\");\n }\n customFreezeFlag = true;\n }else{\n $('.customFreezeMessageDeliveryContact').hide();\n }\n if(formFields.indexOf(\".delivery-address\") > -1 && !customFreezeFlag){\n if($('.customFreezeMessageDeliveryAddress:visible').length > 0){$('.customFreezeMessageDeliveryAddress').remove();}\n if($('.customFreezeMessageDeliveryAddress:visible').length < 1 && $(\".gift-content .gift-save-button\").is(\":visible\") == false && !$('.addresses-select-group .addresses-select').hasClass('loqate-select')){\n $(\"<div style='margin-bottom:20px;' class='customErrorMessage customFreezeMessageDeliveryAddress'>Please complete delivery address details</div>\").insertBefore( \".delivery .delivery-address legend:first\");\n }\n customFreezeFlag = true;\n }else{\n $('.customFreezeMessageDeliveryAddress').hide();\n }\n}\n\nfunction reInitialFunction(){\n initClearPayModalEvents();\n if($('#isOPCPage').val()==\"true\"){\n if(typeof paymentTriggeredClass !== 'undefined' && paymentTriggeredClass != \"\"){\n if(paymentTriggeredClass.indexOf(\"paysafe\") != -1){\n $('.payment-method-wrapper .payment-method.paysafe .field').find('input.input-radio').prop('checked', true);\n }else if(paymentTriggeredClass.indexOf(\"budgetpay\") != -1){\n $('.payment-method-wrapper .payment-method.budgetpay .field').find('input.input-radio').prop('checked', true);\n }else if(paymentTriggeredClass.indexOf(\"paypal-credit\") != -1){\n $('.payment-method-wrapper .payment-method.paypal-credit .field').find('input.input-radio').prop('checked', true);\n }else if(paymentTriggeredClass.indexOf(\"paypal\") != -1){\n $('.payment-method-wrapper .payment-method.paypal .field').find('input.input-radio').prop('checked', true);\n }\n }\n\n if($('.paymentMethod .checkout-summary .payment-methods').length > 0 && $('#payment-form .new-card-form iframe').length < 3){\n paysafe.init();\n }\n\n if (window._dw && window._dw.applepay) {\n applePay.init('checkout');\n }\n\n if (window.gpayPreferences && window.gpayPreferences.isGpayEnabledOnCheckout) {\n window.gpayPreferences.isExpressCheckout = false;\n\n if (typeof onGooglePayLoaded === 'function') {\n onGooglePayLoaded({\n buttonType: 'pay',\n buttonSizeMode: 'static',\n });\n } else {\n var gPayPaymentMethod = $('.payment-method.google-pay');\n\n if (gPayPaymentMethod.length > 0) {\n gPayPaymentMethod.hide();\n }\n }\n }\n\n if($('#currentCheckoutStep').val() == '1.0'){\n $('.payment-method-wrapper .payment-method.paysafe .field').find('input.input-radio').prop('checked', true);\n }\n\n var sUniformStyled = 'uniformstyled';\n $(['input:checkbox', 'input:radio', '.opc .existing-card-section #existing-paysafe-card']).each(function () {\n $(this + ':not(.' + sUniformStyled + ')').not('.no-uniform').addClass(sUniformStyled).uniform();\n });\n\n var shippingMethodsDescriptionJSON = JSON.parse(Resources.ShippingMethods_CheckoutDescription), method_id, method_labelText;\n $.each(shippingMethodsDescriptionJSON, function(key, data){\n method_id = $('input[value='+key+']').attr('id');\n method_labelText = $('label[for='+method_id+']').text();\n if (method_labelText.indexOf(data) === -1) {\n $('label[for='+method_id+']').html(method_labelText + '<span class=\"delivery-method-description\">('+data+')</span>');\n }\n });\n\n initialFunction();\n\n validator.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n }else{\n paysafe.init();\n }\n\n if ($('.checkout-summary')) {\n billing.init();\n }\n\n if ($('.checkout-addresses-form')) {\n address.init();\n }\n\n //if on the order review page and there are products that are not available diable the submit order button\n if ($('.order-summary-footer').length > 0) {\n if ($('.notavailable').length > 0) {\n $('.order-summary-footer .submit-order .button-fancy-large').attr('disabled', 'disabled');\n }\n }\n\n tabs.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n\n if($('#isOPCPage').length == 0){\n $('form.checkout-billing').on('submit',function(){\n var newCard = $('.paysafe-card-details').find('#existing-paysafe-card'),\n newCardVisible = $('.paysafe-card-details').find('.new-card-form'),\n paysafeToken = $('.paysafe-card-details').find('.paysafe-token'),\n selectedCard = $('.paysafe-card-details').find('#existing-paysafe-card');\n if((newCard.val() !== 'newCard' && !newCardVisible.is(':visible'))){\n if(paysafeToken.val() == \"\"){\n paysafeToken.val(selectedCard.val());\n }\n }\n });\n }\n\n if($('#isOPCPage').val()==\"true\"){\n if(typeof paymentTriggeredClass !== 'undefined' && paymentTriggeredClass != \"\"){\n $('.payment-method-wrapper .payment-method input[type$=radio]').trigger('change');\n setTimeout(function(){\n if(paymentTriggeredClass.indexOf(\"paysafe\") != -1){\n $('.payment-method-wrapper .payment-method.paysafe input').trigger('click');\n continueCheckout = \"card\";\n }else if(paymentTriggeredClass.indexOf(\"budgetpay\") != -1){\n $('.payment-method-wrapper .payment-method.budgetpay input').trigger('click');\n continueCheckout = \"card\";\n }else if(paymentTriggeredClass.indexOf(\"paypal-credit\") != -1){\n $('.payment-method-wrapper .payment-method.paypal-credit input').trigger('click');\n continueCheckout = \"non-card\";\n enableCheckoutButton(true);\n }else if(paymentTriggeredClass.indexOf(\"paypal\") != -1){\n $('.payment-method-wrapper .payment-method.paypal input').trigger('click');\n continueCheckout = \"non-card\";\n enableCheckoutButton(true);\n }\n }, 500);\n }\n\n if($('#currentCheckoutStep').val() == '1.0'){\n $('.payment-method-wrapper .payment-method input[type$=radio]').trigger('change');\n setTimeout(function(){\n $('.payment-method-wrapper .payment-method.paysafe input').trigger('click');\n continueCheckout = \"card\";\n setTimeout(function(){ $('#existing-paysafe-cvv:visible').trigger('focus'); $('#existing-paysafe-cvv:visible').trigger('click'); }, 500);\n }, 500);\n }\n\n checkoutStepFunction();\n\n freezeSectionEvent();\n\n $('.additional-address-fields input[id^=\"dwfrm_checkoutaddresses_shippingAddress_address\"]').each(function(){\n var countvalue = $(this).attr('maxlength') - $(this).val().length;\n $(this).closest('.address-content').find('.addresscharacterlength .count').html(countvalue);\n if (countvalue < 1 ) {\n $(this).closest('.address-content').find('.addresscharacterlength').addClass('alert-danger');\n } else {\n $(this).closest('.address-content').find('.addresscharacterlength').removeClass('alert-danger');\n }\n });\n }\n\n $('.existing-cards').on('blur', function() {\n if( $(this).val().length > 0 ) {\n $(this).removeClass('validation-error');\n $('.cvv-input-error').hide();\n }else{\n $(this).addClass('validation-error');\n $('.cvv-input-error').show();\n }\n });\n\n // Start Checkout SignIn\n if (window.SitePreferences.NEW_GUEST_CHECKOUT) {\n checkoutsignin();\n }\n // End Checkout SignIn\n\n initGoogleRecaptchaV3();\n\n function initClearPayModalEvents() {\n\t\t\n\t\t$('.afterpay-link').on('click', function(e) {\n\t\t\te.preventDefault();\n\n\t\t\tvar modalRegion = $(this).attr('data-afterpay-modal');\n\t\t\tvar afterPay = window.AfterPay;\n\n\t\t\tif (afterPay) {\n\t\t\t\tafterPay.launchModal(modalRegion);\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunction disguisePassword(){\n $('.icon-password').off('click').on('click', function () {\n var $this = $(this), $passwordField = $this.closest('.js-checkout-password').find('.input-text');\n\n if (!$this.hasClass('show')) {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'password');\n } else {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'text');\n }\n $this.toggleClass('show');\n });\n}\n\nfunction validateEmail(email) {\n var emailPattern = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/;\n var isValid = emailPattern.test($.trim(email));\n return isValid;\n}\n\nfunction checkoutsignin() {\n $('input[id^=\"dwfrm_checkoutaddresses_customerinfo_email_\"]').on('blur', function() {\n $('input[id^=\"dwfrm_login_username_\"]').val($(this).val());\n });\n\n if($('.js-checkout-login #dwfrm_login .message-content').length) {\n $('.js-checkout-signin-button').removeClass('hidden');\n $('.js-checkout-loginin-button').removeAttr('disabled');\n $('.registration-social-login').addClass('hidden');\n $('.js-checkout-signin-social-button').addClass('hidden');\n $('.js-checkout-password').removeClass('hidden');\n $('.js-checkout-forgot-password').removeClass('hidden');\n $('.js-continueasguest').removeClass('hidden');\n $('.addtomaillist').addClass('hidden');\n $('.js-external-authenicate-message').removeClass('hidden');\n $('.account-signin').addClass('hidden');\n disguisePassword();\n $('.checkout-social-signin, .checkout-signin').removeClass('multi-line');\n } else {\n $('.account-signin').removeClass('hidden');\n }\n\n var $input = $('input[id^=\"dwfrm_login_username_\"]');\n var debounce;\n if ($('.js-checkout-login').length > 0 && $('.js-checkout-login').hasClass('hidden')) {\n $('.js-checkoutaddress-email').removeClass('hidden');\n } else {\n $('.js-checkoutaddress-email').addClass('hidden');\n }\n \n $input.on('change', function() {\n var $this = $(this);\n var $form = $this.closest('form');\n var inputEmail = $this.val().trim();\n var isEmailValid = validateEmail(inputEmail);\n\n if (isEmailValid) {\n $('.js-checkoutaddress-email').val(inputEmail);\n $('input[id^=\"dwfrm_checkoutaddresses_customerinfo_email_\"]').val(inputEmail);\n $('input[id^=\"dwfrm_checkoutaddresses_customerinfo_email_\"]').attr('value', inputEmail);\n var url = util.appendParamsToUrl(Urls.checkCustomerRegistration, {'email':$input.val()});\n\n clearTimeout(debounce);\n debounce = setTimeout(function () {\n $('.js-checkout-loginin-button').removeAttr('disabled');\n\n $.ajax({\n url: url,\n type: 'GET',\n success: function (data) {\n var result = JSON.parse(data);\n\n var isData8Valid = true;\n if (window.SitePreferences.DATA8_ENABLED && result.response.data8) {\n var data8Obj = result.response.data8;\n var responseCode = data8Obj.responseCode;\n isData8Valid = (\n (responseCode === \"Valid\") ||\n (responseCode === \"CatchAll\" && data8Obj.isValidCatchAllowed) ||\n (responseCode === \"Inconclusive\" && data8Obj.isInconclusiveAllowed) ||\n (responseCode === \"GreyListed\" && data8Obj.isGreyListedAllowed)\n );\n }\n\n if (!result.error && result.response.customerFound === true && isData8Valid) {\n if (result.response.isExternallyAuthenticated === true) {\n // Display social login buttons\n $('.js-checkout-signin-social-button').removeClass('hidden');\n $('#Google').removeClass('hidden');\n $('#appleid-signin').removeClass('hidden');\n\n if (result.response.authenticationProvider.includes('google') && result.response.authenticationProvider.includes('apple')) {\n $('.checkout-social-signin, .checkout-signin').addClass('multi-line');\n } else {\n $('.checkout-social-signin, .checkout-signin').removeClass('multi-line');\n }\n\n if (!result.response.authenticationProvider.includes('google')) {\n $('#Google').addClass('hidden');\n }\n if (!result.response.authenticationProvider.includes('apple')) {\n $('#appleid-signin').addClass('hidden');\n }\n $('.js-checkout-signin-button').addClass('hidden');\n $('.js-checkout-loginin-button').attr('disabled', true);\n $('.registration-social-login').removeClass('hidden');\n $('.js-checkout-password').addClass('hidden');\n $('.js-checkout-forgot-password').addClass('hidden');\n $('.js-continueasguest').removeClass('hidden');\n $('.addtomaillist').addClass('hidden');\n $('.js-external-authenicate-message').removeClass('hidden');\n $('.account-signin').addClass('hidden');\n } else {\n // Display signin buttons\n $('.js-checkout-signin-button').removeClass('hidden');\n $('.js-checkout-loginin-button').removeAttr('disabled');\n $('.registration-social-login').addClass('hidden');\n $('.js-checkout-signin-social-button').addClass('hidden');\n $('.js-checkout-password').removeClass('hidden');\n $('.js-checkout-forgot-password').removeClass('hidden');\n $('.js-continueasguest').removeClass('hidden');\n $('.addtomaillist').addClass('hidden');\n $('.js-external-authenicate-message').removeClass('hidden');\n $('.account-signin').addClass('hidden');\n disguisePassword()\n $('.checkout-social-signin, .checkout-signin').removeClass('multi-line');\n }\n } else {\n // Display only Checkout As Guest\n $('.js-checkout-signin-button').addClass('hidden');\n $('.js-checkout-loginin-button').attr('disabled', true);\n $('.registration-social-login').addClass('hidden');\n $('.js-checkout-signin-social-button').addClass('hidden');\n $('.js-checkout-password').addClass('hidden');\n $('.js-checkout-forgot-password').addClass('hidden');\n $('.js-continueasguest').addClass('hidden');\n $('.addtomaillist').removeClass('hidden');\n $('.js-external-authenicate-message').addClass('hidden');\n $('.checkout-social-signin, .checkout-signin').removeClass('multi-line');\n\n util.removeGeneralFormError($form);\n }\n }\n });\n }, 1000);\n } else {\n showGuestCheckout();\n }\n });\n\n function showGuestCheckout() {\n $('.js-checkout-signin-button').addClass('hidden');\n $('.js-checkout-loginin-button').attr('disabled', true);\n $('.registration-social-login').addClass('hidden');\n $('.js-checkout-signin-social-button').addClass('hidden');\n $('.js-checkout-password').addClass('hidden');\n $('.js-checkout-forgot-password').addClass('hidden');\n $('.js-continueasguest').addClass('hidden');\n $('.addtomaillist').removeClass('hidden');\n $('.js-external-authenicate-message').addClass('hidden');\n $('.account-signin').removeClass('hidden');\n $('.checkout-social-signin, .checkout-signin').removeClass('multi-line');\n }\n\n $input.on('blur', function() {\n var inputEmail = $(this).val().trim();\n if (inputEmail === \"\") {\n $('.js-checkout-signin-button').addClass('hidden');\n $('.js-checkout-loginin-button').attr('disabled', true);\n $('.registration-social-login').addClass('hidden');\n $('.js-checkout-signin-social-button').addClass('hidden');\n $('.js-checkout-password').addClass('hidden');\n $('.js-checkout-forgot-password').addClass('hidden');\n $('.js-continueasguest').addClass('hidden');\n $('.addtomaillist').removeClass('hidden');\n $('.js-external-authenicate-message').addClass('hidden');\n $('.account-signin').removeClass('hidden');\n $('.checkout-social-signin, .checkout-signin').removeClass('multi-line');\n }\n });\n\n $(\".js-continueasguest\").on('click', function(e){\n e.preventDefault();\n $('.js-checkout-signin-button').addClass('hidden');\n $('.js-checkout-loginin-button').attr('disabled', true);\n $('.registration-social-login').addClass('hidden');\n $('.js-checkout-signin-social-button').addClass('hidden');\n $('.js-checkout-password').addClass('hidden');\n $('.js-checkout-forgot-password').addClass('hidden');\n $('.js-continueasguest').addClass('hidden');\n $('.addtomaillist').removeClass('hidden');\n $('.js-external-authenicate-message').addClass('hidden');\n if($('.js-checkout-login #dwfrm_login .message-content').length) {\n $('.js-checkout-login #dwfrm_login .message.error-form').remove()\n }\n });\n}\n\nfunction initGoogleRecaptchaV3() {\n $('.login-submit-js').off('click').on('click', function (event) {\n event.preventDefault();\n var button = $(this);\n var $form = $(event.target).closest('.login-form');\n if ($form.valid()) {\n $('<input>')\n .attr({\n type: 'hidden', \n name: button.attr('name'),\n value: button.attr('value')\n })\n .appendTo($form);\n\n if (window.SitePreferences.EnableGoogleRecaptchaLogin) {\n handleRecaptcha($form);\n } else {\n loginForm($form); \n }\n }\n });\n}\n \n\nfunction handleRecaptcha($form) {\n grecaptcha.ready(function () {\n grecaptcha.execute(window.SitePreferences.SiteKeyGoogleRecaptchaV3, { action: 'formSubmit' }).then(function (token) {\n $(\".grecaptcharesponse-js\").val(token);\n loginForm($form);\n }.bind(this));\n }.bind(this));\n}\n\nfunction loginForm($form) {\n $form.trigger(\"submit\");\n $form.addClass('btn-loader');\n}\n\nfunction getFormatedAmount(amount){\n return parseInt(parseFloat(amount).toFixed(2).replace('.',''));\n}\n\n/**\n * @function Initializes the page events depending on the checkout stage (shipping/billing)\n */\nmodule.exports = {\n init: reInitialFunction,\n enableCheckoutButton: enableCheckoutButton,\n};\n", "'use strict';\n\nvar nbDatalayer = require(15),\n tjcplusactivation = require(43),\n util = require(46);\n\nfunction init() {\n var productBundling = require(27);\n var quickView = require(39);\n var addToCart = require(22);\n\n if (window.gtmDatalayer && typeof window.gtmDatalayer.pushDataFromPurchase === 'function') {\n window.gtmDatalayer.pushDataFromPurchase();\n }\n productBundling.init();\n quickView.init();\n addToCart();\n initLimitedTimeDeal();\n\n if (window.SitePreferences.UPFLUENCE_ENABLED) {\n pushUpfluenceOrderData();\n }\n\n var urls = Urls.addlogs;\n\n $.ajax({\n type: \"GET\",\n url: urls + \"?logFileName=Northbeam&logData=Initializing pushNBDataFromPurchase\",\n success: function (data) {\n },\n error: function (f) {\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n\n if ($('.js-tjc-plus-section').length > 0) {\n tjcplusactivation.init();\n }\n\n nbDatalayer.pushNBDataFromPurchase();\n\n var logUrl = Urls.addlogs;\n\n $.ajax({\n type: \"GET\",\n url: logUrl + \"?logFileName=Northbeam&logData=Successfully Completed pushNBDataFromPurchase\",\n success: function (data) {\n },\n error: function (f) {\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n\n var $gtmDataHolder = $('#gtmDataHolder');\n var purchase = $gtmDataHolder.data('gtmpurchase');\n var products = $gtmDataHolder.data('gtmproducts');\n var orderCategory = $gtmDataHolder.data('gtmordercategory');\n var productCoupons = (purchase.coupon) ? purchase.coupon + \",\" : \"\",\n awinCookieValue = util.getCookie(\"awc\"),\n awinMerchantID = window.SitePreferences.awinMerchantID,\n awinCommissionGroup = orderCategory,\n awinChannel = window.SitePreferences.awinChannel;\n var totalOrderPrice = 0,\n isFpcItemAvailable = false;\n\n if (awinMerchantID != \"\" && awinCommissionGroup != \"\" && awinChannel != \"\") {\n $(products).each(function (index, value) {\n if (value.itemSource !== \"TV\" && value.itemSource !== \"TGTV\" && value.itemSource !== \"RISING\") {\n totalOrderPrice += parseFloat(value.price || 0);\n isFpcItemAvailable = true;\n }\n if (value.coupon) {\n productCoupons += value.coupon;\n if (index + 1 < products.length && productCoupons != \"\") {\n productCoupons += \",\";\n }\n }\n });\n if (isFpcItemAvailable) {\n var url = Urls.awinTracking;\n var url = util.appendParamsToUrl(url, {\n merchant: '' + awinMerchantID,\n ref: '' + purchase.id,\n amount: '' + totalOrderPrice,\n parts: awinCommissionGroup + ':' + totalOrderPrice,\n cr: 'GBP',\n vc: productCoupons,\n ch: awinChannel,\n cks: '' + awinCookieValue\n });\n\n $.ajax({\n type: \"GET\",\n url: url,\n success: function (data) {\n },\n error: function (f) {\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n }\n }\n}\n\nfunction initLimitedTimeDeal() {\n var variant = require(30);\n variant.wishListAJAXEvent();\n util.countDownTimer($('.countdown-timer'));\n\n var now = new Date();\n var midnight = new Date(now);\n midnight.setHours(24, 0, 0, 0);\n util.setCookie('limitedTimeDeal', true, null, midnight);\n}\n\nfunction pushUpfluenceOrderData () {\n var upfScript = $('#upfScript');\n var orderConfirmationContainer = $('.order-confirmation-container');\n var trackingData;\n\n try {\n trackingData = JSON.parse(orderConfirmationContainer.attr('data-tracking'));\n } catch (e) {\n console.error('Error parsing data-tracking', e);\n }\n\n if (!trackingData) return;\n\n var eventData = [\n 'order',\n {\n order_id: trackingData.orderNumber,\n order_name: trackingData.orderNo,\n amount: trackingData.amount,\n currency: trackingData.currency,\n }\n ];\n\n if (window._upf) {\n _upf.push(eventData);\n } else {\n upfScript.on('load', function() {\n _upf.push(eventData);\n })\n }\n}\n\nmodule.exports = {\n init: init\n};", "/*jslint nomen: true */\n'use strict';\n\nvar util = require(46),\n TPromise = require(51),\n addedModal = require(1),\n progress = require(35),\n risingauctions = require(41);\n\n/**\n * @description Make the AJAX request to add an item to cart\n * @param {Element} form The form element that contains the item quantity and ID data\n * @returns {Promise}\n */\nvar addItemToCart = function (form, isProductSetAddToCart) {\n var $form = $(form),\n $qty = $form.find('input[name=\"Quantity\"]'),\n cgid = util.getQueryStringParams(window.location.hash.substr(1)).cgid ||\n $('#quickViewCgid').val() || $('#primarycategoryid').val(),\n isSearch = util.getQueryStringParams(window.location.hash.substr(1)).issearch ||\n $('#quickViewIsSearch').val() || false;\n if ($qty.length === 0 || isNaN($qty.val()) || parseInt($qty.val(), 10) === 0) {\n $qty.val('1');\n }\n\n var isEngravingItem = $('#isEngravingItem').val(),\n newPDPFlag = $('.pt_product-details').hasClass('pdp_redesign');\n if(isEngravingItem == \"true\"){\n var errorFields = \"\";\n var engravingValidateFields = [\"mandatory_color\", \"mandatory_size\", \"mandatory_birthstone\", \"mandatory_birthflower\", \"mandatory_chakra\", \"mandatory_zodiac\", \"mandatory_engraving1\", \"mandatory_engraving2\", \"mandatory_engraving3\", \"mandatory_engraving4\"];\n var $engravingForm = $('form.engraving-form:visible');\n jQuery.each(engravingValidateFields, function(i,val){\n if($engravingForm.find('#'+val).length >= 1){\n if($engravingForm.find('#'+val).val() == \"true\"){\n var fieldToChk = $engravingForm.find('#'+val).attr('data-validateClass');\n if($engravingForm.find('#'+fieldToChk).val() == \"\"){\n if($engravingForm.find('#'+fieldToChk).prop('tagName') == \"SELECT\"){\n var $selectParent = $engravingForm.find('#'+fieldToChk).parents('.form-row-select');\n $selectParent.find('.styledSelect').css('border-color','#C20000').css('border-width','1.5px');\n $engravingForm.find('#'+fieldToChk+'-error').css('display','block');\n }else{\n $engravingForm.find('#'+fieldToChk).css('border-color','#C20000').css('border-width','1.5px');\n $engravingForm.find('#'+fieldToChk+'-error').css('display','block');\n }\n errorFields+=fieldToChk;\n }else{\n if($engravingForm.find('#'+fieldToChk).prop('tagName') == \"SELECT\"){\n var $selectParent = $engravingForm.find('#'+fieldToChk).parents('.form-row-select');\n $selectParent.find('.styledSelect').css('border-color','#b9addb').css('border-width','1px');\n $engravingForm.find('#'+fieldToChk+'-error').css('display','none');\n }else{\n $engravingForm.find('#'+fieldToChk).css('border-color','#b9addb').css('border-width','1px');\n $engravingForm.find('#'+fieldToChk+'-error').css('display','none');\n }\n }\n }\n }\n });\n if(!$engravingForm.find('#dwfrm_engraving_engravingtac').is(\":checked\")){\n $engravingForm.find('div.checker').css('border-color','#C20000').css('border-width','1.5px');\n $engravingForm.find(\"label[for='dwfrm_engraving_engravingtac']\").css('color','#C20000');\n var fieldToChk = \"form.engraving-form:visible #dwfrm_engraving_engravingtac\";\n errorFields+=fieldToChk;\n }else{\n $engravingForm.find('div.checker').css('border-color','#b9addb').css('border-width','1px');\n $engravingForm.find(\"label[for='dwfrm_engraving_engravingtac']\").css('color','#2c163d');\n }\n var engravingForm = $engravingForm;\n\n if(errorFields!=\"\"){\n $('input, select').on('keyup keydown change', function(){\n var id = $(this).attr('id'),\n parentClass = \"form.engraving-form:visible \",\n mandVal = $('input[data-validateClass='+id+']').val();\n if(mandVal==\"true\"){\n if($(this).val() == \"\"){\n if($(this).prop('tagName') == \"SELECT\"){\n $(parentClass+'#uniform-'+id).css('border-color','#C20000').css('border-width','1.5px');\n $(parentClass+'.'+id+'-error').css('display','block');\n }else{\n $(this).css('border-color','#C20000').css('border-width','1.5px');\n $(parentClass+'.'+id+'-error').css('display','block');\n }\n }else{\n if($(this).prop('tagName') == \"SELECT\"){\n $(parentClass+'#uniform-'+id).css('border-color','#b9addb').css('border-width','1px');\n $(parentClass+'.'+id+'-error').css('display','none');\n }else{\n $(this).css('border-color','#b9addb').css('border-width','1px');\n $(parentClass+'.'+id+'-error').css('display','none');\n }\n }\n }\n });\n return false;\n }\n }\n\n var isWarrantyEligible = $('#isWarrantyEligible').val();\n if(isWarrantyEligible == \"true\" && !isProductSetAddToCart){\n var isWarrantySelected = $(\".product-add-to-cart input[name='warrantyEnabled']\").prop(\"checked\");\n if(isWarrantySelected){\n var warrantyQty = $('#warranty-total-quantity').val();\n }\n }\n\n $('#quickViewCgid').remove();\n $('#quickViewIsSearch').remove();\n if (cgid) {\n $form.append($('<input id=\"quickViewCgid\" type=\"hidden\" name=\"cgid\" value=\"' + cgid + '\"/>'));\n }\n $form.append($('<input id=\"quickViewIsSearch\" type=\"hidden\" name=\"issearch\" value=\"' + isSearch + '\"/>'));\n\n if(isWarrantyEligible == \"true\" && !isProductSetAddToCart){\n return TPromise.resolve($.ajax({\n type: 'POST',\n url: util.ajaxUrl(Urls.addProduct),\n data: $form.serialize() + '&isWarrantySelected=' + isWarrantySelected + '&warrantyQty=' + warrantyQty + '&quickview=isQuickView'\n }));\n }\n else if(isEngravingItem == \"true\"){\n return TPromise.resolve($.ajax({\n type: 'POST',\n url: util.ajaxUrl(Urls.addProduct),\n data: $form.serialize() + '&' + engravingForm.serialize()\n }));\n }\n else if(isProductSetAddToCart && $('.product-bundling-container').length > 0) {\n var productBundlingContainer = $('.product-bundling-container');\n var selectedDiscount = productBundlingContainer.attr('data-product-set-selected-discount');\n var setID = productBundlingContainer.attr('data-product-set-id');\n var selectedProducts = productBundlingContainer.attr('data-set-selected-products');\n var allBundlingProducts = productBundlingContainer.attr('data-set-all-products');\n\n var productSetData = {\n setID: setID,\n discount: selectedDiscount,\n productIDs: selectedProducts,\n allProductIDs: null\n };\n\n if (selectedProducts.split(\",\").length > 1) {\n productSetData.allProductIDs = allBundlingProducts;\n }\n\n return TPromise.resolve($.ajax({\n type: 'POST',\n url: util.ajaxUrl(Urls.addProduct),\n data: $form.serialize() + '&productSetData=' + JSON.stringify(productSetData)\n }));\n }else{\n return TPromise.resolve($.ajax({\n type: 'POST',\n url: util.ajaxUrl(Urls.addProduct),\n data: $form.serialize()\n }));\n }\n\n};\n\n\n/**\n * @description Handler to handle the add to cart event\n */\nvar addToCart = function (e) {\n e.preventDefault();\n var $form = $(this).closest('form'),\n $button = $(e.target),\n paymentPreselectID = $button.data('payment-preselect'),\n callback = e.data;\n\n var sizeVariation = $('.attribute.size-variations');\n var isSocialTvForm = $form.hasClass('social-tv-product-form');\n\n if (sizeVariation.length > 0) {\n var selectedSwatch = sizeVariation.find('li.selected');\n if (selectedSwatch.length <= 0) {\n sizeVariation.find('span.error').removeClass('d-none');\n if (!isSocialTvForm) {\n $('body,html').scrollTop(sizeVariation.offset().top);\n }\n return false;\n }\n }\n\n var item = $(this);\n disableItemCheckbox(item);\n\n $('.pdp_redesign .pdp-container-addtocart .pdp-box-addtocart .variations-wrapper:visible').removeClass('crossed');\n $('.pdp_redesign .pdp-container-addtocart .pdp-box-addtocart .variations-wrapper .xlt-pdpVariations .size-variations .value .swatches.size .sticky-variant-selection a.swatchanchor:visible').removeClass('sticky-variant-anchor');\n $('.pdp_redesign .pdp-container-addtocart .pdp-box-addtocart .variations-wrapper .xlt-pdpVariations .size-variations .value .swatches.size .sticky-variant-selection').removeClass('sticky-selected');\n $('.pdp_redesign .pdp-container-addtocart .pdp-box-addtocart .variations-wrapper .xlt-pdpVariations .size-variations .value .swatches.size li:not(.unavailable):visible').removeClass('sticky-variant-selection');\n $('.pdp_redesign .pdp-container-addtocart .pdp-box-addtocart .product-add-to-cart:visible').css('margin-top','10px');\n\n if (paymentPreselectID) {\n $form.append($('<input type=\"hidden\" name=\"paymentpreselect\" value=\"' + paymentPreselectID + '\"/>'));\n }\n\n addItemToCart($form).then(function (response) {\n var pid = $form.find('input[name=\"pid\"]').val();\n var $uuid = $form.find('input[name=\"uuid\"]');\n var $button = $form.find('.ra-add-to-cart'); // Assuming the button has this class\n if ($button.length === 0) {\n $button = $form.find('.add-to-cart');\n }\n var isSocialTvForm = $form.hasClass('social-tv-product-form');\n\n if (isSocialTvForm) {\n var gtmData = $form.data(\"gtm\");\n var qty = $form.find('input[name=\"Quantity\"]').val();\n window.dataLayer.push({\n 'event': 'addToCart',\n 'ecommerce': {\n 'currencyCode': '' + gtmData.currency,\n 'page': 'socialTvReel',\n 'videoId': gtmData.videoId,\n 'add': { // 'add' actionFieldObject measures.\n 'products': [{ // adding a product to a shopping cart.\n 'name': '' + gtmData.name,\n 'id': '' + gtmData.id,\n 'price': '' + gtmData.price,\n 'brand': '' + gtmData.brand,\n 'category': '' + gtmData.category,\n 'google_business_vertical': \"retail\",\n 'variant': '' + gtmData.variant,\n 'quantity': parseInt(qty),\n 'metric1': parseFloat(gtmData.price * parseInt(qty)).toFixed(2)\n }]\n }\n }\n });\n\n updateMiniCartCount();\n if (window.dialog) {\n window.dialog.close();\n }\n util.toast($('.js-toast-add-to-bag'), {shake: true, duration: 5000});\n return;\n };\n\n if ($uuid.length > 0 && $uuid.val().length > 0) {\n window.location.href = $button.data('carturl');\n }\n else {\n if(window.SitePreferences.EnablePreCart && (!$button.length > 0 || $button.data('page') === 'pdp')){\n var params = {pid: pid}\n\n var isJewelryBox = $('.jewelrybox-packaging').length > 0;\n \n if (isJewelryBox) {\n var selectedJewelry = $('.packaging-item.selected input').val();\n if (selectedJewelry != 'null') {\n params.jewelrybox = true;\n }\n }\n\n var preCartUrl = util.appendParamsToUrl(Urls.preCart, params);\n window.location = preCartUrl;\n } else {\n if ($button.hasClass('go-to-cart-all')) {\n window.location = Urls.cartShow;\n }\n else if ($button.hasClass('ra-enabled-checkboxes')) {\n $button.text('Go to bag');\n $button.removeClass('bid-button');\n $button.removeClass('button-add-to-cart');\n $button.removeClass('ra-add-to-cart');\n $button.removeClass('add-to-cart');\n $button.removeClass('lazy-load-button');\n $button.addClass('go-to-cart');\n }\n else {\n $button.text('Already in Bag');\n $button.addClass('disabled');\n }\n }\n }\n setTimeout(risingauctions.disableHeaderIfAllInBag, 500);\n updateMiniCartCount();\n }.bind(this));\n\n if (typeof callback === 'function') {\n callback($button);\n }\n};\n\nfunction handleAddAllToBagEnable() {\n var checkboxes = $(\"input[name='itemSelected']\");\n var checkedArray = $.map(checkboxes, function(e) {\n return e.checked;\n });\n var anyChecked = checkedArray.indexOf(true) !== -1;\n if (anyChecked) {\n $(\".add-all-ra-items\").removeClass(\"disabled\");\n } else {\n $(\".add-all-ra-items\").addClass(\"disabled\");\n }\n};\n\nfunction showSlidingMiniCart(response) {\n if(!window.SitePreferences.EnableSlidingMiniCart || $('#isAbTest').length || $('.ra-auctionswon-main').length >= 1){\n $('.ui-dialog').find('.ui-dialog-content').dialog('close');\n if (window.minicart && typeof window.minicart.show === 'function') {\n window.minicart.show(response);\n }\n addedModal.init();\n } else {\n\n // do not close quickview if adding individual item that is part of product set\n // @TODO should notify the user some other way that the add action has completed successfully\n if (!$(this).hasClass('sub-product-item')) {\n if (window.dialog) {\n window.dialog.close();\n }\n }\n\n progress.show();\n var url = Urls.slidingminicart;\n if (window.dialog) {\n window.dialog.open({\n url: url,\n options:{\n dialogClass:'sliding-modal',\n title: \"Shopping Bag\",\n open: function(event,ui){\n progress.hide();\n $('body').css('overflow','hidden');\n $('.ui-widget-overlay').on('click', function(){\n $('.sliding-modal').find('.ui-dialog-content').dialog('close');\n });\n\n $('.sliding-cart-item-remove').on('click', function(e){\n e.preventDefault();\n var pid = $(this).attr(\"data-pid\");\n var url = Urls.removeProductFromSlidingCart;\n $.ajax({\n url: url + '?pid='+ pid,\n type: 'POST',\n success: function (response) {\n updateMiniCartCount();\n $('.slidingcart_container').html(response);\n if ($('.emptybasket').length > 0) {\n $('.sliding-modal').find('.ui-dialog-content').dialog('close');\n } else {\n $('.sliding-modal').find('.ui-dialog-content').dialog('close');\n $('.sliding-modal').find('.ui-dialog-content').dialog('open');\n }\n }\n });\n\n });\n\n $('.sliding-cart-item-remove-warranty').off('click').on('click', function(e){\n e.preventDefault();\n var warrantypid = $(this).attr(\"data-pid\");\n var url = Urls.removeProductFromSlidingCart;\n $.ajax({\n url: url + '?pid='+ warrantypid,\n type: 'POST',\n success: function (response) {\n updateMiniCartCount();\n $('.slidingcart_container').html(response);\n $('.sliding-modal').find('.ui-dialog-content').dialog('close');\n $('.sliding-modal').find('.ui-dialog-content').dialog('open');\n }\n });\n });\n },\n close:function() {\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n }\n }\n });\n }\n if (window.minicart && typeof window.minicart.show === 'function') {\n window.minicart.show(response);\n }\n }\n}\n\n/**\n * @description refresh the count of minicart\n */\nfunction updateMiniCartCount() {\n var url = Urls.refreshminicart;\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n if(response && $('.header-bag-link').length > 0){\n $('.header-bag-link').html(response);\n }\n }\n });\n};\n\n/**\n * @description Handler to handle the add all items to cart event\n */\nvar addAllToCart = function (e) {\n e.preventDefault();\n var $productForms = $('#product-set-list').find('form').toArray();\n TPromise.all($.map($productForms, addItemToCart))\n .then(function (responses) {\n if (window.dialog) {\n window.dialog.close();\n }\n // show the final response only, which would include all the other items\n if (window.minicart && typeof window.minicart.show === 'function') {\n window.minicart.show(responses[responses.length - 1]);\n }\n addedModal.init();\n });\n};\n\n/**\n * @description Handler to handle the add all items to cart event\n */\nvar addAllToCartSocial = function (forms, isProductSetAddToCart, productIds) {\n var $productForms = forms.toArray();\n TPromise.all($.map($productForms, function(form){\n return addItemToCart(form, isProductSetAddToCart);\n })).then(function (responses) {\n if (isProductSetAddToCart) {\n if (window.gtmDatalayer && typeof window.gtmDatalayer.pushBundleDataToDataLayer === 'function') {\n window.gtmDatalayer.pushBundleDataToDataLayer();\n }\n }\n if(window.SitePreferences.EnablePreCart) {\n var preCartURL = (productIds && productIds !== '') ? util.appendParamToURL(Urls.preCart, 'pid', productIds[0]) : Urls.preCart;\n window.location = preCartURL;\n } else {\n showSlidingMiniCart(responses[responses.length - 1])\n }\n });\n};\n\nvar addAllToCartRA = function (forms, cartUrl) {\n var $productForms = forms.toArray();\n TPromise.all($.map($productForms, addItemToCart))\n .then(function (responses) {\n window.location.href = cartUrl;\n });\n};\n\nfunction enableAddToCart() {\n $('#add-to-cart').attr('disabled', false);\n $('#showActivateQBModel').attr('disabled', false);\n}\n\nfunction disableAddToCart() {\n $('#add-to-cart').attr('disabled', true);\n $('#showActivateQBModel').attr('disabled', true);\n}\n\nfunction setChecked(element, value) {\n element.prop(\"checked\", value);\n if (value) {\n element.parent().addClass(\"checked\");\n } else {\n element.parent().removeClass(\"checked\");\n }\n};\n\nfunction initEngravingEvents() {\n var isEngravingItem = $('#isEngravingItem').val();\n\n if (isEngravingItem == \"true\") {\n var $engravingForm = $('form.engraving-form:visible');\n var engravingProductID = $engravingForm.find('#engravingProductID').val();\n var payload = {\n productId: engravingProductID\n }\n\n $engravingForm.find('select').first().trigger('change');\n\n if ($engravingForm.valid()) {\n enableAddToCart();\n payload.isFinalSelection = true;\n }\n\n if ($('form#dwfrm_engraving select').length === 0) {\n enableAddToCart();\n payload.isFinalSelection = true;\n }\n\n $(document).on('click', '.engraving-reset', function (e) {\n e.preventDefault();\n\n if ($('form#dwfrm_engraving select').length > 0) {\n disableAddToCart();\n }\n\n checkPersonalizedInventories(JSON.stringify(payload), $engravingForm);\n\n $(\"form#dwfrm_engraving select\").val(\"\");\n $('.options').find('li:first').trigger('click');\n $('.styledSelect').removeAttr('style');\n $('li').find('.soldout-text').remove();\n $('.styledSelect').find('.soldout-text').remove();\n $('.styledSelect').each(function () {\n $(this).text($(this).text().replace('(SOLD OUT)', '').trim());\n });\n $('select option').each(function(){\n $(this).text($(this).text().replace('(SOLD OUT)', '').trim());\n });\n $('.engraving-form').find('.form-row').removeClass('validation-error');\n $('.engraving-form').find('.select').removeClass('engravefield-disabled');\n });\n\n checkPersonalizedInventories(JSON.stringify(payload), $engravingForm);\n\n $('form#dwfrm_engraving select').on('change', function(e){\n var id = $(this).attr('id'),\n mandVal = $('input[data-validateClass='+id+']').val();\n if (mandVal==\"true\") {\n if ($(this).val() == \"\") {\n } else {\n if ($(this).prop('tagName') == \"SELECT\") {\n progress.show();\n $('<div class=\"progress-overlay\"/>').appendTo('body');\n var payload = getRequestPayload($engravingForm);\n checkPersonalizedInventories(payload, $engravingForm);\n $(this).closest('.select').addClass('engravefield-disabled');\n }\n }\n }\n });\n\n $('#uniform-dwfrm_engraving_engravingtac').on('input', function() {\n var payload = getRequestPayload($engravingForm);\n checkPersonalizedInventories(payload, $engravingForm);\n });\n }\n}\n\nfunction checkPersonalizedInventories(payload, engravingForm) {\n $.ajax({\n type: 'POST',\n url: Urls.checkPersonalizedInventories,\n data: 'payload=' + payload,\n success: function(response){\n var responseObj = JSON.parse(response);\n if(responseObj.response.status == \"ERROR\" || responseObj.response.success == false){\n progress.hide();\n }else{\n updateEngravingFields(engravingForm, responseObj.response);\n progress.hide();\n $('.progress-overlay').remove();\n }\n },\n error: function(){\n progress.hide();\n }\n });\n}\n\nfunction getRequestPayload(engravingForm){\n var params = new Object();\n var $engravingForm = engravingForm;\n var engravingValidateFields = [\"mandatory_color\", \"mandatory_size\", \"mandatory_birthstone\", \"mandatory_birthflower\", \"mandatory_chakra\", \"mandatory_zodiac\", \"mandatory_engraving1\", \"mandatory_engraving2\", \"mandatory_engraving3\", \"mandatory_engraving4\"];\n var prop;\n jQuery.each(engravingValidateFields, function(i,val){\n if($engravingForm.find('#'+val).length >= 1){\n if($engravingForm.find('#'+val).val() == \"true\"){\n prop = val.split('_');\n prop = prop[1];\n var fieldToChk = $engravingForm.find('#'+val).attr('data-validateClass');\n var currentField = $engravingForm.find('#'+fieldToChk);\n if(currentField.val() !== \"\"){\n params[prop] = currentField.val();\n }\n }\n }\n });\n var isFinalSelection = getFinalSelectionStatus(engravingForm);\n var engravingProductID = $('#engravingProductID').val();\n params.productId = engravingProductID;\n params.isFinalSelection = isFinalSelection;\n params = JSON.stringify(params);\n return params;\n\n}\nfunction getFinalSelectionStatus(engravingForm){\n var $engravingForm = engravingForm;\n var engravingValidateFields = [\"mandatory_color\", \"mandatory_size\", \"mandatory_birthstone\", \"mandatory_birthflower\", \"mandatory_chakra\", \"mandatory_zodiac\", \"mandatory_engraving1\", \"mandatory_engraving2\", \"mandatory_engraving3\", \"mandatory_engraving4\"];\n var isFinalSelection = true;\n jQuery.each(engravingValidateFields, function(i,val){\n if($engravingForm.find('#'+val).length >= 1){\n if($engravingForm.find('#'+val).val() == \"true\"){\n var fieldToChk = $engravingForm.find('#'+val).attr('data-validateClass');\n var currentField = $engravingForm.find('#'+fieldToChk);\n if(currentField.val() === \"\" && currentField.prop('tagName') == \"SELECT\"){\n isFinalSelection = false;\n return false;\n }\n }\n }\n });\n return isFinalSelection;\n\n}\n\nfunction finalSelectionCheck(engravingForm) {\n var i = 0;\n engravingForm.find('select').each(function(index, currentSelect){\n if ($(currentSelect).val()) {i++};\n });\n\n if (i == engravingForm.find('select').length - 1) {\n return true;\n }\n\n return false;\n}\n\nfunction updateEngravingFields(engravingForm, response) {\n if (!response.inventoryResponse.isFinalSelection && !finalSelectionCheck(engravingForm) && engravingForm.find('select').length > 0) {\n $('#add-to-cart').attr('disabled', true);\n $('#showActivateQBModel').attr('disabled', true);\n return;\n }\n var $engravingForm = engravingForm;\n var engravingValidateFields = [\"mandatory_color\", \"mandatory_size\", \"mandatory_birthstone\", \"mandatory_birthflower\", \"mandatory_chakra\", \"mandatory_zodiac\", \"mandatory_engraving1\", \"mandatory_engraving2\", \"mandatory_engraving3\", \"mandatory_engraving4\"];\n var inventoryResponse = response.inventoryResponse;\n var prop, propValue;\n jQuery.each(engravingValidateFields, function(i,val){\n if($engravingForm.find('#'+val).length >= 1){\n if($engravingForm.find('#'+val).val() == \"true\"){\n var fieldToChk = $engravingForm.find('#'+val).attr('data-validateClass');\n var currentField = $engravingForm.find('#'+fieldToChk);\n if (currentField.val() === \"\"){\n if(currentField.prop('tagName') == \"SELECT\"){\n //update option values stock status\n prop = val.split('_');\n propValue = inventoryResponse[prop[1]];\n currentField.find('option').each(function(index,option) {\n var index = -1;\n if (propValue) {\n var index = propValue.indexOf(option.label);\n }\n if (index > -1){\n option.text = propValue[index];\n } else {\n if (option.text.indexOf('SOLD OUT') === -1 && option.text.indexOf('Select') == -1) {\n option.text = option.text + ' (SOLD OUT)';\n }\n }\n });\n if (window.newformstyle && typeof window.newformstyle.selectBoxCustom === 'function') {\n window.newformstyle.selectBoxCustom(currentField);\n }\n }\n } else {\n if (currentField.prop('tagName') == \"SELECT\") {\n if (inventoryResponse.quantity > 0) {\n engravingForm.find('select option:selected').each(function() {\n $(this).text($(this).text().replace('<span class=\"soldout-text\">(SOLD OUT)</span>', '').trim());\n });\n }\n }\n }\n }\n }\n });\n if (inventoryResponse.quantity === 0) {\n //disable checkout and quickbuy\n $('#engravingqty').val(inventoryResponse.quantity);\n $('#add-to-cart').attr('disabled', true);\n $('#showActivateQBModel').attr('disabled', true);\n ($('.engraving-form .form-row').each(function (index) {\n if ($(this).find('.styledSelect').text().indexOf('SOLD OUT') > -1) {\n $(this).addClass('validation-error').removeClass('validation-success');\n }\n }))\n } else {\n $('#engravingqty').val(inventoryResponse.quantity);\n $('#add-to-cart').attr('disabled', false);\n $('#showActivateQBModel').attr('disabled', false);\n ($('.engraving-form .form-row').each(function (index) {\n $(this).addClass('validation-success').removeClass('validation-error');\n $(this).find('.styledSelect').find('.soldout-text').remove();\n }))\n }\n}\n\n // Disables a checkbox for a specific .ra-item-row\n function disableItemCheckbox(raItem) {\n var checker = raItem.closest(\".ra-item-row\").find(\".ra-item-checkbox .checker\")\n\n checker.addClass(\"hidden\");\n }\n\n/**\n * @function\n * @description Binds the click event to a given target for the add-to-cart handling\n * @param {Element} target The target on which an add to cart event-handler will be set\n */\nmodule.exports = function (target, callback) {\n $('.add-to-cart[disabled]').attr('title', $('.availability-msg').text());\n\n if (target) {\n target.off('click', '.add-to-cart').on('click', '.add-to-cart', callback, addToCart);\n } else {\n $('.add-to-cart').off('click', '.add-to-cart').on('click', callback, addToCart);\n }\n initEngravingEvents();\n $('#add-all-to-cart').on('click', addAllToCart);\n\n $('.main').off('change', '.buy-more-pay-less').on('change', '.buy-more-pay-less', function(e) {\n var $this = $(this);\n var accordionContent = $this.closest('.accordion-content');\n var form = $this.closest('form');\n var attributeId = $this.data('attribute-id');\n var atributeValue = $this.val();\n var pid = form.data('pid');\n var siblingSelect = $this.parent().siblings('.select').find('select');\n var siblingAttributeId = siblingSelect.data('attribute-id');\n var siblingAtributeValue = siblingSelect.val();\n var buyAllButton = accordionContent.find('.add-all-to-cart-social');\n var allProductVariations = accordionContent.find('.product-variations');\n var selectedValue = allProductVariations.find('.styledSelect');\n var input = form.find(\"[name=\"+attributeId+\"]\");\n\n if (atributeValue.indexOf('Combo') > -1) {\n atributeValue = atributeValue.split(' ')[0].trim();\n }\n if (atributeValue.indexOf('All') > -1) {\n atributeValue = atributeValue.slice(4).trim();\n }\n\n input.val(atributeValue);\n\n var unselected = selectedValue.filter(function(){\n return $(this).text().indexOf('Select') > -1 || $(this).text().indexOf('available') > -1 || $(this).text().indexOf('SOLD') > -1;\n });\n\n if (unselected.length > 0) {\n buyAllButton.attr('disabled', true);\n } else {\n buyAllButton.removeAttr('disabled');\n }\n $.ajax({\n type: 'POST',\n url: form.data('url'),\n data: {\n pid: pid,\n attributeId: attributeId,\n attributeValue: atributeValue,\n updateAttributeId: siblingAttributeId,\n format: 'ajax'\n },\n success: function (data) {\n var replaced = siblingSelect.replaceWith(data);\n replaced.val(siblingAtributeValue);\n newformstyle.init();\n }\n });\n });\n\n $(document).off('click', '.add-all-to-cart-social').on('click', '.add-all-to-cart-social', function(e){\n e.preventDefault();\n var productVariations = $(this).siblings('.product-variations');\n var forms = productVariations.find('form');\n var category = $(this).data('category');\n var isComboAddToBag = false;\n productVariations.each(function(){\n var form = $(this).find('form');\n var attributes = form.data('attributes');\n var attributeId = form.find('.buy-more-pay-less').data('attribute-id');\n var pidInput = form.find(\"[name='pid']\");\n\n attributes.forEach(function(attribute) {\n if(category === 'clasp'){\n if (attribute.color == form.find(\"[name='color']\").val().trim()) {\n if(attribute.pid.split(',').length > 1){\n var pids = attribute.pid.split(',');\n var $qty = form.find('input[name=\"Quantity\"]');\n var comboQty = parseInt($qty.val(), 10);\n var newQty = parseInt($qty.val(), 10)/pids.length ;\n\n for(var i=0; i<pids.length; i++){\n pidInput.val(pids[i]);\n $qty.val(newQty);\n addAllToCartSocial(forms);\n }\n isComboAddToBag = true;\n $qty.val(comboQty);\n }\n else{\n pidInput.val(attribute.pid);\n }\n\n }\n } else if(category === 'rings') {\n var attributeLength = Object.keys(attribute).length - 1;\n var formAttributeValue = form.find(\"[name=\"+attributeId+\"]\").val().trim();\n var attributeValue = attribute[attributeId];\n\n if ((attributeLength === 1 && attributeValue === formAttributeValue) ||\n (attribute.size == form.find(\"[name='size']\").val().trim() && (attribute.color == form.find(\"[name='color']\").val().trim() || attribute.gemstone == form.find(\"[name='gemstone']\").val().trim()))) {\n pidInput.val(attribute.pid);\n }\n }\n })\n });\n\n if(!isComboAddToBag){\n addAllToCartSocial(forms);\n }\n });\n\n $(document).off('click', '.product-tile .tile-addtocart').on('click', '.product-tile .tile-addtocart', function (e) {\n e.preventDefault();\n var button = $(this);\n var form = button.closest('form');\n\n addItemToCart(form).then(function(){\n button.addClass('added-to-cart');\n button.removeClass('tile-addtocart').removeClass('checkout-journey');\n button.text(button.attr('data-label'));\n\n updateMiniCartCount();\n })\n });\n\n $(document).off('click', '.quickview-tile-addtocart').on('click', '.quickview-tile-addtocart', function (e) {\n e.preventDefault();\n var button = $(this);\n var form = button.closest('form');\n var sizeVariation = $('.attribute.size-variations');\n var pid = $('#masterId').val();\n var tile = $('.product-tile[data-itemid=\"'+pid+'\"]');\n var tileAddToCart = tile.find('button.quickview');\n\n if (sizeVariation.length > 0) {\n var selectedSwatch = sizeVariation.find('li.selected');\n if (selectedSwatch.length <= 0) {\n sizeVariation.find('span.error').removeClass('d-none');\n return false;\n }\n }\n\n addItemToCart(form).then(function(){\n if (tileAddToCart.length > 0) {\n tileAddToCart.addClass('added-to-cart');\n tileAddToCart.removeClass('tile-addtocart').removeClass('checkout-journey').removeClass('quickview');\n tileAddToCart.text(tileAddToCart.attr('data-label'));\n }\n updateMiniCartCount();\n if (window.dialog) {\n window.dialog.close();\n }\n })\n });\n\n $(document).off('click', '.product-tile .added-to-cart').on('click', '.product-tile .added-to-cart', function (e) {\n e.preventDefault();\n window.location.href = Urls.cartShow;\n });\n\n $(\"#select-all-checkbox\").on(\"click\", function(e) {\n var checked = this.checked;\n var checkboxes = document.querySelectorAll('input[name=\"itemSelected\"]');\n\n for (var i = 0; i < checkboxes.length; i++) {\n var checkbox = checkboxes[i];\n var checkboxValue = checkbox.checked;\n\n if (checkboxValue !== checked) {\n setChecked($(checkbox), checked);\n }\n }\n\n handleAddAllToBagEnable();\n });\n\n $('input[name=\"itemSelected\"]').on(\"click\", function(e) {\n var selectAllBox = document.querySelector(\"#select-all-checkbox\");\n\n var selectAllValue = selectAllBox && selectAllBox.checked;\n var thisValue = this.checked;\n\n if (selectAllValue && !thisValue) {\n setChecked($(selectAllBox), false);\n }\n\n if ($(\".add-all-ra-items\").length > 0) {\n handleAddAllToBagEnable();\n }\n\n });\n\n $('.add-all-ra-items').off().on('click', function(e){\n e.preventDefault();\n var container = $(this).closest('.ra-auctionswon-main');\n var forms = container.find('input[name=\"itemSelected\"]:checked').closest('form');\n var preCartUrl = Urls.cartShow;\n\n addAllToCartRA(forms, preCartUrl);\n\n });\n};\n\nmodule.exports.addAllToCartSocial = addAllToCartSocial;", "'use strict';\n\nvar ajax = require(3),\n util = require(46);\n\nvar updateContainer = function (data) {\n var $availabilityMsg = $('.pdp-main .availability .availability-msg'),\n message; // this should be lexically scoped, when `let` is supported (ES6)\n if (!data) {\n $availabilityMsg.html(Resources.ITEM_STATUS_NOTAVAILABLE);\n return;\n }\n $availabilityMsg.empty();\n // Look through levels ... if msg is not empty, then create span el\n if (data.levels.IN_STOCK > 0) {\n if (data.levels.PREORDER === 0 && data.levels.BACKORDER === 0 && data.levels.NOT_AVAILABLE === 0) {\n // Just in stock\n message = Resources.IN_STOCK;\n } else {\n // In stock with conditions ...\n message = data.inStockMsg;\n }\n $availabilityMsg.append('<div class=\"in-stock-msg\">' + message + '</div>');\n }\n if (data.levels.PREORDER > 0) {\n if (data.levels.IN_STOCK === 0 && data.levels.BACKORDER === 0 && data.levels.NOT_AVAILABLE === 0) {\n message = Resources.PREORDER;\n } else {\n message = data.preOrderMsg;\n }\n $availabilityMsg.append('<div class=\"preorder-msg msg\">' + message + '</div>');\n }\n if (data.levels.BACKORDER > 0) {\n if (data.levels.IN_STOCK === 0 && data.levels.PREORDER === 0 && data.levels.NOT_AVAILABLE === 0) {\n message = Resources.BACKORDER;\n } else {\n message = data.backOrderMsg;\n }\n $availabilityMsg.append('<div class=\"backorder-msg msg\">' + message + '</div>');\n }\n if (data.inStockDate !== '') {\n $availabilityMsg.find('.msg').append(' <span class=\"expected\">' +\n String.format(Resources.IN_STOCK_DATE, data.inStockDate) + '</span>');\n }\n if (data.levels.NOT_AVAILABLE > 0) {\n if (data.levels.PREORDER === 0 && data.levels.BACKORDER === 0 && data.levels.IN_STOCK === 0) {\n message = Resources.NOT_AVAILABLE;\n } else {\n message = Resources.REMAIN_NOT_AVAILABLE;\n }\n $availabilityMsg.append('<div class=\"not-available-msg\">' + message + '</div>');\n }\n};\n\nvar getAvailability = function () {\n ajax.getJson({\n url: util.appendParamsToUrl(Urls.getAvailability, {\n pid: $('#pid').val(),\n Quantity: $(this).val()\n }),\n callback: updateContainer\n });\n};\n\nmodule.exports = function () {\n $('#pdpMain').on('change', '.pdpForm input[name=\"Quantity\"]', getAvailability);\n};\n", "'use strict';\n\nrequire(48);\n\n/**\n * @description Enables the zoom viewer on the product detail page\n */\nvar loadZoom = function (imageURL) {\n var pageContextType = pageContext.type;\n if(pageContextType == \"product\"){\n var $imgZoom = $('#pdpMainOverlay .overlay-item:visible'),\n hiresURL;\n\n if (!$imgZoom.length) {\n return;\n }\n if (imageURL) {\n hiresURL = imageURL;\n } else {\n // Get Zoom Image URL\n hiresURL = $('.productthumbnail.selected').data('zoom-image-url');\n }\n\n // Init Zoom View\n var newPDPFlag = $('.pt_product-details').hasClass('pdp_redesign');\n if(newPDPFlag == false || newPDPFlag == \"false\"){\n if (hiresURL && hiresURL !== 'null' && hiresURL.indexOf('noimagelarge') === -1) {\n $imgZoom.zoom({\n url: hiresURL\n });\n }\n }\n }\n};\n\n\n/**\n * @description Sets the main image attributes and the href for the surrounding <a> tag\n * @param {Object} atts Object with url, alt, title and hires properties\n */\nvar setMainImage = function (imageURL, zoomImageURL) {\n var newPDPFlag = $('.pt_product-details').hasClass('pdp_redesign');\n var $container;\n if(newPDPFlag == true || newPDPFlag == \"true\"){\n $container = $('#pdpMain .product-primary-image .single-view .pdp-image-non_mobile img');\n }else{\n $container = $('#pdpMain .product-primary-image .single-view img');\n }\n $container.css('display', '');\n\n // check for url\n try {\n if(typeof imageURL === \"object\"){\n return false;\n }else if(imageURL.indexOf('http') < 0){\n return false;\n }\n } catch (b) {\n //console.log(b);\n return false;\n }\n\n // replace main image\n $container.attr({\n src: imageURL\n });\n\n var pageContextType = pageContext.type;\n if(pageContextType == \"product\"){\n // re-init zoom view\n $('#pdpMain .product-primary-image .single-view .main-image').attr({\n href: zoomImageURL\n });\n loadZoom();\n }\n};\n\nvar loadImageComponents = function () {\n // Init Thumbnails\n $('#pdpMain').on('click mouseover', '.productthumbnail:not(.video)', function (e) {\n e.preventDefault();\n $(this).closest('.product-thumbnails').find('.productthumbnail.selected').removeClass('selected');\n $(this).addClass('selected');\n $('.video-text').removeClass('active');\n\n setMainImage($(this).data('main-image-url'), $(this).data('zoom-image-url'));\n $('div.magnifier, div.cursorshade, div.tracker').removeClass('visually-hidden');\n\n // show image\n $('#pdpMain .product-primary-image .single-view img').css('visibility','visible');\n\n // video effects disable\n var $playButton = $('#pdpMain .product-primary-image .single-view .playButton.mainButton');\n $playButton.removeClass('livetvvideo').removeClass('360video');\n $playButton.hide();\n //$('#pdpMain .product-primary-image .single-view .product-image').css({'filter':'unset','-webkit-filter':'unset'});\n $('.pdp_redesign .product-primary-image .single-view .pdp-image-non_mobile img').css('pointer-events','auto');\n }).on('click mouseover', '.productthumbnail.video', function (e) {\n e.preventDefault();\n $(this).closest('.product-thumbnails').find('.productthumbnail.selected').removeClass('selected');\n $(this).addClass('selected');\n $('.video-text').removeClass('active');\n\n setMainImage($(this).data('zoom-image-url'), $(this).data('zoom-image-url'));\n $('div.magnifier, div.cursorshade, div.tracker').addClass('visually-hidden');\n\n // video effects enable\n var $playButton = $('#pdpMain .product-primary-image .single-view .playButton.mainButton');\n if($(this).hasClass('360video')){\n $playButton.removeClass('livetvvideo').addClass('360video');\n }else if($(this).hasClass('livetvvideo')){\n $playButton.removeClass('360video').addClass('livetvvideo');\n }\n $playButton.show();\n //$('#pdpMain .product-primary-image .single-view .product-image').css({'filter':'blur(1.5px)','-webkit-filter':'blur(1.5px)'});\n $('.pdp_redesign .product-primary-image .single-view .pdp-image-non_mobile img').css('pointer-events','none');\n });\n\n $('#pdpMain').on('click', '.primary-col .icons-product-image', function () {\n loadZoom();\n });\n\n $('#pdpMain').on('click', '.product-primary-image .single-view .nav-prev.button', function () {\n var thumbnails = $('#pdpMain .product-thumbnails'),\n selectedThumbnail = thumbnails.find('.productthumbnail.selected'),\n previousThumbnail = selectedThumbnail.prev(),\n isFirstThumbnail = thumbnails.find('.productthumbnail').first().hasClass('selected');\n\n if (isFirstThumbnail) {\n previousThumbnail = thumbnails.find('.productthumbnail').last();\n // bubbles are not visible but needed as a workaround for scrolling\n thumbnails.find('.bubble-ctr .bubble').last().click();\n } else {\n $('#pdpMain .product-thumbnails .nav-prev').click();\n }\n\n previousThumbnail.click();\n });\n\n $('#pdpMain').on('click', '.product-primary-image .single-view .nav-next.button', function () {\n var thumbnails = $('#pdpMain .product-thumbnails'),\n selectedThumbnail = thumbnails.find('.productthumbnail.selected'),\n nextThumbnail = selectedThumbnail.next(),\n isLastThumbnail = thumbnails.find('.productthumbnail').last().hasClass('selected');\n\n if (isLastThumbnail) {\n nextThumbnail = thumbnails.find('.productthumbnail').first();\n // bubbles are not visible but needed as a workaround for scrolling\n thumbnails.find('.bubble-ctr .bubble').first().click();\n } else {\n $('#pdpMain .product-thumbnails .nav-next').click();\n }\n\n nextThumbnail.click();\n });\n\n $('.pdp-thumbnail-container .livetvvideo').on('click',function(){\n if (window.matchMedia(\"(min-width: 767.5px)\").matches){\n $('.livetvvideo .playButtonSymbol').trigger('click');\n }\n });\n $('.pdp-thumbnail-container .360video').on('click',function(){\n if (window.matchMedia(\"(min-width: 767.5px)\").matches){\n $('.360video .playButtonSymbol').trigger('click');\n }\n });\n\n var newPDPFlag = $('.pt_product-details').hasClass('pdp_redesign');\n if(newPDPFlag == true || newPDPFlag == \"true\"){\n $('.pdp_redesign div:not(.ui-dialog-content) .pdp-main').find('.single-view .pdp-main-img').imagezoomsl({ zoomrange: [1.5, 1.5] }); /*2x zoom*/\n }\n};\n\n\n\n/* @module image\n * @description this module handles the primary image viewer on PDP\n **/\n\n/**\n * @description by default, this function sets up zoom and event handler for thumbnail click\n **/\nmodule.exports = function () {\n // Load Zoom View\n loadZoom();\n loadImageComponents();\n};\n\nmodule.exports.loadZoom = loadZoom;\nmodule.exports.loadImageComponents = loadImageComponents;\nmodule.exports.setMainImage = setMainImage;\n", "'use strict';\n\nvar applePay = require(4),\n tooltip = require(44),\n util = require(46),\n addToCart = require(22),\n availability = require(23),\n image = require(24),\n productNav = require(28),\n productBundling = require(27),\n jewelryBox = require(26),\n variant = require(30),\n informMeWhenAvailablePDP = require(12),\n tjcplusactivation = require(43),\n qbfornonlivetv = require(37),\n progress = require(35),\n lazyload = require(7);\n\n/**\n * @description Initialize product detail page with reviews, recommendation and product navigation.\n */\nfunction initializeDom() {\n $('#pdpMain .product-detail .product-tabs').tabs();\n productNav();\n tooltip.init();\n qbfornonlivetv.init();\n var isApplePayEligble = false;\n\n if (window._dw && window._dw.applepay && window.SitePreferences.LoadPDPAppleJS && window.ApplePaySession && window.ApplePaySession.canMakePayments()) {\n applePay.init('pdp');\n isApplePayEligble = true;\n }\n\n if ((window.gpayPreferences != undefined || window.gpayPreferences != null) && window.gpayPreferences.isGpayEnabledOnPDP && !isApplePayEligble) {\n window.gpayPreferences.isExpressCheckout = true;\n if (typeof onGooglePayLoaded === 'function') {\n onGooglePayLoaded({\n buttonType: 'checkout',\n buttonSizeMode: 'fill'\n });\n }\n else {\n var gpayWrapper = $('.gpay-wrapper');\n\n if (gpayWrapper.length > 0) {\n gpayWrapper.hide();\n }\n }\n }\n\n var newPDPFlag = $('.pt_product-details').hasClass('pdp_redesign');\n if (newPDPFlag == true || newPDPFlag == \"true\") {\n var i = 0;\n setTimeout(function () {\n var pixleeAdjust = setInterval(function () {\n i++;\n if (i > 10) {\n clearInterval(pixleeAdjust);\n }\n pixleeAdjuster();\n }, 1000);\n }, 1000);\n\n $(document).scroll(function () {\n pixleeAdjuster();\n });\n }\n var scripts = [];\n var $veygoPlayerWindow = $('.veygo-player-window');\n\n if ($veygoPlayerWindow.length > 0) {\n scripts = [\n $veygoPlayerWindow.attr('data-vip-player-url'),\n $veygoPlayerWindow.attr('data-vip-config-url'),\n $veygoPlayerWindow.attr('data-vip-controls-url'),\n $veygoPlayerWindow.attr('data-vip-index-url'),\n ];\n }\n\n $(window).on('load', function () {\n /** re-opening turnto sso-popup after loging-in*/\n var urlParams = new URLSearchParams(window.location.search);\n var myParam = urlParams.get('turntoSSORedirect');\n if (myParam) {\n var uri = window.location.href.toString();\n var clean_uri = uri.substring(0, uri.indexOf(\"?\"));\n window.history.replaceState({}, document.title, clean_uri);\n $('html,body').animate({ scrollTop: $(\".tt-o-button\").offset().top }, 'slow');\n $('.tt-o-button')[0].click();\n }\n /** Pushing data to data layer */\n\n var veygoPlayerWindow = document.querySelector('.veygo-player-window');\n if (veygoPlayerWindow !== null && util.elementInViewport(veygoPlayerWindow) && scripts.length > 0) {\n util.loadScripts(scripts);\n $veygoPlayerWindow.attr('data-veygo-scripts-loaded', true);\n }\n\n $(document).trigger('pdp:viewPdp');\n });\n\n $(window).on('scroll', function () {\n var $veygoPlayerWindow = $('.veygo-player-window');\n if (!$('.veygo-player-window').attr('data-veygo-scripts-loaded') && scripts.length > 0) {\n util.loadScripts(scripts);\n $veygoPlayerWindow.attr('data-veygo-scripts-loaded', true);\n }\n });\n}\n\nfunction pixleeAdjuster() {\n $('.pixlee_container').each(function () {\n var IFrameWidth = $(this).find('iframe').css('width');\n var ParentWidth = $(this).css('width');\n if (IFrameWidth != ParentWidth) {\n $(this).find('iframe').css('width', $(this).css('width'));\n }\n });\n}\n/**\n * @description Initialize event handlers on product detail page\n */\nfunction initializeEvents() {\n var $pdpMain = $('#pdpMain');\n\n addToCart($pdpMain);\n availability();\n variant.init();\n image();\n productBundling.init();\n informMeWhenAvailablePDP.init();\n tjcplusactivation.init();\n\n // Product Subscription\n if (window.ProductSubscription && typeof window.ProductSubscription.initPdpEvents === 'function') {\n window.ProductSubscription.initPdpEvents();\n }\n\n jewelryBox.init();\n\n // Add to Wishlist and Add to Gift Registry links behaviors\n $pdpMain.on('click', '[data-action=\"wishlist\"], [data-action=\"gift-registry\"]', function () {\n var data = util.getQueryStringParams($('.pdpForm').serialize()),\n url;\n if (data.cartAction) {\n delete data.cartAction;\n }\n url = util.appendParamsToUrl(this.href, data);\n this.setAttribute('href', url);\n });\n\n // product options\n $pdpMain.on('change', '.product-options select', function () {\n var salesPrice = $pdpMain.find('.product-add-to-cart .price-sales'),\n selectedItem = $(this).children().filter(':selected').first();\n salesPrice.text(selectedItem.data('combined'));\n });\n\n // prevent default behavior of thumbnail link and add this Button\n $pdpMain.on('click', '.thumbnail-link, .unselectable a', function (e) {\n e.preventDefault();\n });\n\n //add cgid on clicking of the full details button in quickview\n $pdpMain.on('click', 'a.link-details', function () {\n var cgid = $('#quickViewCgid').val(),\n isSearch = $('#quickViewIsSearch').val();\n if (cgid) {\n $(this)[0].hash = 'cgid=' + encodeURIComponent(cgid);\n }\n if (isSearch) {\n if (cgid) {\n $(this)[0].hash += '&issearch=true';\n } else {\n $(this)[0].hash = 'issearch=true';\n }\n }\n });\n\n // Copy the coupon code to clipboard\n $pdpMain.on('click', '.js-coupon-code-copy', function () {\n var couponCode = $('.coupon-code').text();\n var copyButton = $(this);\n var initialButtonState = copyButton.html();\n var copiedIcon = $('#copiedIcon').val();\n\n copyButton.addClass('disabled-coupon-cta');\n\n navigator.clipboard.writeText(couponCode).then(function () {\n copyButton.find('.copy-icon').html(copiedIcon).end().find('.label').text('Copied!');\n\n setTimeout(function () {\n copyButton.html(initialButtonState);\n copyButton.removeClass('disabled-coupon-cta');\n }, 10000);\n }).catch(function () {\n copyButton.removeClass('disabled-coupon-cta');\n });\n });\n\n $('.size-chart-link a').on('click', function (e) {\n e.preventDefault();\n if (window.dialog) {\n window.dialog.open({\n url: $(e.target).attr('href')\n });\n }\n });\n\n function scrollToElement(elementToScroll) {\n $('html, body').animate({\n scrollTop: elementToScroll.offset().top\n });\n }\n\n function scrollToYotpoReview(lazyLoadContainer) {\n var elementToScroll = lazyLoadContainer.find('.yotpo-widget-container');\n if (elementToScroll.length > 0) {\n if (window.yotpoWidgetsContainer || window.loadedScripts['yotpo-widget-script']) {\n progress.hide();\n scrollToElement(elementToScroll);\n } else {\n document.addEventListener('yotpo-widget-script', function() {\n setTimeout(function() {\n progress.hide();\n scrollToElement(elementToScroll);\n }, 1000);\n })\n }\n } else {\n progress.hide();\n }\n }\n\n $pdpMain.off('click', '.pdp-global-details-section .product-reviews.pdp-product-reviews-link').on('click', '.pdp-global-details-section .product-reviews.pdp-product-reviews-link', function(e) {\n e.preventDefault();\n if (window.SitePreferences.LazyLoadingProductBottomContent) {\n var lazyLoadContainer = $('.js-lazyload-content.yotpo-widget-js');\n lazyload.lazyLoadContent(lazyLoadContainer, function() {\n scrollToYotpoReview(lazyLoadContainer);\n }, true);\n } else {\n var lazyLoadScript = $('.lazyload-script-onscroll-js.yotpo-widget-instance');\n lazyload.lazyLoadScript(lazyLoadScript);\n scrollToYotpoReview($('#pdpMain'));\n }\n });\n\n $('.js-trigger-review-summary').off('click').on('click', function () {\n if ($('#yotpo-summary').length > 0) {\n $('#yotpo-summary').trigger('click');\n return;\n }\n if (window.SitePreferences.LazyLoadingProductBottomContent) {\n var lazyLoadContainer = $('.js-lazyload-content.yotpo-widget-js');\n lazyload.lazyLoadContent(lazyLoadContainer, function() {\n loadYotpoScript();\n }, true);\n } else {\n var lazyLoadScript = $('.lazyload-script-onscroll-js.yotpo-widget-instance');\n lazyload.lazyLoadScript(lazyLoadScript);\n loadYotpoScript();\n }\n });\n\n function loadYotpoScript() {\n var yotpoWidgetContainer = $pdpMain.find('.yotpo-widget-container');\n if (yotpoWidgetContainer.length > 0) {\n if (window.yotpoWidgetsContainer || window.loadedScripts['yotpo-widget-script']) {\n progress.hide();\n clickButtonWhenAvailable(yotpoWidgetContainer);\n } else {\n document.addEventListener('yotpo-widget-script', function() {\n progress.hide();\n clickButtonWhenAvailable(yotpoWidgetContainer);\n })\n }\n } else {\n progress.hide();\n }\n }\n\n function clickButtonWhenAvailable(yotpoWidgetContainer) {\n var observer = new MutationObserver(function (mutations, obs) {\n var $button = $('#yotpo-summary');\n if ($button.length > 0) {\n $button.trigger('click');\n obs.disconnect();\n }\n });\n observer.observe(yotpoWidgetContainer[0], { childList: true, subtree: true });\n }\n\n var quickview = require(39);\n quickview.init();\n}\n\nvar product = {\n initializeEvents: initializeEvents,\n init: function () {\n initializeDom();\n initializeEvents();\n if (window.gtmDatalayer && typeof window.gtmDatalayer.pushDataToDataLayerForPDP === 'function') {\n window.gtmDatalayer.pushDataToDataLayerForPDP();\n }\n }\n};\n\nmodule.exports = product;\n", "'use strict';\n\nmodule.exports = {\n init: function () {\n var jewelrybox = $('input[name=\"jewelrybox\"]:checked');\n if (jewelrybox) {\n handleJewelryBoxChange(jewelrybox);\n }\n\n $('.pdp-jewelrybox input[type=radio][name=jewelrybox]').on('change', function(e){\n handleJewelryBoxChange(this);\n });\n }\n};\n\nfunction handleJewelryBoxChange(radioElement) {\n var jewelryboxPrice = $('.jewelrybox-price');\n var jewelryboxName = $('.jewelrybox-name');\n var jewelryboxLinkContainer = $('.jewelrybox-link');\n var jewelryboxLink = jewelryboxLinkContainer.find('a');\n var packagingItem = $(radioElement).closest('.packaging-item');\n\n if ($(radioElement).val() === 'null') {\n jewelryboxLinkContainer.addClass('d-none');\n } else {\n jewelryboxLinkContainer.removeClass('d-none');\n }\n\n $('.pdp-jewelrybox .packaging-item').removeClass('selected');\n packagingItem.addClass('selected');\n\n jewelryboxLink.attr('href',packagingItem.attr('data-url'));\n jewelryboxName.text(packagingItem.attr('data-name'));\n jewelryboxPrice.html($(radioElement).siblings('.packaging-item-price').html());\n}", "'use strict';\n\nvar addToCart = require(22),\n ajax = require(3),\n tooltip = require(44),\n util = require(46);\n\nfunction initializeEvents () {\n var $addToCart = $('#add-to-cart'),\n $addAllToCart = $('#add-all-to-cart'),\n $productSetList = $('#product-set-list'),\n\n updateAddToCartButtons = function () {\n if ($productSetList.find('.add-to-cart[disabled]').length > 0) {\n $addAllToCart.attr('disabled', 'disabled');\n // product set does not have an add-to-cart button, but product bundle does\n $addToCart.attr('disabled', 'disabled');\n } else {\n $addAllToCart.removeAttr('disabled');\n $addToCart.removeAttr('disabled');\n }\n };\n allBundlingProducts();\n\n if ($productSetList.length > 0) {\n updateAddToCartButtons();\n }\n // click on swatch for product set\n $productSetList.on('click', '.product-set-item .swatchanchor', function (e) {\n e.preventDefault();\n var url = Urls.getSetItem + this.search,\n $container = $(this).closest('.product-set-item'),\n qty = $container.find('form input[name=\"Quantity\"]').first().val();\n if (isNaN(qty)) {\n qty = '1';\n }\n url = util.appendParamToURL(url, 'Quantity', qty);\n\n ajax.load({\n url: url,\n target: $container,\n callback: function () {\n updateAddToCartButtons();\n addToCart($container);\n tooltip.init();\n }\n });\n });\n\n $(document).off('change', 'input[name=\"itemSelected\"]').on('change', 'input[name=\"itemSelected\"]',function(e) {\n var productSetData = $(this).closest('form').find('.js-product-set-data');\n var dataJson;\n\n if (productSetData.length > 0) {\n dataJson = JSON.parse(productSetData.val());\n }\n\n var isChecked = $(this).is(\":checked\");\n\n if (!isChecked) {\n $(this).parents('.product-bundling').find('input[name=\"itemSelected\"]').each(function(){\n $(this).attr('checked', false);\n });\n }\n\n if (dataJson && dataJson.setID != '' && !isChecked ) {\n productSetData.remove();\n }\n\n var $productSetContainer = $('.product-bundling-container');\n var $productSetItem = $productSetContainer.find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n\n if ($productSetContainer.hasClass('horizontal')) {\n if ($(document).width() >= 1280) {\n $productSetItem = $('.container-desktop').find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n\n } else {\n $productSetItem = $('.container-mobile').find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n }\n }\n\n updateProductSetSelection($productSetContainer, $productSetItem);\n updateSetTotalPrice();\n });\n\n $(document).off('change', '.product-bundling-container .product-bundling-variations select').on('change', '.product-bundling-container .product-bundling-variations select',function(e) {\n var $productSetContainer = $('.product-bundling-container');\n var $productSetItems = $productSetContainer.find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n var $productSetItem = $(this).closest('.product-set-item');\n var isDesktopView = $(document).width() >= 1280;\n\n if ($productSetContainer.hasClass('horizontal')) {\n if (isDesktopView) {\n $productSetItems = $('.container-desktop').find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n } else {\n $productSetItems = $('.container-mobile').find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n }\n }\n\n var url = util.appendParamsToUrl($(this).find(\":selected\").data('url'), {\n format: 'ajax',\n view: isDesktopView ? 'desktop' : 'mobile',\n isHorizontalBundle: true,\n pid: $(this).val(),\n isLastSetItem: !$productSetItem.next().hasClass('product-set-item'),\n pageType: $productSetItems.find('input[name=\"pageType\"]').val()\n });\n\n $.ajax({\n type: 'GET',\n url: url,\n success: function (data) {\n var $newProductSetItem = $(data).filter('.product-set-item');\n var $select = $newProductSetItem.find('select');\n var $form = $select.closest('form');\n\n $productSetItem.replaceWith($newProductSetItem);\n $select.val($newProductSetItem.attr('data-pid'));\n require(45)();\n\n if ($form.valid()) {\n $select.removeClass('invalid');\n } else {\n $select.addClass('invalid');\n }\n\n updateProductSetSelection($productSetContainer, $productSetItems);\n updateSetTotalPrice();\n }\n });\n\n });\n\n $('.container-mobile, .container-desktop, .confirmation, .product-bundling-container.vertical').off('click', '.add-set-items').on('click', '.add-set-items', function(e){ e.preventDefault();\n\n var forms = $(e.delegateTarget).find('input[name=\"itemSelected\"]:checked').closest('form');\n var allFormsValid = true;\n var selectedProductsIds = [];\n\n forms.each(function() {\n var select = $(this).find('select');\n var productSetItem = $(this).parent('.product-set-item');\n select.removeClass('invalid')\n\n if (!$(this).valid()) {\n allFormsValid = false;\n select.addClass('invalid');\n }\n\n if (select.length > 0) {\n productSetItem.attr('data-pid', select.val());\n }\n\n selectedProductsIds.push(productSetItem.attr('data-pid'));\n });\n\n var isProductSetAddToCart = $(this).hasClass('add-set-items');\n $('.product-bundling-container').attr('data-set-selected-products', selectedProductsIds);\n\n if ($(this).parent().hasClass('sticky-buttons')) {\n $('html, body').scrollTop($('.product-bundling-container').offset().top - 30);\n } else if (allFormsValid) {\n addToCart.addAllToCartSocial(forms, isProductSetAddToCart, selectedProductsIds);\n }\n });\n};\n\nfunction updateSetTotalPrice() {\n var totalSalePrice = 0;\n var totalListPrice = 0;\n var totalProducts = 0;\n\n var salePriceContainer = $('.product-bundling-container .summary .price-sales');\n var listPriceContainer = $('.product-bundling-container .summary .price-standard');\n var totalProductContainer = $('.totalProducts');\n var container = $('.product-bundling-container');\n\n var productSetItem = container.find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n\n if (container.hasClass('horizontal')) {\n if ($(document).width() >= 1280) {\n productSetItem = $('.container-desktop').find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n\n } else {\n productSetItem = $('.container-mobile').find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n }\n }\n\n var productLevelDiscount = false\n\n productSetItem.each(function(){\n var itemSalePrice = parseFloat($(this).find('.price-sales').attr('content'));\n var itemListPrice = parseFloat($(this).find('.price-standard').attr('content'));\n\n if (!itemListPrice) {\n itemListPrice = itemSalePrice;\n } else {\n if ($('.js-multi-buy-discount-applied').length > 0) {\n productLevelDiscount = true;\n }\n }\n\n totalSalePrice += itemSalePrice;\n totalListPrice += itemListPrice;\n totalProducts += 1;\n });\n\n if (totalProducts > 1) {\n $('.js-multi-buy-discount-applied').addClass('d-none');\n var selectedDiscount;\n var productSetDiscountObject = container.data('product-set-discount');\n\n\n if (productSetDiscountObject) {\n var productSetDiscounts = productSetDiscountObject && JSON.parse(JSON.parse(productSetDiscountObject));\n for (var i = 0; i < productSetDiscounts.length; i++) {\n if (productSetDiscounts[i].items === totalProducts) {\n selectedDiscount = productSetDiscounts[i].discount;\n $('.js-multi-buy-discount-applied').text(selectedDiscount);\n\n container.attr('data-product-set-selected-discount', selectedDiscount);\n $('.js-product-set-data').each(function() {\n var setData = JSON.parse($(this).val());\n if(setData != 0){\n setData.discount = selectedDiscount.toString();\n var updatedsetData = JSON.stringify(setData);\n $(this).val(updatedsetData);\n }\n });\n break;\n }\n }\n }\n\n if (selectedDiscount) {\n if (productLevelDiscount) {\n listPriceContainer.text('£' + totalSalePrice.toFixed(2));\n totalListPrice = totalSalePrice;\n }\n var discountedPrice = totalSalePrice === totalListPrice ? totalListPrice * (1 - selectedDiscount / 100) : totalSalePrice * (1 - selectedDiscount / 100);\n totalSalePrice = discountedPrice;\n var savedMoney = totalListPrice - discountedPrice;\n salePriceContainer.siblings('.saved-money').text('You Save: £' + savedMoney.toFixed(2));\n }\n }\n $('.js-multi-buy-discount-applied').removeClass('d-none');\n\n salePriceContainer.text('£' + totalSalePrice.toFixed(2));\n if (!productLevelDiscount) listPriceContainer.text('£' + totalListPrice.toFixed(2));\n var UKPound = new Intl.NumberFormat('en-GB', {\n style: 'currency',\n currency: 'GBP',\n });\n var updateAddToCartButtonLabel = totalProductContainer.attr('data-update-label');\n if(totalProducts == 0){\n totalProductContainer.attr('disabled', true);\n if (updateAddToCartButtonLabel === 'true') {\n totalProductContainer.text('Add to Bag');\n }\n container.find('.notapplied').removeClass('d-none').addClass('d-block');\n container.find('.js-multi-buy-promo-message').removeClass('d-none');\n container.find('.applied').removeClass('d-block').addClass('d-none');\n container.find('.notapplied').removeClass('d-none').addClass('d-block');\n container.find('.total-price').removeClass('d-flex').addClass('d-none');\n container.find('.js-empty-product-set').remove();\n container.find('.total-price').after('<p class=\"my-0 js-empty-product-set\">Please select Items to avail the discount</p>')\n }else if(totalProducts == 1){\n if (updateAddToCartButtonLabel === 'true') {\n totalProductContainer.text('Add to Bag (' + totalProducts + ' Item)');\n }\n totalProductContainer.attr('disabled', false);\n container.find('.total-price').removeClass('d-none').addClass('d-flex');\n $('.js-multi-buy-promo-message').addClass('d-none');\n container.find('.js-empty-product-set').addClass('d-none');\n }else{\n if (updateAddToCartButtonLabel === 'true') {\n totalProductContainer.text('Add to Bag (' + totalProducts + ' Items)');\n }\n totalProductContainer.attr('disabled', false);\n container.find('.js-multi-buy-promo-message').removeClass('d-none');\n container.find('.notapplied').addClass('d-none').removeClass('d-block');\n container.find('.applied').removeClass('d-none').addClass('d-block');\n container.find('.total-price').removeClass('d-none').addClass('d-flex');\n container.find('.js-empty-product-set').addClass('d-none');\n }\n\n if (totalSalePrice === totalListPrice) {\n listPriceContainer.parent().removeClass('price-promotion');\n salePriceContainer.removeClass('d-inline-block').addClass('d-none');\n salePriceContainer.siblings('.saved-money').addClass('d-none');\n } else {\n listPriceContainer.parent().addClass('price-promotion');\n salePriceContainer.addClass('d-inline-block').removeClass('d-none');\n\n if (totalProducts === 1) {\n salePriceContainer.siblings('.saved-money').addClass('d-none');\n\n listPriceContainer.text(UKPound.format(totalListPrice));\n }\n\n listPriceContainer.show();\n }\n}\n\nfunction updateProductSetSelection($productSetContainer, $productSetItem) {\n var selectedProductsIds = [];\n $productSetItem.each(function() {\n selectedProductsIds.push($(this).attr('data-pid'));\n });\n $productSetContainer.attr('data-set-selected-products', selectedProductsIds);\n}\nfunction allBundlingProducts() {\n var allBundlingProducts = [],\n $allBundlingProductIDs = $('.product-bundling-container .product-bundling-items').length > 0 ? $('.product-bundling-container .product-bundling-items') : $('.product-bundling-container.confirmation') ,\n $productSetContainer = $('.product-bundling-container'),\n $productSetItem = $allBundlingProductIDs.find('.product-set-item');\n $productSetItem.each(function() {\n allBundlingProducts.push($(this).attr('data-pid'));\n });\n $productSetContainer.attr('data-set-all-products', allBundlingProducts);\n}\n\nmodule.exports = {\n init: function () {\n initializeEvents();\n\n var $productSetContainer = $('.product-bundling-container');\n var $salePriceContainer = $productSetContainer.find('.summary .price-sales');\n var $listPriceContainer = $productSetContainer.find('.summary .price-standard');\n var $totalProductContainer = $('.totalProducts');\n var $productSetItem = $productSetContainer.find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n\n if ($productSetContainer.hasClass('horizontal')) {\n if ($(document).width() >= 1280) {\n $productSetItem = $('.container-desktop').find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n\n } else {\n $productSetItem = $('.container-mobile').find('input[name=\"itemSelected\"]:checked').closest('.product-set-item');\n }\n }\n\n if ($productSetContainer.length > 0 && $salePriceContainer.length > 0 && $listPriceContainer.length > 0 && $totalProductContainer.length > 0 && $productSetItem.length > 0) {\n updateSetTotalPrice();\n updateProductSetSelection($productSetContainer, $productSetItem);\n }\n },\n initializeEvents: initializeEvents,\n updateSetTotalPrice: updateSetTotalPrice,\n};", "'use strict';\n\nvar ajax = require(3),\n util = require(46);\n\n/**\n * @description loads product's navigation\n **/\nmodule.exports = function () {\n var $pidInput = $('.pdpForm input[name=\"pid\"]').last(),\n $navContainer = $('#product-nav-container'),\n pid,\n hash,\n url;\n // if no hash exists, or no pid exists, or nav container does not exist, return\n if (window.location.hash.length <= 1 || $pidInput.length === 0 || $navContainer.length === 0) {\n return;\n }\n\n pid = $pidInput.val();\n hash = window.location.hash.substr(1);\n url = util.appendParamToURL(Urls.productNav + '?' + hash, 'pid', pid);\n\n ajax.load({\n url: url,\n target: $navContainer\n });\n};\n", "'use strict';\n\n/**\n * @description Enables the zoom viewer on the product detail page\n */\nvar loadZoom = function (imageURL) {\n var pageContextType = pageContext.type;\n if(pageContextType == \"product\"){\n var $imgZoom = $('#QuickViewDialogOverlay .overlay-item:visible'),\n hiresURL;\n\n if (!$imgZoom.length) {\n return;\n }\n if (imageURL) {\n hiresURL = imageURL;\n } else {\n // Get Zoom Image URL\n hiresURL = $('.productthumbnail.selected').data('zoom-image-url');\n }\n\n // Init Zoom View\n if (hiresURL && hiresURL !== 'null' && hiresURL.indexOf('noimagelarge') === -1) {\n $imgZoom.zoom({\n url: hiresURL\n });\n }\n }\n};\n\n\n/**\n * @description Sets the main image attributes and the href for the surrounding <a> tag\n * @param {Object} atts Object with url, alt, title and hires properties\n */\nvar setMainImage = function (imageURL, zoomImageURL) {\n $('#QuickViewDialog .product-primary-image .single-view img').css('display', '');\n\n // check for url\n try {\n if(typeof imageURL === \"object\"){\n return false;\n }else if(imageURL.indexOf('http') < 0){\n return false;\n }\n } catch (b) {\n //console.log(b);\n return false;\n }\n\n // replace main image\n $('#QuickViewDialog .product-primary-image .single-view img').attr({\n src: imageURL\n });\n\n var pageContextType = pageContext.type;\n if(pageContextType == \"product\"){\n // re-init zoom view\n $('#QuickViewDialog .product-primary-image .single-view .main-image').attr({\n href: zoomImageURL\n });\n loadZoom();\n }\n};\n\nvar loadImageComponents = function () {\n // Init Thumbnails\n\n\n $('#QuickViewDialog').on('click', '.productthumbnail:not(.video)', function (e) {\n e.preventDefault();\n $(this).closest('.product-thumbnails').find('.productthumbnail.selected').removeClass('selected');\n $(this).addClass('selected');\n $('.video-text').removeClass('active');\n\n setMainImage($(this).data('main-image-url'), $(this).data('zoom-image-url'));\n\n // show image\n $('#QuickViewDialog .product-primary-image .single-view img').css('visibility','visible');\n\n // hide video\n }).on('click', '.productthumbnail.video', function (e) {\n e.preventDefault();\n $(this).closest('.product-thumbnails').find('.productthumbnail.selected').removeClass('selected');\n $(this).addClass('selected');\n\n // hide image\n $('#QuickViewDialog .product-primary-image .single-view img').css('visibility','hidden');\n });\n\n $('#QuickViewDialog').on('click', '.primary-col .icons-product-image', function () {\n loadZoom();\n });\n\n $('#QuickViewDialog').on('click', '.product-primary-image .single-view .nav-prev.button', function () {\n var thumbnails = $('#QuickViewDialog .product-thumbnails'),\n selectedThumbnail = thumbnails.find('.productthumbnail.selected'),\n previousThumbnail = selectedThumbnail.prev(),\n isFirstThumbnail = thumbnails.find('.productthumbnail').first().hasClass('selected');\n\n if (isFirstThumbnail) {\n previousThumbnail = thumbnails.find('.productthumbnail').last();\n // bubbles are not visible but needed as a workaround for scrolling\n thumbnails.find('.bubble-ctr .bubble').last().click();\n } else {\n $('#QuickViewDialog .product-thumbnails .nav-prev').click();\n }\n\n previousThumbnail.click();\n });\n\n $('#QuickViewDialog').on('click', '.product-primary-image .single-view .nav-next.button', function () {\n var thumbnails = $('#QuickViewDialog .product-thumbnails'),\n selectedThumbnail = thumbnails.find('.productthumbnail.selected'),\n nextThumbnail = selectedThumbnail.next(),\n isLastThumbnail = thumbnails.find('.productthumbnail').last().hasClass('selected');\n\n if (isLastThumbnail) {\n nextThumbnail = thumbnails.find('.productthumbnail').first();\n // bubbles are not visible but needed as a workaround for scrolling\n thumbnails.find('.bubble-ctr .bubble').first().click();\n } else {\n $('#QuickViewDialog .product-thumbnails .nav-next').click();\n }\n\n nextThumbnail.click();\n });\n\n};\n\n/* @module image\n * @description this module handles the primary image viewer on PDP\n **/\n\n/**\n * @description by default, this function sets up zoom and event handler for thumbnail click\n **/\nmodule.exports = function () {\n // Load Zoom View\n loadZoom();\n loadImageComponents();\n};\n\nmodule.exports.loadZoom = loadZoom;\nmodule.exports.loadImageComponents = loadImageComponents;\nmodule.exports.setMainImage = setMainImage;", "'use strict';\n\nvar ajax = require(3),\n image = require(24),\n pdpoverlay = require(33),\n pdpprint = require(34),\n productBundling = require(27),\n tooltip = require(44),\n util = require(46),\n tjcplusactivation = require(43),\n newsignin = require(14),\n uniform = require(45),\n qbfornonlivetv = require(37),\n jewelryBox = require(26);\n\n\nvar parent = $('#pdpMain').find('#product-content-wrapper'),\n promotionalPriceavailable = parent.find('.promoprice-available').val();\n\nfunction showSlot() {\n var finalPriceString = parent.find('.price-sales').attr('content'),\n finalPriceFloat = parseFloat(finalPriceString),\n priceForEligibility = window.SitePreferences.PriceForTBEligibility,\n assetpdp = parent.find('.assetTB');\n assetpdp.hide();\n if (finalPriceFloat >= priceForEligibility) {\n assetpdp.show();\n }\n\n}\n\nshowSlot();\n\n/**\n * @description update product content with new variant from href, load new content to #product-content panel\n * @param {String} href - url of the new product variant\n **/\nvar updateContent = function (href) {\n\n var $pdpMain = $('#pdpMain'),\n $pdpForm = $('.pdpForm'),\n $pdpFlyIn = $('#pdpMain').find('.flyin .flyin-inner');\n\n if ($('#QuickViewDialog').is(':visible')) {\n $pdpMain = $('#QuickViewDialog .pdp-main');\n $pdpForm = $('#QuickViewDialog .pdpForm');\n $pdpFlyIn = $('#QuickViewDialog').find('.flyin .flyin-inner');\n }\n\n var qty = $pdpForm.find('input[name=\"Quantity\"]').first().val(),\n params = {\n Quantity: isNaN(qty) ? '1' : qty,\n format: 'ajax',\n productlistid: $pdpForm.find('input[name=\"productlistid\"]').first().val(),\n viewtype: $('#viewtype').val()\n };\n\n var isJewelryBox = $('.jewelrybox-packaging').length > 0;\n\n if (isJewelryBox) {\n var jewelrybox = $('input[name=\"jewelrybox\"]:checked').val();\n\n if (jewelrybox && jewelrybox != 'null') {\n params.jewelrybox = jewelrybox;\n }\n };\n\n var url = new URL(href);\n var isSizeAttribute = url.searchParams.get(\"isSizeAttribute\") !== null\n ? url.searchParams.get(\"isSizeAttribute\")\n : false;\n url.searchParams.delete(\"isSizeAttribute\");\n\n if (isSizeAttribute === 'true') {\n $.ajax({\n url: util.appendParamsToUrl(href, params),\n method: 'GET',\n success: function (response) {\n var $responseHtml = $(response);\n\n // Update product details section\n var $productDetailsSection = $responseHtml.find('.pdp-global-details-section');\n $('.pdp-global-details-section').replaceWith($productDetailsSection);\n \n\n // Handle Google Pay initialization\n if ((window.gpayPreferences != undefined || window.gpayPreferences != null) && window.gpayPreferences.isGpayEnabledOnPDP) {\n window.gpayPreferences.isExpressCheckout = true;\n if (typeof onGooglePayLoaded === 'function') {\n onGooglePayLoaded({\n buttonType: 'checkout',\n buttonSizeMode: 'fill'\n });\n }\n }\n if (window._dw && window._dw.applepay && window.ApplePaySession && window.ApplePaySession.canMakePayments()) {\n // Show Apple Pay button\n var applePayDetails = $('.applePayDetails');\n if (applePayDetails.length > 0) {\n applePayDetails.removeClass('d-none');\n }\n // Hide Gpay button on PDP\n var googlePayDetails = $('.googlePayDetails');\n if (googlePayDetails.length > 0) {\n googlePayDetails.addClass('d-none');\n }\n }\n\n // initializations\n jewelryBox.init();\n\n // Product Subscription\n if (window.ProductSubscription && typeof window.ProductSubscription.initPdpEvents === 'function') {\n window.ProductSubscription.initPdpEvents();\n }\n\n $pdpMain.find('.pdp-product-quantity').val(\"1\");\n util.executeJqueryReadyCallbacks();\n AttributeNameChange($pdpMain, '.attribute.color-variations .swatches', '.color-name');\n AttributeNameChange($pdpMain, '.swatches.size', '.size-name');\n image.loadZoom();\n image.loadImageComponents();\n pdpoverlay.init();\n pdpprint.init();\n qbfornonlivetv.init();\n tooltip.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n uniform();\n if (window.globalcontentutils && typeof window.globalcontentutils.init === 'function') {\n window.globalcontentutils.init();\n }\n\n var $productBundlingContainer = $('.pdp-global-details-section').find('.product-bundling-container');\n\n if ($productBundlingContainer.length > 0) {\n productBundling.init();\n };\n },\n error: function (status, error) {\n console.error('AJAX call failed:', status, error);\n }\n });\n } else {\n ajax.load({\n url: util.appendParamsToUrl(href, params),\n target: $pdpMain.find('#product-content-wrapper'),\n callback: function (response) {\n var $responseHtml = $(response);\n // Update product SEO name when only color is changed\n var $seoName = $responseHtml.find('.js-productSEOName').html();\n $('.product-long-name').html($seoName);\n // Update product details section\n var $productDetailsSection = $responseHtml.find('.pdp-global-details-section');\n $('.pdp-global-details-section').replaceWith($productDetailsSection);\n if ($('.multiple-size-option').length > 0 && $('.swatches.size').length > 0) {\n var $colors = $('.swatches.color');\n var $sizes = $('.swatches.size');\n var notifymeBells = $sizes.find('.notifyme-bell').length;\n var sizesAvailable = $sizes.find('.js-size-item').length;\n var isSelectedSizeOutOfStock = $('.swatches.size li.selected').hasClass('unavailable');\n\n if (notifymeBells !== sizesAvailable && $colors.find('li.selected').find('.notifyme-bell').length > 0 && !isSelectedSizeOutOfStock) {\n $colors.find('li.selected').find('.notifyme-bell').remove();\n }\n }\n\n image.loadZoom();\n image.loadImageComponents();\n pdpoverlay.init();\n pdpprint.init();\n qbfornonlivetv.init();\n tooltip.init();\n if (window.carousel && typeof window.carousel.init === 'function') {\n window.carousel.init();\n }\n wishListAJAXEvent();\n AttributeNameChange($pdpMain, '.swatches.color', '.color-name');\n AttributeNameChange($pdpMain, '.attribute.color-variations .swatches', '.color-name');\n $pdpMain.find('.flyin .flyin-inner').replaceWith($pdpFlyIn);\n util.executeJqueryReadyCallbacks();\n $pdpMain.find('.pdp-product-quantity').val(\"1\");\n tjcplusactivation.init();\n uniform();\n updateCanonicalUrl();\n showSlot();\n\n // Product Subscription\n if (window.ProductSubscription && typeof window.ProductSubscription.initPdpEvents === 'function') {\n window.ProductSubscription.initPdpEvents();\n }\n\n jewelryBox.init();\n\n if (window.yotpoWidgetsContainer && typeof window.yotpoWidgetsContainer.initWidgets === 'function') {\n window.yotpoWidgetsContainer.initWidgets(false);\n }\n if ($('.veygo-player-window').length > 0) {\n $('.veygo-player-window').removeData('data-veygo-scripts-loaded');\n }\n\n var $productBundlingContainer = $('.product-bundling-container');\n\n if ($productBundlingContainer.length > 0) {\n productBundling.init();\n };\n\n //GooglePay\n if ((window.gpayPreferences != undefined || window.gpayPreferences != null) && window.gpayPreferences.isGpayEnabledOnPDP) {\n window.gpayPreferences.isExpressCheckout = true;\n if (typeof onGooglePayLoaded === 'function') {\n onGooglePayLoaded({\n buttonType: 'checkout',\n buttonSizeMode: 'fill'\n });\n }\n }\n\n if (window._dw && window._dw.applepay && window.ApplePaySession && window.ApplePaySession.canMakePayments()) {\n // Show Apple Pay button\n var applePayDetails = $('.applePayDetails');\n if (applePayDetails.length > 0) {\n applePayDetails.removeClass('d-none');\n }\n\n // Hide Gpay button on PDP\n var googlePayDetails = $('.googlePayDetails');\n if (googlePayDetails.length > 0) {\n googlePayDetails.addClass('d-none');\n }\n }\n\n var addToCart = require(22);\n addToCart($pdpMain);\n if (window.globalcontentutils && typeof window.globalcontentutils.init === 'function') {\n window.globalcontentutils.init();\n }\n\n // Updates the product in the FREQUENTLY BOUGHT TOGETHER section based on Qucick view selection.\n $('.update-product').on('click', function (e) {\n e.preventDefault();\n var isProductSetModal = false;\n var $container = $('.pdp-global-template');\n\n if ($(e.currentTarget).parents('.pdp-global-template').length > 0) {\n isProductSetModal = $(e.currentTarget).parents('.pdp-global-template').hasClass('productSet');\n }\n\n var sizeVariation = $('.attribute.size-variations');\n\n if (isProductSetModal) {\n $container = $('.pdp-global-template.updateSetTotalPriceproductSet');\n sizeVariation = $container.find('.attribute.size-variations')\n }\n\n if (sizeVariation.length > 0) {\n var selectedSwatch = sizeVariation.find('li.selected');\n if (selectedSwatch.length <= 0) {\n sizeVariation.find('span.error').removeClass('d-none');\n $('body,html').scrollTop(sizeVariation.offset().top);\n return false;\n }\n }\n // pid of the product to be updated\n var pid = $('#QuickViewDialog').data('pid');\n var targetContainer = $('.product-set-item[data-pid=\"' + pid + '\"]');\n var targetUrl = $(this).data('url');\n var targetPid = targetUrl.substring(targetUrl.indexOf('?') + 1).split('&')[0].split('=')[1];\n // ajax get new pid details\n $.ajax({\n type: 'GET',\n url: $(this).data('url'),\n success: function (data) {\n targetContainer.replaceWith(data);\n\n var mobileImgContainer = $('.product-bundling-container .mobile-only .product-bundling-image[data-pid=\"' + pid + '\"]');\n if (mobileImgContainer.length) {\n var newImg = jQuery(data).find('.product-bundling-image .image').find(\"img\").attr('src');\n $('.product-bundling-container .mobile-only .product-bundling-image[data-pid=\"' + pid + '\"] .image').find('img').attr('src', newImg);\n mobileImgContainer.attr('data-pid', targetPid);\n }\n $('input[name=\"itemSelected\"]').uniform();\n productBundling.updateSetTotalPrice();\n\n var productSetBundlingContainer = $('.product-bundling-container');\n\n if (productSetBundlingContainer.length > 0) {\n var selectedProducts = productSetBundlingContainer.attr('data-set-selected-products');\n\n selectedProducts = selectedProducts.replace(pid, targetPid);\n productSetBundlingContainer.attr('data-set-selected-products', selectedProducts);\n }\n }\n });\n if (window.dialog) {\n window.dialog.close();\n }\n });\n\n try {\n var pictureTag = document.querySelectorAll('picture source');\n for (var j = 0; j < pictureTag.length; j++) {\n var pictureTagArr = pictureTag[j];\n var pictureTagUrl = pictureTagArr.getAttribute('data-srcset');\n if (pictureTagUrl) {\n pictureTagArr.setAttribute('srcset', pictureTagUrl);\n }\n }\n\n var lazyImg = document.querySelectorAll('img.lazy');\n for (var i = 0; i < lazyImg.length; i++) {\n var imgArr = lazyImg[i];\n var imgUrl = imgArr.getAttribute('data-src');\n if (imgUrl) {\n imgArr.setAttribute('src', imgUrl);\n }\n }\n\n } catch (error) {\n // console.log(error)\n }\n\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n if ($('.pdp_redesign .pdp-container-addtocart .pdp-box-addtocart .variations-wrapper.variant-product:visible').length >= 1) {\n $('.pdp_redesign .pdp-container-addtocart .pdp-box-addtocart .variations-wrapper:visible').removeClass('variant-product');\n }\n }\n });\n }\n return true;\n};\n\nfunction updateCanonicalUrl() {\n var url = Urls.formCanonicalUrl;\n var pid = $('#product-id-variant').val();\n url = util.appendParamToURL(url, 'pid', pid);\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n try {\n if (response.success) {\n $('link[rel=\"canonical\"]').attr('href', response.Url);\n }\n } catch (b) {\n //console.log(b);\n }\n },\n });\n\n}\nfunction wishListAJAXEvent() {\n\n $(document).off('click.wishlist').on('click.wishlist', '.product-wishlist-link, .product-slider-wishlist-link', function (e) {\n e.preventDefault();\n if ($(this).hasClass('login-class') || $(this).hasClass('login-wish-class')) {\n window.location.href = $(this).attr('href').replace('#', '?');\n } else {\n wishListAJAX(this);\n }\n });\n newsignin.init();\n}\nfunction wishListAJAX($this) {\n var originalHref = $($this).attr('href');\n var url = originalHref.split('#')[0] + '?' + originalHref.split('#')[1],\n $this = $($this),\n processClass = \"\";\n url = util.appendParamToURL(url, 'isNewPDP', true);\n var start_time = new Date().getTime();\n\n $.ajax({\n url: url,\n type: 'GET',\n success: function (response) {\n var responseJSON = JSON.parse(response);\n if (responseJSON.success) {\n $($this).attr('href', responseJSON.wishListURL.replace('?', '#'));\n $($this).attr('class', responseJSON.wishListClass);\n $($this).find('i').attr('class', responseJSON.wishListSymbolClass);\n wishListAJAXEvent();\n /*var request_time = new Date().getTime() - start_time,\n remaining_time = 1500 - request_time;\n if(request_time >= 1500){\n $($this).removeClass(processClass);\n $($this).attr('href', responseJSON.wishListURL);\n $($this).attr('class', responseJSON.wishListClass);\n $($this).find('i').attr('class', responseJSON.wishListSymbolClass);\n }else{\n setTimeout(function(){\n $($this).removeClass(processClass);\n $($this).attr('href', responseJSON.wishListURL);\n $($this).attr('class', responseJSON.wishListClass);\n $($this).find('i').attr('class', responseJSON.wishListSymbolClass);\n }, remaining_time);\n }*/\n }\n },\n error: function (jqXHR, textStatus, errorThrown) {\n //console.warn(textStatus + errorThrown);\n //$($this).removeClass(processClass);\n }\n });\n}\n\n//This is for the swatches that are contained as HTML in product business manager\n$(document).ready(function () {\n var dataText = $('.attribute-variations li.selected').attr(\"data-hover\");\n $('.variations-title span').text(dataText);\n if ($('.swatches').length > 0) {\n $(\".swatch\").hover(function () {\n var dataText = $(this).attr(\"data-hover\");\n $('.variations-title span').text(dataText);\n });\n $('.swatch').mouseleave(function () { $('.variations-title span').text(dataText); });\n }\n});\n\nfunction init() {\n newsignin.init();\n var $pdpMain = $('.pdp-main');\n if ($('#QuickViewDialog').is(':visible')) {\n $pdpMain = $('#QuickViewDialog .pdp-main');\n }\n AttributeNameChange($pdpMain, '.swatches.color', '.color-name');\n AttributeNameChange($pdpMain, '.attribute.color-variations .swatches', '.color-name');\n AttributeNameChange($pdpMain, '.swatches.size', '.size-name');\n\n var $productBundlingContainer = $('.product-bundling-container');\n\n if ($productBundlingContainer.length > 0) {\n productBundling.init();\n }\n\n $('.dropshiptac').find('label span').addClass('tooltip');\n $('.dropshiptac').find('label span').attr(\"title\", \"This product can only be shipped to UK (Excluding channel island). Don't worry, if you are outside of UK, you can still order from a wide range of products.\");\n\n $('.update-product').on('click', function (e) {\n e.preventDefault();\n var isProductSetModal = false;\n var $container = $('.pdp-global-template');\n\n if ($(e.currentTarget).parents('.pdp-global-template').length > 0) {\n isProductSetModal = $(e.currentTarget).parents('.pdp-global-template').hasClass('productSet');\n }\n\n var sizeVariation = $('.attribute.size-variations');\n\n if (isProductSetModal) {\n $container = $('.pdp-global-template.productSet');\n sizeVariation = $container.find('.attribute.size-variations')\n }\n\n if (sizeVariation.length > 0) {\n var selectedSwatch = sizeVariation.find('li.selected');\n if (selectedSwatch.length <= 0) {\n sizeVariation.find('span.error').removeClass('d-none');\n $('body,html').scrollTop(sizeVariation.offset().top);\n return false;\n }\n }\n });\n\n // hover on swatch - should update main image with swatch image\n $pdpMain.on('mouseenter mouseleave', '.swatchanchor', function () {\n var largeImg = $(this).data('lgimg'),\n $imgZoom = $pdpMain.find('.main-image'),\n $mainImage = $pdpMain.find('.primary-image');\n\n if (!largeImg) {\n return;\n }\n // store the old data from main image for mouseleave handler\n $(this).data('lgimg', {\n hires: $imgZoom.attr('href'),\n url: $mainImage.attr('src'),\n alt: $mainImage.attr('alt'),\n title: $mainImage.attr('title')\n });\n // set the main image\n image.setMainImage(largeImg);\n });\n\n // click on swatch - should replace product content with new variant\n $pdpMain.on('click', '.product-variations .swatchanchor:not(.sticky-variant-anchor):visible', function (e) {\n e.preventDefault();\n updateContent($(this).attr('data-href'), $(this).attr('data-set-details'));\n });\n\n // change drop down variation attribute - should replace product content with new variant\n $pdpMain.on('change', '.variation-select', function () {\n if ($(this).val().length === 0) {\n return;\n }\n updateContent($(this).val());\n });\n\n $pdpMain.off('click.wishlist').on('click.wishlist', '.product-wishlist-link, .product-slider-wishlist-link', function (e) {\n e.preventDefault();\n if ($(this).hasClass('login-wish-class')) {\n window.location.href = $(this).attr('href');\n } else {\n wishListAJAX(this);\n }\n });\n}\n\nfunction updateContentExt(href) {\n return updateContent(href);\n}\n\nfunction AttributeNameChange($pdpMain, attributeSelector, nameSelector) {\n var attribute = $pdpMain.find(attributeSelector);\n\n if (attribute.length > 0) {\n var updateName = function (element) {\n var dataLgImg = element.attr(\"data-lgimg\");\n if (dataLgImg) {\n var obj = JSON.parse(dataLgImg);\n element.closest('.attribute').find(nameSelector + ' span').text(obj.color);\n }\n };\n\n // Update name for the initially selected variant\n var selectedVariant = attribute.find('li.selected .swatchanchor');\n if (selectedVariant.length > 0) {\n updateName(selectedVariant);\n }\n\n // Handle hover events\n attribute.find(\".swatchanchor\").on(\"mouseenter\", function () {\n updateName($(this));\n });\n\n // Handle mouseleave events\n attribute.find(\".swatchanchor\").on(\"mouseleave\", function () {\n var selectedVariant = attribute.find('li.selected .swatchanchor');\n if (selectedVariant.length > 0) {\n updateName(selectedVariant);\n }\n });\n }\n}\n\nvar plpwishlist = function () {\n $('.plp-wishlist').off('click.wishlist').on('click.wishlist', '.product-wishlist-link', function (e) {\n e.preventDefault();\n if ($(this).hasClass('login-wish-class')) {\n window.location.href = $(this).attr('href');\n } else {\n wishListAJAX(this);\n }\n });\n}\n\n// Module public functions\nmodule.exports = {\n init: init,\n updateContent: updateContentExt,\n plpwishlist: plpwishlist,\n wishListAJAXEvent: wishListAJAXEvent,\n};\n", "'use strict';\n\nvar nbDataLayer = require(15),\n enableCheckoutButton = require(20),\n progress = require(35),\n util = require(46);\n\nvar initPaysafe = function () {\n\n if (window.paysafeScriptInsert === undefined || (window.paysafeScriptInsert != true && !window.paysafe)) {\n $.getScript('https://hosted.paysafe.com/js/v1/latest/paysafe.min.js')\n window.paysafeScriptInsert = true;\n }\n\n // if(window.SitePreferences.ApplePay_OnCheckout_Flag && window.applePayScriptInsert != true){\n // var applePay_script = document.createElement('script');\n // applePay_script.setAttribute('src','https://hosted.paysafe.com/request/v1/latest/paysafe.request.min.js');\n // document.head.appendChild(applePay_script);\n // console.log('ApplePay-paysafe script inserted');\n // window.applePayScriptInsert = true;\n // }\n\n if (!$('.paysafe-card-details').length) {\n return;\n }\n\n var btoa = window.btoa,\n apiKey = btoa(window.SitePreferences.PAYSAFE_SINGLE_USE_TOKEN),\n paysafe = window.paysafe,\n $form = $('.paysafe-card-details'),\n $credit = $('.tjc-credit-details'),\n $formSubmitOrder = $('.checkout-billing'),\n $paymentMethod = $('input[name=dwfrm_billing_paymentMethods_selectedPaymentMethodID]'),\n $paymentMethodsWarning = $('.payment-methods-warning-inner'),\n payBtn = $form.find('#payNow'),\n $secondayPayNowBtn = $('.paynow'), // This is the Big PAY NOW BUTTON.\n $selectCard = $form.find('#existing-paysafe-card'),\n $selectCardCVV = $form.find('#existing-paysafe-cvv'),\n //$selectCVVForm = $form.find('.cvv-input'),\n $existingCardForm = $form.find('.existing-card-options'),\n $newCardForm = $form.find('.new-card-form'),\n newFormClass = '',\n cardBrandClass = {\n AmericanExpress: 'fa-cc-amex',\n MasterCard: 'fa-cc-mastercard',\n Visa: 'fa-cc-visa',\n Diners: 'fa-cc-diners-club',\n JCB: 'fa-cc-jcb',\n Maestro: 'fa-cc-discover'\n },\n $tjcCredit = $('input[name=dwfrm_billing_tjcCredit]'),\n tjcCreditBalance = $tjcCredit.data('creditavailable'),\n netPrice = $tjcCredit.data('subtotal'),\n paysafeConfig = { // PAYSAFE FIELD CONFIGURATION\n environment: window.SitePreferences.PAYSAFE_ENVIRONMENT,\n\n // set the CSS selectors to identify the payment field divs above\n // set the placeholder text to display in these fields\n fields: {\n cardNumber: {\n selector: '#cardNumber',\n placeholder: $('#cardNumber').data('placeholder')\n },\n expiryDate: {\n selector: '#cardExpiry',\n placeholder: $('#cardExpiry').data('placeholder')\n },\n cvv: {\n selector: '#cardCVC',\n placeholder: $('#cardCVC').data('placeholder')\n }\n },\n\n initializationTimeout: window.SitePreferences.Netbanx_Timeout\n },\n\n // work around for submitting the form in case of new card, which is asynchronus.\n submitPaymentForm = function (form) {\n if (window.SitePreferences.EnableGoogleRecaptchaV3) {\n grecaptcha.ready(function () {\n grecaptcha.execute(window.SitePreferences.SiteKeyGoogleRecaptchaV3, { action: 'tjcchecckout' }).then(function (token) {\n $(\".grecaptcharesponse-js\").val(token);\n var input = $('<input>')\n .attr('type', 'hidden')\n .attr('name', $('#payNow').attr('name')).val('X');\n $(form).append(input);\n form.submit();\n });\n });\n } else {\n var input = $('<input>')\n .attr('type', 'hidden')\n .attr('name', $('#payNow').attr('name')).val('X');\n $(form).append(input);\n form.submit();\n }\n },\n\n paymentFormReady = function () {\n var isPaymentFormReady = false,\n tjcCreditValue = $tjcCredit.val();\n if ($form.find('#cardNumber').hasClass('success') &&\n $form.find('#cardExpiry').hasClass('success') &&\n $form.find('#cardCVC').hasClass('success') &&\n $selectCard.val() === 'newCard') {\n isPaymentFormReady = true;\n } else if ($selectCard.val() !== 'newCard' && ($selectCard.val() !== null && $selectCard.val() !== '') &&\n $selectCardCVV.val() !== '') {\n isPaymentFormReady = true;\n } else if (parseInt(tjcCreditValue) >= tjcCreditBalance) {\n return true;\n }\n return isPaymentFormReady;\n };\n\n\n $(document).on('click', '.credit-apply-button', function () {\n $('.credit-apply-button').data('credit-clicked', true);\n\n });\n /***** Added For Password Eye Icon *******/\n $('.icon-password').off('click').on('click', function () {\n var $this = $(this), $passwordField = $this.closest('.budgetPay-password').find('.input-text');\n if (!$this.hasClass('show')) {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'password');\n } else {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'text');\n }\n $this.toggleClass('show');\n });\n /***** Added For Placeholder / Lable *******/\n //Lable appear on top on focus\n $('.budgetPay-password input').on('focus', function () {\n $(this).siblings(\".focus-helper\").show();\n $(\".login-box-content .error\").hide();\n $(this).siblings(\".label\").addClass('focus-active');\n });\n //check length of input on focus out the field\n $('.budgetPay-password input').on('blur', function () {\n $(\".focus-helper\").hide();\n $(this).siblings(\".label\").removeClass('focus-active');\n if ($(this).val().length > 0) {\n $(this).siblings(\".label\").addClass('focus-active');\n\n }\n });\n\n $(document).ready(function () {\n $('.bp_guest_pass').keyup(function () {\n if ($(this).val().length > 3) {\n $('#bp_signin_btn').removeAttr('disabled');\n } else {\n $('#bp_signin_btn').attr('disabled', 'disabled');\n }\n }).trigger('keyup');\n });\n $(document).off('click', '#bp_signin_btn').on('click', '#bp_signin_btn', function (e) {\n e.preventDefault();\n\n $('.signin-guest-bp-errormsg').addClass(\"hidden\");\n var guestPassword = $('.bp_guest_pass').val();\n\n if ($('.bp_guest_pass').val().length > 3) {\n var guestPass = $('.bp_guest_pass').val();\n var profileExists = $('#profileExists').val();\n var isTvCustomer = $('#isTvCustomer').val();\n try {\n $.ajax({\n url: Urls.checkCustomerAuth + \"?guestCustPass=\" + guestPass + \"&profileExists=\" + profileExists + \"&isTvCustomer=\" + isTvCustomer,\n type: 'POST',\n success: function () {\n $('.paysafe-card-details.BudgetPay').removeClass(\"hidden\");\n $('.form-group.checkbox-input-wrapper.sameAsShipping').removeClass(\"hidden\");\n $('.signin-guest-bp-signin').addClass(\"hidden\");\n $('.password-field.signin-guest-bp-password').addClass(\"hidden\");\n $('.forgot-password-pin.signin-guest-bp-forgot-password').addClass(\"hidden\");\n $('.signin-guest-bp-errormsg').addClass(\"hidden\");\n },\n error: function () {\n $('.signin-guest-bp-errormsg').removeClass(\"hidden\");\n }\n });\n } catch (b) {\n //DO nothing\n }\n } else if (guestPassword == '') {\n $('.signin-guest-bp-errormsg').addClass(\"hidden\");\n\n } else {\n $('.signin-guest-bp-errormsg').removeClass(\"hidden\");\n $('.error-msg').addClass('hidden');\n }\n });\n\n\n /**\n * Handle case for the paysafe form\n * if the paysafe radio is selected, show form and hide Pay now button\n * else hide the paysafe form and show pay now button.\n * For TJC Credit, we disregard this logic as it can be coupled with\n * any payment method.\n */\n $(document).on('click', '.payment-method-wrapper .input-radio', function () {\n if ($(this).val().toLowerCase() === 'tjccredit') {\n $credit.slideToggle();\n return;\n }\n // TJC Credit could also be active at this time\n var selectedPaymentMethods = $paymentMethod.filter(':checked'),\n selectedPaymentMethod = {}, bpisexistinigcust = $('#bpisexistinigcust').val();\n for (var i = 0; i < selectedPaymentMethods.length; i++) {\n if (selectedPaymentMethods[i].value !== \"TJCCredit\") {\n selectedPaymentMethod = selectedPaymentMethods[i].value;\n break;\n }\n }\n if ($(this).hasClass('paysafe')) {\n if (selectedPaymentMethod === 'Paysafe') {\n $('.buget-pay-remember-card-text').css('display', 'none');\n $('#newcard-paysafe-remember').parent().addClass('checked');\n $('#newcard-paysafe-remember').closest('.checkbox-input-wrapper').removeAttr('style');\n $('#existing-paysafe-forget').closest('.checkbox-input-wrapper').removeAttr('style');\n } else {\n $('#newcard-paysafe-remember').prop('checked', true);\n $('#existing-paysafe-forget').prop('checked', false);\n $('.buget-pay-remember-card-text').css('display', 'block');\n $('#existing-paysafe-forget').parent().removeClass('checked');\n $('#newcard-paysafe-remember').parent().addClass('checked');\n $('#newcard-paysafe-remember').closest('.checkbox-input-wrapper').css('display', 'none');\n $('#existing-paysafe-forget').closest('.checkbox-input-wrapper').css('display', 'none');\n }\n newFormClass = 'paysafe-card-details ' + selectedPaymentMethod;\n $secondayPayNowBtn.hide();\n $form.attr('class', newFormClass).show();\n\n if (selectedPaymentMethod === 'BudgetPay' && $('#bp_signin_btn').length > 0 && !($('.signin-guest-bp-password').hasClass(\"hidden\"))) {\n $('.paysafe-card-details.BudgetPay').addClass(\"hidden\");\n $('.form-group.checkbox-input-wrapper.sameAsShipping').addClass(\"hidden\");\n }\n } else {\n $form.hide().removeClass(selectedPaymentMethod);\n $secondayPayNowBtn.show();\n }\n\n $('.payment-method-wrapper .paypal-details').addClass('hidden');\n var $privacyPolicyRequiredButton = $('.privacy-policy-required');\n var payPalCheckFlag = ($('.paypal-details .checkout-pp input[type=\"checkbox\"]').length > 0) ? true : false;\n if ($(this).hasClass('paypal')) {\n if (payPalCheckFlag) {\n var displayOrder = ($('#isOPCPage').val() == \"true\") ? '7' : '5';\n $('.payment-method-wrapper .paypal-details').removeClass('hidden').css({ 'order': displayOrder, 'margin-bottom': '20px' });\n $('.paypal-details .checkout-pp input[type=\"checkbox\"]').prop('checked', false);\n $('.paypal-details .checkout-pp input[type=\"checkbox\"]').parent().removeClass('checked');\n $privacyPolicyRequiredButton.addClass('disabled');\n enableCheckoutButton.enableCheckoutButton(false);\n $('.paypal-details .checkout-pp input[type=\"checkbox\"]').on('change', function (e) {\n if ($(this).is(':checked')) {\n $privacyPolicyRequiredButton.removeClass('disabled');\n enableCheckoutButton.enableCheckoutButton(true);\n } else {\n $privacyPolicyRequiredButton.addClass('disabled');\n enableCheckoutButton.enableCheckoutButton(false);\n }\n });\n }\n }\n if ($(this).hasClass('paypal-credit')) {\n if (payPalCheckFlag) {\n var displayOrder = ($('#isOPCPage').val() == \"true\") ? '9' : '6';\n $('.payment-method-wrapper .paypal-details').removeClass('hidden').css({ 'order': displayOrder, 'margin-bottom': '20px' });\n $('.paypal-details .checkout-pp input[type=\"checkbox\"]').prop('checked', false);\n $('.paypal-details .checkout-pp input[type=\"checkbox\"]').parent().removeClass('checked');\n $privacyPolicyRequiredButton.addClass('disabled');\n enableCheckoutButton.enableCheckoutButton(false);\n $('.paypal-details .checkout-pp input[type=\"checkbox\"]').on('change', function (e) {\n if ($(this).is(':checked')) {\n $privacyPolicyRequiredButton.removeClass('disabled');\n enableCheckoutButton.enableCheckoutButton(true);\n } else {\n $privacyPolicyRequiredButton.addClass('disabled');\n enableCheckoutButton.enableCheckoutButton(false);\n }\n });\n }\n }\n });\n $secondayPayNowBtn.off('click').on('click', function () {\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').addClass('freezeSection');\n progress.show();\n })\n\n /* $selectCard.on('change', function () {\n $selectCardCVV.val('');\n\n payBtn.prop('disabled', true);\n if ($selectCard.val() === 'newCard') {\n $newCardForm.slideDown(400);\n $existingCardForm.slideUp(400);\n } else {\n $existingCardForm.slideDown(400);\n $newCardForm.slideUp(400);\n }\n if (paymentFormReady()) {\n payBtn.prop('disabled', false);\n }\n });\n\n $selectCardCVV.on('keyup cut copy paste', function (e) {\n if (paymentFormReady()) {\n payBtn.prop('disabled', false);\n } else {\n payBtn.prop('disabled', true);\n }\n e.preventDefault();\n }); */\n\n\n if (window.paysafeForQB != true) {\n // initalize the hosted iframes using the SDK setup function\n paysafe.fields.setup(apiKey, paysafeConfig, function (instance, error) {\n\n if (error) {\n // Do the Error logging here.\n enableCheckoutButton.enableCheckoutButton(false);\n return;\n }\n\n /*jslint unparam: true */\n instance.fields('cvv cardNumber expiryDate').valid(function (eventInstance, event) {\n $(event.target.containerElement).closest('.card-input').removeClass('error').addClass('success');\n enableCheckoutButton.enableCheckoutButton(true);\n if (paymentFormReady()) {\n payBtn.prop('disabled', false);\n }\n });\n /*jslint unparam: false */\n\n // instance.fields('cardNumber').value('alabala');\n\n /*jslint unparam: true */\n instance.fields('cvv cardNumber expiryDate').invalid(function (eventInstance, event) {\n $(event.target.containerElement).closest('.card-input').removeClass('success').addClass('error');\n enableCheckoutButton.enableCheckoutButton(false);\n if (!paymentFormReady()) {\n //payBtn.prop('disabled', true);\n }\n });\n /*jslint unparam: false */\n\n instance.fields.cardNumber.on('FieldValueChange', function (eventInstance) {\n if (!instance.fields.cardNumber.isEmpty()) {\n\n var cardBrand,\n cardClass;\n if (eventInstance.getCardBrand()) {\n cardBrand = eventInstance.getCardBrand().replace(/\\s+/g, '');\n }\n cardClass = cardBrandClass[cardBrand];\n $form.find($('.fa')).removeClass('fa-credit-card').addClass(cardClass);\n } else {\n $form.find($('.fa')).removeClass().addClass('fa fa-credit-card');\n }\n });\n\n // When the customer clicks Pay Now,\n // call the SDK tokenize function to create\n // a single-use payment token corresponding to the card details entered\n $formSubmitOrder.on('submit', function (e) {\n //payBtn.prop('disabled', true);\n var selectedPaymentMethod;\n var isMultiplePaymentMethodsSelected = $paymentMethod.filter(':checked').length > 1;\n if (isMultiplePaymentMethodsSelected) {\n var tjcCreditisClicked = $('.credit-apply-button').data('credit-clicked') ? true : false;\n var checkboxes = $('.input-radio.paysafe');\n\n if (tjcCreditisClicked) {\n for (var i = 0; i < checkboxes.length; i++) {\n checkboxes[i].checked = false;\n }\n checkboxes.parent().removeClass('checked');\n $('.paysafe-card-details').hide();\n selectedPaymentMethod = $('#dwfrm_billing_paymentMethods_selectedPaymentMethodID_TJCCredit').val();\n } else {\n selectedPaymentMethod = $paymentMethod.filter(':checked').not('#dwfrm_billing_paymentMethods_selectedPaymentMethodID_TJCCredit').val();\n $('input[id=dwfrm_billing_paymentMethods_selectedPaymentMethodID_TJCCredit]').click();\n }\n\n } else {\n selectedPaymentMethod = $paymentMethod.filter(':checked').val();\n }\n\n var that = this,\n selectedCardValue = $selectCard.val(),\n threeDS = $form.data('3dsecure'),\n gtmJSON;\n\n if (selectedPaymentMethod !== 'Paysafe' && selectedPaymentMethod !== 'BudgetPay') {\n payBtn.prop('disabled', false);\n return;\n }\n e.preventDefault();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').addClass('freezeSection');\n\n try {\n if (window.gtmDatalayer && typeof window.gtmDatalayer.getPayNowGTMData === 'function') {\n gtmJSON = window.gtmDataLayer.getPayNowGTMData();\n gtmJSON.ecommerce.checkout_option.actionField.option = selectedPaymentMethod;\n window.gtmDataLayer.pushCheckoutStepToDataLayer(gtmJSON);\n }\n } catch (er) {\n // eslint-disable-next-line no-console\n //console.log(er);\n }\n try {\n if (window.gtmDatalayer && typeof window.gtmDatalayer.getPayNowNBData === 'function') {\n nbJSON = window.gtmDataLayer.getPayNowNBData();\n nbJSON.ecommerce.checkout_option.actionField.option = selectedPaymentMethod;\n nbDataLayer.pushCheckoutStepToNBDataLayer(nbJSON);\n }\n } catch (er) {\n // eslint-disable-next-line no-console\n //console.log(er);\n }\n\n if (selectedCardValue === 'newCard' || $newCardForm.is(':visible')) {\n /*jslint unparam: true */\n progress.show();\n instance.tokenize(threeDS, function (eventInstance, tokenizationError, result) {\n if (tokenizationError) {\n if (tokenizationError.code) {\n $paymentMethodsWarning.text(tokenizationError.message).parent().show();\n payBtn.prop('disabled', false);\n $(window).scrollTop($('.payment-methods-warning-inner').offset().top - 50);\n //$('form.xlt-continueCheckout').addClass('freezeSection');\n //$('#checkout-form1 button').attr('disabled', 'true');\n }\n progress.hide();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n //console.error('3D secured card error: ',tokenizationError);\n var totalPrice = $('.order-total.order-full-total td')[1];\n var $gtmprice;\n if (totalPrice) {\n $gtmprice = totalPrice.textContent;\n } else {\n $gtmprice = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': '3D Card Error',\n 'errorMessage': tokenizationError.code + ': ' + tokenizationError.displayMessage,\n 'price': $gtmprice\n }\n });\n } else {\n //console.log(JSON.stringify(result));\n $('.paysafe-token').val(JSON.stringify(result));\n submitPaymentForm(that);\n }\n });\n } else if ($tjcCredit.val() >= netPrice) {\n submitPaymentForm(that);\n } else if (window.SitePreferences.Paysafe_3ds2_Enabled) {\n var amount = $('.paysafe-card-details.Paysafe').data('ordertotalvalue');\n // 3ds2 Code Start\n //var cardBin = $('.paysafemodelbox').data(\"paysafeselectedcard\").cardBin;\n progress.show();\n var accountId = window.SitePreferences.PAYSAFE_MID,\n environment = window.SitePreferences.PAYSAFE_ENVIRONMENT,\n //var cardBin = document.getElementById('cardBin').value; will make dynamic\n authenticationPurpose = 'PAYMENT_TRANSACTION',\n cardBin = null, paymentToken = null;\n if (JSON.parse($('.paysafemodelbox').attr(\"data-paysafeselectedcard\")).cardBin != undefined && JSON.parse($('.paysafemodelbox').attr(\"data-paysafeselectedcard\")).cardBin != '') {\n cardBin = JSON.parse($('.paysafemodelbox').attr(\"data-paysafeselectedcard\")).cardBin;\n }\n if (JSON.parse($('.paysafemodelbox').attr(\"data-paysafeselectedcard\")).paymentToken != undefined && JSON.parse($('.paysafemodelbox').attr(\"data-paysafeselectedcard\")).paymentToken != '') {\n paymentToken = JSON.parse($('.paysafemodelbox').attr(\"data-paysafeselectedcard\")).paymentToken;\n }\n if (selectedPaymentMethod == 'BudgetPay') {\n authenticationPurpose = 'INSTALMENT_TRANSACTION';\n amount = $('.paysafe-card-details.BudgetPay').data('bpvalue');\n }\n var options = { accountId: accountId, card: { cardBin: cardBin }, environment: environment };\n if (cardBin != null && paymentToken != null) {\n try {\n paysafe.threedsecure.start(apiKey, options, function (deviceFingerprintingId, startError) {\n if (startError) {\n var lastDigits, id, cardType;\n lastDigits = $('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits;\n id = $('.paysafemodelbox').data(\"paysafeselectedcard\").id;\n cardType = $('.paysafemodelbox').data(\"paysafeselectedcard\").cardType;\n\n var url = Urls.paysafe3DSecure2LogInfo;\n var data = {\n 'lastDigits': lastDigits,\n 'txnID': id,\n 'callNode': 'GENERAL_ERRORS',\n 'cardType': cardType,\n 'code': startError.code,\n 'displayMessage': startError.displayMessage,\n 'detailedMessage': startError.detailedMessage\n };\n\n url = util.appendParamsToUrl(url, data);\n\n $.ajax({\n type: \"GET\", \n url: url,\n success: function (data) {\n if (data.returnStatus !== undefined && data.returnStatus) {\n return;\n }\n },\n error: function (f) {\n progress.hide();\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n progress.hide();\n $paymentMethodsWarning.text(\"Technical issues prevent processing your payment. Please try later or use another payment method.\").parent().show();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n } else if (deviceFingerprintingId !== undefined) {\n // 3DS2 Next Step\n var url = Urls.paysafe3DSecure2Authenticate;\n url = util.appendParamsToUrl(url, {\n 'deviceFingerprintingId': deviceFingerprintingId,\n 'authenticationPurpose': authenticationPurpose,\n 'paymentToken': paymentToken,\n 'amount': amount\n });\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n progress.hide();\n response = JSON.parse(response);\n if (typeof (response) == 'object') {\n var responseObj = response.dataObj;\n if (responseObj.sdkChallengePayload != undefined && responseObj.sdkChallengePayload != '') {\n // go for challange\n var sdkChallengePayload = responseObj.sdkChallengePayload;\n var options = { sdkChallengePayload: sdkChallengePayload, environment: environment };\n try {\n paysafe.threedsecure.challenge(apiKey, options, function (resultId, error) {\n if (resultId !== undefined) {\n var url = Urls.paysafe3DSecure2GetAuthDetails;\n var data = { authenticationId: resultId };\n $.ajax({\n url: url,\n type: 'POST',\n data: data,\n success: function (response2Obj) {\n if (response2Obj !== undefined) {\n //{status: 'COMPLETED', threeDResult: 'U', errorMsg: 'AUTH_FAILED_U', sdkChallengePayload: ''}\n if (response2Obj.dataObj !== undefined) {\n var finalStatus = response2Obj.dataObj.status;\n var finalthreeDResult = response2Obj.dataObj.threeDResult;\n var finalerrorMsg = response2Obj.dataObj.errorMsg;\n var finalsdkChallengePayload = response2Obj.dataObj.sdkChallengePayload;\n if (finalStatus == 'COMPLETED' && finalerrorMsg == 'AUTH_OK_A_Y') {\n $('.paysafe-token').val(selectedCardValue);\n submitPaymentForm(that);\n } else if (finalthreeDResult == 'U') {\n if (window.SitePreferences.AllowStatusCodeU) {\n $('.paysafe-token').val(selectedCardValue);\n submitPaymentForm(that);\n } else {\n $paymentMethodsWarning.text(\"Your request could not be completed by the bank due to technical reasons. Please try again or use a different card\").parent().show();\n var totalPrice1 = $('.order-total.order-full-total td')[1];\n var $gtmprice5;\n if (totalPrice1) {\n $gtmprice5 = totalPrice1.textContent;\n } else {\n $gtmprice5 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice5\n }\n });\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n $('.progress-loader').hide();\n }\n } else {\n $paymentMethodsWarning.text(\"Your request has been declined by the Bank. Try using a different Card or Payment Option\").parent().show();\n var totalPrice = $('.order-total.order-full-total td')[1];\n var $gtmprice;\n if (totalPrice) {\n $gtmprice = totalPrice.textContent;\n } else {\n $gtmprice = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request has been declined by the Bank. Try using a different Card or Payment Option',\n 'price': $gtmprice\n }\n });\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n $('.progress-loader').hide();\n }\n }\n }\n },\n error: function () {\n //console.error('Second Api Error in Ajax Call');\n }\n });\n } else {\n //console.error('We got resultID undefined');\n }\n });\n } catch (e) {\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n //console.error('POST Authetication API Error');\n }\n } else {\n if (responseObj !== undefined) {\n var finalthreeDResult = responseObj.threeDResult;\n if (finalthreeDResult == 'Y' || finalthreeDResult == 'A') {\n $('.paysafe-token').val(selectedCardValue);\n submitPaymentForm(that);\n } else if (finalthreeDResult == 'U') {\n if (window.SitePreferences.AllowStatusCodeU) {\n $('.paysafe-token').val(selectedCardValue);\n submitPaymentForm(that);\n } else {\n $paymentMethodsWarning.text(\"Your request could not be completed by the bank due to technical reasons. Please try again or use a different card\").parent().show();\n var totalPrice2 = $('.order-total.order-full-total td')[1];\n var $gtmprice2;\n if (totalPrice2) {\n $gtmprice2 = totalPrice2.textContent;\n } else {\n $gtmprice2 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice2\n }\n });\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n }\n } else {\n //SDK Challenge Empty and Declined by bank according to status\n $paymentMethodsWarning.text(\"Your request has been declined by the Bank. Try using a different Card or Payment Option\").parent().show();\n var totalPrice4 = $('.order-total.order-full-total td')[1];\n var $gtmprice1;\n if (totalPrice4) {\n $gtmprice1 = totalPrice4.textContent;\n } else {\n $gtmprice1 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request has been declined by the Bank. Try using a different Card or Payment Option',\n 'price': $gtmprice1\n }\n });\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n }\n }\n }\n }\n },\n error: function () {\n progress.hide();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n }\n });\n } else {\n // Device Fingure print ID undefined\n var lastDigits, id, cardType;\n if ($('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits != undefined && $('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits != '') {\n lastDigits = $('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits;\n id = $('.paysafemodelbox').data(\"paysafeselectedcard\").id;\n cardType = $('.paysafemodelbox').data(\"paysafeselectedcard\").cardType;\n }\n\n var url = Urls.paysafe3DSecure2LogInfo;\n url = util.appendParamsToUrl(url, {\n 'lastDigits': lastDigits,\n 'txnID': id,\n 'callNode': 'DEVICEFP_MISSING',\n 'cardType': cardType\n });\n $.ajax({\n type: \"POST\",\n url: url,\n success: function (data) {\n try {\n if (data.returnStatus != undefined && data.returnStatus) {\n // Do Nothing\n }\n } catch (b) {\n //console.error('Custom Log Info Error'+b);\n }\n },\n error: function (f) {\n progress.hide();\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n\n progress.hide();\n $paymentMethodsWarning.text(\"We are facing some technical issues. Please try after sometime or choose different payment option\").parent().show();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n }\n });\n } catch (e) {\n progress.hide();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n //console.error('Initial Catch of 3ds2');\n }\n } else {\n //if CardBin or paymentToken null\n var lastDigits, id, cardType, customCallNode;\n if ($('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits != undefined && $('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits != '') {\n lastDigits = $('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits;\n id = $('.paysafemodelbox').data(\"paysafeselectedcard\").id;\n cardType = $('.paysafemodelbox').data(\"paysafeselectedcard\").cardType;\n }\n if (cardBin == null) {\n customCallNode = 'EMPTY_CARDBIN';\n } else if (paymentToken == null) {\n customCallNode = 'EMPTY_PAYMNT_TKN';\n }\n var url = Urls.CustomLogInfo;\n url = util.appendParamsToUrl(url, {\n 'lastDigits': lastDigits,\n 'txnID': id,\n 'callNode': customCallNode,\n 'cardType': cardType\n });\n $.ajax({\n type: \"POST\",\n url: url,\n success: function (data) {\n try {\n if (data.returnStatus != undefined && data.returnStatus) {\n // Do Nothing\n }\n } catch (b) {\n //console.error('Custom Log Info Error'+b);\n }\n },\n error: function (f) {\n progress.hide();\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n progress.hide();\n $paymentMethodsWarning.text(\"We are facing some technical issues. Please try after sometime or choose different payment option\").parent().show();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n }\n // 3ds2 Code End\n }\n else {\n $('.paysafe-token').val(selectedCardValue);\n submitPaymentForm(that);\n //Below is the Old Code\n }\n });\n });\n } else {\n setTimeout(function () {\n var options = { // PAYSAFE FIELD CONFIGURATION\n environment: window.SitePreferences.PAYSAFE_ENVIRONMENT,\n // set the CSS selectors to identify the payment field divs above\n // set the placeholder text to display in these fields\n fields: {\n cardNumber: {\n selector: '#cardNumber',\n placeholder: $('#cardNumber').data('placeholder'),\n separator: \" \"\n },\n expiryDate: {\n selector: '#expiryDate',\n placeholder: $('#expiryDate').data('placeholder')\n },\n cvv: {\n selector: '#cvv',\n placeholder: $('#cvv').data('placeholder')\n }\n },\n initializationTimeout: window.SitePreferences.Netbanx_Timeout\n };\n\n paysafe = window.paysafe;\n /* initalize the hosted iframes using the SDK setup function*/\n paysafe.fields.setup(apiKey, options, function (instance, error) {\n\n /* When the customer clicks Pay Now,\n call the SDK tokenize function to create\n a single-use payment token corresponding to the card details entered*/\n document.getElementById(\"payNow\").addEventListener(\"click\", function (event) {\n progress.show();\n var threeDS = $('.paysafe-card-details').data(\"3dsecure\");\n\n if ($('#qberror .error').length > 0) {\n $('#qberror .error').remove();\n }\n\n instance.tokenize(threeDS, function (eventInstance, tokenizationError, result) {\n if (tokenizationError) {\n //console.log(tokenizationError);\n /*alert(\"tokenizationError\");*/\n var newDiv = '<div class=\"error\">Unable to add card. Please check your card details again. <div>';\n $(\"#qberror\").append(newDiv);\n progress.hide();\n } else {\n /*console.log(JSON.stringify(result));*/\n $('.paysafe-token').val(JSON.stringify(result));\n var billingaddress = $('#dwfrm_quickbuyaddress_billingAddress_address_address1').val() + ' ' + $('#dwfrm_quickbuyaddress_billingAddress_address_address2').val() + '$' + $('#dwfrm_quickbuyaddress_billingAddress_address_city').val() + '$' + $('#dwfrm_quickbuyaddress_billingAddress_address_postCode').val() + '$' + $('#dwfrm_quickbuyaddress_billingAddress_address_country option:selected').val();\n var url = Urls.authorizeCard;\n url = url + '?token=' + result.token + '&address=' + billingaddress;\n if ($('#fromUpdate').val() == 'yes') {\n url = url + '&fromUpdate=yes';\n }\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n progress.hide();\n var paymentToken = response.PaymentToken;\n if (!paymentToken) {//request not processed due to some error\n var newDiv = '<div class=\"error\">Unable to process the request. <div>';\n $(\"#qberror\").append(newDiv);\n } else if (paymentToken === \"repetitive\") {//user trying to add existing card\n var newDiv = '<div class=\"error\">Card Already Exists. <div>';\n $(\"#qberror\").append(newDiv);\n } else {\n if (response.success) {\n if ($('#addnewcard-sucessmg').hasClass('d-none')) {\n $('#addnewcard-sucessmg').removeClass('d-none');\n $('.credit-card-box .error').addClass('d-none');\n }\n $('#dialog-container').css('min-height', 'unset');\n $('.qbheading').addClass('d-none');\n $('#cardNumber').addClass('d-none');\n $('.security').addClass('d-none');\n $('#payNow').addClass('d-none');\n /*$(\"#qbaddnewcard\").load(location.href + \" #qbaddnewcard\");*/\n /*$( \".paysafe-card-details #\" ).load(\" #existing-paysafe-card > *\" );*/\n var qbtoken = JSON.parse($('.paysafe-token').val()).token;\n var refreshurl = Urls.refreshCardSection;\n $.ajax({\n url: refreshurl + '?newCardToken=' + paymentToken,\n type: 'POST',\n success: function (data) {\n $(\"#qb-paysafecard\").html(data);\n $(\"select#existing-paysafe-card\").change(function () {\n var selectedCountry = JSON.parse($(this).children(\"option:selected\").val());\n var selectedExpiryMonth = selectedCountry.cardExpiry.month;\n var selectedExpiryYear = selectedCountry.cardExpiry.year;\n var expiry = \"Expiry: \" + selectedExpiryMonth + \"/\" + selectedExpiryYear;\n $('#cardExpiry').val(expiry);\n });\n if ($('#addnewCardQb').hasClass('new-card-empty')) {\n $('#addnewCardQb').removeClass('new-card-empty');\n }\n //reinitialize the custom checkbox when new card is added\n util.customSelectBox();\n initPaysafe();\n /*alert(\"ok\");*/\n }\n });\n }\n else {\n if ($('#addnewcard-notvaliderror').length > 0) {\n $('#addnewcard-notvaliderror').remove();\n }\n /*console.log(\"Add a different card\");*/\n var newDiv = '<div id=\"addnewcard-notvaliderror\">Add a Valid Card<div>';\n $(\"#qb-paysafecard\").append(newDiv);\n initPaysafe();\n }\n }\n }\n });\n }\n });\n }, false);\n });\n }, 3000);\n }\n\n // if(window.SitePreferences.ApplePay_OnCheckout_Flag){\n // var ApplePayRequestOptions = {\n // country: $('#countryCode').val(),\n // currency: $('#currencyCode').val(),\n // amount: parseInt(parseFloat($('#orderTotalValue').val()).toFixed(2).replace('.','')),\n // requestBillingAddress: true,\n // label: \" \",\n // environment: window.SitePreferences.ApplePay_Environment\n // };\n\n // setTimeout(function(){\n // if(window.applePayInit != true){\n // paysafe.request.init(apiKey, ApplePayRequestOptions);\n // window.applePayInit = true;\n // }else{\n // paysafe.request.updateOptions(ApplePayRequestOptions);\n // }\n // //console.debug(ApplePayRequestOptions);\n // paysafe.request.canMakePayment(function (methods, error) {\n // if (methods) {\n // if (methods.indexOf(\"APPLEPAY\") < 0) {\n // console.log(\"Apple Pay not supported\");\n // $('.payment-method.apple-pay').hide();\n // }else{\n // paysafe.request.onTokenization(function (event, error) {\n // progress.show();\n // if (event) {\n // try {\n // // Process the token - event.result.token\n // // Acknowledge - event.showSuccess() or reject event.showFailure()\n // var result = {\"token\":event.result.token};\n // $('.applepay-token').val(JSON.stringify(result));\n // //console.log(event.result.token);\n // window.applePayAddress = new Array();\n // window.existingAddress = new Array();\n // $.each(['address1', 'address2', 'address3', 'address4', 'locality', 'city', 'postCode', 'country'], function (i, attribute) {\n // var value = $('.checkout-billing-address').find('[name$=' + attribute + ']').val();\n // existingAddress.push(value);\n // });\n // var billingContact = event.result.billingContact;\n // if(typeof(billingContact)!=='undefined'){\n // var itr=1;\n // $.each(billingContact.addressLines, function(i, item) {\n // if(itr <= 4){\n // applePayAddress.push(item);\n // itr++;\n // }\n // });\n // while(itr<=4){\n // applePayAddress.push(\"\");\n // itr++;\n // }\n // applePayAddress.push(billingContact.locality);\n // applePayAddress.push(billingContact.locality);\n // applePayAddress.push(billingContact.postalCode);\n // applePayAddress.push(billingContact.countryCode);\n // $.each(['address1', 'address2', 'address3', 'address4', 'locality', 'city', 'postCode', 'country'], function (i, attribute) {\n // $('.checkout-billing-address').find('[name$=' + attribute + ']').val(applePayAddress[i]);\n // });\n // }\n // event.showSuccess();\n // document.getElementById(\"nonCardPayNow\").click();\n // } catch (b) {\n // console.error('Apple Pay error - Payment:',b);\n // progress.hide();\n // }\n // } else {\n // // handle error\n // $paymentMethodsWarning.text(error.detailedMessage).parent().show();\n // console.error('Apple Pay error - Tokenization:',error);\n // event.showFailure();\n // progress.hide();\n // //$('.payment-method.apple-pay').hide();\n // }\n // });\n // paysafe.request.showButtons(function (displayedPaymentMethods, error) {\n // if (error) {\n // // handle error\n // //$paymentMethodsWarning.text(error.detailedMessage).parent().show();\n // console.error('Apple Pay error - Show Button:',error);\n // $('.payment-method.apple-pay').hide();\n // }\n // });\n // }\n // }else{\n // //console.error(error);\n // //$paymentMethodsWarning.text(error.detailedMessage).parent().show();\n // //console.log('Apple Pay error - Initialize:',error);\n // $('.payment-method.apple-pay').hide();\n // }\n // });\n // }, 1000);\n // }\n};\n\nexports.init = initPaysafe;\n", "'use strict';\n\n\nfunction pdpbundle() {\n $('.js-social-bundle-swatch').on('click', function (event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n\n var url = $(this).prop('href');\n var $socialBundleTile = $(this).parents('.js-social-bundle-tile');\n\n $(this).siblings().removeClass('active');\n $(this).addClass('active');\n\n $.ajax({\n url: url,\n success: function(response){\n var $newSocialBundleTile = $(response);\n var $newSocialBundleTileDetails = $newSocialBundleTile.find('.js-social-bundle-tile-details').html();\n var $newSocialBundleTileAddToCart = $newSocialBundleTile.find('.js-add-to-cart').html();\n var $newSocialBundleTileFooter = $newSocialBundleTile.filter('.js-card-footer').html();\n\n $socialBundleTile.find('.js-social-bundle-tile-details').html($newSocialBundleTileDetails);\n $socialBundleTile.find('.js-add-to-cart').html($newSocialBundleTileAddToCart);\n $socialBundleTile.find('.js-card-footer').html($newSocialBundleTileFooter);\n pdpbundle();\n },\n error: function(e){\n console.log(e);\n }\n });\n });\n\n}\n\n\n\n// Module public functions\nmodule.exports = {\n init: pdpbundle\n};\n", "'use strict';\n\nvar imageScript = require(24),\n progress = require(35);\n\n/**\n * Finds at which element of the array has a class 'selected' and when found it is returned.\n *\n * @param {Array} productImages - Array of jQuery elements, holding the image tiles of product.\n */\nfunction getIndexOfClassNameSelected(productImages) {\n var i;\n if (productImages.length <= 0) {\n // in case the parameter is empty, assume we want the first element (fix for TJC-1064)\n return 0;\n }\n for (i = 0; i < productImages.length; i++) {\n if (productImages[i].className.includes('selected')) {\n return i;\n }\n }\n}\n\n/*function getVideoIndex(productImages) {\n for (var i = 0; i < productImages.length; i++) {\n if (productImages[i].className.includes('video')) {\n return i;\n }\n }\n // let's hope we do not have products with more than 1000 thumbnails\n return 1000;\n}*/\n\nfunction pdpOverlayImages() {\n // Open the Overlay\n $(document).on('click','.overlay-open, .single-view img, .carousel-view img', function () {\n if($(this).parents('.ui-dialog-content').length >= 1){\n return;\n }\n\n var $this = $(this);\n var mainimageclick = $(this).attr(\"src\");\n\n\n //Shows Overlay\n $('.overlay-container.pdp-images-overlay').addClass('overlay-container-on').removeClass('overlay-container-off');\n if(!$('.pdp_redesign').length > 0 || $('.pdp-image-mobile').is(':visible')) {\n $('body').css('overflow','hidden');\n }\n\n //Block mousewheel when overlay selector is opened\n $('body').on({\n 'mousewheel': function (e) {\n if ($('.overlay-container').hasClass('overlay-container-on') !== true) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n }\n });\n\n //Holds the image containers\n var productImages = Array.from($('li.productthumbnail')),\n\n //Create the Image Carousel\n currentIndex = getIndexOfClassNameSelected(productImages),\n items = $('#overlay-list li'),\n itemAmt = items.length,\n item;\n //videoindex = getVideoIndex(productImages);\n //autoSlide;\n //currentIndex = (videoindex <= currentIndex) ? currentIndex - 1 : currentIndex;\n item = $('#overlay-list li').eq(currentIndex);\n items.hide();\n item.css('display', 'block');\n var newPDPFlag = $('.pt_product-details').hasClass('pdp_redesign');\n function cycleItems() {\n //Changing the selected image for zoom\n item.removeClass('selected');\n item = $('#overlay-list li').eq(currentIndex);\n item.addClass('selected');\n items.hide();\n item.css('display', 'block');\n var link = item.attr('href');\n //Enables zoom on the new selected image\n imageScript.loadZoom(link);\n imageScript.loadImageComponents();\n }\n\n /* Overlay thumbnail click */\n $('#pdpMainOverlay').off('click').on('click', '.productthumbnail:not(.video)', function (e) {\n e.preventDefault();\n $(this).closest('.product-thumbnails').find('.productthumbnail.selected').removeClass('selected');\n $(this).addClass('selected');\n var imgURL = $(this).data('main-image-url');\n $('.overlay-item.selected img').attr('src', imgURL);\n $('.overlay-item.selected .overlayDisplyImage').unwrap();\n $(\".overlayDisplyImage\").removeAttr(\"style\");\n });\n\n\n /*autoSlide = setInterval(function () {\n console.log('autoslide');\n currentIndex += 1;\n if (currentIndex > itemAmt - 1) {\n currentIndex = 0;\n }\n cycleItems();\n }, 10000);*/\n\n\n $('.overlay-btn-next').click(function (e) {\n // clearInterval(autoSlide);\n currentIndex += 1;\n if (currentIndex > itemAmt - 1) {\n currentIndex = 0;\n }\n e.preventDefault();\n var thumbnails = $('#pdpMain .product-thumbnails'),\n selectedThumbnail = thumbnails.find('.productthumbnail.selected'),\n nextThumbnail = selectedThumbnail.next(),\n isLastThumbnail = thumbnails.find('.productthumbnail').last().hasClass('selected');\n if (isLastThumbnail) {\n nextThumbnail = thumbnails.find('.productthumbnail').first();\n // bubbles are not visible but needed as a workaround for scrolling\n thumbnails.find('.bubble-ctr .bubble').first().click();\n } else {\n $('#pdpMain .product-thumbnails .nav-next').click();\n }\n\n nextThumbnail.click();\n\n cycleItems();\n\n });\n\n\n\n\n $('.overlay-btn-prev').click(function (e) {\n // clearInterval(autoSlide);\n currentIndex -= 1;\n if (currentIndex < 0) {\n currentIndex = itemAmt - 1;\n }\n\n e.preventDefault();\n var thumbnails = $('#pdpMain .product-thumbnails'),\n selectedThumbnail = thumbnails.find('.productthumbnail.selected'),\n previousThumbnail = selectedThumbnail.prev(),\n isFirstThumbnail = thumbnails.find('.productthumbnail').first().hasClass('selected');\n\n if (isFirstThumbnail) {\n previousThumbnail = thumbnails.find('.productthumbnail').last();\n // bubbles are not visible but needed as a workaround for scrolling\n thumbnails.find('.bubble-ctr .bubble').last().click();\n } else {\n $('#pdpMain .product-thumbnails .nav-prev').click();\n }\n\n previousThumbnail.click();\n\n cycleItems();\n\n\n\n });\n // initial zoom loading\n cycleItems();\n });\n\n // Close the Overlay\n function closeOverlay($target) {\n // Hide Overlay\n $('body').css('overflow','scroll');\n if (!$target) {\n $('.overlay-container').addClass('overlay-container-off').removeClass('overlay-container-on');\n } else {\n if ($target.hasClass('overlay-container')) {\n $target.addClass('overlay-container-off').removeClass('overlay-container-on');\n } else {\n $target.parents('.overlay-container')\n .addClass('overlay-container-off')\n .removeClass('overlay-container-on');\n }\n }\n var video = $('#360Video');\n\n if (video.length > 0) {\n video.pause();\n }\n }\n\n // Close the Overlay by clincking in the black area of the container\n $('.overlay-container').on('click', function (e) {\n if (e.target !== this) {\n return;\n }\n\n closeOverlay($(e.target));\n });\n\n // Close the Overlay by clincking in the \"X\" button\n $('.overlay-close').on('click', function (e) {\n closeOverlay($(e.target));\n\n });\n\n $('.overlay-box-close').on('click', function () {\n $('.overlay-item.selected .overlayDisplyImage').unwrap();\n $(\".overlayDisplyImage\").removeAttr(\"style\");\n $('#overlay-list li').removeClass('selected');\n $('.thumbnailrender #thumbnails').remove();\n });\n}\n\nfunction pdpOverlayVideo() {\n // Adds play button html to the video slides.\n var viewerId;\n if (window.SitePreferences.SIRV_ENABLED) {\n Sirv.on('viewer:ready', function(viewer) {\n if (viewer.id === 'fpcPDP') {\n viewer.items().forEach(function(item, index){\n var thumbnail = $(item.thumbnail);\n\n if (thumbnail.hasClass('overlayvideo-open')) {\n var image = $('.smv-slides .smv-slide').eq(index).find('img');\n var playButtonContainer = $('<span class=\"playButton mainButton\">');\n\n playButtonContainer.addClass($(thumbnail).attr('data-video'));\n $('<span class=\"playButtonBackground\">').appendTo(playButtonContainer);\n $('<span class=\"playButtonSymbol\">').appendTo(playButtonContainer);\n playButtonContainer.insertAfter(image);\n }\n });\n }\n if (viewer.id === 'raPDP') {\n $('.utils-wrapper').remove().clone(true, true).insertAfter(\".smv-slides\").css('display', 'block');\n }\n viewerId = viewer.id;\n });\n }\n\n\n // Open the overlay\n $(document).on('touchstart', '.responsive', function (e) {\n //Shows Overlay\n var $videoContainer = $('.overlayvideo-container');\n $('body').css('overflow', 'hidden');\n $('.overlayvideo-container').addClass('overlayvideo-container-on').removeClass('overlayvideo-container-off');\n $('#360Video')[0].play();\n var vid = $videoContainer.find(\"video\");\n vid.trigger('play');\n });\n\n $(document).on('click', '.overlayvideo-open.video.360video', function (e) {\n //Shows Overlay\n var $videoContainer = $('.inline-video-overlay');\n $('body').css('overflow', 'hidden');\n $('.inline-video-overlay').addClass('video-overlay-on');\n $('#360Video')[0].play();\n // Enables video replay\n //$videoContainer.find('video').attr('loop', true);\n // Enables auto play when the user opens the video tab.\n //$videoContainer.find('.vjs-big-play-button').click();\n var vid = $videoContainer.find(\"video\");\n var poster = vid.attr('data-poster');\n vid.attr('poster',poster);\n vid.trigger('play');\n //Block mousewheel when overlay selector is opened\n $('body').on({\n 'mousewheel': function (e) {\n if ($videoContainer.hasClass('video-overlay') !== true) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n }\n });\n });\n\n $(document).on('click', '.video-close', function (e) {\n $('#360Video')[0].pause();\n $('.inline-video-overlay').removeClass('video-overlay-on');\n });\n\n $(document).on('click', '.pdp-main-image.360video, .pdp-main-image.livetvvideo, .overlayvideo-open, .product-primary-image.newtemplate .single-view .playButton, .smv-slides-box .playButton', function (e) {\n //Shows Overlay\n var $videoContainer = $('.overlayvideo-container');\n $('body').css('overflow', 'hidden');\n $('.overlayvideo-container').addClass('overlayvideo-container-on').removeClass('overlayvideo-container-off');\n $('#360Video')[0].play();\n\n // Enables video replay\n //$videoContainer.find('video').attr('loop', true);\n // Enables auto play when the user opens the video tab.\n //$videoContainer.find('.vjs-big-play-button').click();\n\n var vid = $videoContainer.find(\"video\");\n var poster = vid.attr('data-poster');\n\n vid.attr('poster',poster);\n vid.trigger('play');\n\n //Block mousewheel when overlay selector is opened\n $('body').on({\n 'mousewheel': function (e) {\n if ($videoContainer.hasClass('overlayvideo-container-on') !== true) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n }\n });\n });\n\n // Close the Overlay\n function closeOverlay() {\n $('.backtotop').show();\n $('body').css('overflow', 'visible');\n var $videoContainer = $('.overlayvideo-container');\n if($(this).hasClass('360video')){\n $videoContainer = $('.overlayvideo-container.360video');\n }else if($(this).hasClass('livetvvideo')){\n $videoContainer = $('.overlayvideo-container.livetvvideo');\n }\n $videoContainer.addClass('overlayvideo-container-off').removeClass('overlayvideo-container-on');\n var vid = $videoContainer.find(\"video\");\n vid.trigger('pause');\n }\n\n // Close the Overlay by clicking in the black area of the container\n $('.overlayvideo-container').on('click', function (e) {\n if (e.target !== this) {\n return;\n }\n closeOverlay();\n });\n\n function ContentAssetContainer() {\n $('body').css('overflow', 'hidden');\n $('.pdp-size-guide').addClass('overlay-container-on').removeClass('overlay-container-off');\n }\n\n $(document).on('click', '.size-chart-link-simple', function (e) {\n ContentAssetContainer();\n });\n\n // Close the Overlay by clicking in the \"X\" button\n $('.modal-close').on('click', function () {\n closeOverlay();\n });\n}\n\nfunction pdpProductEngraving(){\n var engravingValidateFields = [\"dwfrm_engraving_engraving1\", \"dwfrm_engraving_engraving2\", \"dwfrm_engraving_engraving3\", \"dwfrm_engraving_engraving4\"];\n var $engravingForm = $('form.engraving-form:visible');\n jQuery.each(engravingValidateFields, function(i,val){\n //$engravingForm.find(\"#\"+val).val(\"\");\n if($engravingForm.find('#'+val).length >= 1){\n $engravingForm.find('#'+val).addClass('checkMaxChar');\n var valValue = $engravingForm.find('#'+val).val();\n var valValueLength = valValue.length;\n var maxVal = $engravingForm.find('#'+val).attr('maxlength');\n var leftValue = parseInt(maxVal) - parseInt(valValueLength);\n $(\"span[for='\" + val + \"']\").html(leftValue);\n }\n });\n $engravingForm.find('#uniform-dwfrm_engraving_engravingtac span').removeClass(\"checked\");\n $engravingForm.find('#dwfrm_engraving_engravingtac').prop(\"checked\",false);\n var tacLink = $engravingForm.find('#tacLink').val();\n $engravingForm.find('.engravingtac').find('label span').addClass('tooltip');\n $engravingForm.find('.engravingtac').find('label span').attr(\"title\",\"Personalised items are non-returnable. Though, you have refund/repair rights for manufactured defects. Please see <a href='\"+tacLink+\"' target='_blank'>terms and conditions</a> for more details.\");\n\n for(var itr=0; itr<5; itr++){\n $engravingForm.find(\"#engravingIconCon\"+itr).insertAfter($engravingForm.find(\".engravingIconCon\"+itr+\" .input-text\"));\n }\n\n tooltipInitialize();\n engravingImageOverlay();\n\n // Getting placeholder value and append to the label\n $('.engraving-group .field input').on('focus', function() {\n $(this).closest('.engraving-group').find('.engraving-focus-label').show();\n });\n\n if($('.genderselect select.input-select').val()) {\n $('.genderselect select.input-select').trigger('blur');\n }\n\n $('.engraving-group .field .input-text').each(function () {\n var engravingplace = $(this).attr('placeholder');\n $(this).closest('.field').find('.new-label').text(engravingplace);\n });\n\n $('.checkMaxChar').on('change keyup keydown', function(e){\n var valId = this.id;\n var valValue = this.value;\n var valValueLength = valValue.length;\n var maxValue = $(this).attr('maxlength');\n //var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);\n //var regex = new RegExp(\"^[a-zA-Z0-9 %'_\\b]+$\");\n //if(regex.test(str)){}else{e.preventDefault();return false;}\n if(valValueLength >= maxValue){$(this).val(this.value.substr(0, maxValue));}\n valValue = this.value;\n valValueLength = valValue.length;\n var leftValue = parseInt(maxValue) - parseInt(valValueLength);\n $(\"span[for='\" + valId + \"']\").html(leftValue);;\n });\n}\n\nfunction tooltipInitialize(){\n if (window.matchMedia(\"(max-width: 767px)\").matches){\n $('.tooltip').each(function(index){\n $(this).tooltip({\n position: {\n my: \"bottom-18\",\n at: \"bottom-18\"\n },\n content: function () {\n var tooltipContent = $('<div />').html( $.parseHTML( $(this).attr('title') ) );\n return tooltipContent;\n },\n //show: \"slideDown\",\n open: function(event, ui){\n var _elemId = ui.tooltip.attr('id');\n $('.ui-tooltip').each(function(index){\n if(this.id!=_elemId){\n $(this).remove();\n }\n });\n var width = $(window).width();\n $('.ui-tooltip').css('max-width',width+'px');\n if(width<350){\n $('#'+_elemId).css('left','0px');\n }else{\n $('#'+_elemId).css('left','5px');\n }\n $('#'+_elemId).click(function(){\n $(this).remove();\n });\n },\n close: function(event, ui) {\n ui.tooltip.hover(function() {\n $(this).stop(true).fadeTo(500, 1);\n },\n function() {\n $(this).remove();\n });\n }\n });\n });\n }else{\n $('.tooltip').each(function(index){\n $(this).tooltip({\n position: {\n my: \"left top+18\",\n at: \"left top+18\"\n },\n content: function () {\n var tooltipContent = $('<div />').html( $.parseHTML( $(this).attr('title') ) );\n return tooltipContent;\n },\n //show: \"slideDown\",\n open: function(event, ui){\n var _elemId = ui.tooltip.attr('id');\n $('.ui-tooltip').css('max-width','250px');\n $('#'+_elemId).click(function(){\n $(this).remove();\n });\n },\n close: function(event, ui) {\n ui.tooltip.hover(function() {\n $(this).stop(true).fadeTo(500, 1);\n },\n function() {\n $(this).remove();\n });\n }\n });\n });\n }\n}\n\nfunction engravingImageOverlay(){\n $('html,body').on('click', '.field .img-edit' , function (e) {\n e.preventDefault();\n var engImg = $(this).attr('data-engImg');\n var engVal = $(this).attr('data-engVal');\n var engValFontSize = $(this).attr('data-engValFontSize');\n var engValFontName = $(this).attr('data-engValFontName');\n var engValFontFamily = \"\";\n switch(engValFontName){\n case \"Times New Roman\":\n engValFontFamily = \"Times New Roman\";\n break;\n case \"Arial\":\n engValFontFamily = \"Arial\";\n break;\n default:\n engValFontFamily = \"Times New Roman\";\n break;\n }\n var engValFontStyl = \"H\";\n var engValue = \"\";\n var engValueMaxLen = 0;\n if(engValFontSize!=\"\" && engValFontFamily!=\"\"){\n var $engravingForm = $('form.engraving-form:visible');\n engValueMaxLen = parseInt($engravingForm.find('#'+engVal).attr('maxlength'));\n if(engValueMaxLen > 0 && engValueMaxLen <= 15){\n if($engravingForm.find('#'+engVal).val() == \"\"){\n $engravingForm.find('#'+engVal+'-error').css('display','block');\n return false;\n }else{\n $engravingForm.find('#'+engVal+'-error').css('display','none');\n engValue = $engravingForm.find('#'+engVal).val();\n }\n }\n }\n progress.show();\n var url = Urls.engravingimageoverlay;\n if (window.dialog) {\n window.dialog.open({\n url: url,\n options:{\n dialogClass:'engraving-image-overlay',\n open: function(event,ui){\n $('body').css('overflow','hidden');\n progress.show();\n $('.engraving-image-overlay #data-text1').html(engValue);\n if(engValFontStyl==\"V\"){\n $('.engraving-image-overlay #data-text1').css({'writing-mode': 'vertical-rl', 'text-orientation': 'upright', 'letter-spacing': '-10px'});\n }\n textAlignMiddle();\n $('.engraving-image-overlay #engravingImage').attr('src',engImg);\n var fontMulFact = ($('.engraving-image-overlay').css('width').slice(0,-2)/500)*7;\n $('.engraving-image-overlay #engravingImage').load(function(){\n if(engValue!=\"\"){\n $('.engraving-image-overlay #data-text1').css({'display':'block'});\n $('.engraving-image-overlay #data-text1').css({'font-family':engValFontFamily});\n $('.engraving-image-overlay #data-text1').css({'font-size':(engValFontSize*fontMulFact)+'px'});\n setTimeout(function(){ textAlignMiddle(); }, 500);\n }else{\n $('.engraving-image-overlay #data-text1').css({'display':'none'});\n }\n progress.hide();\n });\n function textAlignMiddle(){\n var txtHlfWidth = ($('#data-text1').css('width').slice(0,-2)/2);\n var txtHlfHeight = ($('#data-text1').css('height').slice(0,-2)/2);\n $('.engraving-image-overlay #data-text1').css({'left':'calc(50% - '+txtHlfWidth+'px)','top':'calc(50% - '+txtHlfHeight+'px)'});\n }\n },\n close:function() {\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n }\n }\n });\n }\n });\n}\n\nfunction warrantyMiniCart(){\n $('body').off('click', '.warranty-dialog').on('click', '.warranty-dialog' , function (e) {\n e.preventDefault();\n var isCartPage = $(this).attr('data-cartPage');\n var proName = $(this).attr('data-productName');\n var proImg = $(this).attr('data-productImage');\n var productCost = $(this).attr('data-productCost');\n productCost = productCost.replace(',','');\n var proCost = productCost.substring(1, productCost.length);\n var proQuantity = $(this).attr('data-productQuantity');\n var warCost = $(this).attr('data-warrantyCost');\n warCost = warCost.replace(',','');\n var warDuration = $(this).attr('data-warrantyDuration');\n var warQuantity = $(this).attr('data-warrantyQuantity');\n var parentAddWarURI = $(this).attr('data-warrantyAddURI');\n var proQty = $('.pdpForm .product-add-to-cart #Quantity').val();\n var warQty = $('.pdpForm .product-add-to-cart #warranty-total-quantity').val();\n var warEnb = $(\".product-add-to-cart input[name='warrantyEnabled']\").prop(\"checked\");\n var clickedClasses = this.className;\n progress.show();\n var url = Urls.warrantyminicart;\n if (window.dialog) {\n window.dialog.open({\n url: url,\n options:{\n dialogClass:'warranty-mini-cart-dialog',\n title: \"TJC Warranty Details\",\n open: function(event,ui){\n $('body').css('overflow','hidden');\n $('.ui-widget-overlay').on('click', function(){\n $('.warranty-mini-cart-dialog').find('.ui-dialog-content').dialog('close');\n });\n $('.warranty-mini-cart-dialog .warranty-Qty').hide();\n $('.warranty-mini-cart-dialog .warAddBtn').hide();\n $('.warranty-mini-cart-dialog .warQty .item-checkbox').hide();\n $('.warranty-mini-cart-dialog .warAddBtnLink').hide();\n if(clickedClasses.indexOf(\"explore-warranty\") != -1){\n warQty = Math.round(warQuantity);\n $('.warranty-mini-cart-dialog .warAddBtnLink').attr('href',parentAddWarURI);\n $('.warranty-mini-cart-dialog .warAddBtnLink').show();\n $('.warranty-mini-cart-dialog .warQty').hide();\n }else if(clickedClasses.indexOf(\"product-name\") != -1){\n $('.warranty-mini-cart-dialog .warQty').hide();\n warQty = Math.round(warQuantity);\n }else{\n if(warEnb == true){\n if(proQty > 1){\n $('.warranty-mini-cart-dialog .warranty-Qty').show();\n }else{\n $('.warranty-mini-cart-dialog .warQty .item-checkbox').show();\n $('.warranty-mini-cart-dialog .warQty .item-checkbox span').addClass('checked');\n }\n }else{\n $('.warranty-mini-cart-dialog .warAddBtn').show();\n }\n }\n var screenHeight = screen.height;\n $('.warranty-mini-cart-dialog .warrantyMiniCartBody').css('max-height',(parseFloat($('.warranty-mini-cart-dialog').css('height'))-parseFloat(90))+\"px\");\n progress.hide();\n $('.warranty-mini-cart-dialog .productDetails').find('img').attr('src',proImg);\n $('.warranty-mini-cart-dialog .productDetails').find('.name').text(proName);\n $('.warranty-mini-cart-dialog .productDetails .price').find('span').text(proCost);\n if(isCartPage==\"true\"){\n $('.warranty-mini-cart-dialog .productDetails').find('.name').append(\" <span class='bold'>x \"+Math.round(proQuantity)+\"</span>\");\n var productPrice = proCost*proQuantity;\n proCost = productPrice;\n $('.warranty-mini-cart-dialog .productDetails .price').find('span').text(productPrice.toFixed(2));\n }else{\n $('.warranty-mini-cart-dialog .productDetails').find('.name').append(\" <span class='bold'>x \"+Math.round(proQty)+\"</span>\");\n var productPrice = proCost*proQty;\n proCost = productPrice;\n $('.warranty-mini-cart-dialog .productDetails .price').find('span').text(productPrice.toFixed(2));\n }\n $('.warranty-mini-cart-dialog').find('span.warranty-duration').text(warDuration);\n $('.warranty-mini-cart-dialog #warranty-product-quantity').val(warQty);\n $('.warranty-mini-cart-dialog .warrantyDetails .name').find('.warrantyCount').text(warQty);\n var warrantyPrice = warCost*warQty;\n $('.warranty-mini-cart-dialog .warrantyDetails .price').find('span').text(warrantyPrice.toFixed(2));\n var totalPrice = parseFloat(warCost*warQty)+parseFloat(proCost);\n $('.warranty-mini-cart-dialog .totalDetails .price').find('span').text(totalPrice.toFixed(2));\n $('.warranty-mini-cart-dialog .warQty #pricechangefornottjcplus').find('span').text(warrantyPrice.toFixed(2));\n\n $('.warranty-mini-cart-dialog .warranty-sub').off('click').on('click',function(){\n var calVal = parseInt($('.warranty-mini-cart-dialog #warranty-product-quantity').val())-1;\n if(calVal > 0){\n $('.warranty-mini-cart-dialog #warranty-product-quantity').val(calVal);\n $('.warranty-mini-cart-dialog .warrantyDetails .name').find('.warrantyCount').text(calVal);\n var warrantyPrice = warCost*calVal;\n $('.warranty-mini-cart-dialog .warrantyDetails .price').find('span').text(warrantyPrice.toFixed(2));\n var totalPrice = parseFloat(warCost*calVal)+parseFloat(proCost);\n $('.warranty-mini-cart-dialog .totalDetails .price').find('span').text(totalPrice.toFixed(2));\n $('.warranty-mini-cart-dialog .warQty #pricechangefornottjcplus').find('span').text(warrantyPrice.toFixed(2));\n }\n });\n $('.warranty-mini-cart-dialog .warranty-add').off('click').on('click',function(){\n var calVal = parseInt($('#warranty-product-quantity').val())+1;\n if(calVal <= proQty){\n $('.warranty-mini-cart-dialog #warranty-product-quantity').val(calVal);\n $('.warranty-mini-cart-dialog .warrantyDetails .name').find('.warrantyCount').text(calVal);\n var warrantyPrice = warCost*calVal;\n $('.warranty-mini-cart-dialog .warrantyDetails .price').find('span').text(warrantyPrice.toFixed(2));\n var totalPrice = parseFloat(warCost*calVal)+parseFloat(proCost);\n $('.warranty-mini-cart-dialog .totalDetails .price').find('span').text(totalPrice.toFixed(2));\n $('.warranty-mini-cart-dialog .warQty #pricechangefornottjcplus').find('span').text(warrantyPrice.toFixed(2));\n }\n });\n\n $('.warranty-mini-cart-dialog .warQty .item-checkbox').off('click').on('click',function(){\n if($('.warranty-mini-cart-dialog .warQty .item-checkbox span').hasClass('checked')){\n $(\".product-add-to-cart input[name='warrantyEnabled']\").prop(\"checked\",false);\n $(\".product-add-to-cart input[name='warrantyEnabled']\").parents('span').removeClass('checked');\n }else{\n $(\".product-add-to-cart input[name='warrantyEnabled']\").prop(\"checked\",true);\n $(\".product-add-to-cart input[name='warrantyEnabled']\").parents('span').addClass('checked');\n }\n $('.warranty-mini-cart-dialog').find('.ui-dialog-content').dialog('close');\n });\n $('.warranty-mini-cart-dialog .warUpdateBtn').off('click').on('click',function(){\n var warTot = $('.warranty-mini-cart-dialog #warranty-product-quantity').val();\n $('.warranty-count').val(warTot);\n $(\".total-warranty-count\").html('x ' + warTot);\n var warrantyPrice = warCost*warTot;\n $('.warranty-dialog .total-warranty-price').text(\"+ £\" + warrantyPrice.toFixed(2));\n $('.warranty-mini-cart-dialog').find('.ui-dialog-content').dialog('close');\n });\n $('.warranty-mini-cart-dialog .warAddBtn').off('click').on('click',function(){\n $(\".product-add-to-cart input[name='warrantyEnabled']\").parents('span').addClass(\"checked\");\n $(\".product-add-to-cart input[name='warrantyEnabled']\").prop(\"checked\",true);\n //var warTot = 1;\n //$(\".total-warranty-count\").html('x ' + warTot);\n //var warrantyPrice = warCost*warTot;\n //$('.warranty-dialog .total-warranty-price').text(\"+ \" + $('.warranty-dialog .total-warranty-price').text());\n $('.warranty-mini-cart-dialog').find('.ui-dialog-content').dialog('close');\n });\n },\n close:function() {\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n }\n }\n });\n }\n });\n}\n\nfunction warrantyQuantitySelection(){\n /***** Start - Method for increasing/Decreasing the Product Quantity *****/\n\n var $pdpMain = $('#pdpMain');\n if($('#QuickViewDialog').is(':visible')){\n $pdpMain = $('#QuickViewDialog .pdp-main');\n }\n $pdpMain.find('.product-add').off('click').on('click', function(e){\n var productqty = $pdpMain.find('.pdp-product-quantity').val(),\n pdpProductCount = $pdpMain.find(\".product-add-to-cart .pdp-product-quantity\").data('availability');\n var isEngravingItem = $('#isEngravingItem').val();\n var engravingqty = parseInt($('#engravingqty').val());\n productqty++;\n pdpProductCount = pdpProductCount?parseInt(pdpProductCount):0;\n if(isEngravingItem && engravingqty != 0 && (engravingqty < pdpProductCount)){\n if(productqty <= engravingqty){\n $pdpMain.find(\".pdp-product-quantity\").val(productqty);\n $pdpMain.find(\".product-add-to-cart .warranty-add\").trigger('click');\n //$(\".warranty-count\").val(productqty);\n changeWarrantyPrice();\n }\n }else if(productqty <= pdpProductCount){\n $pdpMain.find(\".pdp-product-quantity\").val(productqty);\n $pdpMain.find(\".product-add-to-cart .warranty-add\").trigger('click');\n //$(\".warranty-count\").val(productqty);\n changeWarrantyPrice();\n }\n });\n $pdpMain.find('.product-sub').off('click').on('click', function(e){\n var productqty = $pdpMain.find('.pdp-product-quantity').val();\n productqty--;\n if(productqty>0){\n $pdpMain.find(\".pdp-product-quantity\").val(productqty);\n $pdpMain.find(\".product-add-to-cart .warranty-sub\").trigger('click');\n //$(\".warranty-count\").val(productqty);\n changeWarrantyPrice();\n }\n });\n\n /***** End - Method for increasing/Decreasing the Product Quantity *****/\n\n /***** Start - Method for increasing/Decreasing the Warranty Quantity *****/\n\n $('.warranty-add').off('click').on('click', function(e){\n var warrantyqty=$('.warranty-count').val();\n warrantyqty++;\n if(warrantyqty<= $('#pdpMain').find('.pdp-product-quantity').val()){\n $(\".warranty-count\").val(warrantyqty);\n changeWarrantyPrice();\n }\n });\n $('.warranty-sub').off('click').on('click', function(e){\n var warrantyqty=$('.warranty-count').val();\n warrantyqty--;\n if(warrantyqty>0){\n $(\".warranty-count\").val(warrantyqty);\n changeWarrantyPrice();\n }\n });\n\n /***** End - Method for increasing/Decreasing the Warranty Quantity *****/\n\n /***** Start - trigger warranty program dialog *****/\n $('.rightarrow').on('click', function(){\n $(\".warranty-dialog\").trigger('click');\n });\n /***** End - trigger warranty program dialog *****/\n\n function changeWarrantyPrice(){\n /***** Start - change Warranty Price *****/\n var warrantyqty = $('.warranty-count').val(),\n warrantyCost = $(\".product-add-to-cart .warranty-dialog\").data('warrantycost'),\n warrantyPrice = warrantyCost*warrantyqty;\n\n if($('#pdpMain').find('.pdp-product-quantity').val() > 1){\n $('.warranty-quantity-box').show();\n $(\".total-warranty-count\").html('x ' + warrantyqty);\n $('.warranty-dialog .total-warranty-price').text(\"+ £\" + warrantyPrice.toFixed(2));\n }\n else{\n $('.warranty-quantity-box').hide();\n $(\".total-warranty-count\").html(\"\");\n $('.warranty-dialog .total-warranty-price').text(\"+ £\" + warrantyPrice.toFixed(2));\n }\n /***** Start - change Warranty Price *****/\n }\n}\n\n// Module public functions\nmodule.exports = {\n init: function () {\n pdpOverlayImages();\n pdpOverlayVideo();\n pdpProductEngraving();\n warrantyMiniCart();\n warrantyQuantitySelection();\n },\n warrantyQuantitySelection: function () {\n warrantyQuantitySelection();\n }\n};\n", "'use strict';\n\n\nfunction pdpprint() {\n $('.pdp-print-function').on('click', function () {\n\n window.print();\n\n });\n\n}\n\n\n\n// Module public functions\nmodule.exports = {\n init: pdpprint\n\n};\n", "'use strict';\n\nvar $loader;\n\n/**\n * @function\n * @description Shows an AJAX-loader on top of a given container\n * @param {Element} container The Element on top of which the AJAX-Loader will be shown\n */\nvar show = function (container) {\n var target = (!container || $(container).length === 0) ? $('body') : $(container);\n $loader = $loader || $('.progress-loader');\n\n if ($loader.length === 0) {\n $loader = $('<div/>').addClass('progress-loader')\n .append($('<i/>').addClass('fa fa-spinner fa-pulse'));\n }\n return $loader.appendTo(target).show();\n};\n/**\n * @function\n * @description Hides an AJAX-loader\n */\nvar hide = function () {\n if ($loader) {\n $loader.hide();\n }\n};\n\nexports.show = show;\nexports.hide = hide;\n", "/*global PUBNUB: false */\n'use strict';\n\n/* Required Modules */\n\n\n\n/* Local Variables / Configuration */\n/* ******************************* */\nvar pubnub,\n subscribeKey,\n publishKey;\n\n\n/* Functions */\n/* ********* */\nfunction init(channel, onMessageCallback, onConnectCallback) {\n\n // get site preferences\n subscribeKey = window.SitePreferences.PUBNUB_SKEY;\n publishKey = window.SitePreferences.PUBNUB_PKEY;\n if (!subscribeKey || !publishKey) {\n return null;\n }\n\n\n // initialize pubnub object\n /*eslint-disable */\n pubnub = PUBNUB({\n publish_key : publishKey,\n subscribe_key : subscribeKey,\n ssl: true\n });\n /*eslint-enable */\n\n\n // subscribe to listen on channel\n pubnub.subscribe({\n channel : channel,\n message : onMessageCallback,\n connect: onConnectCallback\n });\n\n return pubnub;\n}\n\nexports.init = init;\n", "'use strict';\n\nvar util = require(46),\n validator = require(47),\n progress = require(35),\n flyinheader = require(9);\n\nfunction enableQuickBuy() {\n $('.quickbuypref-check').addClass('enabled');\n $('.change-mode').html('enabled');\n $('.quickbuy-detail').css('opacity', '1');\n $(\".quickbuy-detail :input[type=text], .quickbuy-detail :input[type=submit], .quickbuy-detail :input[type=checkbox], .quickbuy-detail select\").prop(\"disabled\", false);\n $('#qbpref-enablecontent').removeClass('d-none');\n $('#isquikbuydisabled').addClass('d-none');\n $('.add-new-address').css('pointer-events', 'auto');\n $('.add-new-address').css('cursor', 'pointer');\n $(\".quickbuy-detail .styledSelect\").css('pointer-events', 'pointer');\n $(\".quickbuy-detail .styledSelect\").css('cursor', 'pointer');\n}\n\nfunction disableQuickBuy() {\n $('.quickbuypref-check').removeClass('enabled');\n $('#qbpref-disablecontent').addClass('d-none');\n $('#qbpref-enablecontent').addClass('d-none');\n $('#isquikbuydisabled').removeClass('d-none');\n $('.change-mode').html('disabled');\n $('.add-new-address').css('pointer-events', 'none');\n $('.add-new-address').css('cursor', 'default');\n $('.quickbuy-detail').css('opacity', '0.5');\n $('.quickbuytac').css('display', 'none');\n $(\".quickbuy-detail :input[type=text], .quickbuy-detail :input[type=submit], .quickbuy-detail :input[type=checkbox], .quickbuy-detail select\").prop(\"disabled\", true);\n $(\".quickbuy-detail .styledSelect\").css('pointer-events', 'none');\n $(\".quickbuy-detail .styledSelect\").css('cursor', 'auto');\n}\n\nfunction addToCartValidation() {\n var isEngravingItem = $('#isEngravingItem').val();\n if (isEngravingItem == \"true\") {\n var errorFields = \"\";\n var engravingValidateFields = [\"mandatory_color\", \"mandatory_size\", \"mandatory_birthstone\", \"mandatory_birthflower\", \"mandatory_chakra\", \"mandatory_zodiac\", \"mandatory_engraving1\", \"mandatory_engraving2\", \"mandatory_engraving3\", \"mandatory_engraving4\"];\n var $engravingForm = $('form.engraving-form:visible');\n jQuery.each(engravingValidateFields, function (i, val) {\n if ($engravingForm.find('#' + val).length >= 1) {\n if ($engravingForm.find('#' + val).val() == \"true\") {\n var fieldToChk = $engravingForm.find('#' + val).attr('data-validateClass');\n if ($engravingForm.find('#' + fieldToChk).val() == \"\") {\n if ($engravingForm.find('#' + fieldToChk).prop('tagName') == \"SELECT\") {\n var $selectParent = $engravingForm.find('#' + fieldToChk).parents('.form-row-select');\n $selectParent.find('.styledSelect').css('border-color', '#C20000').css('border-width', '1.5px');\n $engravingForm.find('#' + fieldToChk + '-error').css('display', 'block');\n } else {\n $engravingForm.find('#' + fieldToChk).css('border-color', '#C20000').css('border-width', '1.5px');\n $engravingForm.find('#' + fieldToChk + '-error').css('display', 'block');\n }\n errorFields += fieldToChk;\n } else {\n if ($engravingForm.find('#' + fieldToChk).prop('tagName') == \"SELECT\") {\n var $selectParent = $engravingForm.find('#' + fieldToChk).parents('.form-row-select');\n $selectParent.find('.styledSelect').css('border-color', '#b9addb').css('border-width', '1px');\n $engravingForm.find('#' + fieldToChk + '-error').css('display', 'none');\n } else {\n $engravingForm.find('#' + fieldToChk).css('border-color', '#b9addb').css('border-width', '1px');\n $engravingForm.find('#' + fieldToChk + '-error').css('display', 'none');\n }\n }\n }\n }\n });\n if (!$engravingForm.find('#dwfrm_engraving_engravingtac').prop(\"checked\")) {\n $engravingForm.find('div.checker').css('border-color', '#C20000').css('border-width', '1.5px');\n $engravingForm.find(\"label[for='dwfrm_engraving_engravingtac']\").css('color', '#C20000');\n var fieldToChk = \"form.engraving-form:visible #dwfrm_engraving_engravingtac\";\n errorFields += fieldToChk;\n } else {\n $engravingForm.find('div.checker').css('border-color', '#b9addb').css('border-width', '1px');\n $engravingForm.find(\"label[for='dwfrm_engraving_engravingtac']\").css('color', '#2c163d');\n }\n\n if (errorFields != \"\") {\n $('input, select').on('keyup keydown change', function () {\n var id = $(this).attr('id'),\n parentClass = \"form.engraving-form:visible \",\n mandVal = $('input[data-validateClass=' + id + ']').val();\n if (mandVal == \"true\") {\n if ($(this).val() == \"\") {\n if ($(this).prop('tagName') == \"SELECT\") {\n $(parentClass + '#uniform-' + id).css('border-color', '#C20000').css('border-width', '1.5px');\n $(parentClass + '.' + id + '-error').css('display', 'block');\n } else {\n $(this).css('border-color', '#C20000').css('border-width', '1.5px');\n $(parentClass + '.' + id + '-error').css('display', 'block');\n }\n } else {\n if ($(this).prop('tagName') == \"SELECT\") {\n $(parentClass + '#uniform-' + id).css('border-color', '#b9addb').css('border-width', '1px');\n $(parentClass + '.' + id + '-error').css('display', 'none');\n } else {\n $(this).css('border-color', '#b9addb').css('border-width', '1px');\n $(parentClass + '.' + id + '-error').css('display', 'none');\n }\n }\n }\n });\n return false;\n } else {\n return true;\n }\n } else {\n return true;\n }\n}\n\nvar plid = '', quantity = '', itemid = '', pid = '';\nfunction initializeEvents() {\n if (customer.loggedIn == true && (customer.loginStatusCode == \"1\" || customer.loginStatusCode == \"2\")) {\n if (customer.quickbuy.activated == true && customer.quickbuy.enabled == false) {\n if (!$('#showActivateQBModel').hasClass('quick-buy-pref-Class')) {\n $('#showActivateQBModel').addClass('quick-buy-pref-Class');\n }\n $('#showActivateQBModel').removeClass('quick-buy-signin');\n } else if (customer.quickbuy.activated == true && customer.quickbuy.enabled == true) {\n if (!$('#showActivateQBModel').hasClass('quick-buy-signin')) {\n $('#showActivateQBModel').addClass('quick-buy-signin');\n }\n $('#showActivateQBModel').removeClass('quick-buy-pref-Class');\n } else if (customer.quickbuy.activated == false) {\n $('#showActivateQBModel').removeClass('quick-buy-signin');\n $('#showActivateQBModel').removeClass('quick-buy-pref-Class');\n }\n } else {\n if (!$('#showActivateQBModel').hasClass('quick-buy-login-class')) {\n $('#showActivateQBModel').addClass('quick-buy-login-class')\n }\n $('#showActivateQBModel').removeClass('quick-buy-signin');\n $('#showActivateQBModel').removeClass('quick-buy-pref-Class');\n }\n\n showActivateQBModel();\n flyinheader.init();\n whatiscvv();\n checkFieldsIntiator();\n checkFieldsType();\n\n //Pass quickbuy=true when you click QB button in like list page to add persistent login\n $(document).off('click.persistentqbpopup').on('click.persistentqbpopup', '.wishlist-table #showActivateQBModel.quick-buy-login-class', function (e) {\n e.preventDefault();\n var sessionTimeout = Urls.wishlist + \"?quickbuy=true\";\n window.location.href = sessionTimeout;\n });\n\n if (!$('#use-billing-address').is(':checked')) {\n //$('.customerAddressBilling').find('.add-billing-address').removeClass('hidden');\n $('.customerAddressBilling').find('.saved-address').removeClass('hidden');\n }\n\n $(\"#dwfrm_quickbuyaddress_shippingAddress_addressid\").focus(function () {\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid-error').remove();\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid').css('border-color', '#b9addb');\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid').css('color', '#2c163d');\n });\n\n if ($('.quickbuypref-check input').is(\":checked\") || ($('#isQbActivated').val() != \"true\") && ($('#isQbEnabled').val() != \"true\")) {\n enableQuickBuy();\n }\n else {\n disableQuickBuy();\n }\n\n $('body').on('change', '#dwfrm_quickbuyaddress_customer_quickbuytac', function () {\n if ($('#dwfrm_quickbuyaddress_customer_quickbuytac').is(':checked')) {\n $('#dwfrm_quickbuyaddress_customer_quickbuytac').attr('value', 'true');\n }\n else {\n $('#dwfrm_quickbuyaddress_customer_quickbuytac').attr('value', 'false');\n }\n });\n\n if (window.QBClick != true) {\n var $addingToCartSection = $('.pdpForm'),\n pageURL = window.location.href;\n var redirectQuickBuyActivation = util.getParamFromUrl('redirectQuickBuyActivation', pageURL),\n quantity = util.getParamFromUrl('quantity', pageURL),\n warrantyFlag = util.getParamFromUrl('warrantyFlag', pageURL),\n warrantyQuantity = util.getParamFromUrl('warrantyQuantity', pageURL),\n engravingFlag = util.getParamFromUrl('engravingFlag', pageURL),\n engravingCount = parseInt(util.getParamFromUrl('engravingCount', pageURL));\n\n if (redirectQuickBuyActivation == 'true') {\n $addingToCartSection.find('.quantity input.pdp-product-quantity.item').val(quantity);\n if (warrantyFlag == 'true') {\n $addingToCartSection.find(\".warranty-section input[name='warrantyEnabled']\").prop(\"checked\", true);\n $addingToCartSection.find('.warranty-section input.warranty-count.item').val(warrantyQuantity);\n }\n if (engravingFlag == 'true') {\n var $engravingForm = $('form.engraving-form:visible'),\n engravingField = $engravingForm.find('[name^=\"dwfrm_engraving_\"]'),\n engravingParameterId, engravingParameterVal;\n $engravingForm.find('#dwfrm_engraving_engravingtac').prop(\"checked\", true);\n for (var i = 0; i < engravingCount; i++) {\n engravingParameterId = 'engravingField' + (i + 1);\n engravingParameterVal = util.getParamFromUrl(engravingParameterId, pageURL);\n if ($(engravingField[i]).prop('tagName') == 'SELECT') {\n $(engravingField[i]).find('option:selected').prop('selected', false);\n $(engravingField[i]).find('option:selected').removeAttr('selected');\n $($(engravingField[i]).find('option')[engravingParameterVal]).prop('selected', true);\n $($(engravingField[i]).find('option')[engravingParameterVal]).attr('selected', true);\n } else {\n engravingParameterVal = (engravingParameterVal == 'EMPTY') ? '' : engravingParameterVal;\n $(engravingField[i]).val(engravingParameterVal);\n }\n }\n }\n\n $('#showActivateQBModel:not(.quick-buy-login-class)').trigger('click');\n window.QBClick = true;\n }\n }\n}\nfunction redirectQuickBuyPrefPage() {\n var url = Urls.quickbuyprefpage;\n url = util.appendParamsToUrl(url, {\n 'plid': plid,\n 'pid': pid,\n 'quantity': quantity,\n 'itemid': itemid,\n 'pagecontext': pageContext.ns,\n 'redirectQuickBuyActivation': true\n });\n window.location.href = url\n}\n\nfunction showActivateQBModel() {\n $(document).off('click.qblogin').on('click.qblogin', '.pdp-buttons .quick-buy-login-class', function (e) {\n e.preventDefault();\n var url = Urls.quickbuysignpage;\n pid = $(this).closest('form').find(\"input[name='pid']\").val();\n var $addingToCartSection = $('.pdpForm');\n var quantity = $addingToCartSection.find('.quantity input.pdp-product-quantity.item').val(),\n warrantyQuantity = 0;\n var Login_PopUp_Active = window.SitePreferences.Login_PopUp_Active;\n if (Login_PopUp_Active) {\n url = util.appendParamToURL(url, 'pageContext', pageContext.ns);\n if (window.dialog) {\n window.dialog.open({\n url: url,\n options: {\n dialogClass: 'new-sign-registration quick-buy-dialog',\n open: function (event, ui) {\n validator.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n\n $('.item').on('click', '.oAuthIcon', function (e) {\n $('.OAuthProvider').val($(e.delegateTarget).attr('id'));\n $('.quickBuyClick').val(true);\n });\n\n $('body').css('overflow', 'hidden');\n $('.checkemail-button button').off('click').on('click submit', function (event) {\n event.preventDefault();\n var url = Urls.checkMailAvailabilty;\n var $form = $(this).closest('form');\n var emailid = $form.find('.email-field input').val();\n if ($form.find('.checkemail-field .error').length > 0) {\n $form.find('.checkemail-field .error').remove();\n }\n var regex = validator.regex;\n if (emailid != '' && !regex.newEmail.test(emailid)) {\n var newDiv = '<div class=\"error\" style=\"color:#E30613;\">The email address is invalid.<div>'\n $form.find('.checkemail-field').append(newDiv);\n return;\n }\n if (emailid == '') {\n var newDiv = '<div class=\"error\" style=\"color:#E30613;\">Cannot be blank<div>'\n $form.find('.checkemail-field').append(newDiv);\n return;\n }\n url = util.appendParamToURL(url, 'emailid', emailid);\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n var responseJson = JSON.parse(response);\n if (responseJson.availableEmail) {\n var $form1 = $('.returning-customers form');\n if ($form1.find('.email-value').hasClass('d-none')) {\n $form1.find('.email-value').text(responseJson.email).removeClass('d-none');\n } else {\n $form1.find('.email-value').text(responseJson.email);\n }\n if ($form1.find('.checkpw-content').hasClass('d-none')) {\n $form1.find('.checkpw-content').removeClass('d-none');\n }\n if (!$form1.find('.checkemail-field').hasClass('d-none')) {\n $form1.find('.checkemail-field').addClass('d-none');\n }\n if ($form1.find('.form-row-password').hasClass('d-none')) {\n $form1.find('.form-row-password').removeClass('d-none');\n }\n if (!$form1.find('.form-row-button .checkemail-button').hasClass('d-none')) {\n $form1.find('.form-row-button .checkemail-button').addClass('d-none');\n }\n if ($form1.find('.checkpw-button').hasClass('d-none')) {\n $form1.find('.checkpw-button').removeClass('d-none');\n }\n if ($('.newsignin-box-inner .checkpw-title').hasClass('d-none')) {\n $('.newsignin-box-inner .checkpw-title').removeClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-title').hasClass('d-none')) {\n $('.newsignin-box-inner .checkemail-title').addClass('d-none')\n }\n if (!$('.newsignin-box-inner .guest-checkout-button').hasClass('d-none')) {\n $('.newsignin-box-inner .guest-checkout-button').addClass('d-none')\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')) {\n $('.newsignin-box-inner .checkemail-content').addClass('d-none')\n }\n\n $('.newsignin-box-inner .checkemail-title').addClass('d-none')\n qbsignInForCustoer();\n qbforgotPwdClick();\n qbeditbuttonclick();\n qbenteredWrongEmail();\n qbdisguisePassword();\n } else {\n\n var url = util.appendParamsToUrl(Urls.oldRegPage, {\n 'emailid': emailid,\n 'fromPopUpRegister': 'yes',\n 'quickbuy': true,\n 'pagecontext': pageContext.ns,\n 'itemPnP': itemPnP,\n 'pids': pid,\n 'quantity': quantity,\n 'redirectQuickBuyActivation': true\n });\n window.location.href = url;\n }\n\n $(\".emailEditButton\").on(\"click\", function () {\n $('.newsignin-box-inner .checkpw-title').addClass('d-none');\n $('.newsignin-box-inner .checkpw-content').addClass('d-none');\n $('.newsignin-box-inner .checkpw-field').addClass('d-none');\n $('.newsignin-box-inner .checkpw-button').addClass('d-none');\n $('.newsignin-box-inner .checkemail-title').removeClass('d-none');\n $('.newsignin-box-inner .checkemail-content').removeClass('d-none');\n $('.newsignin-box-inner .checkemail-field').removeClass('d-none');\n $('.newsignin-box-inner .checkemail-button').removeClass('d-none');\n });\n\n },\n error: function (jqXHR, textStatus, errorThrown) {\n // console.log(jqXHR + textStatus + errorThrown);\n }\n });\n });\n },\n close: function () {\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n }\n }\n });\n }\n } else {\n var addToCartValid = addToCartValidation();\n if (addToCartValid) {\n var url = util.appendParamsToUrl(Urls.oldRegPage, {\n 'quickbuy': true,\n 'pids': pid,\n 'pid': pid,\n 'pagecontext': pageContext.ns,\n 'quantity': quantity,\n 'redirectQuickBuyActivation': true,\n 'emailid': '',\n 'fromPopUpRegister': 'no'\n });\n var urlParams = {};\n if ($('#isWarrantyEligible').val() == 'true') {\n var isWarrantySelected = $addingToCartSection.find(\".warranty-section input[name='warrantyEnabled']\").prop(\"checked\");\n if (isWarrantySelected) {\n urlParams.warrantyFlag = isWarrantySelected;\n urlParams.warrantyQuantity = $addingToCartSection.find('.warranty-section input.warranty-count.item').val();\n }\n }\n if ($('#isEngravingItem').val() == 'true') {\n var $engravingForm = $('form.engraving-form:visible'),\n engravingFormFieldsCount = $engravingForm.find('[name^=\"dwfrm_engraving_\"]').length,\n engravingFieldType, $engravingField, engravingParameterId, engravingFieldCount = 0, engravingTempValue;\n if (engravingFormFieldsCount > 0) {\n jQuery.each($engravingForm.find('[name^=\"dwfrm_engraving_\"]'), function (i, val) {\n $engravingField = $(val);\n engravingFieldType = $engravingField.attr('type');\n engravingParameterId = 'engravingField' + (i + 1);\n if (engravingFieldType != \"checkbox\") {\n if ($engravingField.prop('tagName') == 'SELECT') {\n urlParams[engravingParameterId] = $engravingField.find('option:selected').index();\n } else {\n engravingTempValue = $engravingField.val();\n urlParams[engravingParameterId] = (engravingTempValue.trim() == '') ? 'EMPTY' : engravingTempValue;\n }\n engravingFieldCount++;\n }\n });\n urlParams.engravingFlag = $engravingForm.find('#dwfrm_engraving_engravingtac').is(\":checked\");\n urlParams.engravingCount = engravingFieldCount;\n }\n }\n url = util.appendParamsToUrl(url, urlParams);\n window.location.href = url;\n }\n }\n });\n\n $(document).off('click.qbpopup').on('click.qbpopup', '#showActivateQBModel:not(.quick-buy-login-class)', function (e) {\n e.preventDefault();\n\n var addToCartValid = addToCartValidation();\n if (!addToCartValid) { return false; }\n\n pid = $(this).closest('form').find(\"input[name='pid']\").val();\n plid = $(this).closest('form').find(\"input[name='plid']\").val();\n quantity = $(this).closest('form').find(\"input[name='Quantity']\").val();\n itemid = $(this).closest('form').find(\"input[name='itemid']\").val();\n if (itemid == undefined) {\n itemid = $(this).closest('form').find(\"input[name='uuid']\").val();\n }\n\n var productAcilabilityQty = Number($(this).closest('form').find('.inventoryRecord').val());\n var qty = Number(quantity);\n if (qty > productAcilabilityQty) {\n $(this).closest('form').find('.product-non-availability').show();\n $(this).closest('form').find('.product-non-availability').css(\"color\", \"red\");\n return;\n } else {\n $(this).closest('form').find('.product-non-availability').hide();\n $(this).closest('form').find('.product-non-availability').css(\"color\", \"black\");\n }\n\n if ($(this).hasClass('quick-buy-pref-Class')) {\n redirectQuickBuyPrefPage();\n return;\n } else if ($(this).hasClass('quick-buy-signin')) {\n var url = Urls.QuickBuyQuickOrder;\n var sizeVariation = $('.attribute.size-variations');\n if (sizeVariation.length > 0) {\n var selectedSwatch = sizeVariation.find('li.selected');\n if (selectedSwatch.length <= 0) {\n sizeVariation.find('span.error').removeClass('d-none');\n $('body,html').scrollTop(sizeVariation.offset().top);\n return false;\n }\n }\n var urlParams = {\n Quantity: quantity,\n itemid: itemid,\n nonLiveTvProductForQB: true\n };\n if (pid != undefined) {\n urlParams.pid = pid;\n var isWarrantyEligible = $('#isWarrantyEligible').val();\n var isEngravingItem = $('#isEngravingItem').val();\n var engdata = '';\n if (isWarrantyEligible == \"true\") {\n var $addingToCartSection = $('.pdpForm');\n var isWarrantySelected = $addingToCartSection.find(\".warranty-section input[name='warrantyEnabled']\").prop(\"checked\");\n if (isWarrantySelected) {\n urlParams.warrantyQty = $addingToCartSection.find('.warranty-section input.warranty-count.item').val();;\n urlParams.isWarrantySelected = isWarrantySelected;\n urlParams.warrantyEnabled = isWarrantyEligible;\n }\n }\n if (isEngravingItem == \"true\") {\n var $engravingForm = $('form.engraving-form:visible');\n engdata = $engravingForm.serialize();\n }\n } else {\n urlParams.plid = plid;\n }\n url = util.appendParamsToUrl(url, urlParams);\n if (window.dialog) {\n window.dialog.open({\n url: url,\n data: engdata,\n options: {\n dialogClass: 'qb-livetv-dialog',\n open: function (event, ui) {\n progress.hide();\n validator.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n $('body').css('overflow', 'hidden');\n require(45)();\n $('#existingCardsCVV').addClass('checkType');\n $('#existingCardsCVV').attr('pattern', '[0-9]{1,4}');\n $('.qb-livetv-dialog .footer .content-heading').css('line-height', '2.5rem');\n $('#dwfrm_billing_paymentMethods_selectedPaymentMethodID_Paysafe').on('click', function () {\n $('.qb-livetv-dialog .footer .content-heading').css('line-height', '2.5rem');\n var ordertotal = $('#paysafe_ordertotal').text();\n $('.updateqbtotal').html(ordertotal);\n });\n $('#dwfrm_billing_paymentMethods_selectedPaymentMethodID_budgetPay').on('click', function () {\n $('.qb-livetv-dialog .footer .content-heading').css('line-height', '1.5rem');\n var ordertotal = $('#budgetpay_ordertotal').text();\n $('.updateqbtotal').html(ordertotal);\n });\n $('.qb-livetv-dialog').off('click').on('click', '.confirm-qborder', function (event) {\n event.preventDefault();\n var $form = $(this).closest('form');\n //var data = $form.serialize();\n var token = $('#dwfrm_billing_paymentToken').val();\n //var cvv = $('#existingCardsCVV').val();\n var existingCards = $('#existing-paysafe-card').val();\n if ($('.safe-budget').length) {\n var radioValue = $(\"input[name='dwfrm_billing_paymentMethods_selectedPaymentMethodID']:checked\").val();\n }\n else {\n var radioValue = $(\"input[name='dwfrm_billing_paymentMethods_selectedPaymentMethodID']\").val();\n }\n /*if (cvv == ''){\n var newDiv ='<div class=\"error\" style=\"color:#E30613;\">CVV cannot be blank<div>';\n if($('.cvv-field').find('.error').length == 0) {\n $form.find('.cvv-field').append(newDiv);\n }\n return;\n }*/\n // Disable the button after click\n $(this).prop('disabled', true);\n\n if (window.SitePreferences.Paysafe_3ds2_Enabled) {\n //Paysafe 3DS2 implementation starts here\n try {\n progress.show();\n $('.progress-loader').css('top', '65% !important');\n var accountId = window.SitePreferences.PAYSAFE_MID,\n environment = window.SitePreferences.PAYSAFE_ENVIRONMENT,\n authenticationPurpose = 'PAYMENT_TRANSACTION',\n cardBin = null, paymentToken = null;\n var btoa = window.btoa,\n apiKey = btoa(window.SitePreferences.PAYSAFE_SINGLE_USE_TOKEN);\n if (existingCards != null) {\n paymentToken = JSON.parse(existingCards).paymentToken;\n cardBin = JSON.parse(existingCards).cardBin;\n }\n if ('BudgetPay' === radioValue) {\n authenticationPurpose = 'INSTALMENT_TRANSACTION';\n }\n\n var options = { accountId: accountId, card: { cardBin: cardBin }, environment: environment };\n paysafe.threedsecure.start(apiKey, options, function (deviceFingerprintingId, startError) {\n if (startError) {\n var lastDigits, id, cardType;\n lastDigits = $('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits;\n id = $('.paysafemodelbox').data(\"paysafeselectedcard\").id;\n cardType = $('.paysafemodelbox').data(\"paysafeselectedcard\").cardType;\n\n var url = Urls.paysafe3DSecure2LogInfo;\n var data = {\n 'lastDigits': lastDigits,\n 'txnID': id,\n 'callNode': 'GENERAL_ERRORS',\n 'cardType': cardType,\n 'code': startError.code,\n 'displayMessage': startError.displayMessage,\n 'detailedMessage': startError.detailedMessage\n };\n url = util.appendParamsToUrl(url, data);\n $.ajax({\n type: \"GET\",\n url: url,\n success: function (data) {\n if (data.returnStatus !== undefined && data.returnStatus) {\n return;\n }\n },\n error: function (f) {\n progress.hide();\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n progress.hide();\n $paymentMethodsWarning.text(\"Technical issues prevent processing your payment. Please try later or use another payment method.\").parent().show();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n } else if (deviceFingerprintingId !== undefined) {\n // 3DS2 Next Step\n progress.show();\n var url = Urls.paysafe3DSecure2Authenticate;\n url = util.appendParamsToUrl(url, {\n 'deviceFingerprintingId': deviceFingerprintingId,\n 'authenticationPurpose': authenticationPurpose,\n 'paymentToken': paymentToken\n });\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n progress.hide();\n response = JSON.parse(response)\n if (typeof (response) == 'object') {\n var responseObj = response.dataObj;\n if (responseObj.sdkChallengePayload != undefined && responseObj.sdkChallengePayload != '') {\n // go for challange\n var sdkChallengePayload = responseObj.sdkChallengePayload;\n var options = { sdkChallengePayload: sdkChallengePayload, environment: environment };\n try {\n paysafe.threedsecure.challenge(apiKey, options, function (resultId, error) {\n if (resultId !== undefined) {\n var url = Urls.paysafe3DSecure2GetAuthDetails;\n var data = { authenticationId: resultId };\n $.ajax({\n url: url,\n type: 'POST',\n data: data,\n success: function (response2Obj) {\n if (response2Obj !== undefined) {\n //{status: 'COMPLETED', threeDResult: 'U', errorMsg: 'AUTH_FAILED_U', sdkChallengePayload: ''}\n if (response2Obj.dataObj !== undefined) {\n var finalStatus = response2Obj.dataObj.status;\n var finalthreeDResult = response2Obj.dataObj.threeDResult;\n var finalerrorMsg = response2Obj.dataObj.errorMsg;\n var finalsdkChallengePayload = response2Obj.dataObj.sdkChallengePayload;\n if (finalStatus == 'COMPLETED' && finalerrorMsg == 'AUTH_OK_A_Y') {\n qbplaceorder();\n } else if (finalthreeDResult == 'U') {\n if (window.SitePreferences.AllowStatusCodeU) {\n qbplaceorder();\n } else if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request could not be completed by the bank due to technical reasons. Please try again or use a different card\");\n var totalPrice14 = $('.order-total.order-full-total td')[1];\n var $gtmprice54;\n if (totalPrice1) {\n $gtmprice54 = totalPrice14.textContent;\n } else {\n $gtmprice54 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice54\n }\n });\n }\n //console.log('authentication result is U');\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request has been declined by the Bank. Try using a different Card or Payment Option\");\n var totalPrice6 = $('.order-total.order-full-total td')[1];\n var $gtmprice6;\n if (totalPrice6) {\n $gtmprice6 = totalPrice6.textContent;\n } else {\n $gtmprice6 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice6\n }\n });\n }\n //console.log('authentication was unsuccessful in the 2nd step and unable to proceed your request');\n }\n }\n }\n },\n error: function () {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while calling the getpaysafe3dsauthdetails endpoint');\n }\n });\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while executing the challenge method and did not get authentication id');\n }\n });\n } catch (e) {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error was thrown while executing the challenge flow ' + e);\n }\n } else {\n if (responseObj !== undefined) {\n var finalthreeDResult = responseObj.threeDResult;\n if (finalthreeDResult == 'Y' || finalthreeDResult == 'A') {\n qbplaceorder()\n } else if (finalthreeDResult == 'U') {\n if (window.SitePreferences.AllowStatusCodeU) {\n qbplaceorder()\n } else if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request could not be completed by the bank due to technical reasons. Please try again or use a different card\");\n var totalPrice16 = $('.order-total.order-full-total td')[1];\n var $gtmprice56;\n if (totalPrice16) {\n $gtmprice56 = totalPrice16.textContent;\n } else {\n $gtmprice56 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice56\n }\n });\n }\n //console.log('auth result is U');\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request has been declined by the Bank. Try using a different Card or Payment Option\");\n var totalPrice7 = $('.order-total.order-full-total td')[1];\n var $gtmprice7;\n if (totalPrice7) {\n $gtmprice7 = totalPrice7.textContent;\n } else {\n $gtmprice7 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice7\n }\n });\n }\n //console.log('Authentication was unsuccessful in the 1st step and Your request has been declined by the Bank. Try using a different Card or Payment Option');\n }\n }\n }\n }\n },\n error: function () {\n progress.hide();\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while calling paysafe 3ds auth endpoint');\n }\n });\n } else {\n progress.hide();\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while calling start method and unable to generate devicefp id');\n }\n });\n } catch (e) {\n progress.hide();\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('Initial Catch of 3ds2 ' + e);\n }\n if ($('.progress-loader').length) {\n progress.hide();\n }\n //Paysafe 3DS2 implementation ends here\n } else {\n qbplaceorder();\n }\n });\n\n $('.qb-livetv-dialog').on('click', '.settings', function (event) {\n var url = Urls.restoreqbbasketfromsession;\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n //do something\n }\n });\n });\n\n },\n close: function () {\n var url = Urls.restoreqbbasketfromsession;\n progress.show();\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n $('body').css('overflow', 'x-hidden');\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n //do something\n }\n });\n url = window.location.href.split('#')[0];\n window.location.href = url.split('?')[0];\n }\n }\n });\n }\n } else {\n var url = Urls.quickbuyactivatepage;\n var sizeVariation = $('.attribute.size-variations');\n if (sizeVariation.length > 0) {\n var selectedSwatch = sizeVariation.find('li.selected');\n if (selectedSwatch.length <= 0) {\n sizeVariation.find('span.error').removeClass('d-none');\n $('body,html').scrollTop(sizeVariation.offset().top);\n return false;\n }\n }\n var urlParams = {\n Quantity: quantity,\n itemid: itemid,\n nonLiveTvProductForQB: true\n };\n urlParams.pid = pid;\n var isWarrantyEligible = $('#isWarrantyEligible').val();\n var isEngravingItem = $('#isEngravingItem').val();\n var engdata = '';\n if (isWarrantyEligible == \"true\") {\n var $addingToCartSection = $('.pdpForm');\n var isWarrantySelected = $addingToCartSection.find(\".warranty-section input[name='warrantyEnabled']\").prop(\"checked\");\n if (isWarrantySelected) {\n urlParams.warrantyQty = $addingToCartSection.find('.warranty-section input.warranty-count.item').val();;\n urlParams.isWarrantySelected = isWarrantySelected;\n urlParams.warrantyEnabled = isWarrantyEligible;\n }\n }\n if (isEngravingItem == \"true\") {\n var $engravingForm = $('form.engraving-form:visible');\n engdata = $engravingForm.serialize();\n }\n urlParams.plid = pid;\n urlParams.qbForNonLiveTvProduct = true;\n urlParams.redirectQuickBuyActivation = true;\n //url = util.appendParamToURL(url,'pageContext',pageContext.ns);\n url = util.appendParamsToUrl(url, urlParams);\n //url = util.appendParamToURL(url,'pageContext',pageContext.ns);\n progress.show();\n if (window.dialog) {\n window.dialog.open({\n url: url,\n data: engdata,\n options: {\n dialogClass: 'showActivateQBModel',\n closeOnEscape: false,\n open: function (event, ui) {\n var addressjs = require(18),\n accountjs = require(17),\n paysafe = require(31);\n progress.hide();\n $('body').css('overflow', 'hidden');\n $('.credit-card-box').css('max-width', 'unset');\n require(45)();\n whatiscvv();\n addressjs.init();\n accountjs.init();\n validator.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n addWarrantyQB();\n window.paysafeForQB = true;\n paysafe.init();\n },\n close: function () {\n var url = Urls.restoreqbbasketfromsession;\n progress.show();\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n $('body').css('overflow', 'x-hidden');\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n\n }\n });\n url = window.location.href.split('#')[0];\n window.location.href = url.split('?')[0];\n }\n }\n });\n }\n }\n });\n}\n\nfunction qbplaceorder() {\n\n var placeOrderURL = Urls.quickbuyPlaceOrder;\n var token = $('#dwfrm_billing_paymentToken').val();\n if ($('.safe-budget').length) {\n var radioValue = $(\"input[name='dwfrm_billing_paymentMethods_selectedPaymentMethodID']:checked\").val();\n }\n else {\n var radioValue = $(\"input[name='dwfrm_billing_paymentMethods_selectedPaymentMethodID']\").val();\n }\n var existingCards = $('#existing-paysafe-card').val();\n $.ajax({\n url: placeOrderURL + \"?token=\" + token + \"&paymentMethod=\" + radioValue + \"&existingCards=\" + existingCards,\n type: 'POST',\n beforeSend: function () { progress.show(); },\n success: function (response) {\n progress.hide();\n if (response.success && response.Orderno != \"\") {\n if ($('#quickBuyConfirmation').hasClass('d-none')) {\n $('#quickBuyForm').addClass('d-none');\n $('#quickBuyConfirmation').removeClass('d-none');\n $(\"#qborder-number\").html(response.Orderno);\n var gtmPurchase = JSON.stringify(response.gtmPurchase),\n gtmProducts = JSON.stringify(response.gtmProducts);\n $(\"#quickBuyConfirmation #gtmDataHolder\").attr('data-gtmPurchase', gtmPurchase);\n $(\"#quickBuyConfirmation #gtmDataHolder\").attr('data-gtmProducts', gtmProducts);\n\n var nbpurchase = JSON.stringify(response.nbpurchase),\n nbtransactionproducts = JSON.stringify(response.nbtransactionproducts),\n nbordercategory = JSON.stringify(response.nbordercategory);\n $(\"#quickBuyConfirmation #nbDataHolder\").attr('data-nbpurchase', nbpurchase);\n $(\"#quickBuyConfirmation #nbDataHolder\").attr('data-nbtransactionproducts', nbtransactionproducts);\n $(\"#quickBuyConfirmation #nbDataHolder\").attr('data-nbordercategory', nbordercategory);\n /*window.dataLayer.push({\n 'event':'purchase',\n 'ecommerce': {\n 'purchase': {\n 'actionField': JSON.parse(gtmPurchase),\n 'products': JSON.parse(gtmProducts)\n }\n }\n });*/\n var orderconfirmation = require(21);\n orderconfirmation.init();\n dataLayer.push({ 'event': 'QBOrderConfirmation' });\n }\n }\n else {\n if (response.errorCode >= 0 && response.errorCode <= 11) {\n if (response.errorCode == 11) {\n if ($('.budgetPaySpecificError').hasClass('d-none')) {\n $('.budgetPaySpecificError').removeClass('d-none');\n }\n }\n else {\n if ($('.budgetPaySomethingError').hasClass('d-none')) {\n $('.budgetPaySomethingError').removeClass('d-none');\n }\n }\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Something didn't work. Please contact customer care on 0344 375 2525.\");\n }\n }\n }\n $(\"#qbConfirm-close\").on('click', function () {\n if (window.dialog) {\n window.dialog.close();\n }\n });\n }\n });\n}\n\nfunction addWarrantyQB() {\n /*### Make Ajax call when you select the warrantyEnabled check box ###*/\n $('.order-totals-box .warranty-box #warrantyEnabled').on('click', function () {\n if ($(this).is(':checked')) {\n var warrantyPrice = parseFloat($('.showActivateQBModel .activate-quickbuy-box .qbwarrantydetails .warranty-dialog').attr('data-warrantycost')),\n url = Urls.qbAddWarranty;\n warrantyPrice = $.trim(warrantyPrice);\n url = util.appendParamsToUrl(url, {\n 'pid': pid,\n 'warrantyQty': quantity,\n 'wprice': warrantyPrice,\n 'fromQB': true\n });\n progress.show();\n $.ajax({\n type: \"POST\",\n url: url,\n success: function (data) {\n try {\n progress.hide();\n $(\".showActivateQBModel .activate-quickbuy-box #includeOrderBasket\").html(data);\n } catch (b) {\n //console.error(b);\n }\n },\n error: function (f) {\n //console.error(f.statusText + \" \" + f.status);\n }\n });\n }\n });\n}\n\nfunction whatiscvv() {\n $('.whatiscvv').click(function (e) {\n if ($(\"#whatiscvv-modelbox\").hasClass('d-none')) {\n $(\"#whatiscvv-modelbox\").removeClass('d-none');\n }\n else {\n $(\"#whatiscvv-modelbox\").addClass('d-none');\n }\n });\n}\n\nfunction tooltipInitialize() {\n if (window.matchMedia(\"(max-width: 767px)\").matches) {\n $('.tooltip').each(function (index) {\n $(this).tooltip({\n position: {\n my: \"bottom-15\",\n at: \"bottom-15\"\n },\n content: function () { return $(this).prop('title'); },\n //show: \"slideDown\",\n open: function (event, ui) {\n var _elemId = ui.tooltip.attr('id');\n $('.ui-tooltip').each(function (index) {\n if (this.id != _elemId) {\n $(this).remove();\n }\n });\n var width = $(window).width();\n $('.ui-tooltip').attr('max-width', width + 'px');\n if (width < 350) {\n $('#' + _elemId).css('left', '0px');\n } else {\n $('#' + _elemId).css('left', '5px');\n }\n setTimeout(function () { if ($('#' + _elemId).is(\":visible\")) { $('#' + _elemId).remove(); } }, 5000);\n },\n close: function (event, ui) {\n ui.tooltip.hover(function () {\n $(this).remove();\n //$(this).stop(true).fadeTo(500, 1);\n },\n function () {\n $(this).remove();\n });\n }\n });\n });\n } else {\n $('.tooltip').each(function (index) {\n $(this).tooltip({\n position: {\n my: \"left+45 top-5\",\n at: \"left+45 top-5\"\n },\n content: function () { return $(this).prop('title'); },\n //show: \"slideDown\",\n open: function (event, ui) {\n var _elemId = ui.tooltip.attr('id');\n $('.ui-tooltip').each(function (index) {\n if (this.id != _elemId) {\n $(this).remove();\n }\n });\n $('#' + _elemId).hover(function () {\n $(this).remove();\n });\n },\n close: function (event, ui) {\n ui.tooltip.hover(function () {\n $(this).remove();\n //$(this).stop(true).fadeTo(500, 1);\n },\n function () {\n $(this).remove();\n });\n }\n });\n });\n }\n}\n\nfunction checkFieldsIntiator() {\n $('#dwfrm_quickbuyaddress_customer_firstname').addClass('checkType');\n $('#dwfrm_quickbuyaddress_customer_firstname').attr('pattern', '[A-Za-z\\s]{1,50}');\n $('#dwfrm_quickbuyaddress_customer_lastname').addClass('checkType');\n $('#dwfrm_quickbuyaddress_customer_lastname').attr('pattern', '[A-Za-z\\s]{1,50}');\n $('#dwfrm_quickbuyaddress_customer_mobile').addClass('checkType');\n $('#dwfrm_quickbuyaddress_customer_mobile').attr('pattern', '[0-9]{1,11}');\n $('#existing-paysafe-cvv').addClass('checkType');\n $('#existing-paysafe-cvv').attr('pattern', '[0-9]{1,4}');\n $('#dwfrm_quickbuyaddress_billingAddress_address_postCode').addClass('checkType');\n $('#dwfrm_quickbuyaddress_billingAddress_address_postCode').attr('pattern', '[A-Za-z0-9 ]{1,8}');\n $('#dwfrm_quickbuyaddress_shippingAddress_address_postCode').addClass('checkType');\n $('#dwfrm_quickbuyaddress_shippingAddress_address_postCode').attr('pattern', '[A-Za-z0-9 ]{1,8}');\n $('.mobile-no').find('.required-indicator').addClass('tooltip');\n $('.mobile-no').find('.required-indicator').attr('title', 'Share your phone number for a seamless shopping experience through our Website and TV.');\n $('.address-alias').find('.required-indicator').addClass('tooltip');\n $('.address-alias').find('.required-indicator').attr('title', 'example - home, office, etc.');\n tooltipInitialize();\n}\n\nfunction checkFieldsType() {\n $('form').find('input').on('keypress', function (e) {\n var keyCode = e.keyCode || e.which;\n if ($(this).is(':visible')) {\n var classes = ($(this).attr('class') != null) ? $(this).attr('class').search('checkType') : -1;\n if (classes >= 0) {\n var regexLength = this.pattern.split('{');\n var regex = new RegExp(regexLength[0]);\n var lengthVal = regexLength[1].replace('}', '');\n var lengthValues = lengthVal.split(',');\n var minLength = lengthValues[0];\n var maxLength = lengthValues[1];\n var isValid = regex.test(String.fromCharCode(keyCode));\n var isValid1 = $(this).val().length + 1;\n if (!isValid) {\n //$(this).css(\"border-bottom\", \"3px solid #FF0000\");\n return isValid;\n } else {\n //$(this).css(\"border-bottom\", \"3px solid #00FF00\");\n }\n if (isValid1 < minLength) {\n //$(this).css(\"border-top\", \"3px solid #FF0000\");\n } else {\n //$(this).css(\"border-top\", \"3px solid #00FF00\");\n }\n if (isValid1 > maxLength) {\n //$(this).css(\"border-top\", \"3px solid #FF0000\");\n return false;\n }\n }\n }\n });\n}\n\nvar qbfornonlivetv = {\n init: function () {\n initializeEvents();\n },\n addWarrantyQB: function () {\n addWarrantyQB();\n }\n};\nmodule.exports = qbfornonlivetv;\n", "'use strict';\n\nvar util = require(46),\n validator = require(47),\n progress = require(35),\n flyinheader = require(9),\n addressjs = require(18),\n accountjs = require(17),\n orderconfirmation = require(21);\n\nfunction ViewHide(pre, show) {\n var view, hide;\n var arr = [\"title\", \"content\", \"field\", \"button\"];\n\n $.each(arr, function (index, value) {\n hide = \".\" + pre + \"-\" + value;\n $(hide).addClass(\"d-none\");\n hide = \"\";\n });\n\n $.each(arr, function (index, value) {\n view = \".\" + show + \"-\" + value;\n $(view).removeClass(\"d-none\");\n view = \"\";\n });\n}\n\nfunction enableQuickBuy() {\n $('.quickbuypref-check').addClass('enabled');\n $('.change-mode').html('enabled');\n $('.quickbuy-detail').css('opacity', '1');\n $(\".quickbuy-detail :input[type=text], .quickbuy-detail :input[type=submit], .quickbuy-detail :input[type=checkbox], .quickbuy-detail select\").prop(\"disabled\", false);\n $('#qbpref-enablecontent').removeClass('d-none');\n $('#isquikbuydisabled').addClass('d-none');\n $('.add-new-address').css('pointer-events', 'auto');\n $('.add-new-address').css('cursor', 'pointer');\n $(\".quickbuy-detail .styledSelect\").css('pointer-events', 'auto');\n $(\".quickbuy-detail .styledSelect\").css('cursor', 'pointer');\n}\n\nfunction disableQuickBuy() {\n $('.quickbuypref-check').removeClass('enabled');\n $('#qbpref-disablecontent').addClass('d-none');\n $('#qbpref-enablecontent').addClass('d-none');\n $('#isquikbuydisabled').removeClass('d-none');\n $('.change-mode').html('disabled');\n $('.add-new-address').css('pointer-events', 'none');\n $('.add-new-address').css('cursor', 'default');\n $('.quickbuy-detail').css('opacity', '0.5');\n $('.quickbuytac').css('display', 'none');\n $(\".quickbuy-detail :input[type=text], .quickbuy-detail :input[type=submit], .quickbuy-detail :input[type=checkbox], .quickbuy-detail select\").prop(\"disabled\", true);\n $(\".quickbuy-detail .styledSelect\").css('pointer-events', 'none');\n $(\".quickbuy-detail .styledSelect\").css('cursor', 'auto');\n}\n\nvar pids = '', itemPnP = '', installments = '', auctioncode = '', channel = '', quantity = '', variationValue = '', secondVariation = '', secondvariationValue = '';\n\nvar auctionCodeApplicable = $(\"input[name=auctionCodeApplicable]\").val(),\n discountAvailable = $(\"input[name=discountAvailable]\").val(),\n buyAllDiscount = $(\"input[name=buyAllDiscount]\").val(),\n discountType = $(\"input[name=discountType]\").val();\n\nfunction initializeEvents() {\n quickBuyAction();\n showActivateQBModel();\n flyinheader.init();\n showActivateModalPopup();\n checkFieldsIntiator();\n checkFieldsType();\n whatiscvv();\n\n //$(\"#dwfrm_quickbuyaddress_shippingAddress_address_address2\").attr(\"required\", true);\n //$(\"#dwfrm_quickbuyaddress_billingAddress_address_address2\").attr(\"required\", true);\n\n if (!$('#use-billing-address').is(':checked')) {\n //$('.customerAddressBilling').find('.add-billing-address').removeClass('hidden');\n $('.customerAddressBilling').find('.saved-address').removeClass('hidden');\n }\n\n $(\"#dwfrm_quickbuyaddress_shippingAddress_addressid\").focus(function () {\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid-error').remove();\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid').css('border-color', '#b9addb');\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid').css('color', '#2c163d');\n });\n\n if ($('.quickbuypref-check input').is(\":checked\") || ($('#isQbActivated').val() != \"true\") && ($('#isQbEnabled').val() != \"true\")) {\n enableQuickBuy();\n }\n else {\n disableQuickBuy();\n }\n\n $(document).on('click', '.live-tv-add-to-cart-form a.quick-buy-login-class', function (e) {\n e.preventDefault();\n var url = Urls.quickbuysignpage;\n pids = $(this).data('pid');\n auctioncode = $(this).data('auctioncode');\n installments = $(this).data('installments');\n channel = $(this).data('channel');\n itemPnP = $(this).data('itempnp');\n auctionCodeApplicable = $(\"input[name='auctionCodeApplicable']\").val();\n quantity = $('#live-tv-product-quantity').val();\n if ($('#live-tv-product-options').hasClass('border')) {\n $('#live-tv-product-options').removeClass('border');\n }\n\n if ($('#live-tv-detail-main .live_groupVariations').length > 0) {\n if ($('#live-tv-product-options').length > 0 && $('#live-tv-product-options').val() != null) {\n variationValue = $('#live-tv-product-options').val();\n }\n else {\n variationValue = $('.auction-product-data .product-id').data('value');\n }\n }\n\n if ($('#live-tv-detail-main .live_groupVariations').length > 0) {\n if ($('#live-tv-product-options').length > 0 && ($('#live-tv-product-options').val() == \"null\" || $('#live-tv-product-options').val() == '')) {\n $('#live-tv-product-options').addClass('border')\n return false;\n }\n else {\n $('#live-tv-product-options').removeClass('border')\n }\n }\n\n\n if ($('.live-tv-detail-main .live_MLAVariations').length > 0) {\n secondVariation = $('.second-variation .input-select').val();\n\n if ($('#live-tv-product-options').length > 0 && $('#live-tv-product-options').val() != null) {\n variationValue = $('#live-tv-product-options').val();\n }\n else {\n variationValue = $('.auction-product-data .product-id').data('value');\n }\n\n var firstVariation = $('.product-selection .input-select').val();\n if (firstVariation == null || firstVariation == \"null\") {\n $('#live-tv-product-options').addClass('border');\n return false;\n }\n else {\n $('#live-tv-product-options').removeClass('border');\n }\n\n if (secondVariation == null || secondVariation == \"null\") {\n $('#select-second-variation').addClass('border');\n return false;\n }\n else {\n $('#select-second-variation').removeClass('border');\n }\n\n }\n\n /*var $productContainer = $('#live-tv-detail-main'),\n $tile = $productContainer.find('.auction-product-data'),\n $selectField = $productContainer.find('.product-selection .input-select'),\n $selectedOption = $selectField.find('option:selected'),\n pids = $selectField.length !== 0 ? $selectField.val() : $tile.find('.product-id').data('value'),\n auctionCodes = $selectField.length !== 0 ? $selectedOption.data('auctioncode') :\n $tile.find('.tile-inner').data('auctioncode');*/\n var $productContainer = $('#live-tv-detail-main'),\n $tile = $productContainer.find('.auction-product-data'),\n $mlaVariations = $productContainer.find('.live_MLAVariations'),\n $groupVariations = $productContainer.find('.live_groupVariations'),\n $selectField = $productContainer.find('.product-selection .input-select'),\n $selectedOption = $selectField.find('option:selected'),\n $selectedFirstOptionValue = $selectedOption.val(),\n $selectedFirstAuctionCode = $selectedOption.attr('data-auctioncode'),\n $selectedfirstPnP = $selectedOption.attr('data-pnp'),\n $selectsecondField = $productContainer.find('.second-variation .input-select'),\n $selectedSecondOption = $selectsecondField.find('option[selected=selected]'),\n $selectedSecondOptionValue = $selectedSecondOption.val(),\n $selectedSecondAuctionCode = $selectedSecondOption.attr('data-auctioncode'),\n $selectedSecondPnP = $selectedSecondOption.attr('data-pnp');\n\n if ($mlaVariations.length > 0) {\n var stockCode = $selectedSecondOptionValue,\n auctionCode = $selectedSecondAuctionCode,\n pnPValue = $selectedSecondPnP;\n }\n\n if ($groupVariations.length > 0) {\n var stockCode = $selectField.length !== 0 ? $selectField.val() : $tile.find('.product-id').data('value'),\n auctionCode = $selectField.length !== 0 ? $selectedOption.data('auctioncode') : $tile.find('.tile-inner').data('auctioncode'),\n pnPValue = $selectedSecondPnP;\n }\n\n var pids = stockCode,\n auctionCodes = auctionCode,\n quantity = $productContainer.find('.quantity-selection .input-select').val();\n\n var secondVarient = $('.second-variation .input-select option:selected').val();\n sessionStorage.setItem('secondField', secondVarient);\n\n if (auctionCodes != '') {\n auctioncode = auctionCodes;\n }\n\n var Login_PopUp_Active = window.SitePreferences.Login_PopUp_Active;\n if (Login_PopUp_Active) {\n url = util.appendParamToURL(url, 'pageContext', pageContext.ns);\n if (window.dialog) {\n window.dialog.open({\n url: url,\n options: {\n dialogClass: 'new-sign-registration quick-buy-dialog',\n open: function (event, ui) {\n validator.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n\n $('.item').on('click', '.oAuthIcon', function (e) {\n $('.OAuthProvider').val($(e.delegateTarget).attr('id'));\n $('.quickBuyClick').val(true);\n });\n\n $('body').css('overflow', 'hidden');\n $('.checkemail-button button').off('click').on('click submit', function (event) {\n event.preventDefault();\n var url = Urls.checkMailAvailabilty;\n var $form = $(this).closest('form');\n var emailid = $form.find('.email-field input').val();\n if ($form.find('.checkemail-field .error').length > 0) {\n $form.find('.checkemail-field .error').remove();\n }\n var regex = validator.regex;\n if (emailid != '' && !regex.newEmail.test(emailid)) {\n var newDiv = '<div class=\"error\" style=\"color:#E30613;\">The email address is invalid.<div>'\n $form.find('.checkemail-field').append(newDiv);\n return;\n }\n if (emailid == '') {\n var newDiv = '<div class=\"error\" style=\"color:#E30613;\">Cannot be blank<div>'\n $form.find('.checkemail-field').append(newDiv);\n return;\n }\n url = util.appendParamToURL(url, 'emailid', emailid);\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n var responseJson = JSON.parse(response);\n if (responseJson.availableEmail) {\n var $form1 = $('.returning-customers form');\n if ($form1.find('.email-value').hasClass('d-none')) {\n $form1.find('.email-value').text(responseJson.email).removeClass('d-none');\n } else {\n $form1.find('.email-value').text(responseJson.email);\n }\n if ($form1.find('.checkpw-content').hasClass('d-none')) {\n $form1.find('.checkpw-content').removeClass('d-none');\n }\n if (!$form1.find('.checkemail-field').hasClass('d-none')) {\n $form1.find('.checkemail-field').addClass('d-none');\n }\n if ($form1.find('.form-row-password').hasClass('d-none')) {\n $form1.find('.form-row-password').removeClass('d-none');\n }\n if (!$form1.find('.form-row-button .checkemail-button').hasClass('d-none')) {\n $form1.find('.form-row-button .checkemail-button').addClass('d-none');\n }\n if ($form1.find('.checkpw-button').hasClass('d-none')) {\n $form1.find('.checkpw-button').removeClass('d-none');\n }\n if ($('.newsignin-box-inner .checkpw-title').hasClass('d-none')) {\n $('.newsignin-box-inner .checkpw-title').removeClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-title').hasClass('d-none')) {\n $('.newsignin-box-inner .checkemail-title').addClass('d-none')\n }\n if (!$('.newsignin-box-inner .guest-checkout-button').hasClass('d-none')) {\n $('.newsignin-box-inner .guest-checkout-button').addClass('d-none')\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')) {\n $('.newsignin-box-inner .checkemail-content').addClass('d-none')\n }\n\n $('.newsignin-box-inner .checkemail-title').addClass('d-none')\n qbsignInForCustoer();\n qbforgotPwdClick();\n qbeditbuttonclick();\n qbenteredWrongEmail();\n qbdisguisePassword();\n } else {\n\n var url = util.appendParamsToUrl(Urls.oldRegPage, {\n 'emailid': emailid,\n 'fromPopUpRegister': 'yes',\n 'quickbuy': true,\n 'pagecontext': pageContext.ns,\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'channel': channel,\n 'quantity': quantity,\n 'variationValue': variationValue,\n 'secondVariation': secondVariation,\n 'redirectQuickBuyActivation': true\n });\n window.location.href = url;\n }\n\n $(\".emailEditButton\").on(\"click\", function () {\n $('.newsignin-box-inner .checkpw-title').addClass('d-none');\n $('.newsignin-box-inner .checkpw-content').addClass('d-none');\n $('.newsignin-box-inner .checkpw-field').addClass('d-none');\n $('.newsignin-box-inner .checkpw-button').addClass('d-none');\n $('.newsignin-box-inner .checkemail-title').removeClass('d-none');\n $('.newsignin-box-inner .checkemail-content').removeClass('d-none');\n $('.newsignin-box-inner .checkemail-field').removeClass('d-none');\n $('.newsignin-box-inner .checkemail-button').removeClass('d-none');\n });\n\n },\n error: function (jqXHR, textStatus, errorThrown) {\n // console.log(jqXHR + textStatus + errorThrown);\n }\n });\n });\n },\n close: function () {\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n }\n }\n });\n }\n } else {\n if (discountAvailable == \"true\" && $('#live-tv-product-options option:selected').attr(\"data-isbuyall\") == \"true\") {\n var url = util.appendParamsToUrl(Urls.oldRegPage, {\n 'quickbuy': true,\n 'pagecontext': pageContext.ns,\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'channel': channel,\n 'quantity': quantity,\n 'variationValue': variationValue,\n 'secondVariation': secondVariation,\n 'redirectQuickBuyActivation': true,\n 'emailid': '',\n 'fromPopUpRegister': 'no',\n 'buyAllDiscount': buyAllDiscount,\n 'discountAvailable': discountAvailable,\n 'discountType': discountType\n });\n } else {\n var url = util.appendParamsToUrl(Urls.oldRegPage, {\n 'quickbuy': true,\n 'pagecontext': pageContext.ns,\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'channel': channel,\n 'quantity': quantity,\n 'variationValue': variationValue,\n 'secondVariation': secondVariation,\n 'redirectQuickBuyActivation': true,\n 'emailid': '',\n 'fromPopUpRegister': 'no'\n });\n }\n window.location.href = url;\n }\n });\n\n $('body').on('change', '#dwfrm_quickbuyaddress_customer_quickbuytac', function () {\n if ($('#dwfrm_quickbuyaddress_customer_quickbuytac').is(':checked')) {\n $('#dwfrm_quickbuyaddress_customer_quickbuytac').attr('value', 'true');\n }\n else {\n $('#dwfrm_quickbuyaddress_customer_quickbuytac').attr('value', 'false');\n }\n });\n\n /** Enable/ Disable functionality on preference page **/\n $('.quickbuypref-check input').on('change', function () {\n if ($('.quickbuypref-check input').is(\":checked\")) {\n var url = Urls.toggleEnableQuickbuy;\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) { }\n });\n enableQuickBuy();\n }\n else {\n $(\"#QBdisableconfirm\").dialog({\n dialogClass: 'QBdisableconfirm',\n open: function (event, ui) {\n if ($('#QBdisableconfirm').hasClass('d-none')) {\n $('#QBdisableconfirm').removeClass('d-none');\n }\n $('.cancel-disable').on('click', function () {\n $('#QBdisableconfirm').dialog('close');\n });\n $('.confirm-disable').on('click', function () {\n var url = Urls.toggleEnableQuickbuy;\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) { }\n });\n disableQuickBuy();\n $('#QBdisableconfirm').dialog('close');\n });\n },\n modal: true\n });\n }\n });\n}\n\nfunction redirectQuickBuyPrefPage() {\n var url = Urls.quickbuyprefpage;\n url = util.appendParamsToUrl(url, {\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'channel': channel,\n 'quantity': quantity,\n 'pagecontext': pageContext.ns,\n 'redirectQuickBuyActivation': true\n });\n window.location.href = url\n}\n\nfunction showActivateQBModel() {\n $('#showActivateQBModel').off('click').on('click', function (e) {\n e.preventDefault();\n pids = $(this).data('pids');\n auctioncode = $(this).data('auctioncode');\n installments = $(this).data('installments');\n channel = $(this).data('channel');\n itemPnP = $(this).data('itempnp');\n auctionCodeApplicable = $(\"input[name='auctionCodeApplicable']\").val();\n quantity = $('#live-tv-product-quantity').val();\n\n if ($('#live-tv-product-options').hasClass('border')) {\n $('#live-tv-product-options').removeClass('border');\n }\n\n if ($('#live-tv-detail-main .live_groupVariations').length > 0) {\n if ($('#live-tv-product-options').length > 0 && $('#live-tv-product-options').val() != null) {\n variationValue = $('#live-tv-product-options').val();\n }\n else {\n variationValue = $('.auction-product-data .product-id').data('value');\n }\n }\n\n if (sessionStorage.getItem(\"secondField\") != null) {\n $('.second-variation .input-select').val(sessionStorage.getItem(\"secondField\")).change();\n sessionStorage.removeItem(\"secondField\");\n }\n\n if ($('#live-tv-detail-main .live_groupVariations').length > 0) {\n if ($('#live-tv-product-options').length > 0 && ($('#live-tv-product-options').val() == \"null\" || $('#live-tv-product-options').val() == '')) {\n $('#live-tv-product-options').addClass('border')\n return false;\n }\n else {\n $('#live-tv-product-options').removeClass('border')\n }\n }\n\n\n if ($('.live-tv-detail-main .live_MLAVariations').length > 0) {\n secondVariation = $('.second-variation .input-select').val();\n\n if ($('#live-tv-product-options').length > 0 && ($('#live-tv-product-options').val() == \"null\" || $('#live-tv-product-options').val() == '')) {\n $('#live-tv-product-options').addClass('border')\n return;\n }\n else {\n $('#live-tv-product-options').removeClass('border')\n }\n\n if (secondVariation == null || secondVariation == \"null\") {\n $('#select-second-variation').addClass('border');\n return false;\n }\n else {\n $('#select-second-variation').removeClass('border');\n }\n }\n\n var $form = $(this).closest('form'),\n $productContainer = $('#live-tv-detail-main'),\n $mlaVariations = $productContainer.find('.live_MLAVariations'),\n $groupVariations = $productContainer.find('.live_groupVariations'),\n $tile = $productContainer.find('.auction-product-data'),\n $selectField = $productContainer.find('.product-selection .input-select'),\n $selectedOption = $selectField.find('option:selected'),\n $selectedFirstOptionValue = $selectedOption.val(),\n $selectedFirstAuctionCode = $selectedOption.attr('data-auctioncode'),\n $selectedfirstPnP = $selectedOption.attr('data-pnp'),\n $selectsecondField = $productContainer.find('.second-variation .input-select'),\n $selectedSecondOption = $selectsecondField.find('option[selected=selected]'),\n $selectedSecondOptionValue = secondVariation ? secondVariation : $selectedSecondOption.val(),\n $selectedSecondAuctionCode = $selectedSecondOption.attr('data-auctioncode'),\n $selectedSecondPnP = $selectedSecondOption.attr('data-pnp'),\n budgetPayContainer = $productContainer.find('.budgetpay'),\n installments = budgetPayContainer.attr('data-installments');\n\n if ($selectedSecondOption.val() == 'null' || $selectedSecondOption.val() == '' || $selectedSecondOption.val() == null) {\n var options = $selectsecondField.find('option');\n $.each(options, function (index, value) {\n\n //console.log(r.find(\".second-variation .input-select option\")[index])\n if ($(this).val() == secondvariationValue) {\n $selectedSecondOptionValue = $(this).val();\n $selectedSecondAuctionCode = $(this).data('auctioncode');\n $selectedSecondPnP = $(this).data('pnp');\n }\n });\n }\n\n if ($mlaVariations.length > 0) {\n var stockCode = $selectedSecondOptionValue,\n auctionCode = $selectedSecondAuctionCode,\n pnPValue = $selectedSecondPnP;\n }\n\n if ($groupVariations.length > 0) {\n var stockCode = $selectField.length !== 0 ? $selectedFirstOptionValue : $tile.find('.product-id').data('value'),\n auctionCode = $selectField.length !== 0 ? $selectedFirstAuctionCode : $tile.find('.tile-inner').data('auctioncode'),\n pnPValue = $selectField.length !== 0 ? $selectedfirstPnP : $tile.find('.tile-inner').data('data-pnp');\n }\n\n var pids = stockCode,\n auctionCodes = auctionCode,\n quantity = $productContainer.find('.quantity-selection .input-select').val();\n\n\n if (auctionCodes != '') {\n auctioncode = auctionCodes;\n }\n\n /*if (variationValue != ''){\n pids = variationValue;\n }*/\n var price = $(\"#tjclive-tileprice\").val();\n var pname = $(\"#gtmliveTV-productname\").val();\n\n if ($(this).hasClass('quick-buy-pref-Class')) {\n redirectQuickBuyPrefPage();\n return;\n } else {\n var url = Urls.quickbuyactivatepage;\n //url = util.appendParamToURL(url,'pageContext',pageContext.ns);\n var quickbuygtm;\n if (discountAvailable == \"true\" && $('#live-tv-product-options option:selected').attr(\"data-isbuyall\") == \"true\") {\n url = util.appendParamsToUrl(url, {\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'channel': channel,\n 'quantity': quantity,\n 'variationValue': variationValue,\n 'secondVariation': secondVariation,\n 'redirectQuickBuyActivation': true,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'buyAllDiscount': buyAllDiscount,\n 'discountAvailable': discountAvailable,\n 'discountType': discountType\n });\n quickbuygtm = {\n \"product name\": pname,\n \"currency\": \"GBP\",\n \"price\": price,\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'channel': channel,\n 'quantity': quantity,\n 'selectedOption': variationValue,\n 'selectedVariation': secondVariation,\n 'redirectQuickBuyActivation': true,\n 'buyAllDiscount': buyAllDiscount,\n 'discountAvailable': discountAvailable,\n 'discountType': discountType\n };\n } else {\n url = util.appendParamsToUrl(url, {\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'channel': channel,\n 'quantity': quantity,\n 'variationValue': variationValue,\n 'secondVariation': secondVariation,\n 'redirectQuickBuyActivation': true\n });\n quickbuygtm = {\n \"product name\": pname,\n \"currency\": \"GBP\",\n \"price\": price,\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'channel': channel,\n 'quantity': quantity,\n 'selectedOption': variationValue,\n 'selectedVariation': secondVariation,\n 'redirectQuickBuyActivation': true\n };\n }\n window.quickbuygtmdata = quickbuygtm;\n //url = util.appendParamToURL(url,'pageContext',pageContext.ns);\n progress.show();\n if (window.dialog) {\n window.dialog.open({\n url: url,\n options: {\n dialogClass: 'showActivateQBModel',\n closeOnEscape: false,\n open: function (event, ui) {\n progress.hide();\n var pageID;\n var pageSrc;\n var currentPage = window.location.href;\n\n if (currentPage.indexOf('watch-tjc-beauty') > -1 || currentPage.indexOf('LiveTV-WatchTJCBeauty') > -1) {\n pageID = \"watch-tjc-beauty\";\n pageSrc = \"BeautyTV\";\n }\n else if (currentPage.indexOf('watch-tjc') > -1 || currentPage.indexOf('LiveTV-WatchTJC') > -1) {\n pageID = \"watch-tjc\";\n pageSrc = \"liveTV\";\n }\n var tjcLiveEventName = pageSrc + \"-CurrentlyOnAir-QuickBuy\";\n dataLayer.push({\n \"event\": tjcLiveEventName,\n \"ecommerce\": window.quickbuygtmdata\n });\n var paysafe = require(31);\n $('body').css('overflow', 'hidden');\n $('.credit-card-box').css('max-width', 'unset');\n require(45)();\n whatiscvv();\n addressjs.init();\n validator.init();\n accountjs.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n window.paysafeForQB = true;\n paysafe.init();\n\n /*Hide warranty details in QB popup in home page and live Tv page*/\n if (pageContext.ns == 'storefront' || pageContext.ns == 'livetv') {\n $('.showActivateQBModel .qbwarrantydetails').hide()\n }\n /*$( \"body\" ).on('click', '#addnewCardQb' , function() {\n $.ajax({\n url: Urls.addCard,\n type: 'POST',\n data: data,\n success: function (response) {\n console.log(\"addcard\");\n $('#addnewCardQb').append(response);\n\n }\n });\n });\n\n $('#addnewCardQb').on('click', function (e) {\n if($( \"#qbaddnewcard\" ).hasClass('d-none')){\n $( \"#qbaddnewcard\" ).removeClass('d-none');\n }\n else{\n $( \"#qbaddnewcard\" ).addClass('d-none');\n }\n }); */\n\n },\n close: function () {\n var url = Urls.restoreqbbasketfromsession;\n progress.show();\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n $('body').css('overflow', 'x-hidden');\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n //do something\n }\n });\n\n url = window.location.href.split('#')[0];\n window.location.href = url.split('?')[0];\n }\n }\n });\n }\n }\n });\n}\n\nfunction whatiscvv() {\n $('.whatiscvv').click(function (e) {\n if ($(\"#whatiscvv-modelbox\").hasClass('d-none')) {\n $(\"#whatiscvv-modelbox\").removeClass('d-none');\n }\n else {\n $(\"#whatiscvv-modelbox\").addClass('d-none');\n }\n });\n}\n\nfunction tooltipInitialize() {\n if (window.matchMedia(\"(max-width: 767px)\").matches) {\n $('.tooltip').each(function (index) {\n $(this).tooltip({\n position: {\n my: \"bottom-15\",\n at: \"bottom-15\"\n },\n content: function () { return $(this).prop('title'); },\n //show: \"slideDown\",\n open: function (event, ui) {\n var _elemId = ui.tooltip.attr('id');\n $('.ui-tooltip').each(function (index) {\n if (this.id != _elemId) {\n $(this).remove();\n }\n });\n var width = $(window).width();\n $('.ui-tooltip').attr('max-width', width + 'px');\n if (width < 350) {\n $('#' + _elemId).css('left', '0px');\n } else {\n $('#' + _elemId).css('left', '5px');\n }\n setTimeout(function () { if ($('#' + _elemId).is(\":visible\")) { $('#' + _elemId).remove(); } }, 5000);\n },\n close: function (event, ui) {\n ui.tooltip.hover(function () {\n $(this).remove();\n //$(this).stop(true).fadeTo(500, 1);\n },\n function () {\n $(this).remove();\n });\n }\n });\n });\n } else {\n $('.tooltip').each(function (index) {\n $(this).tooltip({\n position: {\n my: \"left+45 top-5\",\n at: \"left+45 top-5\"\n },\n content: function () { return $(this).prop('title'); },\n //show: \"slideDown\",\n open: function (event, ui) {\n var _elemId = ui.tooltip.attr('id');\n $('.ui-tooltip').each(function (index) {\n if (this.id != _elemId) {\n $(this).remove();\n }\n });\n $('#' + _elemId).hover(function () {\n $(this).remove();\n });\n },\n close: function (event, ui) {\n ui.tooltip.hover(function () {\n $(this).remove();\n //$(this).stop(true).fadeTo(500, 1);\n },\n function () {\n $(this).remove();\n });\n }\n });\n });\n }\n}\n\n/*function activateQuickbyclick() {\n $(document).off('click').on('click','.activate-quick-buy', function(e){\n e.preventDefault();\n\n if ($('.product-selection .error').length > 0){\n $('.product-selection .error').remove();\n\n $('.product-selection .input-select').removeClass('error')\n }\n if ($('.product-selection .input-select').length > 0 && ($('.product-selection .input-select').val() == 'null' || $('#live-tv-product-options').val() =='' )) {\n var newDiv = '<span class=\"error\" style=\"color:#E30613;\"> Please select size</span>';\n $('.product-selection .input-select').addClass('error');\n $('.product-selection').append(newDiv);\n return false\n }\n\n var url = Urls.activatequickbuyforcustomer;//$(this).attr('href');\n pids = $(this).data('pids');\n auctioncode = $(this).data('auctioncode');\n installments = $(this).data('installments');\n channel = $(this).data('channel');\n itemPnP = $(this).data('itempnp');\n auctionCodeApplicable = $(\"input[name='auctionCodeApplicable']\").val();\n quantity= $('#live-tv-product-quantity').val();\n window.dialog.open({\n url: url,\n options:{\n dialogClass:'new-sign-registration quick-buy-dialog test',\n open: function(event,ui){\n\n $('body').off('click').on('click submit','.activateNow-button', function(e){\n e.preventDefault();\n var activateqburl = Urls.quickbuyactivatepage;\n if ($('#live-tv-product-options .error').length > 0){\n $('#live-tv-product-options .error').remove();\n }\n if ($('#live-tv-product-options').length > 0 && ($('#live-tv-product-options').val() == null || $('#live-tv-product-options').val() =='' )) {\n var newDiv = '<span class=\"error\" style=\"color:#E30613;\"> Please select size</span>';\n $('#live-tv-product-options').append(newDiv);\n return false;\n }\n url = util.appendParamsToUrl(activateqburl,{\n 'pids':pids,\n 'itemPnP':itemPnP,\n 'installments':installments,\n 'auctioncode':auctioncode,\n 'auctionCodeApplicable':auctionCodeApplicable,\n 'channel':channel,\n 'quantity':quantity,\n 'redirectQuickBuyActivation':true,\n 'pagecontext':pageContext.ns\n });\n window.location.href = url;\n });\n }\n }\n });\n });\n\n}*/\n\nfunction qbsignInForCustoer() {\n $('.checkpw-button .singn-button').off('click').on('click', function (e) {\n flyinheader.init();\n e.preventDefault();\n var $this = $(this);\n var url = Urls.newLogin;\n var $form = $(this).closest('form');\n var emailid = $form.find('.email-value').text();\n var pwd = $form.find('.form-row-password input').val();\n if ($form.find('.form-row-password .error').length > 0) {\n $form.find('.form-row-password .error').remove();\n }\n if ($form.find('.form-row-password .input-password').hasClass('error-message')) {\n $form.find('.form-row-password .input-password').removeClass('error-message')\n }\n if (pwd == '') {\n var newDiv = '<div class=\"error\" style=\"color:#E30613;\">Cannot be blank <div>'\n $form.find('.form-row-password').append(newDiv);\n return;\n }\n var data = $form.serialize();\n var cgid = '', pid = '', pipeline = '', cid = '';\n if (pageContext.ns == 'search') {\n cgid = $('.new-register-direction').val();\n } else if (pageContext.ns == 'product') {\n pid = $('.product-code-pdp .product-id').text().trim();\n } else if (pageContext.ns == 'livetv' || pageContext.ns == 'account') {\n var pathName = window.location.pathname;\n pipeline = pathName.split('/')[pathName.split('/').length - 1]\n } else if (pageContext.ns == 'content') {\n var cgidvalue = $('.new-register-direction').val();\n var cidvalue = $('.new-cid-register-direction').val();\n if (cgidvalue != \"null\") {\n cgid = cgidvalue;\n } else if (cidvalue != \"null\") {\n cid = cidvalue;\n } else {\n var pathName = window.location.pathname;\n pipeline = pathName.split('/')[pathName.split('/').length - 1];\n if (pipeline == 'Search-Show') {\n cgid = window.location.search.split('=')[1];\n } else {\n cid = window.location.search.split('=')[1];\n }\n }\n }\n\n var $productContainer = $('#live-tv-detail-main'),\n $tile = $productContainer.find('.auction-product-data'),\n $mlaVariations = $productContainer.find('.live_MLAVariations'),\n $groupVariations = $productContainer.find('.live_groupVariations'),\n $selectField = $productContainer.find('.product-selection .input-select'),\n $selectedOption = $selectField.find('option:selected'),\n $selectedFirstOptionValue = $selectedOption.val(),\n $selectedFirstAuctionCode = $selectedOption.attr('data-auctioncode'),\n $selectedfirstPnP = $selectedOption.attr('data-pnp'),\n $selectsecondField = $productContainer.find('.second-variation .input-select'),\n $selectedSecondOption = $selectsecondField.find('option[selected=selected]'),\n $selectedSecondOptionValue = $selectedSecondOption.val(),\n $selectedSecondAuctionCode = $selectedSecondOption.attr('data-auctioncode'),\n $selectedSecondPnP = $selectedSecondOption.attr('data-pnp');\n\n if ($mlaVariations.length > 0) {\n var stockCode = $selectedSecondOptionValue,\n auctionCode = $selectedSecondAuctionCode,\n pnPValue = $selectedSecondPnP;\n }\n\n if ($groupVariations.length > 0) {\n var stockCode = $selectField.length !== 0 ? $selectField.val() : $tile.find('.product-id').data('value'),\n auctionCode = $selectField.length !== 0 ? $selectedOption.data('auctioncode') : $tile.find('.tile-inner').data('auctioncode'),\n pnPValue = $selectedSecondPnP;\n }\n\n var pids = stockCode,\n auctionCodes = auctionCode,\n quantity = $productContainer.find('.quantity-selection .input-select').val();\n\n if (auctionCodes != '') {\n auctioncode = auctionCodes;\n }\n\n if (variationValue != '') {\n pids = variationValue;\n }\n\n $this.attr('disabled', true);\n progress.show();\n\n url = util.appendParamsToUrl(url, { 'emailid': emailid, 'password': pwd, 'quickbuy': true, 'cgid': cgid, 'pid': pid, 'pipeline': pipeline, 'cid': cid, 'pagecontext': pageContext.ns });\n $.ajax({\n url: url,\n type: 'POST',\n data: data,\n success: function (response) {\n var parseResponse = JSON.parse(response);\n if (parseResponse.loginstatus && !parseResponse.tvcustomer) {\n flyinheader.init();\n progress.hide();\n if (parseResponse.openPlaceOrderDialog) {\n $(\".header .header-inner\").load(\" .header-inner > *\");\n $(\".search-result-content #search-result-items\").load(\" #search-result-items > *\");\n $(\"#ra-details-wrapper .ra-details-bottom\").load(\" .ra-details-bottom > *\");\n $(\".main-wrapper #ajaxRefresh\").load(\" #ajaxRefresh > *\");\n $(\".main-wrapper .cart\").load(\" .cart > *\");\n setTimeout(function () { \n if (window.dialog) {\n window.dialog.close();\n }\n quickBuyAction();\n $(\".quick-buy-signin\").trigger('click');\n }, 5000);\n } else {\n if (parseResponse.redirectQuickbuyPref) {\n url = util.appendParamsToUrl(parseResponse.RedirectURL, {\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'channel': channel,\n 'quantity': quantity,\n 'pagecontext': pageContext.ns,\n 'redirectQuickBuyActivation': true\n });\n window.location.href = url;\n } else {\n $(\".header .header-inner\").load(\" .header-inner > *\");\n $(\".search-result-content #search-result-items\").load(\" #search-result-items > *\");\n $(\"#ra-details-wrapper .ra-details-bottom\").load(\" .ra-details-bottom > *\");\n $(\".main-wrapper #ajaxRefresh\").load(\" #ajaxRefresh > *\");\n $(\".main-wrapper .cart\").load(\" .cart > *\");\n setTimeout(function () { \n if (window.dialog) {\n window.dialog.close();\n }\n showActivateQBModel();\n $(\"#showActivateQBModel\").trigger('click');\n }, 5000);\n }\n /*url = util.appendParamsToUrl(parseResponse.RedirectURL,{\n 'pids':pids,\n 'itemPnP':itemPnP,\n 'installments':installments,\n 'auctioncode':auctioncode,\n 'auctionCodeApplicable':auctionCodeApplicable,\n 'channel':channel,\n 'quantity':quantity,\n 'pagecontext':pageContext.ns,\n 'redirectQuickBuyActivation':true\n });\n window.location.href = url;*/\n }\n }\n else if (parseResponse.loginstatus && parseResponse.tvcustomer) {\n var prevUrl = window.location.href;\n window.location.href = util.appendParamsToUrl(Urls.setnewPassword, {\n 'emailid': emailid,\n 'PasswordResetEmail': parseResponse.PasswordResetEmail,\n 'prevUrl': prevUrl,\n 'quickbuyredirection': parseResponse.RedirectURL,\n 'pids': pids,\n 'itemPnP': itemPnP,\n 'installments': installments,\n 'pagecontext': pageContext.ns,\n 'auctioncode': auctioncode,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'channel': channel,\n 'quantity': quantity,\n 'redirectQuickBuyActivation': true,\n 'variationValue': variationValue,\n 'openPlaceOrderDialog': parseResponse.openPlaceOrderDialog\n });\n }\n else {\n $this.attr('disabled', false);\n progress.hide();\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')) {\n $('.newsignin-box-inner .checkemail-content').addClass('d-none')\n }\n if (!$('.newsignin-box-inner .checkpw-content').hasClass('d-none')) {\n $('.newsignin-box-inner .checkpw-content').addClass('d-none')\n }\n if ($form.find('.checkemail-field').hasClass('d-none')) {\n $form.find('.checkemail-field').removeClass('d-none');\n }\n if ($form.find('.checkemail-field .email-placeholder').hasClass('d-none')) {\n $form.find('.checkemail-field .email-placeholder').removeClass('d-none');\n }\n if (!$('.newsignin-box-inner .guest-checkout-button').hasClass('d-none')) {\n $('.newsignin-box-inner .guest-checkout-button').addClass('d-none')\n }\n if (!$form.find('.form-row-password .input-password').hasClass('error-message')) {\n $form.find('.form-row-password .input-password').addClass('error-message')\n }\n if ($form.find('.form-row-password .pwd-placeholder').hasClass('d-none')) {\n $form.find('.form-row-password .pwd-placeholder').removeClass('d-none')\n }\n if ($form.find('.form-row-password .error').length > 0) {\n $form.find('.form-row-password .error').remove();\n }\n var newDiv = '<div class=\"error\" style=\"color:#E30613;\">The password is incorrect for this account<div>'\n $form.find('.form-row-password').append(newDiv);\n\n }\n }\n });\n });\n}\n\nfunction qbforgotPwdClick() {\n $('.forgot-pin a, .resend-button .button,forgotpw-button a').off('click').on('click', function (e) {\n e.preventDefault();\n var url = Urls.forgotPassword;\n var $form = $(this).closest('form');\n var emailid = $form.find('.email-value').text();\n url = util.appendParamToURL(url, 'emailid', emailid);\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n var parseResponse = JSON.parse(response);\n if (parseResponse.mailHasSend) {\n if ($form.find('.forgotpw-title').hasClass('d-none')) {\n $form.find('.forgotpw-title').removeClass('d-none');\n }\n if ($form.find('.forgotpw-content').hasClass('d-none')) {\n $form.find('.forgotpw-content').removeClass('d-none');\n }\n if (!$form.find('.checkpw-content .edit-button').hasClass('d-none')) {\n $form.find('.checkpw-content .edit-button').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')) {\n $('.newsignin-box-inner .checkemail-content').addClass('d-none');\n }\n if (!$form.find('.checkpw-content').hasClass('d-none')) {\n $form.find('.checkpw-content').addClass('d-none');\n }\n if (!$form.find('.checkpw-button').hasClass('d-none')) {\n $form.find('.checkpw-button').addClass('d-none');\n }\n if ($form.find('.forgotpw-button').hasClass('d-none')) {\n $form.find('.forgotpw-button').removeClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkpw-title').hasClass('d-none')) {\n $('.newsignin-box-inner .checkpw-title').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-title').hasClass('d-none')) {\n $('.newsignin-box-inner .checkemail-title').addClass('d-none')\n }\n if (!$form.find('.form-row-password').hasClass('d-none')) {\n $form.find('.form-row-password').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')) {\n $('.newsignin-box-inner .checkemail-content').addClass('d-none')\n }\n if ($('.newsignin-box-inner .guest-checkout-button').hasClass('d-none')) {\n $('.newsignin-box-inner .guest-checkout-button').removeClass('d-none')\n }\n } else {\n $form.find('.login-error-message').removeClass('d-none');\n }\n\n $('.pwemail').html(emailid);\n }\n });\n });\n}\n\n/**Start - Script to display the modal popup in registration page when you click \"Shopped on our TV channel but not on our website?\" **/\n$(\"#tvconnect-modelbox\").dialog({\n autoOpen: false,\n dialogClass: \"tvconnectdialog\",\n modal: true,\n height: 'auto',\n resizable: true,\n});\n\n$(\"#tvconnect\").click(function () {\n $(this).closest('form');\n $(\"#tvconnect-modelbox\").dialog(\"open\");\n});\n\n$(\".quickbuy-preference-page .fa-question-circle\").on('click', function () {\n var container = $(this).closest('h5').find('.help-dialog');\n $(container).clone().dialog({\n dialogClass: 'help-dialog-modal',\n modal: true\n });\n});\n\nfunction qbeditbuttonclick() {\n $('body').off('click').on('click', '.returning-customers form .checkpw-content .edit-button, .wrong-email-link', function (e) {\n var $form1 = $(this).closest('form');\n if (!$form1.find('.checkpw-content').hasClass('d-none')) {\n $form1.find('.checkpw-content').addClass('d-none');\n }\n if ($form1.find('.checkemail-field').hasClass('d-none')) {\n $form1.find('.checkemail-field').removeClass('d-none');\n }\n if (!$form1.find('.form-row-password').hasClass('d-none')) {\n $form1.find('.form-row-password').addClass('d-none');\n }\n if ($form1.find('.form-row-button .checkemail-button').hasClass('d-none')) {\n $form1.find('.form-row-button .checkemail-button').removeClass('d-none');\n }\n if (!$form1.find('.checkpw-button').hasClass('d-none')) {\n $form1.find('.checkpw-button').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkpw-title').hasClass('d-none')) {\n $('.newsignin-box-inner .checkpw-title').addClass('d-none');\n }\n if ($('.newsignin-box-inner .checkemail-title').hasClass('d-none')) {\n $('.newsignin-box-inner .checkemail-title').removeClass('d-none')\n }\n if (!$form1.find('.forgotpw-title').hasClass('d-none')) {\n $form1.find('.forgotpw-title').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-content').hasClass('d-none')) {\n $form1.find('.forgotpw-content').addClass('d-none');\n }\n if (!$form1.find('.guest-checkout-button').hasClass('d-none')) {\n $form1.find('.guest-checkout-button').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-button').hasClass('d-none')) {\n $form1.find('.forgotpw-button').addClass('d-none');\n }\n $.each($form1.find('.error'), function () { $(this).remove() });\n });\n}\n/**End**/\n\nfunction qbenteredWrongEmail() {\n $('.guest-checkout-button a').off('click').on('click', function (e) {\n\n var $form1 = $(this).closest('form');\n if ($('.checkemail-title').hasClass('d-none')) {\n $('.checkemail-title').removeClass('d-none');\n }\n if ($('.checkemail-content').hasClass('d-none')) {\n $('.checkemail-content').removeClass('d-none');\n }\n if ($('.edit-button').hasClass('d-none')) {\n $('.edit-button').removeClass('d-none');\n }\n if ($form1.find('.checkemail-button').hasClass('d-none')) {\n $form1.find('.checkemail-button').removeClass('d-none');\n }\n if ($form1.find('.checkemail-field').hasClass('d-none')) {\n $form1.find('.checkemail-field').removeClass('d-none');\n }\n if (!$form1.find('.forgotpw-title').hasClass('d-none')) {\n $form1.find('.forgotpw-title').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-content').hasClass('d-none')) {\n $form1.find('.forgotpw-content').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-button').hasClass('d-none')) {\n $form1.find('.forgotpw-button').addClass('d-none');\n }\n });\n}\n\nfunction qbdisguisePassword() {\n $('.icon-password').off('click').on('click', function () {\n var $this = $(this), $passwordField = $this.closest('.form-row-password').find('.input-text');\n\n if (!$this.hasClass('show')) {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'password');\n } else {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'text');\n }\n $this.toggleClass('show');\n });\n}\n\nfunction quickBuyAction() {\n $(document).off('click', '#quick-buy.quick-buy-signin').on('click', '#quick-buy.quick-buy-signin', function (e) {\n e.preventDefault();\n\n if ((($('#live-tv-product-options').val() == \"null\" || $('#live-tv-product-options').val() == null)) && $('#live-tv-product-options').length > 0) {\n $('.product-selection .input-select').css('border', '3px solid #c20000');\n $('.product-selection .input-select').addClass('error');\n return;\n }\n var price = $(\"#tjclive-tileprice\").val();\n var pname = $(\"#gtmliveTV-productname\").val();\n var variationValue = \"\";\n if ($('#live-tv-detail-main .live_groupVariations').length > 0) {\n if ($('#live-tv-product-options').length > 0 && $('#live-tv-product-options').val() != null) {\n variationValue = $('#live-tv-product-options').val();\n }\n else {\n variationValue = $('.auction-product-data .product-id').data('value');\n }\n }\n\n if (sessionStorage.getItem(\"secondField\") != null) {\n $('.second-variation .input-select').val(sessionStorage.getItem(\"secondField\")).change();\n sessionStorage.removeItem(\"secondField\");\n }\n\n if ($('.live-tv-detail-main .live_MLAVariations').length > 0) {\n var secondVariation = $('.second-variation .input-select').val();\n if (secondVariation == null || secondVariation == \"null\") {\n $('#select-second-variation').addClass('border')\n return false;\n }\n else {\n $('#select-second-variation').removeClass('border')\n }\n }\n\n $('body').css('overflow', 'x-hidden');\n\n /*var $form = $(this).closest('form'),\n $productContainer = $('#live-tv-detail-main'),\n $tile = $productContainer.find('.auction-product-data'),\n $selectField = $productContainer.find('.product-selection .input-select'),\n $selectedOption = $selectField.find('option:selected'),\n pids = $selectField.length !== 0 ? $selectField.val() : $tile.find('.product-id').data('value'),\n auctionCodes = $selectField.length !== 0 ? $selectedOption.data('auctioncode') :\n $tile.find('.tile-inner').data('auctioncode'),\n quantity = $productContainer.find('.quantity-selection .input-select').val();*/\n\n var $form = $(this).closest('form'),\n $productContainer = $('#live-tv-detail-main'),\n $mlaVariations = $productContainer.find('.live_MLAVariations'),\n $groupVariations = $productContainer.find('.live_groupVariations'),\n $tile = $productContainer.find('.auction-product-data'),\n $selectField = $productContainer.find('.product-selection .input-select'),\n $selectedOption = $selectField.find('option:selected'),\n $selectedFirstOptionValue = $selectedOption.val(),\n $selectedFirstAuctionCode = $selectedOption.attr('data-auctioncode'),\n $selectedfirstPnP = $selectedOption.attr('data-pnp'),\n $selectsecondField = $productContainer.find('.second-variation .input-select'),\n $selectedSecondOption = $selectsecondField.find('option[selected=selected]'),\n $selectedSecondOptionValue = $selectedSecondOption.val(),\n $selectedSecondAuctionCode = $selectedSecondOption.attr('data-auctioncode'),\n $selectedSecondPnP = $selectedSecondOption.attr('data-pnp'),\n budgetPayContainer = $productContainer.find('.budgetpay'),\n installments = budgetPayContainer.attr('data-installments');\n\n if ($mlaVariations.length > 0) {\n var stockCode = $selectedSecondOptionValue,\n auctionCode = $selectedSecondAuctionCode,\n pnPValue = $selectedSecondPnP;\n }\n\n if ($groupVariations.length > 0) {\n var stockCode = $selectField.length !== 0 ? $selectedFirstOptionValue : $tile.find('.product-id').data('value'),\n auctionCode = $selectField.length !== 0 ? $selectedFirstAuctionCode : $tile.find('.tile-inner').data('auctioncode'),\n pnPValue = $selectField.length !== 0 ? $selectedfirstPnP : $tile.find('.tile-inner').data('data-pnp');\n }\n\n var pids = stockCode,\n auctionCodes = auctionCode,\n auctionCodeApplicable = $(\"input[name='auctionCodeApplicable']\").val(),\n //auctionCodeApplicable =$('.auctionCodeApplicable').text(),\n quantity = $productContainer.find('.quantity-selection .input-select').val();\n\n\n\n /*$form.append('<input type=\"hidden\" name=\"pids\" value=\"' + pids + '\"/>');\n $form.append('<input type=\"hidden\" name=\"quantity\" value=\"' + quantity + '\"/>');\n $form.append('<input type=\"hidden\" name=\"auctionCodes\" value=\"' + auctionCodes + '\"/>');*/\n\n\n /*var installments = $(\"input[name='installments']\").val();\n var itemPnP = $(\"input[name='itemPnP']\").val();\n var auctionCodeApplicable = $(\"input[name='auctionCodeApplicable']\").val();\n var channel = $(\"input[name='channel']\").val();\n var url = Urls.liveTvOrder + \"?installments=\" + installments + \"&itemPnP= \"+ itemPnP + \"&channel= \"+ channel;*/\n var channel = $(\"input[name='channel']\").val();\n if ($('#uniform-live-tv-product-options span').html() != \"Select\") {\n progress.show();\n }\n\n\n if ($('#live-tv-product-options').val() != \"null\") {\n progress.show();\n }\n\n\n var url = Urls.liveTvOrder;\n url = util.appendParamsToUrl(url, {\n 'pids': pids,\n 'auctionCodes': auctionCodes,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'quantity': quantity,\n });\n\n var checkBidStatus = Urls.checkBidStatus;\n checkBidStatus = util.appendParamsToUrl(checkBidStatus, {\n 'pids': pids,\n 'auctionCodes': auctionCodes,\n 'auctionCodeApplicable': auctionCodeApplicable,\n 'quantity': quantity,\n 'checkbidstatus': true,\n });\n\n var quickbuygtm = {\n \"product name\": pname,\n \"currency\": \"GBP\",\n \"price\": price,\n 'pids': pids,\n 'itemPnP': pnPValue,\n 'installments': installments,\n 'auctioncode': auctioncode,\n 'channel': channel,\n 'quantity': quantity,\n 'selectedOption': variationValue,\n 'selectedVariation': secondVariation,\n 'redirectQuickBuyActivation': true,\n 'buyAllDiscount': buyAllDiscount,\n 'discountAvailable': discountAvailable,\n 'discountType': discountType\n };\n\n window.quickbuygtmdata = quickbuygtm;\n var pageID;\n var pageSrc;\n var currentPage = window.location.href;\n\n if (currentPage.indexOf('watch-tjc-beauty') > -1 || currentPage.indexOf('LiveTV-WatchTJCBeauty') > -1) {\n pageID = \"watch-tjc-beauty\";\n pageSrc = \"BeautyTV\";\n }\n else if (currentPage.indexOf('watch-tjc') > -1 || currentPage.indexOf('LiveTV-WatchTJC') > -1) {\n pageID = \"watch-tjc\";\n pageSrc = \"liveTV\";\n }\n var tjcLiveEventName = pageSrc + \"-CurrentlyOnAir-QuickBuy\";\n dataLayer.push({\n \"event\": tjcLiveEventName,\n \"ecommerce\": window.quickbuygtmdata\n });\n $.ajax({\n url: checkBidStatus,\n type: 'POST',\n success: function (response, status, xhr) {\n var ct = xhr.getResponseHeader(\"content-type\") || \"\";\n if (ct.indexOf('html') > -1) {\n if (window.dialog) {\n window.dialog.open({\n url: url,\n data: $form.serialize(),\n options: {\n dialogClass: 'qb-livetv-dialog',\n open: function (event, ui) {\n progress.hide();\n $('body').css('overflow', 'hidden');\n require(45)();\n $('#existingCardsCVV').addClass('checkType');\n $('#existingCardsCVV').attr('pattern', '[0-9]{1,4}');\n $('.qb-livetv-dialog .footer .content-heading').css('line-height', '2.5rem');\n $('#dwfrm_billing_paymentMethods_selectedPaymentMethodID_Paysafe').on('click', function () {\n $('.qb-livetv-dialog .footer .content-heading').css('line-height', '2.5rem');\n var ordertotal = $('#paysafe_ordertotal').text();\n $('.updateqbtotal').html(ordertotal);\n });\n $('#dwfrm_billing_paymentMethods_selectedPaymentMethodID_budgetPay').on('click', function () {\n $('.qb-livetv-dialog .footer .content-heading').css('line-height', '1.5rem');\n var ordertotal = $('#budgetpay_ordertotal').text();\n $('.updateqbtotal').html(ordertotal);\n\n });\n $('.qb-livetv-dialog').off('click').on('click', '.confirm-qborder', function (event) {\n event.preventDefault();\n var $form = $(this).closest('form');\n //var data = $form.serialize();\n var token = $('#dwfrm_billing_paymentToken').val();\n //var cvv = $('#existingCardsCVV').val();\n var existingCards = $('#existing-paysafe-card').val();\n if ($('.safe-budget').length) {\n var radioValue = $(\"input[name='dwfrm_billing_paymentMethods_selectedPaymentMethodID']:checked\").val();\n }\n else {\n var radioValue = $(\"input[name='dwfrm_billing_paymentMethods_selectedPaymentMethodID']\").val();\n }\n /*if (cvv == ''){\n var newDiv ='<div class=\"error\" style=\"color:#E30613;\">CVV cannot be blank<div>';\n if($('.cvv-field').find('.error').length == 0) {\n $form.find('.cvv-field').append(newDiv);\n }\n return;\n }*/\n // Disable the button after click\n $(this).prop('disabled', true);\n\n if (window.SitePreferences.Paysafe_3ds2_Enabled) {\n //Paysafe 3DS2 implementation starts here\n try {\n progress.show();\n $('.progress-loader').css('top', '65% !important');\n var accountId = window.SitePreferences.PAYSAFE_MID,\n environment = window.SitePreferences.PAYSAFE_ENVIRONMENT,\n authenticationPurpose = 'PAYMENT_TRANSACTION',\n cardBin = null, paymentToken = null;\n var btoa = window.btoa,\n apiKey = btoa(window.SitePreferences.PAYSAFE_SINGLE_USE_TOKEN);\n if (existingCards != null) {\n paymentToken = JSON.parse(existingCards).paymentToken;\n cardBin = JSON.parse(existingCards).cardBin;\n }\n if ('BudgetPay' === radioValue) {\n authenticationPurpose = 'INSTALMENT_TRANSACTION';\n }\n var options = { accountId: accountId, card: { cardBin: cardBin }, environment: environment };\n paysafe.threedsecure.start(apiKey, options, function (deviceFingerprintingId, startError) {\n if (startError) {\n var lastDigits, id, cardType;\n lastDigits = $('.paysafemodelbox').data(\"paysafeselectedcard\").lastDigits;\n id = $('.paysafemodelbox').data(\"paysafeselectedcard\").id;\n cardType = $('.paysafemodelbox').data(\"paysafeselectedcard\").cardType;\n\n var url = Urls.paysafe3DSecure2LogInfo;\n var data = {\n 'lastDigits': lastDigits,\n 'txnID': id,\n 'callNode': 'GENERAL_ERRORS',\n 'cardType': cardType,\n 'code': startError.code,\n 'displayMessage': startError.displayMessage,\n 'detailedMessage': startError.detailedMessage\n };\n url = util.appendParamsToUrl(url, data);\n $.ajax({\n type: \"GET\",\n url: url,\n success: function (data) {\n if (data.returnStatus !== undefined && data.returnStatus) {\n return;\n }\n },\n error: function (f) {\n progress.hide();\n //console.log(f.statusText + \" \" + f.status);\n }\n });\n progress.hide();\n $paymentMethodsWarning.text(\"Technical issues prevent processing your payment. Please try later or use another payment method.\").parent().show();\n $('.sections.delivery .section, .sections.payment .section, .sections.order-summary .section').removeClass('freezeSection');\n } else if (deviceFingerprintingId !== undefined) {\n // 3DS2 Next Step\n var url = Urls.paysafe3DSecure2Authenticate;\n url = util.appendParamsToUrl(url, {\n 'deviceFingerprintingId': deviceFingerprintingId,\n 'authenticationPurpose': authenticationPurpose,\n 'paymentToken': paymentToken\n });\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n progress.hide();\n response = JSON.parse(response)\n if (typeof (response) == 'object') {\n var responseObj = response.dataObj;\n if (responseObj.sdkChallengePayload != undefined && responseObj.sdkChallengePayload != '') {\n // go for challange\n var sdkChallengePayload = responseObj.sdkChallengePayload;\n var options = { sdkChallengePayload: sdkChallengePayload, environment: environment };\n try {\n paysafe.threedsecure.challenge(apiKey, options, function (resultId, error) {\n if (resultId !== undefined) {\n var url = Urls.paysafe3DSecure2GetAuthDetails;\n var data = { authenticationId: resultId };\n $.ajax({\n url: url,\n type: 'POST',\n data: data,\n success: function (response2Obj) {\n if (response2Obj !== undefined) {\n //{status: 'COMPLETED', threeDResult: 'U', errorMsg: 'AUTH_FAILED_U', sdkChallengePayload: ''}\n if (response2Obj.dataObj !== undefined) {\n var finalStatus = response2Obj.dataObj.status;\n var finalthreeDResult = response2Obj.dataObj.threeDResult;\n var finalerrorMsg = response2Obj.dataObj.errorMsg;\n var finalsdkChallengePayload = response2Obj.dataObj.sdkChallengePayload;\n if (finalStatus == 'COMPLETED' && finalerrorMsg == 'AUTH_OK_A_Y') {\n qbPlaceOrderltv();\n } else if (finalthreeDResult == 'U') {\n if (window.SitePreferences.AllowStatusCodeU) {\n qbPlaceOrderltv();\n } else if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request could not be completed by the bank due to technical reasons. Please try again or use a different card\");\n var totalPrice77 = $('.order-total.order-full-total td')[1];\n var $gtmprice77;\n if (totalPrice77) {\n $gtmprice77 = totalPrice77.textContent;\n } else {\n $gtmprice77 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice77\n }\n });\n }\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request has been declined by the Bank. Try using a different Card or Payment Option\");\n var totalPrice9 = $('.order-total.order-full-total td')[1];\n var $gtmprice9;\n if (totalPrice9) {\n $gtmprice9 = totalPrice9.textContent;\n } else {\n $gtmprice9 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice9\n }\n });\n }\n }\n }\n }\n },\n error: function () {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while calling the getpaysafe3dsauthdetails endpoint');\n }\n });\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while executing the challenge method and did not get authentication id');\n }\n });\n } catch (e) {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n // console.error('error was thrown while executing the challenge flow ' + e);\n }\n } else {\n if (responseObj !== undefined) {\n var finalthreeDResult = responseObj.threeDResult;\n if (finalthreeDResult == 'Y' || finalthreeDResult == 'A') {\n qbPlaceOrderltv();\n } else if (finalthreeDResult == 'U') {\n if (window.SitePreferences.AllowStatusCodeU) {\n qbPlaceOrderltv();\n } else if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request could not be completed by the bank due to technical reasons. Please try again or use a different card\");\n var totalPrice1 = $('.order-total.order-full-total td')[1];\n var $gtmprice5;\n if (totalPrice1) {\n $gtmprice5 = totalPrice1.textContent;\n } else {\n $gtmprice5 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice5\n }\n });\n }\n } else {\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Your request has been declined by the Bank. Try using a different Card or Payment Option\");\n var totalPrice11 = $('.order-total.order-full-total td')[1];\n var $gtmprice11;\n if (totalPrice11) {\n $gtmprice11 = totalPrice11.textContent;\n } else {\n $gtmprice11 = '';\n }\n window.dataLayer.push({\n 'event': 'checkoutError',\n 'ecommerce': {\n 'errorText': 'payment Error',\n 'errorMessage': 'Your request could not be completed by the bank due to technical reasons. Please try again or use a different card',\n 'price': $gtmprice11\n }\n });\n }\n //console.log('Authentication was unsuccessful in the 1st step and Your request has been declined by the Bank. Try using a different Card or Payment Option');\n }\n }\n }\n }\n },\n error: function () {\n progress.hide();\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while calling paysafe 3ds auth endpoint');\n }\n });\n } else {\n progress.hide();\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('error while calling start method and unable to generate devicefp id');\n }\n });\n } catch (e) {\n progress.hide();\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"We are facing some technical issues. Please try after sometime or choose different payment option\");\n }\n //console.error('Initial Catch of 3ds2 ' + e);\n }\n //Paysafe 3DS2 implementation ends here\n }\n else {\n qbPlaceOrderltv();\n //Below is the Old Code\n }\n\n });\n\n $('.qb-livetv-dialog').on('click', '.settings', function (event) {\n var url = Urls.restoreqbbasketfromsession;\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n //do something\n }\n });\n });\n\n },\n close: function () {\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n var url = Urls.restoreqbbasketfromsession;\n progress.show();\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n //do something\n }\n });\n url = window.location.href.split('#')[0];\n window.location.href = url.split('?')[0];\n }\n }\n });\n }\n }\n if (ct.indexOf('json') > -1) {\n if (response.errorCode == 12.0) {\n $(\"#bidException\").dialog({\n dialogClass: 'bidException',\n open: function (event, ui) {\n progress.hide();\n if ($('#bidException').hasClass('d-none')) {\n $('#bidException').removeClass('d-none');\n }\n $('#bidException').css('min-height', 'unset');\n },\n modal: true\n });\n\n }\n }\n\n }\n });\n\n //var url = Urls.quickbuyOrder;\n\n });\n}\nfunction qbPlaceOrderltv() {\n var placeOrderURL = Urls.quickbuyPlaceOrder;\n var token = $('#dwfrm_billing_paymentToken').val();\n var existingCards = $('#existing-paysafe-card').val();\n if ($('.safe-budget').length) {\n var radioValue = $(\"input[name='dwfrm_billing_paymentMethods_selectedPaymentMethodID']:checked\").val();\n }\n else {\n var radioValue = $(\"input[name='dwfrm_billing_paymentMethods_selectedPaymentMethodID']\").val();\n }\n $.ajax({\n url: placeOrderURL + \"?token=\" + token + \"&paymentMethod=\" + radioValue + \"&existingCards=\" + existingCards,\n type: 'POST',\n beforeSend: function () { progress.show(); },\n success: function (response) {\n progress.hide();\n if (response.success && response.Orderno != \"\") {\n if ($('#quickBuyConfirmation').hasClass('d-none')) {\n $('#quickBuyForm').addClass('d-none');\n $('#quickBuyConfirmation').removeClass('d-none');\n $(\"#qborder-number\").html(response.Orderno);\n var gtmPurchase = JSON.stringify(response.gtmPurchase),\n gtmProducts = JSON.stringify(response.gtmProducts);\n $(\"#quickBuyConfirmation #gtmDataHolder\").attr('data-gtmPurchase', gtmPurchase);\n $(\"#quickBuyConfirmation #gtmDataHolder\").attr('data-gtmProducts', gtmProducts);\n\n var nbpurchase = JSON.stringify(response.nbpurchase),\n nbtransactionproducts = JSON.stringify(response.nbtransactionproducts),\n nbordercategory = JSON.stringify(response.nbordercategory);\n $(\"#quickBuyConfirmation #nbDataHolder\").attr('data-nbpurchase', nbpurchase);\n $(\"#quickBuyConfirmation #nbDataHolder\").attr('data-nbtransactionproducts', nbtransactionproducts);\n $(\"#quickBuyConfirmation #nbDataHolder\").attr('data-nbordercategory', nbordercategory);\n /*window.dataLayer.push({\n 'event':'purchase',\n 'ecommerce': {\n 'purchase': {\n 'actionField': JSON.parse(gtmPurchase),\n 'products': JSON.parse(gtmProducts)\n }\n }\n });*/\n orderconfirmation.init();\n dataLayer.push({ 'event': 'QBOrderConfirmation' });\n }\n }\n else {\n if (response.errorCode >= 0 && response.errorCode <= 11) {\n if (response.errorCode == 11) {\n if ($('.budgetPaySpecificError').hasClass('d-none')) {\n $('.budgetPaySpecificError').removeClass('d-none');\n }\n }\n else {\n if ($('.budgetPaySomethingError').hasClass('d-none')) {\n $('.budgetPaySomethingError').removeClass('d-none');\n }\n }\n if ($('#activation-error').hasClass('d-none')) {\n $('#activation-error').removeClass('d-none');\n $(\"#activation-error\").html(\"Something didn't work. Please contact customer care on 0344 375 2525.\");\n }\n }\n }\n\n $(\"#qbConfirm-close\").on('click', function () {\n if (window.dialog) {\n window.dialog.close();\n }\n });\n }\n });\n}\n\nvar quickBuyClick = false, variationValue = '', qbClicked = false, quickBuyOrderClick = false;\nfunction showActivateModalPopup() {\n if ($('.quickBuyClick').length > 0) {\n quickBuyClick = $('.quickBuyClick').val();\n if (quickBuyClick == 'true') {\n quickBuyClick = true;\n }\n } else if ($('.quickBuyOrderClick').length > 0) {\n quickBuyOrderClick = true;\n }\n\n if ($('.quantity').length > 0) {\n var qty = $('.quantity').val();\n $('#live-tv-detail-main').find('.quantity-selection .input-select').val(qty);\n }\n\n if ($(document).find('#showActivateQBModel').length > 0 && quickBuyClick && !qbClicked && !quickBuyOrderClick) {\n $('.quickBuyClick').val('false');\n qbClicked = true;\n variationValue = $('.variationValue').val();\n secondvariationValue = $('.secondVariation').val();\n sessionStorage.setItem('secondField', secondvariationValue);\n $('#live-tv-product-options').val(variationValue).trigger('change');\n $('.second-variation .input-select').val(secondvariationValue).trigger('change');\n $(document).find('#showActivateQBModel').trigger('click');\n } else if ($(document).find('#quick-buy.quick-buy-signin').length > 0 && !quickBuyClick && !qbClicked && quickBuyOrderClick) {\n qbClicked = true;\n variationValue = $('.variationValue').val();\n secondvariationValue = $('.secondVariation').val();\n sessionStorage.setItem('secondField', secondvariationValue);\n $('#live-tv-product-options').val(variationValue).trigger('change');\n $('.second-variation .input-select').val(secondvariationValue).trigger('change');\n $(document).find('#quick-buy.quick-buy-signin').trigger('click');\n }\n}\n\nfunction checkFieldsIntiator() {\n $('#dwfrm_quickbuyaddress_customer_firstname').addClass('checkType');\n $('#dwfrm_quickbuyaddress_customer_firstname').attr('pattern', '[A-Za-z\\s]{1,50}');\n $('#dwfrm_quickbuyaddress_customer_lastname').addClass('checkType');\n $('#dwfrm_quickbuyaddress_customer_lastname').attr('pattern', '[A-Za-z\\s]{1,50}');\n $('#dwfrm_quickbuyaddress_customer_mobile').addClass('checkType');\n $('#dwfrm_quickbuyaddress_customer_mobile').attr('pattern', '[0-9]{1,11}');\n $('#existing-paysafe-cvv').addClass('checkType');\n $('#existing-paysafe-cvv').attr('pattern', '[0-9]{1,4}');\n $('#dwfrm_quickbuyaddress_billingAddress_address_postCode').addClass('checkType');\n $('#dwfrm_quickbuyaddress_billingAddress_address_postCode').attr('pattern', '[A-Za-z0-9 ]{1,8}');\n $('#dwfrm_quickbuyaddress_shippingAddress_address_postCode').addClass('checkType');\n $('#dwfrm_quickbuyaddress_shippingAddress_address_postCode').attr('pattern', '[A-Za-z0-9 ]{1,8}');\n $('.mobile-no').find('.required-indicator').addClass('tooltip');\n $('.mobile-no').find('.required-indicator').attr('title', 'Share your phone number for a seamless shopping experience through our Website and TV.');\n $('.address-alias').find('.required-indicator').addClass('tooltip');\n $('.address-alias').find('.required-indicator').attr('title', 'example - home, office, etc.');\n tooltipInitialize();\n}\n\nfunction checkFieldsType() {\n $('form').find('input').on('keypress', function (e) {\n var keyCode = e.keyCode || e.which;\n if ($(this).is(':visible')) {\n var classes = ($(this).attr('class') != null) ? $(this).attr('class').search('checkType') : -1;\n if (classes >= 0) {\n var regexLength = this.pattern.split('{');\n var regex = new RegExp(regexLength[0]);\n var lengthVal = regexLength[1].replace('}', '');\n var lengthValues = lengthVal.split(',');\n var minLength = lengthValues[0];\n var maxLength = lengthValues[1];\n var isValid = regex.test(String.fromCharCode(keyCode));\n var isValid1 = $(this).val().length + 1;\n if (!isValid) {\n //$(this).css(\"border-bottom\", \"3px solid #FF0000\");\n return isValid;\n } else {\n //$(this).css(\"border-bottom\", \"3px solid #00FF00\");\n }\n if (isValid1 < minLength) {\n //$(this).css(\"border-top\", \"3px solid #FF0000\");\n } else {\n //$(this).css(\"border-top\", \"3px solid #00FF00\");\n }\n if (isValid1 > maxLength) {\n //$(this).css(\"border-top\", \"3px solid #FF0000\");\n return false;\n }\n }\n }\n });\n}\n\n$(\".activate-quickbuy\").on(\"click\", function () {\n $('.dwfrm_quickbuyaddress_shippingAddress_addressid-error').hide();\n});\n\n$(\"#dwfrm_quickbuyaddress_billingAddress_addressid\").focus(function () {\n $('#dwfrm_quickbuyaddress_shippingAddress_addressid-error').remove();\n});\n\n$(\".add-billing-address .address-check-btn\").click(function () {\n $('.billingform #dwfrm_quickbuyaddress_billingAddress_addressid-error').remove();\n});\n\nfunction qbbuttondisable() {\n if ($('.shippingaddressgroup .post-code-field').hasClass('validation-error') || $('.billingaddressgroup .post-code-field').hasClass('validation-error')) {\n\n $('.activate-quickbuy').attr('disabled', 'disabled');\n }\n else {\n $('.activate-quickbuy').removeAttr('disabled', 'disabled');\n }\n}\nsetInterval(qbbuttondisable, 1000);\nexports.init = function () {\n initializeEvents();\n if (!$('.ui-dialog.showActivateQBModel').is(':visible')) {\n addressjs.init();\n }\n};\n", "/*jslint nomen: true */\n'use strict';\n\nvar product = require(25),\n progress = require(35),\n util = require(46),\n risingAuctions = require(41),\n pdpoverlay = require(33),\n validator = require(47),\n quickviewimage = require(29);\n\n\n\nvar makeUrl = function (url, source, productListID, videoId, viewtype) {\n if (source) {\n url = util.appendParamToURL(url, 'source', source);\n }\n if (productListID) {\n url = util.appendParamToURL(url, 'productlistid', productListID);\n }\n if (videoId) {\n url = util.appendParamToURL(url, 'videoId', videoId);\n }\n if (viewtype) {\n url = util.appendParamToURL(url, 'viewtype', viewtype);\n }\n return url;\n};\n\n\n\n/* Public Quickview Object */\n/* *********************** */\nvar quickview = {\n\n init: function () {\n // keep reference to this\n var that = this;\n\n // bind click events to quickview links\n $(document).on('click', '.product-tile .quickview:not(initialized), .product-tile .variant-addtocart, .complete-the-set .quickview:not(initialized), .product-bundling-variations .quickview:not(initialized), .social-tv-reel .quickview:not(initialized)', function (e) {\n var $this = $(this),\n cgid = $this.closest('.product-tile').data('cgid'),\n options = {};\n\n e.preventDefault();\n if ($this.data('url')) {\n $this.attr('href', $this.data('url'));\n }\n options.url = $this.attr('href');\n options.source = $this.data('source') || 'quickview';\n options.pid = $this.data('pid');\n options.videoId = $(this).data('video-id');\n options.viewtype = $(this).data('viewtype');\n\n if ($this.data('source') === 'social_quickview') {\n options.classList = 'quick_view quick_view_reels';\n progress.show();\n } else {\n options.classList = 'quick_view quick_view_custom';\n }\n\n // if cgid is present add it to the add to cart form after quickview is opened\n if (cgid) {\n options.callback = function () {\n $('#QuickViewDialog form.pdpForm')\n .append($('<input id=\"quickViewCgid\" type=\"hidden\" name=\"cgid\" value=\"' + cgid + '\"/>'));\n risingAuctions.openQuickview();\n };\n } else {\n options.callback = function () {\n risingAuctions.openQuickview();\n };\n }\n that.show(options);\n }).addClass('initialized');\n },\n\n onQuickviewOpen: function () {\n if (window.carousel && typeof window.carousel.init === 'function') {\n window.carousel.init();\n }\n product.initializeEvents();\n if(pageContext.type == \"product\"){\n quickviewimage.loadImageComponents();\n }\n pdpoverlay.warrantyQuantitySelection();\n require(45)();\n if ($('.search-result-content').data('issearchwithquery')) {\n $('#QuickViewDialog form.pdpForm')\n .append($('<input id=\"quickViewIsSearch\" type=\"hidden\" name=\"issearch\" value=\"true\"/>'));\n }\n util.executeJqueryReadyCallbacks();\n },\n\n /**\n * @description show quick view dialog\n * @param {Object} options\n * @param {String} options.url - url of the product details\n * @param {String} options.source - source of the dialog to be appended to URL\n * @param {String} options.productlistid - to be appended to URL\n * @param {Function} options.callback - callback once the dialog is opened\n */\n show: function (options) {\n // check if dialog container already exists and create one if necessary\n if (!this.exists()) {\n this.$container = $('<div/>').attr('id', 'QuickViewDialog').appendTo(document.body);\n }\n\n if (options.pid) {\n this.$container.data('pid', options.pid);\n }\n\n // get product URL\n var quickviewURL = makeUrl(options.url, options.source, options.productlistid, options.videoId, options.viewtype);\n\n // load data into quickview container\n if (window.dialog) {\n window.dialog.open({\n target: this.$container,\n url: quickviewURL,\n options: {\n width: '100%',\n dialogClass: options.classList,\n title: 'Product Quickview',\n open: function () {\n $('body').css('overflow','hidden');\n $(window).on('resize.quickview', util.debounce(function () {\n this.$container.dialog('option', 'position', {my: 'center', at: 'center', of: window});\n }.bind(this), 100));\n if (typeof options.callback === 'function') {\n options.callback();\n }\n this.onQuickviewOpen();\n validator.init();\n $('.field input').on('blur', function() {\n $(this).siblings(\".label\").removeClass('focus-active');\n if( $(this).val().length > 0 ) {\n $(this).siblings(\".label\").addClass('focus-active');\n }\n });\n $('.field input').on('focus', function() {\n $(\".login-box-content .error\").hide();\n $(this).siblings(\".label\").addClass('focus-active');\n });\n }.bind(this),\n close: function () {\n $(window).off('resize.quickview');\n risingAuctions.closeQuickview();\n if ($(document).find('.quick_view_reels').length > 0) {\n this.$container.empty();\n }\n $('body').css('overflow', 'visible');\n }.bind(this)\n }\n });\n }\n },\n\n exists: function () {\n return this.$container && (this.$container.length > 0);\n }\n};\nmodule.exports = quickview;", "'use strict';\n\nfunction init() {\n if ($('.reset-password-modal').length > 0) {\n setTimeout(function () {\n $('.overlay-container').fadeOut();\n }, 1200);\n }\n}\n\n// Module public functions\nmodule.exports = {\n init: function () {\n init();\n }\n};\n\n", "'use strict';\n\n/* Required Modules */\n/* **************** */\nvar addToCart = require(22),\n util = require(46),\n pubnub = require(36),\n newsignin = require(14),\n ajax = require(3),\n progress = require(35);\n\n\n/* Local Variables / Configuration */\n/* ******************************* */\nvar pubnubChannelName = 'RisingAuctions',\n\n timeCounterIntervals = [],\n bidHistorySize = 10,\n pubNubInitialized = false,\n\n $risingAuctionContainer,\n risingAuctionTileSelector,\n risingAuctionTileUpdateMode,\n risingAuctionTileUpdateSuccess;\n\nfunction getServerTime(){\n if($('.ra-timer-plp-pdp').length > 0){\n setInterval(function() {\n try {\n var serverURL = $('#getRAserverTime').attr(\"data-update-url\");\n $('#getRAserverTime').load(serverURL);\n } catch (b) {\n //console.log(b);\n }\n }, 1000);\n }\n}\n\n\n\n/* Functions */\n/* ********* */\n\n/**\n* Handler for auction details reload (ajax)\n*/\nfunction updateAuctionProduct($tile, layout, successType) {\n if (!$tile.length) {\n return;\n }\n\n var updateURL = $tile.data('update-url'),\n $valueInput = $tile.find('input.bid-value'),\n //$bidButton = $tile.find('.bid-button'),\n data = {};\n\n if (!updateURL) {\n return;\n }\n\n if ($valueInput.length) {\n data.currentInputValue = $valueInput.val();\n }\n\n if (layout.length) {\n data.layout = layout;\n }\n\n data.excludeTimeCounter = 'true';\n\n $.ajax({\n url: updateURL,\n dataType: 'html',\n data: data,\n type: 'GET',\n success: function (response) {\n // check if the value input field is currently focussed (user enters a value at the moment) -\n // if so, we do not replace the bottom part of the auction tile\n\n //check if this has implications on some other places where this is reused!\n var skipValueInput = false,\n $response,\n $bidder,\n replaceTimeCounter = function () {\n var $timeCounterPlaceholder = $response.find('.time-counter-placeholder'),\n $timeCounter = $tile.find('.time-counter');\n\n if ($timeCounterPlaceholder.length) {\n $timeCounterPlaceholder.before($timeCounter).remove();\n }\n };\n\n // watchlist / favourites\n if (successType && successType === 'table') {\n $response = $('<tr/>').append(response);\n replaceTimeCounter();\n\n if (skipValueInput) {\n $response.find('.bid-actions').remove();\n $tile.find('td:not(.product-row-part-left):not(.bid-actions)').remove();\n } else {\n $tile.find('td:not(.product-row-part-left)').remove();\n }\n\n $tile.find('td.product-row-part-left').after($response.children());\n\n // listing / pdp\n } else {\n $response = $('<div/>').html(response);\n replaceTimeCounter();\n\n if (skipValueInput) {\n if ($response.find('input.bid-value').length) {\n $bidder = $response.find('.bidder');\n $response = $response.find('.product-tile-top');\n $tile.find('.product-tile-top').before($response).remove();\n if (layout === 'pdp') {\n $tile.find('.bidder').before($bidder).remove();\n }\n } else {\n $tile.html(response);\n }\n\n // otherwise replace the whole dynamic part of the auction tile\n } else {\n $tile.html($response);\n }\n }\n }\n });\n}\n\n\n\n/**\n *Find RecordCount\n */\nfunction recordCount()\n{\n\ttry {\n\t\tvar url = Urls.rarecordcount;\n\n\t\t$.ajax({\n\t\t\turl: url,\n\t\t\ttype: 'GET',\n\t\t\tsuccess: function (response) {\n\t\t\t\tvar res = response; \n\t\t\t\tif(res.activebidcount != \"null\" && res.activebidcount > \"0\"){\n\t\t\t\t\t$('.activebidcount').text(res.activebidcount).addClass('show');\n\t\t\t\t}\n\t\t\t\telse if((res.activebidcount == \"null\" || res.activebidcount == \"0\") && ($('.activebidcount').hasClass('show'))){\n\t\t\t\t\t$('.activebidcount').removeClass('show');\n\t\t\t\t}\n\t\t\t\tif(res.paynowcount != \"null\" && res.paynowcount > \"0\"){\n\t\t\t\t\t$('.paynowcount').text(res.paynowcount).addClass('show');\n\t\t\t\t}\n\t\t\t\telse if((res.paynowcount == \"null\" || res.paynowcount == \"0\") && ($('.paynowcount').hasClass('show'))){\n\t\t\t\t\t$('.paynowcount').removeClass('show');\n\t\t\t\t}\n\n\t\t\t\tif (res.favouritescount) {\n\t\t\t\t\t$('.favouritescount').text(res.favouritescount).addClass('show');\n\t\t\t\t} else {\n\t\t\t\t\t$('.favouritescount').removeClass('show');\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function (jqXHR, textStatus, errorThrown) {\n\t\t\t\t//console.log(jqXHR + textStatus + errorThrown);\n\t\t\t}\n\t\t});\n\t} catch (b) {\n //console.log(b);\n }\n}\n\n/**\n *Initilize Bid History UI\n */\nfunction initBidHistory() {\n var $container = $('#ra-detail-bid-history'),\n $bidRows,\n $showMoreButton;\n if (!$container.length) {\n return;\n }\n\n // find rows in table\n $bidRows = $container.find('tr.bid');\n\n // show rows up to the current limit\n $container.find('tr.bid').each(function (index) {\n var $element = $(this);\n if (index < bidHistorySize) {\n $element.show();\n }\n });\n\n // hide show more button if necessary\n $showMoreButton = $container.find('.ra-detail-bid-history-show-more');\n if ($bidRows.length <= bidHistorySize) {\n $showMoreButton.hide();\n } else {\n $showMoreButton.show();\n }\n}\n\n\n\n\n/**\n* Handler for updating the Bid History\n*/\nfunction updateBidHistory(pids) {\n var $container = $('#ra-detail-bid-history'),\n productID = $('#ra-details-wrapper').data('itemid'),\n updateNecessary = false,\n updateURL,\n i;\n if (!$container.length) {\n return;\n }\n\n\n // check if update is necessary (requires provided list of pids)\n if (pids !== undefined) {\n for (i = 0; i < pids.length; i++) {\n if (pids[i] === productID) {\n updateNecessary = true;\n }\n }\n }\n if (!updateNecessary) {\n return;\n }\n\n\n // update the bid history via AJAX\n updateURL = $container.data('update-url');\n if (!updateURL) {\n return;\n }\n\n $.ajax({\n url: updateURL,\n dataType: 'html',\n type: 'GET',\n success: function (response) {\n $container.html(response);\n initBidHistory();\n }\n });\n}\n\n\n\n\n/**\n * PubNub Message Handler\n */\nfunction handleNotification(message) {\n var messageObj,\n $tile,\n i,\n $quickviewContainer;\n\n // parse message\n if (typeof message === 'string') {\n try {\n messageObj = JSON.parse(message);\n } catch (e) {\n return;\n }\n } else {\n messageObj = message;\n }\n\n\n\n // find and update tile\n for (i = 0; i < messageObj.pids.length; i++) {\n if (risingAuctionTileSelector.length) {\n $tile = $risingAuctionContainer.find(risingAuctionTileSelector +\n '[data-itemid=\"' + messageObj.pids[i] + '\"]');\n } else {\n if ($risingAuctionContainer.data('itemid') === messageObj.pids[i]) {\n $tile = $risingAuctionContainer;\n }\n }\n if ($tile !== undefined && $tile.length) {\n updateAuctionProduct($tile, risingAuctionTileUpdateMode, risingAuctionTileUpdateSuccess);\n }\n }\n\n\n // update bid history on PDP\n if (risingAuctionTileUpdateMode === 'pdp') {\n updateBidHistory(messageObj.pids);\n }\n\n\n // update quickview if necessary\n $quickviewContainer = $('#QuickViewDialog #ra-details-wrapper');\n if ($quickviewContainer.length) {\n for (i = 0; i < messageObj.pids.length; i++) {\n if ($quickviewContainer.data('itemid') === messageObj.pids[i]) {\n updateAuctionProduct($quickviewContainer, 'pdp');\n break;\n }\n }\n }\n}\n\n\n\n\n/**\n* IBM Tracking Tag handler\n*/\nfunction placeBidElementTag($element) {\n var $container = $element.closest('.ra-product-tile'),\n url,\n bid,\n previousBid;\n\n if ($container.length === 0) {\n $container = $element.closest('.ra-details-wrapper');\n }\n\n url = $container.data('ibmtag-url');\n bid = $container.find('input.bid-value').val();\n previousBid = $container.find('.price-bids-amount').text().match(/[0-9]*(\\.|,)[0-9]{2}/);\n $.getScript(util.appendParamsToUrl(url, {\n bid: bid,\n previousBid: previousBid && previousBid[0],\n isAutoBid: $element.hasClass('bid-auto')\n }));\n}\n\n\n\n\n/**\n* Handler for Place Bid action - success callback\n*/\nfunction placeBidSuccessHandler(response, $element) {\n var $container = $element.closest('.ra-product-tile');\n var $bidProductParent = (pageContext.type == \"product\")?$($element).parents('.ra-details-wrapper'):$($element).parents('.product-tile-part-bottom');\n $bidProductParent = ($bidProductParent.length > 0)?$bidProductParent:$($element).parents('.ra-details-wrapper');\n if (response.success) {\n placeBidElementTag($element);\n return undefined;\n }\n if ($container.length) {\n $bidProductParent.find('.progress-loader').css(\"display\",\"none\");\n $bidProductParent.find('.ra-overlay').css(\"display\",\"none\");\n }\n var $errorMessage = $('<div class=\"error-message\">' + response.errorMsg + '</div>');\n $('body').append($errorMessage);\n $errorMessage.dialog({\n draggable: false,\n resizable: false,\n modal: true,\n close: function () {\n $errorMessage.dialog('destroy');\n $errorMessage.remove();\n }\n });\n}\n\n\n\n\n/**\n* Handler for Place Bid action\n*/\nfunction placeBid($element) {\n\n var targetURL = $element.attr('href'),\n bidValue = $element.closest('.ra-bid-action-wrapper').find('input.bid-value').val(),\n $bidProductParent = (pageContext.type == \"product\")?$($element).parents('.ra-details-wrapper'):$($element).parents('.product-tile-part-bottom'),\n bidProduct = util.getParamFromUrl('productid',targetURL),\n $tile,\n i,\n $quickviewContainer;\n $bidProductParent = ($bidProductParent.length > 0)?$bidProductParent:$($element).parents('.ra-details-wrapper');\n\n $.ajax({\n url: targetURL,\n dataType: 'json',\n data: {bid: bidValue},\n type: 'POST',\n success: function (response) {\n if(response.success == 'true' || response.success == true){\n //console.log('Bid Success');\n /** Updating tile **/\n if (risingAuctionTileSelector.length) {\n $tile = $risingAuctionContainer.find(risingAuctionTileSelector +\n '[data-itemid=\"' + bidProduct + '\"]');\n } else {\n if ($risingAuctionContainer.data('itemid') === bidProduct) {\n $tile = $risingAuctionContainer;\n }\n }\n if ($tile !== undefined && $tile.length) {\n updateAuctionProduct($tile, risingAuctionTileUpdateMode, risingAuctionTileUpdateSuccess);\n }\n\n // update bid history on PDP\n if (risingAuctionTileUpdateMode === 'pdp') {\n updateBidHistory(bidProduct);\n }\n\n // update quickview if necessary\n $quickviewContainer = $('#QuickViewDialog #ra-details-wrapper');\n if ($quickviewContainer.length) {\n if ($quickviewContainer.data('itemid') === bidProduct) {\n updateAuctionProduct($quickviewContainer, 'pdp');\n }\n }\n /** Updating tile **/\n }\n //console.log('Bid Response: '+JSON.stringify(response));\n placeBidSuccessHandler(response, $element);\n $bidProductParent.find('.progress-loader').css(\"display\",\"none\");\n $bidProductParent.find('.ra-overlay').css(\"display\",\"none\");\n $bidProductParent.removeClass('processing');\n },\n error: function(jqXHR, exception){\n //console.warn('Response: Error');\n //console.warn(jqXHR.status+': '+jqXHR.statusText);\n $bidProductParent.find('.progress-loader').css(\"display\",\"none\");\n $bidProductParent.find('.ra-overlay').css(\"display\",\"none\");\n $bidProductParent.removeClass('processing');\n }\n });\n}\n\n\n\n\n/**\n* Handler for Remaining Time Refinement (Dropdown)\n*/\nfunction remainingTimeRefinmentHandlerDropdown($element) {\n var url = $element.val();\n window.location.href = url;\n return;\n}\n\n\n\n\n/**\n * Initialize a single Time Counter\n */\nfunction initTimeCounter($timeCounter) {\n\n var remainingTime = parseFloat($timeCounter.data('endTime') - new Date().getTime(), 10),\n // var remainingTime = parseFloat($timeCounter.data('remaining-time'), 10),\n expiratonTreshold = parseFloat($timeCounter.data('expiration-treshold')) * 60000,\n timeCounterInterval;\n\n // start/stop time counter\n timeCounterInterval = setInterval(function () {\n remainingTime -= 1000;\n\n // calculate remaining time values\n var remainingDays,\n remainingHours,\n remainingMinutes,\n remainingSeconds,\n millisRemaining = remainingTime,\n millisPerDay = 86400000,\n millisPerHour = 3600000,\n millisPerMinute = 60000,\n millisPerSecond = 1000,\n renderExpirationFlag = remainingTime <= expiratonTreshold,\n reachedLastSeconds = remainingTime <= 10 * 1000;\n\n\n if (millisRemaining <= 0) {\n remainingDays = 0;\n remainingHours = 0;\n remainingMinutes = 0;\n remainingSeconds = 0;\n } else {\n remainingDays = Math.floor(millisRemaining / millisPerDay);\n millisRemaining = millisRemaining % millisPerDay;\n remainingHours = Math.floor(millisRemaining / millisPerHour);\n millisRemaining = millisRemaining % millisPerHour;\n remainingMinutes = Math.floor(millisRemaining / millisPerMinute);\n millisRemaining = millisRemaining % millisPerMinute;\n remainingSeconds = Math.floor(millisRemaining / millisPerSecond);\n }\n\n // update HTML\n if (remainingDays <= 0) {\n $timeCounter.find('.row-values .days').remove();\n $timeCounter.find('.row-values .separator.days-separator').remove();\n } else {\n $timeCounter.find('.row-values .days').html(remainingDays);\n $timeCounter.find('.row-values .days').removeClass('hidden');\n $timeCounter.find('.row-values .separator.days-separator').removeClass('hidden');\n }\n\n if (remainingDays <= 0 && remainingHours <= 0) {\n $timeCounter.find('.row-values .hours').remove();\n $timeCounter.find('.row-values .separator.hours-separator').remove();\n } else {\n $timeCounter.find('.row-values .hours').html(remainingHours);\n $timeCounter.find('.row-values .hours').removeClass('hidden');\n $timeCounter.find('.row-values .separator.hours-separator').removeClass('hidden');\n }\n\n if (remainingDays <= 0 && remainingHours <= 0 && remainingMinutes <= 0) {\n $timeCounter.find('.row-values .minutes').remove();\n $timeCounter.find('.row-values .separator.minutes-separator').remove();\n } else {\n $timeCounter.find('.row-values .minutes').html(remainingMinutes);\n $timeCounter.find('.row-values .minutes').removeClass('hidden');\n $timeCounter.find('.row-values .separator.minutes-separator').removeClass('hidden');\n\n }\n\n if (remainingDays <= 0 && remainingHours <= 0 && remainingMinutes <= 0 && remainingSeconds <= 0) {\n $timeCounter.find('.row-values .seconds').remove();\n $timeCounter.find('.row-values .separator.seconds-separator').remove();\n } else if (remainingDays <= 0 && remainingHours <= 0 && remainingMinutes <= 0 && remainingSeconds <= 59) {\n $timeCounter.find('.row-values .separator.seconds-separator').remove();\n $timeCounter.find('.row-values .seconds').html(remainingSeconds + ' <span class=\"seconds-left\">seconds left<span>');\n $timeCounter.find('.row-values .seconds').removeClass('hidden');\n } else {\n $timeCounter.find('.row-values .seconds').html(remainingSeconds);\n $timeCounter.find('.row-values .separator.seconds-separator').removeClass('hidden');\n $timeCounter.find('.row-values .seconds').removeClass('hidden');\n }\n\n if (renderExpirationFlag) {\n $timeCounter.addClass('red');\n if (reachedLastSeconds) {\n $timeCounter.addClass('pulse-slow');\n }\n }\n\n\n if (remainingTime <= 0) {\n clearInterval(timeCounterInterval);\n $( \"#primary #ra-auctionswon-main\" ).load(\" #ra-auctionswon-main > *\" );\n }\n }, 1000);\n timeCounterIntervals.push(timeCounterInterval);\n}\n\n\n\n\n/**\n * Reinitializes all time counters\n */\nfunction reInitTimeCounters() {\n\n $('.ra-timer-plp-pdp .time-counter').each(function(){\n raTimer($(this));\n });\n}\n\n\n\n\n/**\n * Initialize common components of rising auction pages\n *\n * - Value Input Fields\n * - Bid Now Buttons\n * - Add-to-Cart Buttons\n * - Login Buttons\n * - PubNub Notifications\n * - Time Counters\n *\n */\nfunction initCommonEventHandlers($container) {\n if (!$container.length) {\n return;\n }\n\n\n // Init input fields event handlers\n $container\n .on('focusin', 'input.bid-value', function () {\n $(this).addClass('focussed');\n $(this).attr('oldValue', $(this).val());\n })\n .on('focusout', 'input.bid-value', function () {\n $(this).removeClass('focussed');\n var newValue = parseFloat($(this).val()),\n oldValue = $(this).attr('oldValue');\n\n if (!newValue) {\n $(this).val(oldValue);\n }\n $(this).removeAttr('oldValue');\n });\n\n\n // Init \"Bid Now\" button event handlers\n $container\n .on('mouseenter', '.bid-button', function () {\n $(this).addClass('focussed');\n })\n .on('mouseleave', '.bid-button', function () {\n $(this).removeClass('focussed');\n })\n .on('click', '.bid-button', function (event) {\n\n event.preventDefault();\n // add progress icon\n if (!$(event.target).hasClass(\"ra-add-to-cart\")) {\n var $con = $(this).closest('.ra-product-tile'),\n $bidProductParent = (pageContext.type == \"product\")?$(this).parents('.ra-details-wrapper'):$(this).parents('.product-tile-part-bottom');\n $bidProductParent = ($bidProductParent.length > 0)?$bidProductParent:$(this).parents('.ra-details-wrapper');\n if ($bidProductParent.length) {\n var $loader = $('<div/>').addClass('progress-loader').append($('<i/>').addClass('fa fa-spinner fa-pulse'));\n $bidProductParent.addClass('processing');\n $loader.appendTo($bidProductParent);\n $bidProductParent.append('<div class=\"ra-overlay\"></div>');\n }\n }\n\n placeBid($(this));\n /*setTimeout(function(){\n $('.progress-loader').css(\"display\",\"none\");\n $('.ra-overlay').css(\"display\",\"none\");\n },3000);*/\n });\n\n\n // init add to cart buttons\n addToCart($container);\n\n\n // init login buttons (used for redirecting after logging in)\n /* $container.on('click', '.ra-login-btn', function (event) {\n event.preventDefault();\n //window.location.href = $('#ra-login-link').attr('href');\n });*/\n\n\n // init update of product tiles on pubnub notification\n if (!pubNubInitialized) {\n pubnub.init(pubnubChannelName, handleNotification, function () {\n pubNubInitialized = true;\n });\n }\n\n $('.ra-timer-plp-pdp .time-counter').each(function(){\n raTimer($(this));\n });\n\n $container.find('.ra-bid-action-wrapper').find('input.bid-value').keypress( function (event) {\n var charCode = (event.which) ? event.which : event.keyCode;\n if (charCode > 31 && (charCode < 48 || charCode > 57)) {\n return false;\n }\n return true;\n });\n\n // init bid history\n initBidHistory();\n $('#ra-detail-bid-history').on('click', '.ra-detail-bid-history-show-more', function (event) {\n event.preventDefault();\n bidHistorySize += 10;\n initBidHistory();\n });\n}\n/**\n* Initialize Listing Page\n*\n* - General Components\n* - Special Refinements (By Auction Duration)\n* - Automatic Update of Auction Product Tiles\n*\n*/\nfunction initRisingAuctionsListingPage() {\n var $container = $('.pt_product-search-result.context-auctionshop');\n if (!$container.length) {\n return;\n }\n\n // save container and tile selector (for later use in handleNotification)\n $risingAuctionContainer = $container;\n risingAuctionTileSelector = '.ra-product-tile .product-tile-part-bottom';\n risingAuctionTileUpdateMode = '';\n\n // init general components\n initCommonEventHandlers($container);\n\n // ??\n $container.find('.ra-product-tile').on('click', '.thumb-link, .name-link', function () {\n var $productLink = $(this),\n $tile = $productLink.parents('.product-tile'),\n cgid = $tile.data('cgid'),\n isSearch = $('.search-result-content').data('issearchwithquery');\n if (cgid) {\n $productLink[0].hash = 'cgid=' + encodeURIComponent(cgid);\n }\n if (isSearch) {\n if (cgid) {\n $productLink[0].hash += '&issearch=true';\n } else {\n $productLink[0].hash = 'issearch=true';\n }\n }\n });\n\n if (!$container.length) {\n return;\n }\n\n\n // init add to cart buttons\n addToCart($container, function ($button) {\n var $theContainer = $button.closest('.add-to-cart-btn-container'),\n updateURL = $theContainer.data('update-url');\n\n $.ajax({\n url: updateURL,\n dataType: 'html',\n type: 'GET',\n success: function (response) {\n $theContainer.html(response);\n }\n });\n });\n\n setInterval(recordCount, 3000);\n}\n\n/**\n* Initialize Detail Page\n*\n* - General Components\n* - Automatic Update of Auction Product Details\n*\n*/\nfunction initRisingAuctionsDetailPage() {\n var $container = $('.ra-details-wrapper:visible');\n if (!$container.length) {\n return;\n }\n\n // save container and tile selector (for later use in handleNotification)\n $risingAuctionContainer = $container;\n risingAuctionTileSelector = '';\n risingAuctionTileUpdateMode = 'pdp';\n\n // init general components\n initCommonEventHandlers($container);\n\n\n // init \"show more\" button for bid history\n $('.section-ra-bid-history').on('click', '.ra-detail-bid-history-show-more', function () {\n $(this).data('visible-rows', $(this).data('visible-rows') + 10);\n });\n\n // init add to cart buttons\n addToCart($container, function ($button) {\n var $theContainer = $button.closest('.add-to-cart-btn-container'),\n updateURL = $theContainer.data('update-url');\n\n $.ajax({\n url: updateURL,\n dataType: 'html',\n type: 'GET',\n success: function (response) {\n $theContainer.html(response);\n }\n });\n });\n}\n\n/**\n* Initialize Watchlist / Favourites Page\n*\n* - General Components\n* - Automatic Update of Auction Product Details\n*\n*/\nfunction initRisingAuctionsWatchlistFavourites() {\n var $container = $('#ra-watchlist-favourites-main');\n if (!$container.length) {\n return;\n }\n\n // save container and tile selector (for later use in handleNotification)\n $risingAuctionContainer = $container;\n risingAuctionTileSelector = '.ra-product-tile-table-row';\n risingAuctionTileUpdateMode = '';\n risingAuctionTileUpdateSuccess = 'table';\n\n\n // init general components\n initCommonEventHandlers($container);\n\n\n // init special refinment dropdown (remaining time)\n $container.on('change', '.refinement.remaining-time select', function (event) {\n event.preventDefault();\n return remainingTimeRefinmentHandlerDropdown($(this));\n });\n setInterval(recordCount, 3000);\n}\n\n/**\n* Initialize Bid History Page\n*\n* - Add to Cart Buttons\n* - Update Time Counter\n*\n*/\nfunction initRisingAuctionsBidHistory() {\n var $container = $('#ra-bidhistory-main');\n\n if (!$container.length) {\n return;\n }\n\n // init add to cart buttons\n addToCart($container, function ($button) {\n var $theContainer = $button.closest('.add-to-cart-btn-container'),\n updateURL = $theContainer.data('update-url');\n\n $.ajax({\n url: updateURL,\n dataType: 'html',\n type: 'GET',\n success: function (response) {\n $theContainer.html(response);\n }\n });\n });\n\n\n $('.ra-timer-plp-pdp .time-counter').each(function(){\n raTimer($(this));\n });\n\n setInterval(recordCount, 3000);\n}\n\n/**\n* Init Auctions Won Page\n*\n* - Add to Cart Buttons\n* - Update Time Counter\n*\n*/\nfunction initRisingAuctionsAuctionsWon() {\n // check presence of container\n var $container = $('#ra-auctionswon-main');\n if (!$container.length) {\n return;\n }\n\n\n // init add to cart buttons\n addToCart($container, function ($button) {\n var $theContainer = $button.closest('.add-to-cart-btn-container'),\n updateURL = $theContainer.data('update-url');\n\n $.ajax({\n url: updateURL,\n dataType: 'html',\n type: 'GET',\n success: function (response) {\n // $theContainer.html(response);\n }\n });\n });\n\n $('.ra-timer-plp-pdp .time-counter').each(function(){\n raTimer($(this));\n });\n\n setInterval(recordCount, 3000);\n\n disableCheckboxesInBag();\n disableHeaderIfAllInBag();\n}\n\n/**\n* Init Sirv as soon as quickview container is opened\n*/\nfunction initSirv() {\n var sirvContainer = $('.pdp-section .Sirv')[0];\n\n if (sirvContainer && Sirv) {\n Sirv.start(sirvContainer);\n }\n};\n\n/**\n* Init Quickview as soon as quickview container is opened\n*/\nfunction openRisingAuctionsQuickview() {\n var $container = $('#QuickViewDialog #ra-details-wrapper');\n if (!$container.length) {\n return;\n }\n\n if (window.SitePreferences.SIRV_ENABLED) {\n initSirv();\n }\n\n // init general components\n initCommonEventHandlers($container);\n $('#QuickViewDialog #ra-details-wrapper').on('click', '.ra-add-to-cart', function () {\n var a = $('#ra-details-wrapper').find('#pid').val();\n $(\"#pid\").closest('.search-result-items').find(\".add-to-cart-btn-container\").each(function() {\n var b=$(this).find('#pid').val();\n if(a === b){\n $(this).find( \".ra-add-to-cart\" ).trigger(\"click\");\n }\n\n });\n });\n\n}\n\n/**\n* Remove Quickview update when overlay is closed\n*/\nfunction closeRisingAuctionsQuickview() {\n reInitTimeCounters();\n}\n\n$(window).on('scroll', function () {\nvar nav = $('.filters-and-sorting');\nif (nav.length) {\n\n if ($(window).width() < 767) {\n var contentNav = nav.offset().top - 112;\n }\n else {\n var contentNav = nav.offset().top - 79;\n }\n\n var pageTop = $(window).scrollTop();\n if (pageTop >= contentNav) {\n $('.rising-action-btn-group').addClass('sticky-on');\n\n var RAsticky = $('#main').find('.sticky-on');\n if(RAsticky.length){\n $('.backtotop.visible').css('bottom', '60px');\n }\n } else {\n $('.rising-action-btn-group').removeClass('sticky-on');\n }\n}\n\n});\n\n$(window).on('scroll', function() {\n var raHeader = $('.ra-timer-plp-pdp');\n if (raHeader.length > 0) {\n var raHeaderOffset = raHeader.offset().top;\n if (raHeaderOffset < $(window).scrollTop() - 20) {\n $('.ra-row.ra-header').addClass('ra-header-sticky');\n } else {\n $('.ra-row.ra-header').removeClass('ra-header-sticky');\n }\n }\n});\n\n$(window).on('scroll', function () {\nvar filtermove = $('.listing-slot-container-bottom');\nvar bottomcontent = $('.listing-slot-container-bottom').outerHeight();\nif (filtermove.length) {\n var filtercontent = filtermove.offset().top - 800;\n var pageTop = $(window).scrollTop();\n if (pageTop >= filtercontent) {\n $('.context-auctionshop .secondary-col').css({position: \"absolute\", bottom: bottomcontent});\n }\n}\n});\n\n// Checks the add to bag button and if it's disabled, then this function will disable the associated checkbox.\nfunction disableCheckboxesInBag() {\n var raItems = $(\".ra-item-row\");\n\n for (var i = 0; i < raItems.length; i++) {\n var isDisabled = $(raItems[i]).find(\".ra-add-to-cart\").hasClass(\"added\") || $(raItems[i]).find(\".ra-add-to-cart\").length === 0;\n var checkbox = $(raItems[i]).find(\".ra-item-checkbox .checker\");\n\n if (isDisabled) {\n checkbox.remove();\n }\n }\n}\n\n// Checks the add to bag buttons and if they are all disabled, then it hides the header\nfunction disableHeaderIfAllInBag() {\n var raItems = $(\".ra-item-row\");\n\n var disabledArray = $.map(raItems, function (e) {\n return $(e).find(\".ra-add-to-cart\").hasClass(\"added\") || $(e).find(\".ra-add-to-cart\").length === 0;\n })\n\n if (disabledArray.indexOf(false) === -1) {\n $(\".ra-row.ra-header\").hide();\n }\n}\n\n\nfunction raTimer($raTimerClass){\n // Set the date we're counting down to\n var countDownDate = $raTimerClass.attr(\"data-end-time\");\n var raExpiratonTreshold = parseFloat($raTimerClass.attr(\"data-expiration-treshold\")) * 60000;\n\n // Update the count down every 1 second\n var x = setInterval(function() {\n\n // Get today's date and time\n //var now = new Date().getTime();\n var now = $('#getRAserverTime').text();\n\n // Find the distance between now and the count down date\n var distance = countDownDate - now;\n\n // Time calculations for days, hours, minutes and seconds\n var days = Math.floor(distance / (1000 * 60 * 60 * 24));\n var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));\n var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));\n var seconds = Math.floor((distance % (1000 * 60)) / 1000);\n var raRenderExpirationFlag = distance <= raExpiratonTreshold;\n var raReachedLastSeconds = distance <= 10 * 1000;\n\n // Output the result in an element with class=ra-timer\"\n if(days > 0 && hours >= 0 && minutes >= 0 && seconds >= 0){\n $raTimerClass.find(\".ra-timer\").html(days + \"<span>d</span> \" + hours + \"<span>h</span> \"+ minutes + \"<span>m</span> \" + seconds + \"<span>s</span> \");\n }\n if(days <= 0 && hours > 0 && minutes >= 0 && seconds >= 0){\n $raTimerClass.find(\".ra-timer\").html( hours + \"<span>h</span> \"+ minutes + \"<span>m</span> \" + seconds + \"<span>s</span> \");\n }\n if(days <= 0 && hours <= 0 && minutes > 0 && seconds >= 0){\n $raTimerClass.find(\".ra-timer\").html( minutes + \"<span>m</span> \" + seconds + \"<span>s</span> \");\n if(minutes < 5 ){\n $raTimerClass.find(\".ra-timer\").addClass('red');\n }\n }\n if(days <= 0 && hours <= 0 && minutes <= 0 && seconds >0){\n $raTimerClass.find(\".ra-timer\").html( seconds + \"<span> seconds left</span> \");\n }\n\n if (raRenderExpirationFlag) {\n $raTimerClass.find(\".ra-timer\").addClass('red');\n if (raReachedLastSeconds) {\n $raTimerClass.find(\".ra-timer\").addClass('pulse-slow');\n }\n }\n\n // If the count down is over, write some text\n if (distance <= 0) {\n clearInterval(x);\n //$( \"#primary #ra-auctionswon-main\" ).load(\" #ra-auctionswon-main > *\" );\n $raTimerClass.closest('.time-counter').find(\".ra-timer\").removeClass('pulse-slow');\n $raTimerClass.closest('.ra-timecounter').find(\".ra-timer\").text(\"ENDED\");\n $raTimerClass.closest('.ra_timercounter').find(\".ra-timer\").text(\"ENDED\");\n $raTimerClass.closest('.cell-timer').find(\".ra-timer\").text(\"ENDED\");\n $raTimerClass.closest('.ra-time-remaining-container').find(\".ra-timer\").text(\"EXPIRED\");\n $raTimerClass.closest('.bid-item').find(\".ra-timer\").text(\"\");\n }\n }, 1000);\n }\n\n\n/* Module Exports */\n/* ************** */\nexports.init = function () {\n initRisingAuctionsListingPage();\n initRisingAuctionsDetailPage();\n initRisingAuctionsWatchlistFavourites();\n initRisingAuctionsBidHistory();\n initRisingAuctionsAuctionsWon();\n newsignin.init();\n getServerTime();\n};\nexports.openQuickview = openRisingAuctionsQuickview;\nexports.closeQuickview = closeRisingAuctionsQuickview;\nexports.reInitTimeCounters = reInitTimeCounters;\nexports.disableHeaderIfAllInBag = disableHeaderIfAllInBag;\n", "'use strict';\n\nvar progress = require(35);\nvar util = require(46);\n\nfunction initTabs() {\n var handlePasswordFields = function ($el) {\n $el.find('.icon-password-show')\n .removeClass('icon-password-show')\n .addClass('icon-password show');\n };\n $('.account-tab-login').on('click', function () {\n $('.account-tab-login').addClass('active');\n $('.account-tab-register').removeClass('active');\n $('.login-container').removeClass('hidden');\n $('.reduced-register-container').addClass('hidden');\n $('.input-password').removeAttr('type');\n $('.input-password').prop('type', 'password');\n handlePasswordFields($('.reduced-register-container'));\n\n });\n $('.account-tab-register').on('click', function () {\n $('.account-tab-register').addClass('active');\n $('.account-tab-login').removeClass('active');\n $('.login-container').addClass('hidden');\n $('.reduced-register-container').removeClass('hidden');\n $('.input-password').removeAttr('type');\n $('.input-password').prop('type', 'password');\n handlePasswordFields($('.login-container'));\n $('#RegistrationForm .form-row-select').find('.styledSelect, .options li').attr('tabindex', '0');\n $('.styledSelect').bind('keypress', function (e) {\n if (e.keyCode == 13) {\n $(this).trigger('click');\n $(this).siblings('.optiongroup').find('.options li:eq(0)').focus();\n }\n });\n $('.options li').bind('keypress', function (e) {\n if (e.keyCode == 13) {\n $(this).trigger('click');\n $('input.first-name').focus();\n }\n });\n $(\"input.first-email, input.first-name\").focus(function () {\n $(this).trigger('click');\n });\n $(\"input.first-name\").focus(function () {\n $('select#dwfrm_profile_customer_title').trigger('focusout');\n });\n $('#onbeforeunload-button').on('click', function () {\n setTimeout(function () {\n if ($('.form-row.validation-error').length > 0) {\n $(window).scrollTop($('.form-row.validation-error').offset().top - 50);\n } else if ($('form#RegistrationForm .validation-success').length == 6) {\n progress.show();\n $(\"#onbeforeunload-button\").prop('disabled', true);\n }\n }, 100);\n });\n\n });\n\n $('.item').on('click', '.oAuthIcon', function (e) {\n $('.OAuthProvider').val($(e.delegateTarget).attr('id'));\n });\n\n //code for opening popup for ring sizer\n var $form = $('#RegistrationForm'),\n $manualAddressButton = $form.find('.js-type-address-btn button'),\n $useAddressFinderButton = $form.find('.showmore'),\n $overlayContainer = $form.find('.overlay-container'),\n $registerButton = $form.find('#register-button'),\n $checkBoxDiv = $form.find('.xlt-addressForm .form-row-checkbox-white'),\n $readtac = $form.find('#uniform-dwfrm_profile_customer_readtac'),\n $amsErrorMessageCheck = $form.find('.message-content').text();\n\n // validate all the fields when AMS returns any error message (Ring Sizer)\n if ($amsErrorMessageCheck) {\n $form.find('.form-row-new').addClass('validation-success');\n }\n\n // remove class from checkbox on page load (Ring Sizer)\n $checkBoxDiv.removeClass('validation-error');\n\n\n //enter address manually button functionality (Ring Sizer)\n $manualAddressButton.off('click').on('click', function () {\n $('body').css('overflow', 'hidden');\n var line1 = $overlayContainer.find(\"input[id$='address_address1']\").val();\n var line2 = $overlayContainer.find(\"input[id$='address_address2']\").val();\n var line3 = $overlayContainer.find(\"input[id$='address_address3']\").val();\n var line4 = $overlayContainer.find(\"input[id$='address_address4']\").val();\n var city = $overlayContainer.find(\"input[id$='address_city']\").val();\n var postalCode = $overlayContainer.find(\"input[id$='address_postCode']\").val();\n\n if (line1) {\n $overlayContainer.find(\"input[id$='address_address1']\").siblings('.label').addClass('focus-active');\n $overlayContainer.find(\"input[id$='address_address1']\").closest('.form-row').addClass('validation-success');\n }\n if (line2) {\n $overlayContainer.find(\"input[id$='address_address2']\").siblings('.label').addClass('focus-active');\n $overlayContainer.find(\"input[id$='address_address2']\").closest('.form-row').addClass('validation-success');\n }\n if (line3) {\n $overlayContainer.find(\"input[id$='address_address3']\").siblings('.label').addClass('focus-active');\n $overlayContainer.find(\"input[id$='address_address3']\").closest('.form-row').addClass('validation-success');\n }\n if (line4) {\n $overlayContainer.find(\"input[id$='address_address4']\").siblings('.label').addClass('focus-active');\n $overlayContainer.find(\"input[id$='address_address4']\").closest('.form-row').addClass('validation-success');\n }\n if (city) {\n $overlayContainer.find(\"input[id$='address_city']\").siblings('.label').addClass('focus-active');\n $overlayContainer.find(\"input[id$='address_city']\").closest('.form-row').addClass('validation-success');\n }\n if (postalCode) {\n $overlayContainer.find(\"input[id$='address_postCode']\").siblings('.label').addClass('focus-active');\n $overlayContainer.find(\"input[id$='address_postCode']\").closest('.form-row').addClass('validation-success');\n }\n\n $overlayContainer.addClass('overlay-container-on').removeClass('overlay-container-off');\n var $selectedCountry = $('body').find('.xlt-addressForm .parent .country .countrycheckopc .styledSelect').text();\n if ($selectedCountry.includes('UK') || $selectedCountry.includes('Jersey (Channel Islands)') || $selectedCountry.includes('Guernsey (Channel Islands)')) {\n $('.showmore').removeClass('visually-hidden');\n } else {\n $('.showmore').addClass('visually-hidden');\n }\n\n // clear postal\n var postCodeField = $('.post-code-field');\n\n if (postCodeField.length > 0) {\n var inputField = postCodeField.find('.postcode-data8');\n var autocompleteList = postCodeField.find('ul.data8-autocomplete-list');\n var postalClear = postCodeField.find('.postal-clear');\n\n if (postalClear.length > 0) {\n inputField.val('');\n autocompleteList.empty();\n postalClear.remove();\n }\n }\n\n $('.saveaddress').off('click').on('click', function () {\n var $formaddress1 = $('#dwfrm_checkoutaddresses_billingAddress_address_address1').val(),\n $formaddress2 = $('#dwfrm_checkoutaddresses_billingAddress_address_address2').val(),\n $formaddress3 = $('#dwfrm_checkoutaddresses_billingAddress_address_address3').val(),\n $formaddress4 = $('#dwfrm_checkoutaddresses_billingAddress_address_address4').val(),\n $formcity = $('#dwfrm_checkoutaddresses_billingAddress_address_city').val(),\n $formpostcode = $('#dwfrm_checkoutaddresses_billingAddress_address_postCode').val();\n\n var $form = $(this).closest('.xlt-addressForm'),\n $addressSelect = $form.find('.addresses-select');\n\n if ($formaddress1 && $formcity && $formpostcode) {\n $('body').css('overflow', 'visible');\n $overlayContainer.addClass('overlay-container-off').removeClass('overlay-container-on');\n\n $addressSelect.find(\"[id$='summary_address_line1']\").text($formaddress1);\n $addressSelect.find(\"[id$='summary_address_line2']\").text($formaddress2);\n $addressSelect.find(\"[id$='summary_address_line3']\").text($formaddress3);\n $addressSelect.find(\"[id$='summary_address_line4']\").text($formaddress4);\n $addressSelect.find(\"[id$='summary_address_city']\").text($formcity);\n $addressSelect.find(\"[id$='summary_address_postalcode']\").text($formpostcode);\n $form.find('.addresses-select').addClass('loqate-select');\n $form.find('.addresses-select-group .selected-address-summary').removeClass('visually-hidden');\n $form.find('.addresses-select-group .addresses-select').removeClass('visually-hidden');\n\n if ($formaddress1) {\n $form.find('.post-code-field .form-row').addClass('validation-success');\n } else {\n $form.find('.post-code-field .form-row').addClass('validation-error form-row-new');\n }\n\n var $parent = $addressSelect.parent().siblings('.parent');\n var $typeAddressBtn = $parent && $parent.find('.js-type-address-btn');\n if ($parent.length > 0 && $typeAddressBtn.length > 0) {\n $parent.find('.js-type-address-btn').addClass('d-none');\n $typeAddressBtn.removeClass('d-none');\n }\n } else {\n var $formData = $(this).closest('form'),\n isValid = $formData.valid();\n if (!$formaddress1) {\n $form.find('.modal-container .address1').addClass('validation-error form-row-new');\n }\n if (!$formcity) {\n $form.find('.modal-container .city').addClass('validation-error form-row-new');\n }\n if (!$formpostcode) {\n $form.find('.modal-container .postCode').addClass('validation-error form-row-new');\n }\n\n\n }\n });\n\n $useAddressFinderButton.off('click').on('click', function () {\n $('body').css('overflow', 'visible');\n $overlayContainer.addClass('overlay-container-off').removeClass('overlay-container-on');\n });\n\n });\n\n //add class validation-success to the checkbox on click (Ring Sizer)\n $readtac.on('click', function () {\n $checkBoxDiv.removeClass('validation-error').addClass('validation-success');\n });\n\n\n // register button functionality (Ring Sizer)\n $registerButton.on('click', function (e) {\n var $addressField = $('body').find('.xlt-addressForm .parent .address .post-code-field-opc');\n if ($addressField.css('display') === 'none' && $('.xlt-addressForm .addresses-select-group .addresses-select').hasClass('visually-hidden')) {\n var $formData = $(this).closest('form'),\n isValid = $formData.valid();\n $('#non-loqate-country-error').css('display', 'block');\n e.preventDefault();\n } else {\n var $checkboxCheck = $form.find('#dwfrm_profile_customer_readtac').prop('checked'),\n $formaddress1 = $('#dwfrm_checkoutaddresses_billingAddress_address_address1').val();\n var $formData = $(this).closest('form'),\n isValid = $formData.valid();\n if ($checkboxCheck && $formaddress1) {\n if ($('.form-row-new.validation-error').length > 0) {\n $(window).scrollTop($('.form-row-new.validation-error').offset().top - 50);\n } else if ($('form#RegistrationForm .validation-success').length >= 8) {\n progress.show();\n $registerButton.prop('disabled', true);\n $('input.input-text, select.input-select').attr('disabled', 'disabled');\n $('form#RegistrationForm').addClass('btn-loader');\n\n var $email = $form.find('.first-email').val().toLowerCase(),\n $title = $form.find('#dwfrm_profile_customer_title').val(),\n $firstName = $form.find('#dwfrm_profile_customer_firstname').val(),\n $lastName = $form.find('#dwfrm_profile_customer_lastname').val(),\n $finalName = $firstName + \" \" + $lastName,\n $loginPin = $form.find('#dwfrm_profile_login_pin').val(),\n $confirmLoginPin = $form.find('#dwfrm_profile_login_pinconfirm').val(),\n $country = $form.find('#dwfrm_checkoutaddresses_billingAddress_address_country').val(),\n $checkboxValue = $form.find('#dwfrm_profile_customer_readtac').val(),\n $addressLines = [\n $('#summary_address_line1').text(),\n $('#summary_address_line2').text(),\n $('#summary_address_line3').text(),\n $('#summary_address_line4').text(),\n $('#summary_address_city').text(),\n $('#summary_address_postalcode').text()\n ],\n $addressObject = {\n address1: $('#summary_address_line1').text(),\n address2: $('#summary_address_line2').text(),\n address3: $('#summary_address_line3').text(),\n address4: $('#summary_address_line4').text(),\n city: $('#summary_address_city').text(),\n postalCode: $('#summary_address_postalcode').text(),\n countryCode: $country\n },\n $addressArray = [], $finalAddress;\n for (var i = 0; i < $addressLines.length; i++) {\n if ($addressLines[i] !== \"\") {\n $addressArray.push($addressLines[i]);\n }\n }\n $finalAddress = $addressArray.join(', ');\n\n var url = Urls.ringSizer;\n url = util.appendParamsToUrl(url , {\n firstnamevalue: $firstName,\n lastnamevalue: $lastName,\n emailvalue: $email,\n titlevalue: $title,\n loginpinvalue: $loginPin,\n confirmloginpinvalue: $confirmLoginPin,\n countryvalue: $country,\n addressvalue: $finalAddress,\n addressobject: JSON.stringify($addressObject),\n checkboxvalue: $checkboxValue,\n finalnamevalue: $finalName\n\n });\n $.ajax({\n url: url,\n type: 'POST',\n success: function () {\n window.location.href = Urls.homePage;\n },\n error: function () {\n window.location.reload();\n }\n });\n }\n } else {\n e.preventDefault();\n if ($checkboxCheck == false || $checkboxCheck == 'false') {\n $checkBoxDiv.addClass('validation-error');\n } if ($formaddress1 == null || $formaddress1 == \"\") {\n $form.find('.post-code-field .form-row').addClass('validation-error form-row-new');\n }\n }\n\n }\n\n });\n\n\n //remove error when loqate countries are selected back\n $('.xlt-addressForm .parent .country .optiongroup .options li').on('click', function () {\n var $selectedCountry = $('body').find('.xlt-addressForm .parent .country .countrycheckopc .styledSelect').text();\n if ($selectedCountry.includes('UK') || $selectedCountry.includes('Jersey (Channel Islands)') || $selectedCountry.includes('Guernsey (Channel Islands)')) {\n $('#non-loqate-country-error').css('display', 'none');\n }\n });\n}\n\nfunction toggleLogin() {\n $('.center-wrapper').on('click', function () {\n $('.logintv-container').slideToggle('slow');\n $('.tv-customer-box').toggleClass('toggleopen');\n $(document).trigger('ConnectTVaccount');\n //$('#chevron').toggleClass('fa-chevron-down').toggleClass('fa-chevron-up');\n });\n\n}\n\nfunction guestLogin() {\n $('.goto-guestlink').on('click', function (event) {\n $(event.target).closest('form').submit();\n });\n}\n\nfunction ottSigninToggle() {\n $('.ott_signin_header').on('click', function () {\n $('.openToggle').removeClass('show');\n $(this).closest('.ott_signin_content').slideToggle('slow');\n $(this).parent('.openToggle').addClass('show');\n });\n}\n\n// Module public functions\nmodule.exports = {\n init: function () {\n initTabs();\n toggleLogin();\n guestLogin();\n ottSigninToggle();\n },\n initTabs: initTabs\n};\n", "'use strict';\n\nvar util = require(46),\n validator = require(47),\n progress = require(35),\n flyinheader = require(9);\n\nfunction initializeEvents(){\n var addressjs = require(18),\n accountjs = require(17),\n paysafe = require(31);\n\nfunction tjcdeliveryissue(){\n var town = $('#dwfrm_quickbuyaddress_shippingAddress_address_city').val();\n if(town !=\"\"){\n var t1 = town.toUpperCase();\n var t2=t1.replace(/\\s+/g, '');\n var towncurrent=t2.replace(/[^a-zA-Z ]/g, \"\"); \n }\n if (towncurrent === 'JERSEY' || towncurrent === 'GUERNSEY' || towncurrent === 'ISLEOFMAN')\n { \t\n if($('.addresses-select .showmore').hasClass('deliverycheck')){\n $('.cityerror').css(\"display\",\"none\");\n $('.cityerror2').css(\"display\",\"block\");\n }\n else{\n $('.cityerror').css(\"display\",\"block\");\n $('.cityerror2').css(\"display\",\"none\");\n }\n $('#dwfrm_quickbuyaddress_shippingAddress_address_city').closest('.form-row').addClass('validation-error');\t\t \n } \n else{ \n $('.cityerror').css(\"display\",\"none\");\n $('.cityerror2').css(\"display\",\"none\");\n $('#dwfrm_quickbuyaddress_shippingAddress_address_city').closest('.form-row').removeClass('validation-error');\n }\n}\n\nfunction checkTjcPlusMember() {\n var url = Urls.TJCcheckmember;\n\n return $.ajax({\n url: url,\n type: 'GET'\n });\n}\n\nfunction restoreQuickBuyBasket() {\n var url = Urls.restoreqbbasketfromsession;\n\n return $.ajax({\n url: url,\n type: 'POST',\n async: false,\n cache: false,\n contentType: \"application/json\",\n timeout: 60000\n });\n}\n\n$('.tjcplus-activation').on('click', function(){\n var $this = $(this);\n\n checkTjcPlusMember().then(function(response) {\n var res = response;\n $('.ismember').text(res.ismember);\n $('.ismember').css(\"display\", \"none\");\n\n if (res.ismember == \"true\") {\n window.location.href = window.location.pathname;\n $('.showActivateQBModel').addClass(\"membercheck\");\n }\n\n var pid; \n var tjcpluscontext = $this.data('tjcpluscontext');\n \n if(tjcpluscontext == 'account'){\n pid = $this.data('pid');\n }else if(tjcpluscontext == 'pdp' || tjcpluscontext == 'cart' || tjcpluscontext == 'order_confirmation'){\n pid = $('input[name=\"subscription-product\"]:checked').val();\n }\n\n if($('.tjcplus-newuser-redirection').length > 0){\n pid = $this.data('selectedtjcpluspid');\n $('.tjcplus-newuser-redirection').remove();\n }\n \n var url = Urls.tjcplusactivate;\n \n url = util.appendParamsToUrl(url,{\n 'pid':pid\n });\n\n progress.show();\n if (window.dialog) {\n window.dialog.open({ \n url: url,\n options:{\n dialogClass:'showActivateQBModel tjc-sub-papin',\n closeOnEscape: false,\n open: function(event,ui){\n progress.hide();\n $('body').css('overflow','hidden');\n $('.credit-card-box').css('max-width','unset');\n require(45)(); \n whatiscvv();\n accountjs.init();\n addressjs.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n validator.init();\n window.paysafeForQB = true;\n paysafe.init();\n\n $('.addresses-select .showmore').on('click',function(){\n $('.addresses-select .showmore').addClass('deliverycheck');\n });\n $('.address-boxes .address-check-btn').on('click',function(){\n $('.addresses-select .showmore').removeClass('deliverycheck');\n });\n setInterval(tjcdeliveryissue,1000);\n $('#qb-activation-page').on('click', '.js-address-autocomplete-item', function (event) {\n event.stopImmediatePropagation();\n var hasSubAddresses = $(this).attr('data-has-sub-addresses') === 'true';\n \n if (hasSubAddresses) {\n addressjs.drillDownAddresses($(this));\n } else {\n addressjs.retrieveAddress($(this));\n }\n });\n },\n close:function() {\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n $('body').css('overflow','x-hidden');\n\n var context = $('.tjcplus-activation').data('tjcpluscontext');\n if (context == 'pdp') {\n restoreQuickBuyBasket().then(function() {\n var redirect = Urls.getProductUrl;\n redirect = util.appendParamsToUrl(redirect,{\n 'pid': $('.product-code-pdp .product-id').text().trim()\n });\n window.location.href = redirect;\n });\n } else if (context == 'cart') {\n window.location.href = Urls.cartShow;\n } else {\n restoreQuickBuyBasket().then(function() {\n window.location.href = window.location.href.split('#')[0];\n });\n }\n }\n }\n });\n }\n });\n});\n\n\t$(document).on('click', '.tjcplus-activation-login' , function (e) {\n\t e.preventDefault();\n\t var Login_PopUp_Active = window.SitePreferences.Login_PopUp_Active;\n\t if(Login_PopUp_Active){\n\t\t var url = Urls.newRegistration;\n\t\t url = util.appendParamToURL(url,'pageContext',pageContext.ns);\n\t\t url = util.appendParamToURL(url,'tjcpluscontext',true);\n if (window.dialog) {\n window.dialog.open({ \n url: url,\n options:{\n dialogClass:'new-sign-registration',\n open: function(event,ui){\n validator.init();\n if (window.newformstyle && typeof window.newformstyle.init === 'function') {\n window.newformstyle.init();\n }\n \n $('.item').on('click', '.oAuthIcon', function (e) {\n $('.OAuthProvider').val($(e.delegateTarget).attr('id'));\n \n var tjcplusproductId = $('input[name=\"subscription-product\"]:checked').val();\n $('.tjcpluspid').val(tjcplusproductId);\n $('.redirecttjcplusactivation').val(true);\n });\n \n $('body').css('overflow','hidden');\n $('.checkemail-button button').on('click', function(event){\n event.preventDefault(); \n var url = Urls.checkMailAvailabilty;\n var $form = $(this).closest('form');\n var emailid = $form.find('.email-field input').val();\n if ($form.find('.checkemail-field .error').length > 0){\n $form.find('.checkemail-field .error').remove();\n }\n var regex = validator.regex;\n if (emailid != '' && !regex.newEmail.test(emailid)){\n var newDiv ='<div class=\"error\" style=\"color:#E30613;\">The email address is invalid.<div>' \n $form.find('.checkemail-field').append(newDiv);\n return;\n }\n if (emailid == ''){\n var newDiv ='<div class=\"error\" style=\"color:#E30613;\">Cannot be blank<div>' \n $form.find('.checkemail-field').append(newDiv);\n return;\n }\n url = util.appendParamToURL(url,'emailid',emailid);\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) { \n var responseJson = JSON.parse(response);\n if (responseJson.availableEmail){\n var $form1 = $('.returning-customers form');\n if ($form1.find('.email-value').hasClass('d-none')){\n $form1.find('.email-value').text(responseJson.email).removeClass('d-none');\n } else {\n $form1.find('.email-value').text(responseJson.email);\n }\n if ($form1.find('.checkpw-content').hasClass('d-none')){\n $form1.find('.checkpw-content').removeClass('d-none');\n }\n if (!$form1.find('.checkemail-field').hasClass('d-none')){\n $form1.find('.checkemail-field').addClass('d-none');\n }\n if ($form1.find('.form-row-password').hasClass('d-none')){\n $form1.find('.form-row-password').removeClass('d-none');\n }\n if (!$form1.find('.form-row-button .checkemail-button').hasClass('d-none')){\n $form1.find('.form-row-button .checkemail-button').addClass('d-none');\n }\n if ($form1.find('.checkpw-button').hasClass('d-none')){\n $form1.find('.checkpw-button').removeClass('d-none');\n }\n if ($('.newsignin-box-inner .checkpw-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkpw-title').removeClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-title').addClass('d-none')\n }\n if (!$('.newsignin-box-inner .guest-checkout-button').hasClass('d-none')){\n $('.newsignin-box-inner .guest-checkout-button').addClass('d-none')\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-content').addClass('d-none')\n }\n \n $('.newsignin-box-inner .checkemail-title').addClass('d-none')\n signInForCustoer();\n forgotPwdClick();\n editbuttonclick();\n enteredWrongEmail();\n disguisePassword();\n } else {\n var cgid = '',pid='',pipeline='',cid='';\n var tjcpluspid = $('input[name=\"subscription-product\"]:checked').val();\n \n if (pageContext.ns == 'search') {\n cgid = $('.new-register-direction').val();\n } else if (pageContext.ns == 'product'){\n pid = $('.product-code-pdp .product-id').text().trim();\n } else if (pageContext.ns == 'livetv' || pageContext.ns == 'account'){\n var pathName = window.location.pathname;\n pipeline = pathName.split('/')[pathName.split('/').length-1]\n } else if (pageContext.ns == 'content'){\n var cgidvalue = $('.new-register-direction').val();\n var cidvalue = $('.new-cid-register-direction').val();\n if (cgidvalue != \"null\") {\n cgid = cgidvalue;\n } else if (cidvalue != \"null\"){\n cid = cidvalue;\t\t \n } else {\n var pathName = window.location.pathname;\n pipeline = pathName.split('/')[pathName.split('/').length-1];\n if (pipeline == 'Search-Show'){\n cgid = window.location.search.split('=')[1];\n } else {\n cid = window.location.search.split('=')[1];\n }\n }\n }\n var url = util.appendParamsToUrl(Urls.oldRegPage,{\n 'emailid':emailid, \n 'fromPopUpRegister' : 'yes',\n 'newSignin':'newSignin',\n 'pagecontext':pageContext.ns,\n 'cgid':cgid,\n 'pid':pid,\n 'pipeline':pipeline,\n 'cid':cid,\n 'tjcpluspid':tjcpluspid,\n 'redirecttjcplusactivation':true\n });\n \n window.location.href = url;\n }\n \n $(\".emailEditButton\").on(\"click\", function(){\n $('.newsignin-box-inner .checkpw-title').addClass('d-none');\n $('.newsignin-box-inner .checkpw-content').addClass('d-none');\n $('.newsignin-box-inner .checkpw-field').addClass('d-none');\n $('.newsignin-box-inner .checkpw-button').addClass('d-none');\n $('.newsignin-box-inner .checkemail-title').removeClass('d-none');\n $('.newsignin-box-inner .checkemail-content').removeClass('d-none');\n $('.newsignin-box-inner .checkemail-field').removeClass('d-none');\n $('.newsignin-box-inner .checkemail-button').removeClass('d-none');\n });\n \n }, \n error: function (jqXHR, textStatus, errorThrown) {\n // console.log(jqXHR + textStatus + errorThrown);\n }\n });\n });\n },\n close:function() {\n $('body').removeAttr(\"style\");\n $('html').removeAttr(\"style\");\n }\n }\n });\n }\n }else{\n var cgid = '',pid='',pipeline='',cid='';\n var tjcpluspid = $('input[name=\"subscription-product\"]:checked').val();\n\n if (pageContext.ns == 'search') {\n cgid = $('.new-register-direction').val();\n } else if (pageContext.ns == 'product'){\n pid = $('.product-code-pdp .product-id').text().trim();\n } else if (pageContext.ns == 'livetv' || pageContext.ns == 'account'){\n var pathName = window.location.pathname;\n pipeline = pathName.split('/')[pathName.split('/').length-1]\n } else if (pageContext.ns == 'content'){\n var cgidvalue = $('.new-register-direction').val();\n var cidvalue = $('.new-cid-register-direction').val();\n if (cgidvalue != \"null\") {\n cgid = cgidvalue;\n } else if (cidvalue != \"null\"){\n cid = cidvalue;\n } else {\n var pathName = window.location.pathname;\n pipeline = pathName.split('/')[pathName.split('/').length-1];\n if (pipeline == 'Search-Show'){\n cgid = window.location.search.split('=')[1];\n } else {\n cid = window.location.search.split('=')[1];\n }\n }\n }\n var url = util.appendParamsToUrl(Urls.oldRegPage,{\n 'pagecontext':pageContext.ns,\n 'cgid':cgid,\n 'pid':pid,\n 'pipeline':pipeline,\n 'cid':cid,\n 'tjcpluspid':tjcpluspid,\n 'redirecttjcplusactivation':true,\n 'emailid':'',\n 'fromPopUpRegister' : 'no',\n 'newSignin':'newSignin'\n });\n\n window.location.href = url;\n }\n });\n\n\n if($('.tjcplus-newuser-redirection').length > 0){\n $(\".sticky-desktop-check .tjcplus-activation\").trigger('click');\n }\n\n}\n\nfunction whatiscvv(){\n $('.whatiscvv').click(function (e) {\n if($( \"#whatiscvv-modelbox\" ).hasClass('d-none')){\n $( \"#whatiscvv-modelbox\" ).removeClass('d-none');\n }\n else{\n $( \"#whatiscvv-modelbox\" ).addClass('d-none');\n }\n });\n}\n\nfunction signInForCustoer() {\n$('.checkpw-button .singn-button').off('click').on('click', function(e){\n flyinheader.init();\n e.preventDefault();\n var url = Urls.newLogin;\n var $form = $(this).closest('form');\n var emailid = $form.find('.email-value').text();\n var pwd = $form.find('.form-row-password input').val();\n if ($form.find('.form-row-password .error').length > 0){\n $form.find('.form-row-password .error').remove();\n }\n if (pwd == '') {\n var newDiv ='<div class=\"error\" style=\"color:#E30613;\">Cannot be blank <div>'\n $form.find('.form-row-password').append(newDiv);\n return;\n }\n\n var data = $form.serialize();\n url = util.appendParamsToUrl(url,{'emailid':emailid , 'password':pwd, 'redirecttjcplusactivation':true});\n $.ajax({\n url: url,\n type: 'POST',\n data: data,\n success: function (response) {\n var parseResponse = JSON.parse(response);\n if (parseResponse.loginstatus && !parseResponse.tvcustomer){\n if(!parseResponse.isTJCPlusMember){\n if($('a.tjcplus-activation-login').length > 0){\n var plusanchor = $('a.tjcplus-activation-login');\n plusanchor.addClass(\"tjcplus-activation\");\n plusanchor.removeClass(\"tjcplus-activation-login\");\n initializeEvents();\n $(\".sticky-desktop-check .tjcplus-activation\").trigger('click');\n }\n }else{\n $('.plus-subscription-class').remove();\n }\n\n if(pageContext.ns == 'product'){\n window.location.reload();\n }\n else{\n $( \".header .header-inner\" ).load(\" .header-inner > *\" );\n $( \".search-result-content #search-result-items\" ).load(\" #search-result-items > *\" );\n $( \"#ra-details-wrapper .ra-details-bottom\" ).load(\" .ra-details-bottom > *\" );\n $( \".main-wrapper #ajaxRefresh\" ).load(\" #ajaxRefresh > *\" );\n $( \".main-wrapper .cart\" ).load(\" .cart > *\" );\n $( \".main-wrapper .plus-delivery-message\" ).load(\" .plus-delivery-message > *\" );\n\n $('.product-wishlist-link').removeClass('login-class');\n $('.wishlist-button').removeClass('sigin-model-button');\n $( \".main-wrapper #product-content-wrapper\" ).load(\" #product-content-wrapper > *\" );\n if (window.dialog) {\n window.dialog.close();\n }\n }\n }\n else if(parseResponse.loginstatus && parseResponse.tvcustomer){\n var prevUrl = window.location.href;\n prevUrl = util.appendParamsToUrl(prevUrl,{'redirecttjcplusactivation':true, 'tjcpluspid':$('input[name=\"subscription-product\"]:checked').val()});\n\n window.location.href = util.appendParamsToUrl(Urls.setnewPassword,{'emailid':emailid , 'PasswordResetEmail': parseResponse.PasswordResetEmail, 'prevUrl' : prevUrl});\n }\n else {\n if ($form.find('.login-error-message').hasClass('d-none')){\n $form.find('.login-error-message').removeClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-content').addClass('d-none')\n }\n if (!$('.newsignin-box-inner .guest-checkout-button').hasClass('d-none')){\n $('.newsignin-box-inner .guest-checkout-button').addClass('d-none')\n }\n if ($form.find('.form-row-password .error').length > 0){\n $form.find('.form-row-password .error').remove();\n }\n var newDiv ='<div class=\"error\" style=\"color:#E30613;\">The password is incorrect<div>'\n $form.find('.form-row-password').append(newDiv);\n\n }\n }\n });\n});\n}\n\nfunction forgotPwdClick() {\n$('.forgot-pin a, .resend-button .button,forgotpw-button a').on('click',function(e){\n e.preventDefault();\n var url = Urls.forgotPassword;\n var $form = $(this).closest('form');\n var emailid = $form.find('.email-value').text();\n url = util.appendParamToURL(url,'emailid',emailid);\n $.ajax({\n url: url,\n type: 'POST',\n success: function (response) {\n var parseResponse = JSON.parse(response);\n if (parseResponse.mailHasSend){\n enteredWrongEmail();\n if ($form.find('.forgotpw-title').hasClass('d-none')){\n $form.find('.forgotpw-title').removeClass('d-none');\n }\n if ($form.find('.forgotpw-content').hasClass('d-none')) {\n $form.find('.forgotpw-content').removeClass('d-none');\n }\n if (!$form.find('.checkpw-content .edit-button').hasClass('d-none')){\n $form.find('.checkpw-content .edit-button').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-content').addClass('d-none');\n }\n if (!$form.find('.checkpw-content').hasClass('d-none')){\n $form.find('.checkpw-content').addClass('d-none');\n }\n if (!$form.find('.checkpw-button').hasClass('d-none')){\n $form.find('.checkpw-button').addClass('d-none');\n }\n if ($form.find('.forgotpw-button').hasClass('d-none')){\n $form.find('.forgotpw-button').removeClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkpw-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkpw-title').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-title').addClass('d-none')\n }\n if (!$form.find('.form-row-password').hasClass('d-none')){\n $form.find('.form-row-password').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkemail-content').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-content').addClass('d-none')\n }\n if ($('.newsignin-box-inner .guest-checkout-button').hasClass('d-none')){\n $('.newsignin-box-inner .guest-checkout-button').removeClass('d-none')\n }\n } else {\n $form.find('.login-error-message').removeClass('d-none');\n }\n\n $('.pwemail').html(emailid);\n }\n });\n});\n}\n\n/**Start - Script to display the modal popup in registration page when you click \"Shopped on our TV channel but not on our website?\" **/\n$( \"#tvconnect-modelbox\" ).dialog({\nautoOpen: false,\ndialogClass: \"tvconnectdialog\",\nmodal: true,\nheight: 'auto',\nresizable: true,\n});\n\n$( \"#tvconnect\" ).click(function() {\n$(this).closest('form');\n$( \"#tvconnect-modelbox\" ).dialog( \"open\" );\n});\n\nfunction editbuttonclick() {\n$('body').on('click','.returning-customers form .checkpw-content .edit-button, .wrong-email-link', function(e){\n var $form1 = $(this).closest('form');\n if (!$form1.find('.checkpw-content').hasClass('d-none')){\n $form1.find('.checkpw-content').addClass('d-none');\n }\n if ($form1.find('.checkemail-field').hasClass('d-none')){\n $form1.find('.checkemail-field').removeClass('d-none');\n }\n if (!$form1.find('.form-row-password').hasClass('d-none')){\n $form1.find('.form-row-password').addClass('d-none');\n }\n if ($form1.find('.form-row-button .checkemail-button').hasClass('d-none')){\n $form1.find('.form-row-button .checkemail-button').removeClass('d-none');\n }\n if (!$form1.find('.checkpw-button').hasClass('d-none')){\n $form1.find('.checkpw-button').addClass('d-none');\n }\n if (!$('.newsignin-box-inner .checkpw-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkpw-title').addClass('d-none');\n }\n if ($('.newsignin-box-inner .checkemail-title').hasClass('d-none')){\n $('.newsignin-box-inner .checkemail-title').removeClass('d-none')\n }\n if (!$form1.find('.forgotpw-title').hasClass('d-none')){\n $form1.find('.forgotpw-title').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-content').hasClass('d-none')) {\n $form1.find('.forgotpw-content').addClass('d-none');\n }\n if (!$form1.find('.guest-checkout-button').hasClass('d-none')) {\n $form1.find('.guest-checkout-button').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-button').hasClass('d-none')){\n $form1.find('.forgotpw-button').addClass('d-none');\n }\n $.each($form1.find('.error'),function(){$(this).remove()});\n});\n}\n/**End**/\n\nfunction enteredWrongEmail() {\n$('body').on('click','.guest-checkout-button a', function(e){\n var $form1 = $(this).closest('form');\n if ($('.checkemail-title').hasClass('d-none')){\n $('.checkemail-title').removeClass('d-none');\n }\n if ($('.checkemail-content').hasClass('d-none')){\n $('.checkemail-content').removeClass('d-none');\n }\n if ($('.edit-button').hasClass('d-none')){\n $('.edit-button').removeClass('d-none');\n }\n if ($form1.find('.checkemail-button').hasClass('d-none')){\n $form1.find('.checkemail-button').removeClass('d-none');\n }\n if ($form1.find('.checkemail-field').hasClass('d-none')){\n $form1.find('.checkemail-field').removeClass('d-none');\n }\n if (!$form1.find('.forgotpw-title').hasClass('d-none')){\n $form1.find('.forgotpw-title').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-content').hasClass('d-none')) {\n $form1.find('.forgotpw-content').addClass('d-none');\n }\n if (!$form1.find('.forgotpw-button').hasClass('d-none')){\n $form1.find('.forgotpw-button').addClass('d-none');\n }\n});\n}\n\nfunction disguisePassword(){\n$('.icon-password').off('click').on('click', function () {\n var $this = $(this), $passwordField = $this.closest('.form-row-password').find('.input-text');\n\n if (!$this.hasClass('show')) {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'password');\n } else {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'text');\n }\n $this.toggleClass('show');\n});\n}\n\n\nfunction menuclick(){\n$(document).ready(function(){\n$('.menu-category li .menu-item-toggle').unbind().click(function (e) {\n e.preventDefault();\n var $parentLi = $(e.target).closest('li');\n $parentLi.siblings('li.active').removeClass('active').find('.menu-item-toggle.active').click()\n .removeClass('fa-minus active').addClass('fa-plus');\n $parentLi.toggleClass('active');\n $(e.target).toggleClass('active');\n if ($(e.target).hasClass('fa-minus') || $(e.target).hasClass('fa-plus')){\n $(e.target).toggleClass('fa-plus fa-minus');\n }\n});\n\n});\n}\n\n\nexports.init = function () {\n initializeEvents();\n};", "'use strict';\n\n/**\n * @function\n * @description Initializes the tooltip-content and layout\n */\nexports.init = function () {\n $(document).tooltip({\n items: '.tooltip',\n track: true,\n content: function () {\n return $(this).find('.tooltip-content').html();\n }\n });\n};\n", "/**\n * This module is used to initialize [UniformJS]{@link https://uniformjs.com/}.\n */\n'use strict';\n\nmodule.exports = function () {\n var sUniformStyled = 'uniformstyled';\n $(['input:checkbox', 'input:radio', '.opc .existing-card-section #existing-paysafe-card']).each(function () {\n $(this + ':not(.' + sUniformStyled + ')').not('.no-uniform').addClass(sUniformStyled).uniform();\n });\n};", "/* global Countries */\n/*jslint nomen: true */\n\n'use strict';\n\nvar util = {\n /**\n * @function\n * @description adds generic toggle functionality to all .toggle in a container\n * @param {jQuery Object} $target The target container for this, defaults to document\n */\n addToggleEvents: function ($target) {\n if ($target === null || $target === undefined) {\n $target = $(document);\n }\n var refinementFlag = false;\n $target.find('.toggle').on('click', function () {\n var $toggleTrigger = $(this),\n $toggleContent = $toggleTrigger.next('.toggle-content');\n $toggleTrigger.add($toggleContent).toggleClass('expanded').toggleClass('collapsed');\n $toggleContent.slideToggle();\n }).each(function (length, value) {\n var $this = $(this),\n $toggleContent = $this.next('.toggle-content');\n if($this.hasClass('refinement-headline') && $this.is(\":visible\")){\n if(refinementFlag){\n //$this.removeClass('expanded').addClass('collapsed');\n $this.add($toggleContent).removeClass('expanded').addClass('collapsed');\n $toggleContent.hide();\n }else{\n refinementFlag = true;\n }\n }\n });\n },\n /**\n * @function\n * @description appends the parameter with the given name and value to the given url and returns the changed url\n * @param {String} url the url to which the parameter will be added\n * @param {String} name the name of the parameter\n * @param {String} value the value of the parameter\n */\n appendParamToURL: function (url, name, value) {\n // quit if the param already exists\n if (url.indexOf(name + '=') !== -1) {\n return url;\n }\n var separator = url.indexOf('?') !== -1 ? '&' : '?';\n return url + separator + name + '=' + encodeURIComponent(value);\n },\n /**\n * @function\n * @description appends the parameters to the given url and returns the changed url\n * @param {String} url the url to which the parameters will be added\n * @param {Object} params\n */\n appendParamsToUrl: function (url, params) {\n var theUrl = url;\n $.each(params, function (name, value) {\n theUrl = this.appendParamToURL(theUrl, name, value);\n }.bind(this));\n return theUrl;\n },\n isString: function(value) {\n return typeof value == 'string' || Object.prototype.toString.call(value) === '[object String]';\n },\n /**\n * @param val\n * @returns {*|boolean}\n */\n isMergeableObject: function(val) {\n var nonNullObject = val && typeof val === 'object';\n return nonNullObject &&\n Object.prototype.toString.call(val) !== '[object RegExp]' &&\n Object.prototype.toString.call(val) !== '[object Date]';\n },\n /**\n * @param val\n * @returns {*}\n */\n emptyTarget: function(val) {\n return Array.isArray(val) ? [] : {}\n },\n /**\n * @param value\n * @param optionsArgument\n * @returns {*}\n */\n cloneIfNecessary: function(value, optionsArgument) {\n var clone = optionsArgument && optionsArgument.clone === true;\n return (clone && this.isMergeableObject(value)) ? this.merge(this.emptyTarget(value), value, optionsArgument) : value;\n },\n /**\n * @param target\n * @param source\n * @param optionsArgument\n * @returns {*}\n */\n defaultArrayMerge: function(target, source, optionsArgument) {\n var destination = target.slice();\n source.forEach(function (e, i) {\n if (typeof destination[i] === 'undefined') {\n destination[i] = this.cloneIfNecessary(e, optionsArgument);\n } else if (this.isMergeableObject(e)) {\n destination[i] = this.merge(target[i], e, optionsArgument);\n } else if (target.indexOf(e) === -1) {\n destination.push(this.cloneIfNecessary(e, optionsArgument));\n }\n });\n return destination;\n },\n /**\n * @param target\n * @param source\n * @param optionsArgument\n * @returns {{}}\n */\n mergeObject: function (target, source, optionsArgument) {\n var destination = {};\n if (this.isMergeableObject(target)) {\n Object.keys(target).forEach(function (key) {\n destination[key] = util.cloneIfNecessary(target[key], optionsArgument)\n })\n }\n Object.keys(source).forEach(function (key) {\n if (!util.isMergeableObject(source[key]) || !target[key]) {\n destination[key] = util.cloneIfNecessary(source[key], optionsArgument)\n } else {\n destination[key] = util.merge(target[key], source[key], optionsArgument)\n }\n });\n return destination\n },\n /**\n * @param target\n * @param source\n * @param optionsArgument\n * @returns {*}\n */\n merge: function(target, source, optionsArgument) {\n var array = Array.isArray(source);\n var options = optionsArgument || {arrayMerge: this.defaultArrayMerge};\n var arrayMerge = options.arrayMerge || this.defaultArrayMerge;\n if (array) {\n return Array.isArray(target) ? arrayMerge(target, source, optionsArgument) : this.cloneIfNecessary(source, optionsArgument);\n } else {\n return this.mergeObject(target, source, optionsArgument);\n }\n },\n without: function(array, elements) {\n var newArray = [];\n for(var el in array) {\n if (elements.indexOf(el) === -1) {\n newArray.push(el);\n }\n }\n return newArray;\n },\n /**\n * @function\n * @description extract the query string from URL\n * @param {String} url the url to extra query string from\n **/\n getQueryString: function (url) {\n var qs,\n a;\n if (!this.isString(url)) {\n return undefined;\n }\n a = document.createElement('a');\n a.href = url;\n if (a.search) {\n qs = a.search.substr(1); // remove the leading ?\n }\n return qs;\n },\n /**\n * @function\n * @description\n * @param {String}\n */\n elementInViewport: function (el) {\n var rect = el.getBoundingClientRect();\n return (\n rect.top >= 0 &&\n rect.left >= 0 &&\n rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&\n rect.right <= (window.innerWidth || document.documentElement.clientWidth)\n );\n },\n\n /**\n * @function\n * @description Appends the parameter 'format=ajax' to a given path\n * @param {String} path the relative path\n */\n ajaxUrl: function (path) {\n return this.appendParamToURL(path, 'format', 'ajax');\n },\n\n /**\n * @function\n * @description\n * @param {String} url\n */\n toAbsoluteUrl: function (url) {\n if (url.indexOf('http') !== 0 && url.charAt(0) !== '/') {\n url = '/' + url;\n }\n return url;\n },\n /**\n * @function\n * @description Loads css dynamically from given urls\n * @param {Array} urls Array of urls from which css will be dynamically loaded.\n */\n loadDynamicCss: function (urls) {\n var i, len = urls.length;\n for (i = 0; i < len; i++) {\n this.loadedCssFiles.push(this.loadCssFile(urls[i]));\n }\n },\n\n /**\n * @function\n * @description Loads javascript files dynamically from given url\n * @param {String} url The url from which css file will be dynamically loaded.\n */\n loadScripts: function (scripts) {\n for (var index = 0; index < scripts.length; index++) {\n var element = scripts[index];\n var script = document.createElement('script');\n script.src = element;\n script.async = false;\n document.body.appendChild( script );\n }\n },\n\n /**\n * @function\n * @description Loads css file dynamically from given url\n * @param {String} url The url from which css file will be dynamically loaded.\n */\n loadCssFile: function (url) {\n return $('<link/>').appendTo($('head')).attr({\n type: 'text/css',\n rel: 'stylesheet'\n }).attr('href', url); // for i.e. <9, href must be added after link has been appended to head\n },\n // array to keep track of the dynamically loaded CSS files\n loadedCssFiles: [],\n\n /**\n * @function\n * @description Removes all css files which were dynamically loaded\n */\n clearDynamicCss: function () {\n var i = this.loadedCssFiles.length;\n while (i-- < 0) {\n $(this.loadedCssFiles[i]).remove();\n }\n this.loadedCssFiles = [];\n },\n /**\n * @function\n * @description Extracts all parameters from a given query string into an object\n * @param {String} qs The query string from which the parameters will be extracted\n */\n getQueryStringParams: function (qs) {\n if (!qs || qs.length === 0) {\n return {};\n }\n var params = {},\n unescapedQS = decodeURIComponent(qs);\n // Use the String::replace method to iterate over each\n // name-value pair in the string.\n /*jslint unparam: true */\n unescapedQS.replace(new RegExp('([^?=&]+)(=([^&]*))?', 'g'),\n function ($0, $1, $2, $3) {\n params[$1] = $3;\n });\n /*jslint unparam: false */\n return params;\n },\n\n fillAddressFields: function (address, $form) {\n var field;\n for (field in address) {\n if (address.hasOwnProperty(field)) {\n /*jslint continue: true */\n if (field === 'ID' || field === 'UUID' || field === 'key') {\n continue;\n }\n /*jslint continue: false */\n // if the key in address object ends with 'Code', remove that suffix\n // keys that ends with 'Code' are postalCode, stateCode and countryCode\n $form.find('[name$=\"' + field.replace('Code', '') + '\"]').val(address[field]);\n // update the state fields\n if (field === 'countryCode') {\n $form.find('[name$=\"country\"]').trigger('change');\n // retrigger state selection after country has changed\n // this results in duplication of the state code, but is a necessary evil\n // for now because sometimes countryCode comes after stateCode\n $form.find('[name$=\"state\"]').val(address.stateCode);\n }\n }\n }\n },\n /**\n * @function\n * @description Adds a error message to a form\n * @param {jQueryObject} $form The form\n * @param {String} message The error message\n */\n addGeneralFormError: function ($form, message) {\n var $closeIcon = $('<i/>').addClass('fa fa-times'),\n $closeButton = $('<a/>', {title: 'Close'}).addClass('button button-icon button-transparent'),\n $messageContent = $('<div/>').addClass('message-content').text(message),\n $messageInner = $('<div/>').addClass('message-inner'),\n $messageErrorForm = $('<div/>').addClass('message error-form');\n\n $closeButton.append($closeIcon);\n $messageContent.append($closeButton);\n $messageInner.append($messageContent);\n $messageErrorForm.append($messageInner).hide();\n $form.find('.message.error-form').remove();\n $messageErrorForm.prependTo($form).fadeIn();\n },\n /**\n * @function\n * @description Removes the error message to a form\n * @param {jQueryObject} $form The form\n */\n removeGeneralFormError: function ($form) {\n $form.find('.message.error-form').remove();\n },\n /**\n * @function\n * @description Updates the states options to a given country\n * @param {String} countrySelect The selected country\n */\n updateStateOptions: function (form) {\n var $form = $(form),\n $country = $form.find('select[id$=\"_country\"]'),\n country = Countries[$country.val()],\n arrHtml = [],\n $stateField,\n $postalField,\n $stateLabel,\n $postalLabel,\n prevStateValue,\n s,\n o1;\n if ($country.length === 0 || !country) {\n return;\n }\n $stateField = $country.data('stateField') || $form.find('select[name$=\"_state\"]');\n $postalField = $country.data('postalField') || $form.find('input[name$=\"_postal\"]');\n $stateLabel = ($stateField.length > 0) ? $form.find('label[for=\"' + $stateField[0].id + '\"] span')\n .not('.required-indicator') : undefined;\n $postalLabel = ($postalField.length > 0) ? $form.find('label[for=\"' + $postalField[0].id + '\"] span')\n .not('.required-indicator') : undefined;\n prevStateValue = $stateField.val();\n // set the label text\n if ($postalLabel) {\n $postalLabel.html(country.postalLabel);\n }\n if ($stateLabel) {\n $stateLabel.html(country.regionLabel);\n } else {\n return;\n }\n for (s in country.regions) {\n if (country.regions.hasOwnProperty(s)) {\n arrHtml.push('<option value=\"' + s + '\">' + country.regions[s] + '</option>');\n }\n }\n // clone the empty option item and add to stateSelect\n o1 = $stateField.children().first().clone();\n $stateField.html(arrHtml.join('')).removeAttr('disabled').children().first().before(o1);\n // if a state was selected previously, save that selection\n if (prevStateValue && $.inArray(prevStateValue, country.regions)) {\n $stateField.val(prevStateValue);\n } else {\n $stateField[0].selectedIndex = 0;\n }\n },\n /**\n * @function\n * @description Updates the number of the remaining character\n * based on the character limit in a text area\n */\n limitCharacters: function () {\n $('form').find('textarea[data-character-limit]').each(function () {\n var characterLimit = $(this).data('character-limit'),\n charCountHtml = String.format(Resources.CHAR_LIMIT_MSG,\n '<span class=\"char-remain-count\">' + characterLimit + '</span>',\n '<span class=\"char-allowed-count\">' + characterLimit + '</span>'),\n charCountContainer = $(this).next('div.char-count');\n if (charCountContainer.length === 0) {\n charCountContainer = $('<div class=\"char-count\"/>').insertAfter($(this));\n }\n charCountContainer.html(charCountHtml);\n // trigger the keydown event so that any existing character data is calculated\n $(this).change();\n });\n },\n /**\n * @function\n * @description Binds the onclick-event to a delete button on a given container,\n * which opens a confirmation box with a given message\n * @param {String} container The name of element to which the function will be bind\n * @param {String} message The message the will be shown upon a click\n */\n setDeleteConfirmation: function (container, message) {\n /*eslint-disable no-alert */\n $(container).on('click', '.delete', function () {\n return window.confirm(message);\n });\n /*eslint-enable no-alert */\n },\n /**\n * @function\n * @description Scrolls a browser window to a given x point\n * @param {String} The x coordinate\n */\n scrollBrowser: function (xLocation) {\n $('html, body').animate({scrollTop: xLocation}, 500);\n },\n\n isMobile: function () {\n if ($(window).width() < 767) {\n return true;\n }\n var mobileAgentHash = ['mobile', 'tablet', 'phone', 'ipad', 'ipod', 'android', 'blackberry', 'windows ce',\n 'opera mini', 'palm'],\n idx = 0,\n isMobile = false,\n userAgent = (navigator.userAgent).toLowerCase();\n\n while (mobileAgentHash[idx] && !isMobile) {\n isMobile = (userAgent.indexOf(mobileAgentHash[idx]) >= 0);\n idx++;\n }\n return isMobile;\n },\n\n timer: function () {\n var id,\n clear;\n clear = function () {\n if (id) {\n window.clearTimeout(id);\n id = null;\n }\n };\n return {\n clear: clear,\n start: function (duration, callback) {\n clear();\n id = setTimeout(callback, duration);\n }\n };\n },\n\n getCountrySettings : function (countryCode) {\n var i;\n if (Countries === undefined || Countries === null || typeof Countries !== 'object') {\n return null;\n }\n\n for (i in Countries) {\n if (Countries.hasOwnProperty(i)) {\n if (Countries[i].code === countryCode) {\n return Countries[i];\n }\n }\n }\n\n return null;\n },\n disguisePassword : function () {\n $('.icon-password').on('click', function () {\n var $this = $(this), $passwordField = $this.closest('.form-row-password').find('.input-text');\n\n if (!$this.hasClass('show')) {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'password');\n } else {\n $passwordField.removeAttr('type');\n $passwordField.prop('type', 'text');\n }\n $this.toggleClass('show');\n });\n },\n closeHandlerForErrorMessages : function () {\n $('.message.error-form').on('click', function () {\n $(this).remove();\n });\n },\n /**\n * @function\n * @description Get parameter value from URL\n * @param {String} \"name\" parameter for which the value need to get\n * @param {String} \"url\" parameter from where the value must be fetched\n * @param {String} \"results\" parameter returns the value of the respective name\n */\n getParamFromUrl: function (name, url) {\n var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);\n if(results != null){\n if(results.length > 0){\n return results[1];\n }\n }\n return 0;\n },\n /**\n * @function toggleEvent\n * @description toggle events\n */\n toggleEvent: function () {\n $(document).on('click', '[data-toggle]', function () {\n var $targetContent = $('#' + $(this).attr('data-toggle-element')),\n $slideEvent = $(this).attr('data-toggle-slide'),\n $arrow = $(this).find('[data-toggle-arrow=\"true\"]'),\n $expandtrue = $targetContent.attr('data-toggle-expand');\n if ($expandtrue != 'false') {\n $slideEvent !== 'false' && $slideEvent !== undefined ? $targetContent.slideUp() : '';\n $targetContent.attr('data-toggle-expand', 'false');\n $(this).attr('data-toggle', 'collapsed');\n $arrow.removeClass('fa-chevron-up');\n } else {\n $slideEvent !== 'false' && $slideEvent !== undefined ? $targetContent.slideDown() : '';\n $targetContent.attr('data-toggle-expand', 'true');\n $(this).attr('data-toggle', 'expanded');\n $arrow.addClass('fa-chevron-up');\n }\n });\n },\n setCookie: function(cname, cvalue, exdays, expiresDate) {\n var d = new Date();\n d.setTime(d.getTime() + (exdays*24*60*60*1000));\n var expires = \"expires=\"+ d.toUTCString();\n if (expiresDate) {\n expires = \"expires=\"+ expiresDate;\n }\n document.cookie = cname + \"=\" + cvalue + \";\" + expires + \";path=/\";\n },\n getCookie: function(cname) {\n var name = cname + \"=\";\n var decodedCookie = decodeURIComponent(document.cookie);\n var ca = decodedCookie.split(';');\n for(var i = 0; i <ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) == ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length);\n }\n }\n return \"\";\n },\n deleteCookie: function(name) {\n document.cookie = [name, '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=.', window.location.host.toString()].join('');\n },\n showPopup: function(cname, cvalue, exhours) {\n var d = new Date();\n d.setTime(d.getTime() + (exhours*60*60*1000));\n var expires = \"expires=\"+ d.toUTCString();\n document.cookie = cname + \"=\" + cvalue + \";\" + expires + \";path=/\";\n },\n /**\n * @function\n * @description get the name of the browser\n */\n browsername:function () {\n if((navigator.userAgent.indexOf(\"Opera\") || navigator.userAgent.indexOf('OPR')) != -1 ) {\n return 'Opera';\n } else if(navigator.userAgent.indexOf(\"Chrome\") != -1 ) {\n return 'Chrome';\n } else if(navigator.userAgent.indexOf(\"Safari\") != -1) {\n return 'Safari';\n } else if(navigator.userAgent.indexOf(\"Firefox\") != -1 ){\n return 'Firefox';\n } else if((navigator.userAgent.indexOf(\"MSIE\") != -1 ) || (!!document.documentMode == true )) {\n return 'IE';//crap\n } else {\n return 'Unknown';\n }\n },\n /**\n * @function\n * @description custom select box\n */\n customSelectBox: function () {\n $('select:not(.non-custom-select)').each(function () {\n // Cache the number of options\n var $this = $(this),\n numberOfOptions = $(this).children('option').length;\n\n var a = $(this).find('option:selected').text();\n\n // Hides the select element\n $this.addClass('s-hidden');\n\n // Wrap the select element in a div\n $this.wrap('<div class=\"select\"></div>');\n\n\n // Insert a styled div to sit over the top of the hidden select element\n $this.after('<div class=\"styledSelect\"></div>');\n\n\n // Cache the styled div\n var $styledSelect = $this.next('div.styledSelect');\n\n // Show the first select option in the styled div\n $styledSelect.html($(this).find('option:selected').text());\n\n if($(this).closest('.select').find('.styledSelect').text().indexOf('Select')!=0) {\n $(this).closest('.select').find('.styledSelect').addClass('engravefield-disabled');\n }\n\n if ($this.next('div.styledSelect').text().indexOf('Select')==0) {\n $this.next('div.styledSelect').find('.soldout-text').hide();\n }\n\n\n // Insert an unordered list after the styled div and also cache the list\n var $list = $('<ul />', {\n 'class': 'options'\n }).insertAfter($styledSelect);\n\n\n // Insert a list item into the unordered list for each select option\n for (var i = 0; i < numberOfOptions; i++) {\n $('<li />', {\n text: $this.children('option').eq(i).text(),\n rel: $this.children('option').eq(i).val()\n }).appendTo($list);\n }\n\n if ($(this).closest('.engraving-form').length > 0) {\n $list.find('li').each(function (i) {\n $(this).html($(this).text());\n });\n $('.soldout-text').closest('li').addClass('disabledLi');\n //$list.find('li:first').removeClass('disabledLi');\n //$list.find('li:first .soldout-text').hide();\n // $styledSelect.html($(this).find('option:selected').text());\n }\n\n // Cache the list items\n var $listItems = $list.children('li');\n\n // Show the unordered list when the styled div is clicked (also hides it if the div is clicked again)\n $styledSelect.click(function (e) {\n e.stopPropagation();\n $('body').addClass('selectopen');\n $this.after('<div class=\"overlaybg\"></div>');\n $('.options li:first-child').before('<div class=\"select-close\"></div>');\n $('div.styledSelect.active').each(function () {\n $(this).removeClass('active').next('.optiongroup').hide();\n });\n $(this).toggleClass('active').next('.optiongroup').toggle();\n\n });\n\n // Hides the unordered list when a list item is clicked and updates the styled div to show the selected list item\n // Updates the select element to have the value of the equivalent option\n $listItems.click(function (e) {\n if($(this).hasClass('disabledLi')) {\n return false;\n }\n e.stopPropagation();\n $('body').removeClass('selectopen');\n $('.overlaybg').remove();\n $('.select-close').remove();\n $styledSelect.text($(this).text()).removeClass('active');\n $this.val($(this).attr('rel'));\n $list.hide();\n $('.optiongroup').hide();\n $(this).closest('.select').find('select').trigger(\"change\");\n\n\n });\n\n // Hides the unordered list when clicking outside of it\n $('#wrapper').click(function () {\n $('.styledSelect').removeClass('active');\n $list.hide();\n $('.optiongroup').hide();\n $('body').removeClass('selectopen');\n $('.overlaybg').remove();\n $('.select-close').remove();\n\n\n });\n\n $('#qb-activation-page').click(function () {\n $('.styledSelect').removeClass('active');\n $list.hide();\n $('.optiongroup').hide();\n $('body').removeClass('selectopen');\n $('.overlaybg').remove();\n $('.select-close').remove();\n\n });\n\n\n $(\".styledSelect\").on(\"click\", function(){\n $(this).siblings('select').trigger('blur');\n });\n\n $(\".options li\").on(\"click\", function(){\n $(this).parents().siblings('select').trigger('blur');\n });\n\n });\n\n $('ul.options').wrap('<div class=\"optiongroup\"></div>');\n\n // Restrict more select append\n if( $('.select > .select')) {\n $('.select').closest('.select').siblings('.styledSelect').remove();\n $('.select').closest('.select').siblings('.optiongroup').remove();\n\n }\n\n // Auto fucts when text box having a value\n $(\".input-text\").each(function () {\n if( $(this).val().length > 0 ) {\n $(this).siblings(\".label\").addClass('focus-active');\n }\n\n });\n },\n toast: function(element, options) {\n var fade = options && options.fade ? options.fade : 600;\n var duration = options && options.duration ? options.duration: 3000;\n var shake = options && options.shake ? options.shake : false;\n\n if (element) {\n element.addClass('toast-show');\n element.fadeIn(fade);\n if (shake) {\n element.addClass('shake');\n }\n };\n\n setTimeout(function() {\n element.fadeOut(fade || 600, function() {\n element.removeClass('toast-show');\n if (shake) {\n element.removeClass('shake');\n }\n });\n }, duration);\n },\n debounce: function(func, delay, options) {\n var timerId;\n var shouldInvoke;\n var leading = options && options.leading;\n \n return function() {\n var args = Array.prototype.slice.call(arguments);\n shouldInvoke = true;\n \n if (!timerId && leading) {\n func.apply(this, args);\n shouldInvoke = false;\n }\n \n clearTimeout(timerId);\n \n timerId = setTimeout(function() {\n if (shouldInvoke) {\n func.apply(this, args);\n }\n }, delay);\n };\n }\n};\n\nutil.executeJqueryReadyCallbacks = function () {\n if (window.jqueryReadyCallbacks && $.isArray(window.jqueryReadyCallbacks)) {\n /*jslint unparam: true */\n $.each(window.jqueryReadyCallbacks, function (i, callback) {\n if ($.isFunction(callback)) {\n callback(util);\n }\n });\n /*jslint unparam: false */\n window.jqueryReadyCallbacks = [];\n }\n};\n\nutil.countDownTimer = function(container) {\n var countDownMinutes = container.attr('data-minutes');\n var date = new Date();\n var countDownDate = new Date(date.setMinutes(date.getMinutes() + parseInt(countDownMinutes))).getTime();\n\n function updateTimer() {\n var timer;\n var now = new Date().getTime();\n var distance = countDownDate - now;\n \n if (distance <= 0) {\n distance = 0;\n clearTimeout(timer);\n }\n\n var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));\n var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));\n var seconds = Math.floor((distance % (1000 * 60)) / 1000);\n\n container.find('.hrs').text(('0' + hours).slice(-2));\n container.find('.min').text(('0' + minutes).slice(-2));\n container.find('.sec').text(('0' + seconds).slice(-2));\n\n if (distance > 0) {\n var nextTick = 1000 - (now % 1000);\n timer = setTimeout(updateTimer, nextTick);\n }\n }\n\n setTimeout(updateTimer, 1000 - (new Date().getTime() % 1000));\n}\n\nmodule.exports = util;\n", "'use strict';\n\n/*jslint regexp: true */\nvar naPhone = /^\\(?([2-9][0-8][0-9])\\)?[\\-\\. ]?([2-9][0-9]{2})[\\-\\. ]?([0-9]{4})(\\s*x[0-9]+)?$/,\n regex = {\n phone: {\n us: naPhone,\n ca: naPhone\n },\n mobile: /([0-9]*)$/,\n postal: {\n us: /^\\d{5}(-\\d{4})?$/,\n ca: /^[ABCEGHJKLMNPRSTVXY]{1}\\d{1}[A-Z]{1} *\\d{1}[A-Z]{1}\\d{1}$/,\n gb: new RegExp('^GIR?0AA|[A-PR-UWYZ]([0-9]{1,2}|' +\n '([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])?[0-9][ABD-HJLNP-UW-Z]{2}$')\n },\n email: /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/,\n name: /^[a-zA-Z \\.']*$/,\n orderNumber: /^[A-Za-z0-9]{0,12}$/,\n textArea: /^[a-zA-Z0-9\\s.,?!():]*$/,\n newEmail: /^\\w+([\\.\\-]?\\w+)*@\\w+([\\.\\-]?\\w+)*(\\.\\w{2,3})+$/,\n notCC: /^(?!(([0-9 \\-]){13,19})).*$/\n },\n overrideErrorClass = 'validation-error',\n overrideValidClass = 'validation-success',\n settings = {\n // global form validator settings\n errorElement: 'div',\n errorClass: 'error-msg',\n highlight: function (element) {\n $(element).closest('.form-row').addClass(overrideErrorClass);\n $(element).closest('.form-row').removeClass(overrideValidClass);\n },\n unhighlight: function (element) {\n if (element.value.trim() !== '') { // Check if input has a value\n var $errorMsg = $(element).closest('.form-row').find('.error-msg');\n if (!$errorMsg.hasClass('custom-error')) {\n $(element).closest('.form-row').removeClass(overrideErrorClass).addClass(overrideValidClass);\n $errorMsg.remove();\n }\n }\n },\n errorPlacement: function (error, element) {\n if (element.parents('.form-row-birthdate').length > 0) {\n element.parents('.form-row-birthdate > .field').append(error);\n } else {\n element.parents('.form-row:not(.form-row-float) > .field').find('.error-msg').remove();\n element.parents('.form-row:not(.form-row-float) > .field').append(error);\n }\n\n if ($('.registration-alt').length > 0) {\n var top = (element.outerHeight() / 2) - (error.outerHeight() / 2),\n right = -(error.outerWidth() + 25),\n position = 'absolute',\n $fieldset = error.closest('fieldset'),\n errorSiblings = error.siblings('.form-row-float'),\n aClass = 'a' + (Math.random() + 1).toString(36).substring(7),\n arrowRight;\n\n if (element.parents('.form-row-with-button').length > 0) {\n right -= element.parents('.form-row-with-button').find('.button-container').outerWidth() + 10;\n }\n\n error.css('position', position);\n error.css('top', top);\n error.css('right', right);\n error.addClass(aClass);\n\n setTimeout(function () {\n if (($fieldset.position().left + $fieldset.outerWidth() - 10) <\n (error.position().left + error.outerWidth())) {\n error.css('position', 'relative');\n error.css('right', 0);\n error.addClass('error-msg-mobile');\n\n if (element.parents('.form-row-with-button').length > 0) {\n error.css('margin-top', -10);\n }\n\n if (element.parents('.form-row-with-button').length > 0) {\n element.parents('.form-row-with-button').parent().append(error);\n }\n\n if (errorSiblings.length > 0) {\n error.parent().parent().append(error);\n }\n\n if (element.parents('.form-row-birthdate').length > 0) {\n error.parent().parent().append(error);\n }\n\n arrowRight = ((error.outerWidth() / 2) - 5);\n } else {\n arrowRight = (error.outerWidth() - 10);\n }\n\n $('<style>.' + aClass + ':before {right: ' +\n arrowRight + 'px !important;}</style>').appendTo('head');\n }, 1);\n }\n },\n showErrors: function () {\n this.defaultShowErrors();\n\n //$('.error-msg').each(function () {\n //var $this = $(this);\n\n //if ($this.find('.close-icon').length === 0) {\n //$this.append('<span class=\"close-icon fa fa-times\"></span>');\n //}\n //});\n },\n onkeyup: false,\n onfocusout: function (element) {\n if (!this.checkable(element)) {\n this.element(element);\n }\n }\n };\n/*jslint regexp: false */\n\n/**\n * @function\n * @description Validates a given phone number against the countries phone regex\n * @param {String} value The phone number which will be validated\n * @param {String} el The input field\n */\nvar validatePhone = function (value) {\n return value.trim() === '' || ($.isNumeric(value) && value.trim().length === 11);\n};\n\n/**\n * @function\n * @description Validates a given phone number against the countries phone regex\n * @param {String} value The phone number which will be validated\n * @param {String} el The input field\n */\n var validatePhoneWithSeven = function (value) {\n var reg = new RegExp('^(?=0[7])\\\\d{11}$', 'i');\n return value.trim() === '' || (reg.test(value.trim()) && value.trim().length === 11);\n};\n\n/**\n * @function\n * @description Validates a given mobile number against the UK mobile regex\n * @param {String} value The mobile number which will be validated\n * @param {String} el The input field\n */\nvar validateMobile = function (value) {\n return value.trim() === '' || (regex.mobile.test(value.trim()) && value.trim().length === 11);\n};\n\n/**\n * @function\n * @description Validates a given email\n * @param {String} value The email which will be validated\n * @param {String} el The input field\n */\nvar validateEmail = function (value, el) {\n var isOptional = this.optional(el),\n isValid = regex.email.test($.trim(value));\n return isOptional || isValid;\n};\n\n/**\n * @function\n * @description Validates a given name\n * @param {String} value The name which will be validated\n * @param {String} el The input field\n */\nvar validateName = function (value, el) {\n var isOptional = this.optional(el),\n isValid = regex.name.test($.trim(value));\n return isOptional || isValid;\n};\n\n/**\n * @function\n * @description Validates a given order number\n * @param {String} value The order number which will be validated\n * @param {String} el The input field\n */\nvar validateOrderNumber = function (value, el) {\n var isOptional = this.optional(el),\n isValid = regex.orderNumber.test($.trim(value));\n return isOptional || isValid;\n};\n\n/**\n * @function\n * @description Validates a given text area\n * @param {String} value Text area which will be validated\n * @param {String} el Text area\n */\nvar validateTextArea = function (value, el) {\n var isOptional = this.optional(el),\n isValid = regex.textArea.test($.trim(value));\n return isOptional || isValid;\n};\n\n/**\n * @function\n * @description Validates a confirmation field against another field\n * @param {String} value The value which will be validated\n * @param {String} el The input field\n */\nvar validateTwoFields = function (value, el) {\n var $otherField = $('.' + $(el).data('crossvalidationclass'));\n return value === $otherField.val();\n};\n\n/**\n * @function\n * @description Validates that a credit card owner is not a Credit card number\n * @param {String} value The owner field which will be validated\n * @param {String} el The input field\n */\nvar validateOwner = function (value) {\n var isValid = regex.notCC.test($.trim(value));\n return isValid;\n};\n\n/**\n * @function\n * @description Validates that a day is valid against the month and the year\n * @param {String} value The owner field which will be validated\n * @param {String} el The input field\n */\nvar validateDay = function (value, el) {\n var daysInMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n $day = $(el),\n $month = $('.' + $day.data('monthclass')),\n $year = $('.' + $day.data('yearclass')),\n isValid = false;\n if (!value && !$month.val() && !$year.val()) {\n isValid = true;\n } else {\n if (!$year.val() || Number($year.val()) % 4 === 0) {\n daysInMonth[2] = 29;\n }\n if (!$month.val()) {\n isValid = true;\n } else if (Number(value) <= daysInMonth[Number($month.val())]) {\n isValid = true;\n }\n }\n return isValid;\n};\n\n/**\n * @function\n * @description Validates month against the day and the year\n * @param {String} value The owner field which will be validated\n * @param {String} el The input field\n */\nvar validateMonth = function (value, el) {\n var $month = $(el),\n $day = $('.' + $month.data('dayclass')),\n $year = $('.' + $month.data('yearclass')),\n isValid = false;\n if ($day.val() || (!$day.val() && !value && !$year.val())) {\n isValid = true;\n this.check($day);\n }\n return isValid;\n};\n\n/**\n * @function\n * @description Validates the year against the day and the month\n * @param {String} value The owner field which will be validated\n * @param {String} el The input field\n */\nvar validateYear = function (value, el) {\n var $year = $(el),\n $day = $('.' + $year.data('dayclass')),\n $month = $('.' + $year.data('monthclass')),\n isValid = false;\n if ($month.val() || (!$day.val() && !$month.val() && !value)) {\n isValid = true;\n this.check($month);\n }\n return isValid;\n};\n\n\n/**\n * Add phone validation method to jQuery validation plugin.\n * Text fields must have 'phone' css class to be validated as phone\n */\n $.validator.addMethod('phonenumberwithseven', validatePhoneWithSeven, Resources.INVALID_MOBILE);\n\n\n/**\n * Add phone validation method to jQuery validation plugin.\n * Text fields must have 'phone' css class to be validated as phone\n */\n$.validator.addMethod('phone', validatePhone, Resources.INVALID_PHONE);\n\n/**\n * Add mobile validation method to jQuery validation plugin.\n * Text fields must have 'mobile' css class to be validated as mobile\n */\n$.validator.addMethod('mobile', validateMobile, Resources.INVALID_MOBILE);\n\n/**\n * Add email validation method to jQuery validation plugin.\n * Text fields must have 'email' css class to be validated as email\n */\n$.validator.addMethod('email', validateEmail, Resources.INVALID_EMAIL);\n\n/**\n * Add name validation method to jQuery validation plugin.\n * Text fields must have 'contactus-name' css class to be validated as name\n */\n$.validator.addMethod('contactus-name', validateName, Resources.INVALID_NAME);\n\n/**\n * Add order number validation method to jQuery validation plugin.\n * Text fields must have 'order-number' css class to be validated\n */\n$.validator.addMethod('order-number', validateOrderNumber, Resources.INVALID_ORDER);\n\n/**\n * Add text validation method to jQuery validation plugin.\n * Text fields must have 'textarea' css class to be validated\n */\n$.validator.addMethod('textarea', validateTextArea, Resources.INVALID_TEXT);\n\n/**\n * Add cross field validation method to jQuery validation plugin.\n * Text fields must have 'email' css class to be validated as email\n */\n$.validator.addMethod('cross-validation', validateTwoFields, Resources.INVALID_MATCH);\n\n/**\n * Add date validation method to jQuery validation plugin.\n * Text fields must have 'day' css class to be validated as day\n */\n$.validator.addMethod('day', validateDay, Resources.INVALID_DAY);\n\n/**\n * Add date validation method to jQuery validation plugin.\n * Text fields must have 'month' css class to be validated as month\n */\n$.validator.addMethod('month', validateMonth, Resources.INVALID_MONTH);\n\n/**\n * Add date validation method to jQuery validation plugin.\n * Text fields must have 'year' css class to be validated as year\n */\n$.validator.addMethod('year', validateYear, Resources.INVALID_YEAR);\n\n/**\n * Add CCOwner validation method to jQuery validation plugin.\n * Text fields must have 'owner' css class to be validated as not a credit card\n */\n$.validator.addMethod('owner', validateOwner, Resources.INVALID_OWNER);\n\n/**\n * Add gift cert amount validation method to jQuery validation plugin.\n * Text fields must have 'gift-cert-amont' css class to be validated\n */\n$.validator.addMethod('gift-cert-amount', function (value, el) {\n var isOptional = this.optional(el),\n isValid = (!isNaN(value)) && (parseFloat(value) >= 5) && (parseFloat(value) <= 5000);\n return isOptional || isValid;\n}, Resources.GIFT_CERT_AMOUNT_INVALID);\n\n/**\n * Add positive number validation method to jQuery validation plugin.\n * Text fields must have 'positivenumber' css class to be validated as positivenumber\n */\n$.validator.addMethod('positivenumber', function (value) {\n if ($.trim(value).length === 0) {\n return true;\n }\n return (!isNaN(value) && Number(value) >= 0);\n}, ''); // '' should be replaced with error message if needed\n\nvar validator = {\n regex: regex,\n settings: settings,\n init: function () {\n var self = this;\n $('form:not(.suppress)').each(function () {\n $(this).validate(self.settings);\n });\n },\n initForm: function (f) {\n $(f).validate(this.settings);\n }\n};\n\nmodule.exports = validator;\n", "/*http://zoomsl.sergeland.ru Sergey Zaragulov skype: deeserge icq: 287295769 sergeland@mail.ru*/\n\n(function ($, global) {\n \"use strict\";\n\n $.fn.imagezoomsl = function (options) {\n options = options || {};\n return this.each(function () { //return jQuery obj\t\t\n if (!$(this).is(\"img\")) return true;\n var that = this;\n setTimeout(function () {\n $(new Image()).on('load', function () {\n sergelandimagezoomer.init($(that), options);\n }).attr('src', $(that).attr('src'));\n }, 30);\n });\n\n };\n\n var sergelandimagezoomer = {};\n $.extend(sergelandimagezoomer, {\n\n dsetting: { //default settings\n\n // загрузка big картинки\n loadinggif: '', // картинка Ð¿Ð¾ÐºÐ°Ð·Ñ‹Ð²Ð°ÐµÐ¼Ð°Ñ Ð¿Ñ€Ð¸ загрузке big изображениÑ\n loadopacity: 0.1, // прозрачноÑÑ‚ÑŒ фона Ð¿ÐµÑ€ÐµÐºÑ€Ñ‹Ñ‚Ð¸Ñ tmb картинки при загрузке\tbig изображениÑ\n loadbackground: '#878787', // цвет фона Ð¿ÐµÑ€ÐµÐºÑ€Ñ‹Ñ‚Ð¸Ñ tmb картинки при загрузке\t big изображениÑ\n\n\n // лупа (cursorshade)\n cursorshade: true, // показать контейнер лупы\n magnifycursor: 'crosshair', // вид курÑора мыши над tmb в формате CSS\n cursorshadecolor: '#fff', // цвет контейнера лупы в формате CSS\n cursorshadeopacity: 0.3, // прозрачноÑÑ‚ÑŒ контейнера лупы\n cursorshadeborder: '1px solid black', // внешний бордюра контейнера лупы в формате CSS\n zindex: '', // z-index контейнера лупы \n stepzoom: 0.5, // шаг Ð·ÑƒÐ¼Ð¼Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ Ð¿Ñ€Ð¸ прокрутке колеÑа мыши\t\t\t\t\t\n zoomrange: [2, 2], // диапазон зуммированиÑ\n zoomstart: 2, // ÑÑ‚Ð°Ñ€Ñ‚Ð¾Ð²Ð°Ñ ÑƒÑтановка зуммированиÑ\n disablewheel: true, // отключить прокрутку документа колеÑом мыши когда курÑор над картинкой tmb в Ñлучае еÑли не задан диапазон зуммированиÑ\n\n\n // подÑказка (statusdiv)\n showstatus: true, // показывать при наведении на tmb help контейнер\n showstatustime: 2000, // Ð²Ñ€ÐµÐ¼Ñ Ð¿Ð¾ÐºÐ°Ð·Ð° help контейнера\n statusdivborder: '1px solid black',\n statusdivbackground: '#C0C0C0',\n statusdivpadding: '4px',\n statusdivfont: 'bold 13px Arial',\n statusdivopacity: 0.8,\n\n\n // контейнер big картинки (magnifier)\n magnifierpos: 'right', // Ñторона Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ ÐºÐ¾Ð½Ñ‚ÐµÐ¹Ð½ÐµÑ€Ð° left/right\n magnifiersize: [0, 0], // размер контейнера \n magnifiereffectanimate: 'showIn', // Ñффект поÑвлениÑ/ÑÐºÑ€Ñ‹Ñ‚Ð¸Ñ fadeIn/showIn/slideIn\n innerzoom: false, // показать контейнер внутри tmb\n innerzoommagnifier: false, // показать контейнер как лупу\n descarea: false, // показать контейнер в произвольной облаÑти, облаÑÑ‚ÑŒ descarea должна иметь width и height\t\t\t\t\n leftoffset: 15, // отÑтуп Ñлева от tmb картинки\n rightoffset: 15, // отÑтуп Ñправа от tmb картинки\n switchsides: true, // учитывать край Ñкрана\n magnifierborder: '1px solid black', // внешний бордюр\n\n\n // контейнер текÑта Ñнизу к картинке\n textdnbackground: '#fff',\n textdnpadding: '10px',\n textdnfont: '13px/20px cursive',\n\n\n // коÑффициенты ÑкороÑти анимации\n scrollspeedanimate: 5 /*4*/ , // прокрутки big картинки\n zoomspeedanimate: 7, // Ð·ÑƒÐ¼Ð¼Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ (плавноÑÑ‚ÑŒ)\n loopspeedanimate: 2.5 /*2.45342*/ , // Ð¿ÐµÑ€ÐµÐ¼ÐµÑ‰ÐµÐ½Ð¸Ñ Ð¾Ð±Ð»Ð°Ñти лупы и big контейнера в режиме лупы\t\t\t\t\n magnifierspeedanimate: 350, // показа big контейнера\n\n\n // внешний вид\n classmagnifier: \"magnifier\",\n classcursorshade: \"cursorshade\",\n classstatusdiv: \"statusdiv\",\n classtextdn: \"textdn\",\n classtracker: \"tracker\"\n\n },\n\n isie: (function () {\n var nAgt = navigator.userAgent;\n if (nAgt.indexOf(\"MSIE\") != -1) return true;\n else return false;\n })(),\n\n highestzindex: function ($img) {\n\n var z = 0,\n $els = $img.parents().add($img),\n elz;\n $els.each(function () {\n elz = $(this).css('zIndex');\n elz = isNaN(elz) ? 0 : +elz;\n z = Math.max(z, elz);\n });\n return z;\n },\n\n getboundary: function (b, val, specs) {\n if (b == \"left\") {\n var rb = -specs.img.w * specs.newpower + specs.magnifier.w;\n return (val > 0) ? 0 : (val < rb) ? rb : val;\n } else {\n var tb = -specs.img.h * specs.newpower + specs.magnifier.h;\n return (val > 0) ? 0 : (val < tb) ? tb : val;\n }\n },\n\n controlLoop: function ($tracker) {\n var self = this,\n specs = $tracker.data('specs');\n if (!specs) return;\n\n var coords = specs.$img.offsetsl(),\n pageX = self.cld.pageX999 - coords.left,\n pageY = self.cld.pageY999 - coords.top;\n\n self.cld.destU += (self.cld.pageX999 - self.cld.destU) / 2.45342;\n self.cld.destV += (self.cld.pageY999 - self.cld.destV) / 2.45342;\n\n specs.$statusdiv.css({\n left: self.cld.destU - 10,\n top: self.cld.destV + 20\n });\n\n var csw = Math.round(specs.magnifier.w / specs.newpower),\n csh = Math.round(specs.magnifier.h / specs.newpower);\n\n self.cld.destK += (pageX - self.cld.destK) / specs.setting.loopspeedanimate;\n self.cld.destL += (pageY - self.cld.destL) / specs.setting.loopspeedanimate;\n\n specs.$cursorshade.css({\n left: specs.img.w > csw ? Math.min(specs.img.w - csw, Math.max(0, self.cld.destK - csw / 2)) + coords.left - specs.cursorshade999.border999.left999 : coords.left - specs.cursorshade999.border999.left999,\n top: specs.img.h > csh ? Math.min(specs.img.h - csh, Math.max(0, self.cld.destL - csh / 2)) + coords.top - specs.cursorshade999.border999.top999 : coords.top - specs.cursorshade999.border999.top999\n });\n\n if (specs.setting.innerzoommagnifier) {\n\n self.cld.destM += (self.cld.pageX999 - self.cld.destM) / specs.setting.loopspeedanimate;\n self.cld.destN += (self.cld.pageY999 - self.cld.destN) / specs.setting.loopspeedanimate;\n\n specs.$magnifier.css({\n left: self.cld.destM - Math.round(specs.magnifier.w / 2),\n top: self.cld.destN - Math.round(specs.magnifier.h / 2)\n });\n specs.$textdn.css({\n left: self.cld.destM - Math.round(specs.magnifier.w / 2),\n top: self.cld.destN + specs.magnifier.h / 2\n });\n }\n\n self.cld.currU += (pageX - self.cld.currU) / specs.setting.scrollspeedanimate;\n self.cld.currV += (pageY - self.cld.currV) / specs.setting.scrollspeedanimate;\n\n var newx = -self.cld.currU * specs.newpower + specs.magnifier.w / 2;\n var newy = -self.cld.currV * specs.newpower + specs.magnifier.h / 2;\n\n specs.$bigimage.css({\n left: self.getboundary('left', newx, specs),\n top: self.getboundary('top', newy, specs)\n });\n self.cld.controlTimer = setTimeout(function () {\n self.controlLoop($tracker);\n }, 30);\n\n },\n\n controlLoop2: function ($tracker) {\n\n var self = this,\n specs = $tracker.data('specs');\n if (!specs) return;\n\n specs.currM += (specs.newpower - specs.currM) / specs.setting.zoomspeedanimate;\n specs.currM = Math.round(specs.currM * 1000) / 1000;\n\n specs.$cursorshade.css({\n width: specs.img.w > Math.round(specs.magnifier.w / specs.currM) ? Math.round(specs.magnifier.w / specs.currM) : specs.img.w,\n height: specs.img.h > Math.round(specs.magnifier.h / specs.currM) ? Math.round(specs.magnifier.h / specs.currM) : specs.img.h\n });\n specs.$bigimage.css({\n width: Math.round(specs.currM * specs.bigimage.w * (specs.img.w / specs.bigimage.w)),\n height: Math.round(specs.currM * specs.bigimage.h * (specs.img.h / specs.bigimage.h))\n });\n\n self.cld.controlTimer2 = setTimeout(function () {\n self.controlLoop2($tracker);\n }, 30);\n\n },\n\n cld: {},\n\n showimage: function ($tracker) {\n\n var self = this,\n specs = $tracker.data('specs'),\n width = specs.setting.magnifiersize[0],\n height = specs.setting.magnifiersize[1],\n magcoords = {},\n coords = specs.$img.offsetsl(),\n func = function () {},\n left1 = 0,\n top1 = 0;\n\n magcoords.left = coords.left + (specs.setting.magnifierpos === 'left' ? -specs.magnifier.w - specs.setting.leftoffset : specs.img.w + specs.setting.rightoffset);\n if (specs.setting.switchsides && !specs.setting.innerzoom) {\n\n if (specs.setting.magnifierpos !== 'left' && magcoords.left + specs.magnifier.w + specs.setting.leftoffset >= $(window).width() && coords.left - specs.magnifier.w >= specs.setting.leftoffset)\n magcoords.left = coords.left - specs.magnifier.w - specs.setting.leftoffset;\n else if (specs.setting.magnifierpos === 'left' && magcoords.left < 0)\n magcoords.left = coords.left + specs.img.w + specs.setting.rightoffset;\n }\n\n left1 = magcoords.left;\n top1 = coords.top;\n specs.$magnifier.css({\n visibility: \"visible\",\n display: \"none\"\n });\n\n if (specs.setting.descarea) {\n left1 = $(specs.setting.descarea).offsetsl().left;\n top1 = $(specs.setting.descarea).offsetsl().top;\n }\n if (specs.setting.innerzoommagnifier) {\n left1 = self.cld.pageX999 - Math.round(specs.magnifier.w / 2);\n top1 = self.cld.pageY999 - Math.round(specs.magnifier.h / 2);\n }\n\n //*\n func = function () {\n\n specs.$textdn.stop(true, true).fadeIn(specs.setting.magnifierspeedanimate);\n if (!specs.setting.innerzoommagnifier)\n specs.$textdn.css({\n left: left1,\n top: top1 + height\n });\n } // */\t\t\t\n\n if (specs.setting.innerzoom) {\n\n left1 = coords.left;\n top1 = coords.top;\n\n func = function () {\n specs.$img.css({\n visibility: \"hidden\"\n });\n specs.$textdn.css({\n left: left1,\n top: top1 + height\n }).stop(true, true).fadeIn(specs.setting.magnifierspeedanimate);\n };\n }\n\n switch (specs.setting.magnifiereffectanimate) {\n case 'slideIn':\n specs.$magnifier.css({\n left: left1,\n top: top1 - height / 3,\n width: width,\n height: height\n })\n .stop(true, true).show()\n .animate({\n top: top1\n }, specs.setting.magnifierspeedanimate, \"easeOutBounceSL\", func);\n break;\n case 'showIn':\n specs.$magnifier.css({\n left: coords.left + Math.round(specs.img.w / 2),\n top: coords.top + Math.round(specs.img.h / 2),\n width: Math.round(specs.magnifier.w / 5),\n height: Math.round(specs.magnifier.h / 5)\n })\n .stop(true, true).show().css({\n opacity: \"0.1\"\n })\n .animate({\n left: left1,\n top: top1,\n opacity: \"1\",\n width: width,\n height: height\n\n }, specs.setting.magnifierspeedanimate, func);\n break;\n default:\n specs.$magnifier.css({\n left: left1,\n top: top1,\n width: width,\n height: height\n })\n .stop(true, true)\n .fadeIn(specs.setting.magnifierspeedanimate, func);\n }\n if (specs.setting.showstatus && (specs.title999 || specs.help))\n specs.$statusdiv.html(specs.title999 + '<div style=\"font-size:80%\">' + specs.help + '</div>')\n .stop(true, true)\n .fadeIn().delay(specs.setting.showstatustime).fadeOut(\"slow\");\n else specs.$statusdiv.hide();\n },\n\n hideimage: function ($tracker) {\n\n var self = this,\n specs = $tracker.data('specs'),\n coords = specs.$img.offsetsl();\n\n switch (specs.setting.magnifiereffectanimate) {\n\n case 'showIn':\n specs.$magnifier.stop(true, true)\n .animate({\n left: coords.left + Math.round(specs.img.w / 2),\n top: coords.top + Math.round(specs.img.h / 2),\n opacity: \"0.1\",\n width: Math.round(specs.magnifier.w / 5),\n height: Math.round(specs.magnifier.h / 5)\n },\n specs.setting.magnifierspeedanimate,\n function () {\n specs.$magnifier.hide();\n });\n break;\n\n default:\n specs.$magnifier.stop(true, true).fadeOut(specs.setting.magnifierspeedanimate);\n }\n\n },\n\n /* Init function start. */\n init: function ($img, options, gallery) {\n \t\n \tif(window.innerWidth <= 1150){\n \treturn false;\n }\n \t\n \tvar setting = $.extend({}, this.dsetting, options),\n basezindex = setting.zindex || this.highestzindex($img),\n img = {\n w: $img.width(),\n h: $img.height()\n },\n cld = new cld(),\n title = $img.attr(\"data-title\") ? $img.attr(\"data-title\") : '',\n help = $img.attr(\"data-help\") ? $img.attr(\"data-help\") : '',\n textdn = $img.attr(\"data-text-bottom\") ? $img.attr(\"data-text-bottom\") : '',\n self = this,\n newpower,\n key,\n $magnifier,\n $cursorshade,\n $statusdiv,\n $tracker,\n $textdn;\n\n if (img.h === 0 || img.w === 0) {\n $(new Image()).on('load', function () {\n self.init($img, options);\n }).attr(\"src\", $img.attr(\"src\"));\n return;\n }\n\n $img.css({\n visibility: \"visible\"\n });\n setting.largeimage = $img.attr(\"data-large\") || $img.attr(\"src\");\n\n for (key in setting)\n if (setting[key] === '') setting[key] = this.dsetting[key];\n\n if (setting.zoomrange[0] < setting.zoomstart)\n newpower = setting.zoomstart;\n else newpower = setting.zoomrange[0];\n\n if (setting.magnifiersize.toString() === '0,0' ||\n setting.magnifiersize.toString() === '')\n if (setting.innerzoommagnifier)\n setting.magnifiersize = [img.w / 2, img.h / 2];\n else setting.magnifiersize = [img.w, img.h];\n\n if (setting.descarea && $(setting.descarea).length) {\n if ($(setting.descarea).width() === 0 || $(setting.descarea).height() === 0)\n setting.descarea = false;\n else setting.magnifiersize = [$(setting.descarea).width(), $(setting.descarea).height()];\n } else setting.descarea = false;\n\n if (setting.innerzoom) {\n setting.magnifiersize = [img.w, img.h];\n if (!options.cursorshade)\n setting.cursorshade = false;\n if (!options.scrollspeedanimate)\n setting.scrollspeedanimate = 10;\n }\n\n if (setting.innerzoommagnifier) {\n if (!options.magnifycursor)\n if (window.chrome || window.sidebar)\n setting.magnifycursor = \"none\";\n setting.cursorshade = false;\n setting.magnifiereffectanimate = \"fadeIn\";\n }\n\n function cld() {\n this.pageX999 = 0;\n this.pageY999 = 0;\n }\n\n function getspecs($bigimage) {\n\n $tracker.data(\"specs\", {\n\n setting: setting,\n title999: title,\n help: help,\n\n $img: $img,\n $magnifier: $magnifier,\n $bigimage: $bigimage,\n $statusdiv: $statusdiv,\n $cursorshade: $cursorshade,\n $textdn: $textdn,\n\n img: img,\n bigimage: {\n w: $bigimage.width(),\n h: $bigimage.height()\n },\n magnifier: {\n w: $magnifier.width(),\n h: $magnifier.height()\n },\n cursorshade999: {\n w: $cursorshade.width(),\n h: $cursorshade.height(),\n border999: {\n left999: parseInt($cursorshade.css(\"border-left-width\")) || 0,\n top999: parseInt($cursorshade.css(\"border-top-width\")) || 0\n }\n },\n\n currM: newpower,\n newpower: newpower\n });\n\n }\n\n function isImageLoaded(img) {\n if (!img.complete)\n return false;\n if (typeof img.naturalWidth !== \"undefined\" && img.naturalWidth === 0)\n return false;\n return true;\n }\n\n var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'];\n var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'];\n var lowestDelta, lowestDeltaXY;\n\n if ($.event.fixHooks) {\n for (var i = toFix.length; i;) {\n $.event.fixHooks[toFix[--i]] = $.event.mouseHooks;\n }\n }\n\n $.event.special.mousewheel = {\n setup: function () {\n if (this.addEventListener) {\n for (var i = toBind.length; i;) {\n this.addEventListener(toBind[--i], handler, false);\n }\n } else {\n this.onmousewheel = handler;\n }\n },\n\n teardown: function () {\n if (this.removeEventListener) {\n for (var i = toBind.length; i;) {\n this.removeEventListener(toBind[--i], handler, false);\n }\n } else {\n this.onmousewheel = null;\n }\n }\n };\n\n function handler(event) {\n var orgEvent = event || window.event,\n args = [].slice.call(arguments, 1),\n delta = 0,\n deltaX = 0,\n deltaY = 0,\n absDelta = 0,\n absDeltaXY = 0,\n fn;\n event = $.event.fix(orgEvent);\n event.type = \"mousewheel\";\n\n // Old school scrollwheel delta\n if (orgEvent.wheelDelta) {\n delta = orgEvent.wheelDelta;\n }\n if (orgEvent.detail) {\n delta = orgEvent.detail * -1;\n }\n\n // New school wheel delta (wheel event)\n if (orgEvent.deltaY) {\n deltaY = orgEvent.deltaY * -1;\n delta = deltaY;\n }\n if (orgEvent.deltaX) {\n deltaX = orgEvent.deltaX;\n delta = deltaX * -1;\n }\n\n // Webkit\n if (orgEvent.wheelDeltaY !== undefined) {\n deltaY = orgEvent.wheelDeltaY;\n }\n if (orgEvent.wheelDeltaX !== undefined) {\n deltaX = orgEvent.wheelDeltaX * -1;\n }\n\n // Look for lowest delta to normalize the delta values\n absDelta = Math.abs(delta);\n if (!lowestDelta || absDelta < lowestDelta) {\n lowestDelta = absDelta;\n }\n absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX));\n if (!lowestDeltaXY || absDeltaXY < lowestDeltaXY) {\n lowestDeltaXY = absDeltaXY;\n }\n\n // Get a whole value for the deltas\n fn = delta > 0 ? \"floor\" : \"ceil\";\n delta = Math[fn](delta / lowestDelta);\n deltaX = Math[fn](deltaX / lowestDeltaXY);\n deltaY = Math[fn](deltaY / lowestDeltaXY);\n\n // Add event and delta to the front of the arguments\n args.unshift(event, delta, deltaX, deltaY);\n\n return ($.event.dispatch || $.event.handle).apply(this, args);\n }\n\n $.fn.offsetsl = function () {\n var elem = this.get(0);\n\n function getOffsetSum(elem) {\n var top999 = 0,\n left999 = 0;\n while (elem) {\n top999 = top999 + parseInt(elem.offsetTop);\n left999 = left999 + parseInt(elem.offsetLeft);\n elem = elem.offsetParent;\n }\n return {\n top: top999,\n left: left999\n }\n }\n if (elem.getBoundingClientRect)\n return this.offset();\n else return getOffsetSum(elem)\n }\n\n $.easing.easeOutBounceSL = function (x, t, b, c, d) {\n if ((t /= d) < (1 / 2.75)) {\n return c * (7.5625 * t * t) + b;\n } else if (t < (2 / 2.75)) {\n return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;\n } else if (t < (2.5 / 2.75)) {\n return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;\n } else {\n return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;\n }\n }\n\n $magnifier = $(\"<div />\")\n .attr({\n \"class\": setting.classmagnifier\n })\n .css({\n position: \"absolute\",\n zIndex: basezindex,\n width: setting.magnifiersize[0],\n height: setting.magnifiersize[1],\n left: -10000,\n top: -10000,\n visibility: \"hidden\",\n overflow: \"hidden\"\n })\n .appendTo(document.body);\n\n if (!options.classmagnifier)\n $magnifier.css({\n border: setting.magnifierborder\n });\n\n $cursorshade = $(\"<div />\");\n if (setting.cursorshade) {\n $cursorshade.attr({\n \"class\": setting.classcursorshade\n })\n .css({\n zIndex: basezindex,\n display: \"none\",\n position: \"absolute\",\n width: Math.round(setting.magnifiersize[0] / setting.zoomstart),\n height: Math.round(setting.magnifiersize[1] / setting.zoomstart),\n top: 0,\n left: 0\n })\n .appendTo(document.body);\n\n if (!options.classcursorshade)\n $cursorshade.css({\n border: setting.cursorshadeborder,\n opacity: setting.cursorshadeopacity,\n backgroundColor: setting.cursorshadecolor\n });\n }\n\n if (!setting.loadinggif)\n setting.loadinggif = \"data:image/gif;base64,R0lGODlhQABAAKEAAPz6/Pz+/Pr6+gAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBgACACwAAAAAQABAAAACVJSPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YqFBbaBH5cL4H2/4vG2bEaPe+YwmysqAAAh+QQJBgACACwAAAAAQABAAAACVZSPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzqQpIAT+pNdC7XnlaK7eL3YHDOrAPsIWq1+y2+w2PnwoAIfkECQYAAgAsAAAAAEAAQAAAAleUj6nL7Q+jnLTai7PevPsPhuJIluaJpurKtu4Lx/JM1/aN5/rO9/4PDI4AgQDgV0wGekolr5l8Qpe7KVVHhDKbQKPwCw6Lx+Sy+YxOq9fstvsNj8vn4AIAIfkECQYAAgAsAAAAAEAAQAAAAmiUj6nL7Q+jnLTai7PevPsPhuJIluaJpurKtu4Lx/JM1/aNk0DAB3nSC/4OwR5guCvyhsreUNA8MpVPQ7GKzWq33K73Cw6Lx+Sy+YxOq9fsttsWlD6bz+R1qpTjmgH9zS40R1UV95ZQAAAh+QQJBgACACwAAAAAQABAAAACapSPqcvtD6OctNqLs968+w+G4kiW5omm6sq2bRAAbgXAtjxH9p5D9W7rOYA8IeMHxBkXxMByWHwOpdSq9YrNarfcrvcLDovH5LL5jE6r1+y2+/JTZonaphNrnzf1dCzyVgfUFfNWaHgoVQAAIfkECQYAAgAsAAAAAEAAQAAAAm2Uj6nL7Q+jnLTai7PevPsPhuJIluZ5AQDKBe7LYsD7rnFF0zeeuzvV8/0kwcBw0jtSZgGb8gmNSqfUqvWKzWq33K73Cw6Lx4uZc5s7X4NaZhJbNGaLWjaapoY3yfy+/w8YKDhIWGh4iJioWFIAACH5BAkGAAIALAAAAABAAEAAAAJ3lI+py+0Po5y02ouz3rz7D4YcEACAGAbqinrrG7QczMoardo3rmf42cPQgpsS8YhMKpfMpvMJjUqn1Kr1+iSZsIchFhe7gr88cdlKggHNL2537Y7L5/S6/Y7P6/f8vt+nAsdWM9hWSFg1dphD9iJIlYb4N0nZVAAAIfkECQYAAgAsAAAAAEAAQAAAAnqUj6nL7Q+jnLTai7O+YHsZhOFHLuJZpgJwip36tSjsyeFLb3b+sSfO042CxKLxiEwql8ym85mcQR2yacMWsJp22gS26+WCDeKxwTc0q9fstvsNj8vn9Lr9js/r9/y+/w8YWCOlVgaGRgiGBdS1qIYowmY4hsYoeIlQAAAh+QQJBgACACwAAAAAQABAAAACepSPqcvtD6OctNp7QQC4Wx2Em0dC4lmmC3iO6iu0KKyyJ0ercpDDbU8L4YDEovGITCqXzJho2IzsotIp9bFzXRlZ6DZhE30dMu848Tur1+y2+w2Py+f0uv2Oz+v3/H5yFicTaOWWBWf4hpiYNhji9wgZKTlJWWl5SVkAACH5BAkGAAIALAAAAABAAEAAAAKJlI+py+0Po5z0BRCq3ir4z4XURwLiaZEgyiaY6rXyAcezXN+3aup77wsKh8RGqSiCAZGUl4qpqV2go9qS+nCSsNUnd3L8isfksvmMTqvX7Lb7DY/L5zPMla3NvHNtqVt6d+b3B/OWJ+cRSLfISKW4xrOnRFjYx8c2iHmpuQX38dgYKjpKWmqKVAAAIfkECQYAAgAsAAAAAEAAQAAAAoiUj6nL7Q9ZALHaa4LeuPuzhcFHWiJXps6pqe7Cju+csfR93t60yvqV+7lYFGEqZjzakiQk8+N87kTSEqBVzWq33K73Cw6Lx+SyuXMFFM+IIFsQPcfN83KdfBWt2e53Zu8XKDhIWGh4iJiouMjY6PgIGSlpSBW4xJan9xbjQ0fkd8mnGZgJSFMAACH5BAkGAAIALAAAAABAAEAAAAKLlI+py+0PW5gz2oupxrwnvXliBk7AiEJAGZzpu7ABTCulW5MUs1Y5x/rlZEJYr1R8yWbJFAvXFB13UaWpis1qt9yu9wsOi8dCDZRsA53RBiL783wjZGv0lCo/3PJwPP8PGCg4SFhoeIiYqLjI2Oj4+LMCUCeHBOjGh5mnWRn0F3cJQtgCWWp6inpYAAAh+QQJBgACACwAAAAAQABAAAACnpSPqQgBC6Oc9ISLq94b+8eFIuJ54xmWGcpS6tWyzQWSaoy+Slnj6a1o9HycF4xInAGROOOQydJBiaWp9YrNarfcrpcDeH411XFnaZYY066XmG2RwiFK0zyCvi+U+r7/DxgoOEhYaHiImKi4yMhVFqH0hiW3k5dVt7JAqeWk6dbVGbTGhXlUaZmlIrm59Qjh2hgrO0tba3uLm6u721IAACH5BAkGAAIALAAAAABAAEAAAAKalI+pCeELo5zUuBuq3rvhx4Ui8l3jGQFLCaKu8CVs9qKsXNan96lHrhvNaIygjeUzGm9KJc+RbC5b0qr1ig0BotnjhdvlIMNCJllsPmtmanSv7TbBOR7w/I7P6/f8vv8PGCg4SLiwVWgRM/gkF8gm+OiY9hcpiYFYh6i5ydnp+QkaKjpK6mJnCUU4SbnaV8kKhPqlqkgbcCpSAAAh+QQJBgACACwAAAAAQABAAAACnJSPqQrhsKKctIrmst2c5w91otWEB/Y54xqhz5F+7IzEQW3TtJuZuT6zqU4y4Iz3MipxqaUTVnw+k9KqlRUAmK66GFeHvH2xv/FIaF6h06Iw+9x8q8Xyuv2Oz+v3/L7/D8iCEpjgRXhRBrgWuKiY6BhHyHNYs0V5iZmpucnZ6fkJGio62oFhyRiJaqia+tfo+uiHdOq3SplFmutUAAAh+QQJBgACACwAAAAAQABAAAACmJSPqSvhwaKcNL5Xs9b37l91SYeB5kJCR6qersEeQPrW8doB9Xvjzm6jAYcjEfHo0yFPAYBySZx5oEMhlZd6Xk1S0tbF0n4/1jGo+zNjxeq2+w2Py+f0un2HZt99D/29t8c3FShYQghTduh1WJTG+AgZKTlJWWl5iZmpucnoR4jW8pgYCEhYSjq6B+rIuBg5yBkrO0tbO1sAACH5BAkGAAIALAAAAABAAEAAAAKalI+paxAfmJy0Moit3gkChXncWIXR4ZgnyXYqqq7tHCPqN+f18eZ6D4P4hsChDucSGn+ZpZNnQj6Nuym1aGWGslcTt6v8DlPisvmMTqvXFIeUrdnC4955+2afxGT5RCr01mdTJ3iBEVg4iJjI2Oj4CBkpOUlZaXn5lbLISPhY5fjZGMqJRQoo2RkZsInZ6voKGys7S1trextZAAAh+QQJBgACACwAAAAAQABAAAACmpSPqYvhwaKcFLD3qN4XJ+xxogY6TQmNKgOgloGm63zEckznQoueoU7rfR4v4ASE4BGNOWHNxGw6o0Ylksq0YaOuLdMK9WYdRbH5jE6r1+wgub0qwUW4OWlqj9Tzkj1fD1L215ExaHiImKi4yNjo+AgZKdECIMgo5+inqJnIieh5CBZg2XkFOSqZqrrK2ur6ChsrO0tba3vbWgAAIfkECQYAAgAsAAAAAEAAQAAAApiUj6mbEA+YnHS+ENPdtfu1PVoYfKZHioaTnq6UlkYsv/YRH2yY3XeOI/lQHJ1wdBl2WsFLT2kDQqcrKXVqvSpTT+2Q6aU6w+Sy+YxONzZdtWeXdJ+ycgq9DgPj7fq9JeT3URRIWGh4iJiouMjY+DLmKACn0sjVOBm3SON4d9inORgpOkpaanqKmqq6ytrq+gobKztLW9tYAAAh+QQJBgACACwAAAAAQABAAAACn5SPqbsQAJicdIZ7Fca1+7VxhxMG39mV2aGa6Mu0kdHCdkKGs1DfXe4yAEW00s4nGQZ5ukQJWekJiQoHNKW6ap3ZrVfq1T7D4Q35jIZC0tsm26c6vlHg+alu9+DzUSP/NfaHQiInaHiImKi4yNhIBlToWLQR2bhn2SXJkqnJFNjpSQUaOlpqeoqaqrrK2ur6ChsrO0tba3uLm6u7y7tYAAAh+QQJBgACACwAAAAAQABAAAACo5SPqQgBex6ctNKAs8rY+r9wmWSIHYh65ik0Zgpf67E6McoldbSSd/WiBYWin2pGxPgEpqUxhOQ5S5qnZWfNbqLaLrPoDX9Z4ptjWv4N00YXmK3mwmHYeaxuT7lz+fu77wcoOEhYaHiImNcAgJaIsOaoIxdJBUk59neJyadpsKfU+ZgZytRIeoqaqrrK2ur6ChsrO0tba3uLm6u7y9vr+wusUAAAIfkECQYAAgAsAAAAAEAAQAAAAp6Uj6kJ4QujnNS4G2ADtXvUYE8iZt8pleOhcqgXmqxK0m9VuoIq7/xNiWEQtlkJOPkZL4oiEsLTsSIi6bPp9ASs10W2C7YMw88Ll9w9osPK9bXtRsLjtzkd9b3jMWe9/w8YKDhIWPjBZ9iRk5iUx7g09ujlKCnEJAlVhUkVuen5CRoqOkpaanqKmqq6ytrq+gobKztLW2t7i5uru/tUAAAh+QQJBgACACwAAAAAQABAAAACopSPqQrhsKKctIrmst2c5w8xWkcaTXhgn6OsQcmpz+GOaQ1bOL3zbk6RZVA93wo4qbFuNoQSKRHOYi4UtPUjZa+RI/DFvXwSp/BVak4balY1Urp0Q5Vg+bxoz+HzORn/DxgoOJhWRgjjdeixpRjE1lhBB+lYNUmxZ4k1lBkZ0MYJGio6SlpqeoqaqrrK2ur6ChsrO0tba3uLm6u7y9vr+0taAAAh+QQJBgACACwAAAAAQABAAAACnJSPqSvhwaKcNL5Xs9b37l91SYctgAOAHImQzsKqlAsZZ4zcoizRbZcauXi94e8FcwWJCt9G52EycBsjb3d4LD9UlVV6OIGV4HLOaS7Tamk1adtmQpFxd6mOz+v3qwCcD9IF2Ic1SBhleHiXGPLFOAP0WIUoWWl5iZmpucnZ6fkJGio6SlpqeoqaqrrK2ur6ChsrO0tba3uLmytTAAAh+QQJBgACACwAAAAAQABAAAACnpSPqXsQH5ictDKIrd4IgoV53EiFEeKYJ8l2KqquCUC3VZyo3xzaE+7qKV4+EDH4MJqKl+UoFdqxhAcqJyYdHZmGrdaUZTpZUCtX8Ah/vWeurg0XlJPxuKiOz+v3LTOfxPanMZcmCAhkuEFIl7gR2PgzBulYOGl5iZmpucnZ6fkJGio6SlpqeoqaqrrK2ur6ChsrO0tba3uLm6u7e1kAACH5BAkGAAIALAAAAABAAEAAAAKklI+pqxDPopwSyIcD3Vxl7X1QR04iiJxoySKOaKVnSx/qKqh1/YpJj4ntWrNQpvIQsj6ujzIReBoxRJ8Mt4RlrUNosQM8dr1czm1MZpZO0u6XFMainbUgOiK/61sOQHs/VAYY+DZYV2hYJZi4pcZIE5f3aOY4Wfdnmam5ydnp+QkaKjpKWmp6ipqqusra6voKGys7S1tre4ubq7vL2+v7CxxcWwAAIfkECQYAAgAsAAAAAEAAQAAAAp6Uj6nLBg2jTKG+VvPc3GS9fGBHhmKlAGdQttSqrMHltnK80jV54+Ie+R1UQl9GB3wVBSIk4pOE9KJUx7SKUDknVyxzyT1to7kOzHvohmfo57kNVGehcEaZQaTXjSiMeG8yNiQHuHZS6HKHyHO42JLH4ig5SVlpeYmZqbnJ2en5CRoqOkpaanqKmqq6ytrq+gobKztLW2t7i5uru7tXAAAh+QQJBgACACwAAAAAQABAAAACopSPqQiwD6OcB4R7o3W0e4OFT5h95kiWSRpw5wuy7sEG8F0rtX1DFpb4kRa53kIIRKRQQyORpWtFSDMnDQqTWp/LrTfW/XrD4nGyjE5HL9WVSA1JtcFveBDrJtvpoXZtrvangIQBmFaU17SnpHfVt7imcnQGWWl5iZmpucnZ6fkJGio6SlpqeoqaqrrK2ur6ChsrO0tba3uLm6u7y9vr+4taAAAh+QQJBgACACwAAAAAQABAAAACm5SPqRoNC6OcVICGQ92cZ/x04nhcXyNl5GqcGGSqLCQnrrbcM/PxPe3aIXS2Wi4obCFJxGRztHRGRzFc8nC6an3W7SwACHm32fG1+jILn+oVuw2dwkVo1JxVvn+7+n775yciF5gySAhkeJhQB6ZI8eZ4lCEWKRFTiZmpucnZ6fkJGio6SlpqeoqaqrrK2ur6ChsrO0tba3uL+1kAACH5BAkGAAIALAAAAABAAEAAAAKYlI+pK+HBopw0vlez1vfuDyYdFpYIQCqjY7YjoK5UgLYJOi7v1MF2I9OlLLnfiuY6GoOmI2TZseF6P0MU6gE9fFXG9VPsLlDcjVKMPqO76jU2636z4uxLmY7P6/f8vv8PGCg4SFhoeIgINpQo8sV40PYYyTiZWIk4tfgIpLnp+QkaKjpKWmp6ipqqusra6voKGys7S1urVwAAIfkECQYAAgAsAAAAAEAAQAAAApqUj6l7EB+YnLQyiK3eG0PAhRMGKo73iGqCRsmJrjKcKW0pi22AH22+2vV8NaCIBjESeUrBTxmDfpq7Da05elaQLqxNS7l5v1EKNzVGiCu7btpQZoPfhqFlTp8V8/y+/w8YKDhIWGh4iJiouMjY6PgIGSk5SVlpeYmZqbnJ2dkxNYnHWBUpVLr2eBbqYefo4QkbKztLW2t7m1kAACH5BAkGAAIALAAAAABAAEAAAAKYlI+pywLQopw0hYurpgCH2HkBtJWKeDVoarbGSp6r24Yos350meuK7dmZYCqRcHiLYGLHDbApNEKniBmVSrw2gUHtsedtZsOJp4TrIx+syq66yn4jk/K5tM6L4yv6fcXsFyg4SFhoeIiYqLjI2Oj4CBkpOUlZaXmJmam5ydnp+QkaKjo66gaJwsSYc9qnuPr4CiuS2mgKVQAAIfkECQYAAgAsAAAAAEAAQAAAApeUj6nL7Q9ZmCDai8XcIfKahQfHPWQAitk5OQCrhmzXzPEK1/lt7ZLPg7w2Kd0nOCohlUjNqQlFsIpR3vBZXdqyWhKVq7puwFAi+YxOq9fstvsNj1dJcg+2zhCb8YsZjZ/gB9h3N4ig92VoMKbY6PgIGSk5SVlpeYmZqRmzF1nYuOUYCgpkOKpYqii2ydrq+gobKztL61YAACH5BAkGAAIALAAAAABAAEAAAAKZlI+pCLAPo5wHhHup3hx7DoaJ94lmR16OZGHrqaXZlL4wK9P5LXj2kaLIArzaQxXbnVokXk9pGv6izZvU+ZzdmCWs1wD9YqvisvmMTqvX7Lb7DY/L5/S6/Y7P6/fr1pQfxAcUpjckCEaYZ3jIhXGI2PXY80fXIDkYCWh0uCjYqRnomahI9uh3iZqqusra6voKGys7S1trO1cAACH5BAkGAAIALAAAAABAAEAAAAKalI+pC+Gxopy0ioet3hs/wIUi0njOiHLmk7YNtYKtWLLROo94VEN5uPL9hoegjHjJ6HZIJqdna5qOKg/SAI2KHFRiUHjNxcJDJ3nWO6vX7Lb7DY8zlPKOqW73dPFzM1/x9QczJTjhV5hghbjI2Oj4CBkpOUlZaXmJmam5ydnp+QkaKjpKKoix53i4mAWWOgZpFMk6qcp4WkpRAAAh+QQJBgACACwAAAAAQABAAAACmZSPqZvhwKKcNLobqt4bYw6GjeeIpgBcFFmeIAlZrMul5ATT3SzdusYKxH5EQ7CINPqSRQ/zCY1KQ4+pznYZWqnLLcKpwIK9yvEhmCGjeAhxVi04Kthk+fwDj9Pn+a9H24ejEkhYaHiImKi4yNjo+AgZKTlJWWl5iZmpucnZ6elpA9jYxWhXuqdouqiq6CYESer4+klba0tbAAAh+QQJBgACACwAAAAAQABAAAACmZSPqcvtD6MLNACJc6xc+8NdEMBVn1dSUEqJZ0SmI+u+D2vdrC3hNbPjzWSbyk/YCCJ5gGNoySNCp7HnFIq7YpXaKLf7yoKF0jGzZU6r1+y2+w2Py+f0uv2Oz+v3DNKRX/KHR8NnILZXVVIocCjgd3cYaCf1JWdykNgB2KjHmVfZabXImDNqeoqaqrrK2ur6ChsrO0tba3tVAAAh+QQJBgACACwAAAAAQABAAAACm5SPqcvtD1kIINqLBZi85g8a3BiW1zh610aZEIsGWOw68aRCt+xuQC64zYQmGgKV2RWJCKBFWYLWbs6hsRZELq/YYPVD7YqP2rHZe06r1+y2+w2Py+f0uv2Oz+v3fLvv28fVJ8I0mCUYWDgoZQjTYUhGApnQMml5iZmpucnZ6fkJGio6KvqIiZiIuse4qJhaBhkDqOfIQ3qLa1kAACH5BAkGAAIALAAAAABAAEAAAAKclI+pGQGwopy0moaD3ZxnDHXiiHwYiUphaTbpe3xMC790bNYp0K6CrEO1XAleMDX0HQXK0W3Jy+w+zdqTdFperlrYsBv8gmtR4NhrPqOJ6rb7Dbdl48403SK+47l6Sb4/8QcYwTe4UKZhqLjI2Oj4CBkpOUlZaXmJmam5ydnp+QkaKjpK6idFWciIOAeZJOkaucoWmdpYVlWaW1EAACH5BAkGAAIALAAAAABAAEAAAAKclI+pa+EBmJy0svei3dxi3IUVAF2fI6YKiWnIiaqyACtwMKvs5x5nn+PccDZQULRrHZeJGvPZMEKhDuD0is1qt9yu9ytSgkPOsadsptys6eKvTUk+4JU3XS2ls9h3hJzYtwDD13cTuGJ42ISmSHPS6BYDOUlZaXmJmam5ydnpaSJZ+SjKqJg4eQqZqvqBmfcJGys7S1tre4uby1UAACH5BAkGAAIALAAAAABAAEAAAAKZlI+py+0P4wOhygsDvbRWgIWJ50EdGYgq+j1sq2Jv6sxgLJ3o9OJy72L5LsAMafjz3CQ0ZEjjjEqn1GoQZnWyllmcrtT12cK4MVn1tZxjxbWIxHXL5/S6/Y7P6/f8vv8PGCg4SFiYQBEX+FXY9jczaAb4CCk0uGiIZai5CZgoiOLZ9xK6NxloKtnoh5p6xJjJGSs7S1trG1sAACH5BAkGAAIALAAAAABAAEAAAAKZlI+py+0PWQCx2muC3rj7s4XBR1oiV6bOqXWi2rDjxcKLjOF2cmKA/pmsZq6ap7fLnChFEXP3ex2NSUGIBKyqstoSt4uVgmHRsfmMTqvX7Lb7DY/L53T5D/Cs38R6xFf/VxdINzgXFZLXp3SleJPYCBkpOUlZaXmJmam5ydnp+QkaKirHB0nVeIgYKUOkKPMIiLTqRHkIa1MAACH5BAkGAAIALAAAAABAAEAAAAKYlI+py+0PW5gz2oupxrwnvXliBk7AiEJAGZzpu7ABTCulW5MUs1Y5x/rlZEJYr1R8yWbJFAvXFB13UaWpis1qndetB+nVgcIXIjliPj/Sagn4oIGqx4hbex28u+362LO/MEUFaAMiRwgXgrjI2Oj4CBkpOUlZaXmJmam5yXmxAnDI+NbItliKeEqYCvj3OOoa2ik7S1ubWQAAIfkECQYAAgAsAAAAAEAAQAAAAp6Uj6kIAQujnPSEi6veG/vHhSLieeMZlhnKUurVss0FkmqMvkpZ4+mtaPR8nBeMSJwBkTjjkMnSQYmlqfWKzWq33K6XA3h+NdVxZ2mWGNOul5htkcIhStM8gr4vlPq+/w8YKDhIWGh4iJiouMjIVRah9IYlt5OXVbeyQKnlpOnW1Rm0xoV5VGmZpSK5ufUI4doYKztLW2t7i5uru9tSAAAh+QQJBgACACwAAAAAQABAAAACmpSPqQnhC6Oc1Lgbqt674ceFIvJd4xkBSwmirvAlbPairFzWp/epR64bzWiMoI3lMxpvSiXPkWwuW9Kq9YoNAaLZ44Xb5SDDQiZZbD5rZmp0r+02wTke8PyOz+v3/L7/DxgoOEi4sFVoETP4JBfIJvjomPYXKYmBWIeoucnZ6fkJGio6SupiZwlFOEm52lfJCoT6papIG3AqUgAAIfkECQYAAgAsAAAAAEAAQAAAApyUj6kK4bCinLSK5rLdnOcPdaLVhAf2OeMaoc+RfuyMxEFt07Sbmbk+s6lOMuCM9zIqcamlE1Z8PpPSqpUVAJiuuhhXh7x9sb/xSGheodOiMPvcfKvF8rr9js/r9/y+/w/IghKY4EV4UQa4FriomOgYR8hzWLNFeYmZqbnJ2en5CRoqOtqBYckYiWqomvrX6Proh3Tqt0qZRZrrVAAAIfkECQYAAgAsAAAAAEAAQAAAApiUj6kr4cGinDS+V7PW9+5fdUmHgeZCQkeqnq7BHkD61vHaAfV7485uowGHIxHx6NMhTwGAckmceaBDIZWXel5NUtLWxdJ+P9YxqPszY8XqtvsNj8vn9Lp9h2bffQ/9vbfHNxUoWEIIU3bodViUxvgIGSk5SVlpeYmZqbnJ6EeI1vKYGAhIWEo6ugfqyLgYOcgZKztLWztbAAAh+QQJBgACACwAAAAAQABAAAACmpSPqWsQH5ictDKIrd4JAoV53FiF0eGYJ8l2Kqqu7Rwj6jfn9fHmeg+D+IbAoQ7nEhp/maWTZ0I+jbsptWhlhrJXE7er/A5T4rL5jE6r1xSHlK3ZwuPeeftmn8Rk+UQq9NZnUyd4gRFYOIiYyNjo+AgZKTlJWWl5+ZWyyEj4WOX42RjKiUUKKNkZGbCJ2er6ChsrO0tba3sbWQAAIfkECQYAAgAsAAAAAEAAQAAAApqUj6mL4cGinBSw96jeFyfscaIGOk0JjSoDoJaBput8xHJM50KLnqFO630eL+AEhOARjTlhzcRsOqNGJZLKtGGjri3TCvVmHUWx+YxOq9fsILm9KsFFuDlpao/U85I9Xw9S9teRMWh4iJiouMjY6PgIGSnRAiDIKOfop6iZyInoeQgWYNl5BTkqmaq6ytrq+gobKztLW2t721oAACH5BAkGAAIALAAAAABAAEAAAAKYlI+pmxAPmJx0vhDT3bX7tT1aGHymR4qGk56ulJZGLL/2ER9smN13jiP5UBydcHQZdlrBS09pA0KnKyl1ar0qU0/tkOmlOsPksvmMTjc2XbVnl3SfsnIKvQ4D4+36vSXk91EUSFhoeIiYqLjI2Pgy5igAp9LI1TgZt0jjeHfYpzkYKTpKWmp6ipqqusra6voKGys7S1vbWAAAIfkECQYAAgAsAAAAAEAAQAAAAp+Uj6m7EACYnHSGexXGtfu1cYcTBt/ZldmhmujLtJHRwnZChrNQ313uMgBFtNLOJxkGebpECVnpCYkKBzSlumqd2a1X6tU+w+EN+YyGQtLbJtunOr5R4Pmpbvfg81Ej/zX2h0IiJ2h4iJiouMjYSAZU6Fi0Edm4Z9klyZKpyRTY6UkFGjpaanqKmqq6ytrq+gobKztLW2t7i5uru8u7WAAAIfkECQYAAgAsAAAAAEAAQAAAAqOUj6kIAXsenLTSgLPK2Pq/cJlkiB2IeuYpNGYKX+uxOjHKJXW0knf1ogWFop9qRsT4BKalMYTkOUuap2VnzW6i2i6z6A1/WeKbY1r+DdNGF5it5sJh2Hmsbk+5c/n7u+8HKDhIWGh4iJjXAICWiLDmqCMXSQVJOfZ3icmnabCn1PmYGcrUSHqKmqq6ytrq+gobKztLW2t7i5uru8vb6/sLrFAAACH5BAkGAAIALAAAAABAAEAAAAKelI+pCeELo5zUuBtgA7V71GBPImbfKZXjoXKoF5qsStJvVbqCKu/8TYlhELZZCTj5GS+KIhLC07EiIumz6fQErNdFtgu2DMPPC5fcPaLDyvW17UbC47c5HfW94zFnvf8PGCg4SFj4wWfYkZOYlMe4NPbo5SgpxCQJVYVJFbnp+QkaKjpKWmp6ipqqusra6voKGys7S1tre4ubq7v7VAAAIfkECQYAAgAsAAAAAEAAQAAAAqKUj6kK4bCinLSK5rLdnOcPMVpHGk14YJ+jrEHJqc/hjmkNWzi9825OkWVQPd8KOKmxbjaEEikRzmIuFLT1I2WvkSPwxb18EqfwVWpOG2pWNVK6dEOVYPm8aM/h8zkZ/w8YKDiYVkYI43XosaUYxNZYQQfpWDVJsWeJNZQZGdDGCRoqOkpaanqKmqq6ytrq+gobKztLW2t7i5uru8vb6/tLWgAAIfkECQYAAgAsAAAAAEAAQAAAApyUj6kr4cGinDS+V7PW9+5fdUmHLYADgByJkM7CqpQLGWeM3KIs0W2XGrl4veHvBXMFiQrfRudhMnAbI293eCw/VJVVejiBleByzmku02ppNWnbZkKRcXepjs/r96sAnA/SBdiHNUgYZXh4lxjyxTgD9FiFKFlpeYmZqbnJ2en5CRoqOkpaanqKmqq6ytrq+gobKztLW2t7i5srUwAAIfkECQYAAgAsAAAAAEAAQAAAAp6Uj6l7EB+YnLQyiK3eCIKFedxIhRHimCfJdiqqrglAt1WcqN8c2hPu6ilePhAx+DCaipflKBXasYQHKicmHR2Zhq3WlGU6WVArV/AIf71nrq4NF5ST8biojs/r9y0zn8T2pzGXJggIZLhBSJe4Edj4MwbpWDhpeYmZqbnJ2en5CRoqOkpaanqKmqq6ytrq+gobKztLW2t7i5uru3tZAAAh+QQJBgACACwAAAAAQABAAAACpJSPqasQz6KcEsiHA91cZe19UEdOIoicaMkijmilZ0sf6iqodf2KSY+J7VqzUKbyELI+ro8yEXgaMUSfDLeEZa1DaLEDPHa9XM5tTGaWTtLulxTGop21IDoiv+tbDkB7P1QGGPg2WFdoWCWYuKXGSBOX92jmOFn3Z5mpucnZ6fkJGio6SlpqeoqaqrrK2ur6ChsrO0tba3uLm6u7y9vr+wscXFsAACH5BAkGAAIALAAAAABAAEAAAAKelI+pywYNo0yhvlbz3NxkvXxgR4ZipQBnULbUqqzB5bZyvNI1eePiHvkdVEJfRgd8FQUiJOKThPSiVMe0ilA5J1csc8k9baO5Dsx76IZn6Oe5DVRnoXBGmUGk140ojHhvMjYkB7h2Uuhyh8hzuNiSx+IoOUlZaXmJmam5ydnp+QkaKjpKWmp6ipqqusra6voKGys7S1tre4ubq7u7VwAAIfkECQYAAgAsAAAAAEAAQAAAAqKUj6kIsA+jnAeEe6N1tHuDhU+YfeZIlkkacOcLsu7BBvBdK7V9QxaW+JEWud5CCESkUEMjkaVrRUgzJw0Kk1qfy6031v16w+JxsoxORy/VlUgNSbXBb3gQ6ybb6aF2ba72p4CEAZhWlNe0p6R31be4pnJ0BllpeYmZqbnJ2en5CRoqOkpaanqKmqq6ytrq+gobKztLW2t7i5uru8vb6/uLWgAAIfkECQYAAgAsAAAAAEAAQAAAApuUj6kaDQujnFSAhkPdnGf8dOJ4XF8jZeRqnBhkqiwkJ6623DPz8T3t2iF0tlouKGwhScRkc7R0RkcxXPJwump91u0sAAh5t9nxtfoyC5/qFbsNncJFaNScVb5/u/p+++cnIheYMkgIZHiYUAemSPHmeJQhFikRU4mZqbnJ2en5CRoqOkpaanqKmqq6ytrq+gobKztLW2t7i/tZAAAh+QQJBgACACwAAAAAQABAAAACmJSPqSvhwaKcNL5Xs9b37g8mHRaWCEAqo2O2I6CuVIC2CTou79TBdiPTpSy534rmOhqDpiNk2bHhej9DFOoBPXxVxvVT7C5Q3I1SjD6ju+o1Nut+s+LsS5mOz+v3/L7/DxgoOEhYaHiICDaUKPLFeND2GMk4mViJOLX4CKS56fkJGio6SlpqeoqaqrrK2ur6ChsrO0tbq1cAACH5BAkGAAIALAAAAABAAEAAAAKalI+pexAfmJy0Moit3htDwIUTBiqO94hqgkbJia4ynCltKYttgB9tvtr1fDWgiAYxEnlKwU8Zg36auw2tOXpWkC6sTUu5eb9RCjc1Rogru27aUGaD34ahZU6fFfP8vv8PGCg4SFhoeIiYqLjI2Oj4CBkpOUlZaXmJmam5ydnZMTWJx1gVKVS69ngW6mHn6OEJGys7S1tre5tZAAAh+QQJBgACACwAAAAAQABAAAACmJSPqcsC0KKcNIWLq6YAh9h5AbSVing1aGq2xkqeq9uGKLN+dJnriu3ZmWAqkXB4i2Bixw2wKTRCp4gZlUq8NoFB7bHnbWbDiaeE6yMfrMquusp+I5PyubTOi+Mr+n3F7BcoOEhYaHiImKi4yNjo+AgZKTlJWWl5iZmpucnZ6fkJGio6OuoGicLEmHPap7j6+AorktpoClUAACH5BAkGAAIALAAAAABAAEAAAAKNlI+py+0PWZgg2ovF3CHymoUHxz1kAIrZOTkAq4Zs18zxCtf5be2Sz4O8NindJzgqIZVIzakJRbCKUd7wWV3asloSlau6bsBQIvmMTqvX7Lb7DY9XSXIPts4Qm/GLGY2f4AfYdzeIoPdlaDCm2Oj4CBkpOUlZaXmJmam5ydnp+QkaKjpKWmp6ipqqqlYAACH5BAkGAAIALAAAAABAAEAAAAKLlI+pCLAPo5wHhHup3hx7DoaJ94lmR16OZGHrqaXZlL4wK9P5LXj2kaLIArzaQxXbnVokXk9pGv6izZvU+ZzdmCWs1wD9YqvisvmMTqvX7Lb7DY/L5/S6/Y7P6/f8vv8PGCg4SFj41TAY9CczlTe0GKb36DdJSfbX0mi4ydnp+QkaKjpKWmp6iqpWAAAh+QQJBgACACwAAAAAQABAAAACi5SPqQvhsaKctIqHrd4bP8CFItJ4zohy5pO2DbWCrViy0TqPeFRDebjy/YaHoIx4yeh2SCanZ2uajioP0gCNihxUYlB4zcXCQyd51jur1+y2+w2Py+f0uv2Oz+v3/L7/DxgoOEhYaHiImKi4yNjo+AgZKTlJWZmH0eVnxpcF1mcECPrXKbj5+WEpUQAAIfkECQYAAgAsAAAAAEAAQAAAAnmUj6mb4cCinDS6G6reG2MOho3niKYAXBRZniAJWazLpeQE090s3brGCsR+REOwiDT6kkUP8wmNSqfUqvXa+2Bfy+2K5/12w7IxeWFznnGe4bqcecvn9Lr9js/r9/y+/w8YKDhIWGh4iJiouMjY6PgIGSk5SVlp2VgAACH5BAkGAAIALAAAAABAAEAAAAJ7lI+py+0Pows0AIlzrFz7w10QwFWfV1JQSolnRKYj674Pa92sLeE1s+PNZJvKT9gIIpeJEPMJjUqn1Kr1is1qt9yu9wsOi8fksvmMTqvX7PaJdEyX4mXaGqeOEeVKNP5e4mbiRlhoeIiYqLjI2Oj4CBkpOUlZaXmJ2VAAACH5BAkGAAIALAAAAABAAEAAAAJ6lI+py+0PWQgg2osFmLzmDxrcGJbXOHrXRpkQiwZY7DrxpEK3XEv0ees1UJmd0AYyHpewzvL5e0Jz0qr1is1qt9yu9wsOi8fksvmMTqvX7Lb7DY/L5/S6/Y7P6/f8vv8PGCg45wQXxaaEGNSWuNboiEKl1sQzaHmZVQAAIfkECQYAAgAsAAAAAEAAQAAAAm2Uj6kZAbCinLSahoPdnGcMdeKIfBiJdoDZpK7Fau8csfS9fPiuOPzPCwFxq8zwZju6YsplskliQklF3TRqvWJb2q73Cw6Lx+Sy+YxOq9fstvsNj8vn9Lr9js/r9/y+/w8YKDhIWGh4iJioeFUAACH5BAkGAAIALAAAAABAAEAAAAJnlI+pa+EBmJy0svei3dxi3IVi8j3jGZYOynpqC0+lFtckaOf6zvf+DwwKh8Si8YhMKpfMpvMJjUp3mSkCULI2ZlpVwIp9Wb3drFbwOavX7Lb7DY/L5/S6/Y7P6/f8vv8PGCg4SMhXAAAh+QQJBgACACwAAAAAQABAAAACapSPqcvtD+MDocqLZd0B5A8aFGeFpkZW3sk2qdrGyhvINvLeukDufu0LCofEovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5LL5jE6r1+zsikt6X1/yKi17x+bnOXxvu1HXNkhYaHj4VAAAIfkECQYAAgAsAAAAAEAAQAAAAleUj6nL7Q+jnLTai7PevHsZhOFHHuJZkieacsAqth08yhsN2Desz3EPDAqHxKLxiEwql8ym8wmNSqfUqvWKzWq33K73Cw6Lx+Sy+YxOq9fstvsNj8vnyAIAIfkECQYAAgAsAAAAAEAAQAAAAlmUj6nL7Q+jnLTai7PevPsPhuJIluaJpurKtu4Lx/JMBTZAP/Ye5AzP8ymAO2GCaDMikD2lAelEAILRqvWKzWq33K73Cw6Lx+Sy+YxOq9fstvsNj8vn9Hq4AAAh+QQJBgACACwAAAAAQABAAAACVpSPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzGYrAIX6olQetbq7RgFZbYCrA3h7WrAV60yr1+y2+w2Py0UFADs=\";\n\n $statusdiv = $(\"<div />\")\n .attr({\n \"class\": setting.classstatusdiv + \" preloadevt\"\n })\n .css({\n position: \"absolute\",\n display: \"none\",\n zIndex: basezindex,\n top: 0,\n left: 0\n })\n .html('<img src=\"' + setting.loadinggif + '\" />')\n .appendTo(document.body);\n\n $tracker = $(\"<div />\")\n .attr({\n \"class\": setting.classtracker\n })\n .css({\n zIndex: basezindex,\n backgroundImage: self.isie ? \"url(cannotbe)\" : \"none\",\n position: \"absolute\",\n width: img.w,\n height: img.h,\n left: gallery ? $img.offsetsl().left : -10000,\n top: gallery ? $img.offsetsl().top : -10000\n }).appendTo(document.body);\n\n $textdn = $(\"<div />\");\n if (textdn) {\n $textdn.attr({\n \"class\": setting.classtextdn\n })\n .css({\n position: \"absolute\",\n zIndex: basezindex,\n left: 0,\n top: 0,\n display: \"none\"\n })\n .html(textdn)\n .appendTo(document.body);\n if (!options.classtextdn)\n $textdn.css({\n border: setting.magnifierborder,\n background: setting.textdnbackground,\n padding: setting.textdnpadding,\n font: setting.textdnfont\n });\n $textdn.css({\n width: setting.magnifiersize[0] - parseInt($textdn.css(\"padding-left\")) - parseInt($textdn.css(\"padding-right\"))\n });\n }\n $tracker.data(\"largeimage\", setting.largeimage);\n\n\n // EVENTS\t\t\t\n $(window).bind(\"resize\", function () {\n var o = $img.offsetsl();\n if ($tracker.data(\"loadimgevt\"))\n $tracker.css({\n left: o.left,\n top: o.top\n });\n $statusdiv.filter(\".preloadevt\").css({\n left: o.left + img.w / 2 - $statusdiv.width() / 2,\n top: o.top + img.h / 2 - $statusdiv.height() / 2,\n visibility: 'visible'\n });\n });\n $(document).mousemove(function (e) {\n self.cld.docX = e.pageX;\n if (self.cld.pageX999 !== self.cld.docX) {\n clearTimeout(self.cld.controlTimer);\n clearTimeout(self.cld.controlTimer2);\n $img.css({\n visibility: \"visible\"\n });\n }\n });\n $img.mouseover(function (e) {\n var o = $img.offsetsl();\n $tracker.css({\n left: o.left,\n top: o.top\n }).show();\n });\n $tracker.mouseover(function (e) {\n\n \tif(window.innerWidth <= 1150){\n \treturn false;\n }\n \t\n \tself.cld.pageX999 = e.pageX;\n self.cld.pageY999 = e.pageY;\n\n cld.pageX999 = e.pageX;\n cld.pageY999 = e.pageY;\n\n self.cld.docX = e.pageX;\n\n var o = $img.offsetsl(),\n pageX = self.cld.pageX999 - o.left,\n pageY = self.cld.pageY999 - o.top;\n\n self.cld.destK = pageX;\n self.cld.destL = pageY;\n\n self.cld.currU = pageX;\n self.cld.currV = pageY;\n\n self.cld.destM = self.cld.pageX999;\n self.cld.destN = self.cld.pageY999;\n\n self.cld.destU = self.cld.pageX999 - 10;\n self.cld.destV = self.cld.pageY999 + 20;\n\n $tracker.css({\n cursor: setting.magnifycursor\n });\n setting.largeimage = $img.attr(\"data-large\") || $img.attr(\"src\");\n\n $statusdiv.show();\n clearTimeout(self.cld.controlTimer);\n clearTimeout(self.cld.controlTimer2);\n\n if (setting.largeimage !== $tracker.data('largeimage')) {\n\n $(new Image()).on('load', function () {}).attr(\"src\", setting.largeimage);\n\n $($tracker).unbind();\n $($statusdiv).remove();\n $($cursorshade).remove();\n $($magnifier).remove();\n $($tracker).remove();\n $($textdn).remove();\n\n self.init($img, options, true);\n }\n if ($tracker.data(\"loadevt\")) {\n $cursorshade.fadeIn();\n self.showimage($tracker);\n self.controlLoop($tracker);\n self.controlLoop2($tracker);\n }\n\n });\n $tracker.mousemove(function (e) {\n setting.largeimage = $img.attr(\"data-large\") || $img.attr(\"src\");\n if (setting.largeimage !== $tracker.data(\"largeimage\")) {\n\n $(new Image()).on('load', function () {}).attr(\"src\", setting.largeimage);\n\n $($tracker).unbind();\n $($statusdiv).remove();\n $($cursorshade).remove();\n $($magnifier).remove();\n $($tracker).remove();\n $($textdn).remove();\n\n self.init($img, options, true);\n }\n\n self.cld.pageX999 = e.pageX;\n self.cld.pageY999 = e.pageY;\n\n cld.pageX999 = e.pageX;\n cld.pageY999 = e.pageY;\n\n self.cld.docX = e.pageX;\n });\n $tracker.mouseout(function (e) {\n clearTimeout(self.cld.controlTimer);\n clearTimeout(self.cld.controlTimer2);\n $img.css({\n visibility: \"visible\"\n });\n $textdn.hide();\n $cursorshade.add($statusdiv.not(\".preloadevt\")).stop(true, true).hide();\n });\n $tracker.one(\"mouseover\", function (e) {\n\n var imgcoords = $img.offsetsl();\n var $bigimage = $('<img src=\"' + setting.largeimage + '\"/>').css({\n position: \"relative\",\n maxWidth: \"none\"\n }).appendTo($magnifier);\n if (!self.loaded999[setting.largeimage]) {\n $tracker.css({\n opacity: setting.loadopacity,\n background: setting.loadbackground\n });\n $tracker.data(\"loadimgevt\", true);\n $statusdiv.css({\n left: imgcoords.left + img.w / 2 - $statusdiv.width() / 2,\n top: imgcoords.top + img.h / 2 - $statusdiv.height() / 2,\n visibility: 'visible'\n });\n }\n $bigimage.bind(\"loadevt\", function (event, e) {\n\n if (e.type === \"error\") return;\n $tracker.mouseout(function (e) { //image onmouseout\n self.hideimage($tracker);\n clearTimeout(self.cld.controlTimer);\n clearTimeout(self.cld.controlTimer2);\n $img.css({\n visibility: \"visible\"\n });\n $textdn.hide();\n $tracker.hide().css({\n left: -10000,\n top: -10000\n });\n });\n $tracker.mouseover(function (e) { //image onmouseover\n specs.currM = specs.newpower;\n });\n $tracker.data(\"loadimgevt\", false);\n $tracker.css({\n opacity: 0,\n cursor: setting.magnifycursor\n });\n $statusdiv.empty();\n if (!options.classstatusdiv)\n $statusdiv.css({\n border: setting.statusdivborder,\n background: setting.statusdivbackground,\n padding: setting.statusdivpadding,\n font: setting.statusdivfont,\n opacity: setting.statusdivopacity\n });\n $statusdiv.hide().removeClass(\"preloadevt\");\n self.loaded999[setting.largeimage] = true;\n getspecs($bigimage);\n if (cld.pageX999 == self.cld.docX) {\n $cursorshade.fadeIn();\n self.showimage($tracker);\n clearTimeout(self.cld.controlTimer);\n clearTimeout(self.cld.controlTimer2);\n self.controlLoop($tracker);\n self.controlLoop2($tracker);\n }\n\n var specs = $tracker.data(\"specs\");\n $bigimage.css({\n width: setting.zoomstart * specs.bigimage.w * (img.w / specs.bigimage.w),\n height: setting.zoomstart * specs.bigimage.h * (img.h / specs.bigimage.h)\n });\n $tracker.data(\"loadevt\", true);\n\n if (setting.zoomrange && setting.zoomrange[1] > setting.zoomrange[0]) { //if zoom range enabled\n $tracker.bind(\"mousewheel\", function (e, delta) {\n var zoomdir = delta < 0 ? \"out\" : \"in\",\n power = specs.newpower,\n newpower = (zoomdir == \"in\") ? Math.min(power + setting.stepzoom, setting.zoomrange[1]) : Math.max(power - setting.stepzoom, setting.zoomrange[0]);\n\n specs.newpower = newpower;\n specs.delta = delta;\n e.preventDefault();\n });\n\n } else if (setting.disablewheel) {\n $tracker.bind(\"mousewheel\", function (e) {\n e.preventDefault();\n });\n }\n\n }); //end $bigimage onload */\n\n if (isImageLoaded($bigimage.get(0)))\n $bigimage.trigger(\"loadevt\", {\n type: \"load\"\n });\n else $bigimage.bind(\"load error\", function (e) {\n $bigimage.trigger(\"loadevt\", e)\n });\n });\n },\n loaded999: {}\n });\n})(jQuery, window);", "\"use strict\";\n\n// rawAsap provides everything we need except exception management.\nvar rawAsap = require(50);\n// RawTasks are recycled to reduce GC churn.\nvar freeTasks = [];\n// We queue errors to ensure they are thrown in right order (FIFO).\n// Array-as-queue is good enough here, since we are just dealing with exceptions.\nvar pendingErrors = [];\nvar requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);\n\nfunction throwFirstError() {\n if (pendingErrors.length) {\n throw pendingErrors.shift();\n }\n}\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nmodule.exports = asap;\nfunction asap(task) {\n var rawTask;\n if (freeTasks.length) {\n rawTask = freeTasks.pop();\n } else {\n rawTask = new RawTask();\n }\n rawTask.task = task;\n rawAsap(rawTask);\n}\n\n// We wrap tasks with recyclable task objects. A task object implements\n// `call`, just like a function.\nfunction RawTask() {\n this.task = null;\n}\n\n// The sole purpose of wrapping the task is to catch the exception and recycle\n// the task object after its single use.\nRawTask.prototype.call = function () {\n try {\n this.task.call();\n } catch (error) {\n if (asap.onerror) {\n // This hook exists purely for testing purposes.\n // Its name will be periodically randomized to break any code that\n // depends on its existence.\n asap.onerror(error);\n } else {\n // In a web browser, exceptions are not fatal. However, to avoid\n // slowing down the queue of pending tasks, we rethrow the error in a\n // lower priority turn.\n pendingErrors.push(error);\n requestErrorThrow();\n }\n } finally {\n this.task = null;\n freeTasks[freeTasks.length] = this;\n }\n};\n", "\"use strict\";\n\n// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nmodule.exports = rawAsap;\nfunction rawAsap(task) {\n if (!queue.length) {\n requestFlush();\n flushing = true;\n }\n // Equivalent to push, but avoids a function call.\n queue[queue.length] = task;\n}\n\nvar queue = [];\n// Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\nvar flushing = false;\n// `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\nvar requestFlush;\n// The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\nvar index = 0;\n// If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\nvar capacity = 1024;\n\n// The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\nfunction flush() {\n while (index < queue.length) {\n var currentIndex = index;\n // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n index = index + 1;\n queue[currentIndex].call();\n // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n if (index > capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n queue[scan] = queue[scan + index];\n }\n queue.length -= index;\n index = 0;\n }\n }\n queue.length = 0;\n index = 0;\n flushing = false;\n}\n\n// `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n\n/* globals self */\nvar scope = typeof global !== \"undefined\" ? global : self;\nvar BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;\n\n// MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nif (typeof BrowserMutationObserver === \"function\") {\n requestFlush = makeRequestCallFromMutationObserver(flush);\n\n// MessageChannels are desirable because they give direct access to the HTML\n// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\n} else {\n requestFlush = makeRequestCallFromTimer(flush);\n}\n\n// `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\nrawAsap.requestFlush = requestFlush;\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nfunction makeRequestCallFromMutationObserver(callback) {\n var toggle = 1;\n var observer = new BrowserMutationObserver(callback);\n var node = document.createTextNode(\"\");\n observer.observe(node, {characterData: true});\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\nfunction makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n var timeoutHandle = setTimeout(handleTimer, 0);\n // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n var intervalHandle = setInterval(handleTimer, 50);\n\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n}\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n", "'use strict';\n\nmodule.exports = require(56)\n", "'use strict';\n\nvar asap = require(50);\n\nfunction noop() {}\n\n// States:\n//\n// 0 - pending\n// 1 - fulfilled with _value\n// 2 - rejected with _value\n// 3 - adopted the state of another promise, _value\n//\n// once the state is no longer pending (0) it is immutable\n\n// All `_` prefixed properties will be reduced to `_{random number}`\n// at build time to obfuscate them and discourage their use.\n// We don't use symbols or Object.defineProperty to fully hide them\n// because the performance isn't good enough.\n\n\n// to avoid using try/catch inside critical functions, we\n// extract them to here.\nvar LAST_ERROR = null;\nvar IS_ERROR = {};\nfunction getThen(obj) {\n try {\n return obj.then;\n } catch (ex) {\n LAST_ERROR = ex;\n return IS_ERROR;\n }\n}\n\nfunction tryCallOne(fn, a) {\n try {\n return fn(a);\n } catch (ex) {\n LAST_ERROR = ex;\n return IS_ERROR;\n }\n}\nfunction tryCallTwo(fn, a, b) {\n try {\n fn(a, b);\n } catch (ex) {\n LAST_ERROR = ex;\n return IS_ERROR;\n }\n}\n\nmodule.exports = Promise;\n\nfunction Promise(fn) {\n if (typeof this !== 'object') {\n throw new TypeError('Promises must be constructed via new');\n }\n if (typeof fn !== 'function') {\n throw new TypeError('Promise constructor\\'s argument is not a function');\n }\n this._x = 0;\n this._y = 0;\n this._z = null;\n this._A = null;\n if (fn === noop) return;\n doResolve(fn, this);\n}\nPromise._B = null;\nPromise._C = null;\nPromise._D = noop;\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n if (this.constructor !== Promise) {\n return safeThen(this, onFulfilled, onRejected);\n }\n var res = new Promise(noop);\n handle(this, new Handler(onFulfilled, onRejected, res));\n return res;\n};\n\nfunction safeThen(self, onFulfilled, onRejected) {\n return new self.constructor(function (resolve, reject) {\n var res = new Promise(noop);\n res.then(resolve, reject);\n handle(self, new Handler(onFulfilled, onRejected, res));\n });\n}\nfunction handle(self, deferred) {\n while (self._y === 3) {\n self = self._z;\n }\n if (Promise._B) {\n Promise._B(self);\n }\n if (self._y === 0) {\n if (self._x === 0) {\n self._x = 1;\n self._A = deferred;\n return;\n }\n if (self._x === 1) {\n self._x = 2;\n self._A = [self._A, deferred];\n return;\n }\n self._A.push(deferred);\n return;\n }\n handleResolved(self, deferred);\n}\n\nfunction handleResolved(self, deferred) {\n asap(function() {\n var cb = self._y === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n if (self._y === 1) {\n resolve(deferred.promise, self._z);\n } else {\n reject(deferred.promise, self._z);\n }\n return;\n }\n var ret = tryCallOne(cb, self._z);\n if (ret === IS_ERROR) {\n reject(deferred.promise, LAST_ERROR);\n } else {\n resolve(deferred.promise, ret);\n }\n });\n}\nfunction resolve(self, newValue) {\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n if (newValue === self) {\n return reject(\n self,\n new TypeError('A promise cannot be resolved with itself.')\n );\n }\n if (\n newValue &&\n (typeof newValue === 'object' || typeof newValue === 'function')\n ) {\n var then = getThen(newValue);\n if (then === IS_ERROR) {\n return reject(self, LAST_ERROR);\n }\n if (\n then === self.then &&\n newValue instanceof Promise\n ) {\n self._y = 3;\n self._z = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(then.bind(newValue), self);\n return;\n }\n }\n self._y = 1;\n self._z = newValue;\n finale(self);\n}\n\nfunction reject(self, newValue) {\n self._y = 2;\n self._z = newValue;\n if (Promise._C) {\n Promise._C(self, newValue);\n }\n finale(self);\n}\nfunction finale(self) {\n if (self._x === 1) {\n handle(self, self._A);\n self._A = null;\n }\n if (self._x === 2) {\n for (var i = 0; i < self._A.length; i++) {\n handle(self, self._A[i]);\n }\n self._A = null;\n }\n}\n\nfunction Handler(onFulfilled, onRejected, promise){\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}\n", "'use strict';\n\nvar Promise = require(52);\n\nmodule.exports = Promise;\nPromise.prototype.done = function (onFulfilled, onRejected) {\n var self = arguments.length ? this.then.apply(this, arguments) : this;\n self.then(null, function (err) {\n setTimeout(function () {\n throw err;\n }, 0);\n });\n};\n", "'use strict';\n\n//This file contains the ES6 extensions to the core Promises/A+ API\n\nvar Promise = require(52);\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nvar TRUE = valuePromise(true);\nvar FALSE = valuePromise(false);\nvar NULL = valuePromise(null);\nvar UNDEFINED = valuePromise(undefined);\nvar ZERO = valuePromise(0);\nvar EMPTYSTRING = valuePromise('');\n\nfunction valuePromise(value) {\n var p = new Promise(Promise._D);\n p._y = 1;\n p._z = value;\n return p;\n}\nPromise.resolve = function (value) {\n if (value instanceof Promise) return value;\n\n if (value === null) return NULL;\n if (value === undefined) return UNDEFINED;\n if (value === true) return TRUE;\n if (value === false) return FALSE;\n if (value === 0) return ZERO;\n if (value === '') return EMPTYSTRING;\n\n if (typeof value === 'object' || typeof value === 'function') {\n try {\n var then = value.then;\n if (typeof then === 'function') {\n return new Promise(then.bind(value));\n }\n } catch (ex) {\n return new Promise(function (resolve, reject) {\n reject(ex);\n });\n }\n }\n return valuePromise(value);\n};\n\nvar iterableToArray = function (iterable) {\n if (typeof Array.from === 'function') {\n // ES2015+, iterables exist\n iterableToArray = Array.from;\n return Array.from(iterable);\n }\n\n // ES5, only arrays and array-likes exist\n iterableToArray = function (x) { return Array.prototype.slice.call(x); };\n return Array.prototype.slice.call(iterable);\n}\n\nPromise.all = function (arr) {\n var args = iterableToArray(arr);\n\n return new Promise(function (resolve, reject) {\n if (args.length === 0) return resolve([]);\n var remaining = args.length;\n function res(i, val) {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n if (val instanceof Promise && val.then === Promise.prototype.then) {\n while (val._y === 3) {\n val = val._z;\n }\n if (val._y === 1) return res(i, val._z);\n if (val._y === 2) reject(val._z);\n val.then(function (val) {\n res(i, val);\n }, reject);\n return;\n } else {\n var then = val.then;\n if (typeof then === 'function') {\n var p = new Promise(then.bind(val));\n p.then(function (val) {\n res(i, val);\n }, reject);\n return;\n }\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n }\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n};\n\nfunction onSettledFulfill(value) {\n return { status: 'fulfilled', value: value };\n}\nfunction onSettledReject(reason) {\n return { status: 'rejected', reason: reason };\n}\nfunction mapAllSettled(item) {\n if(item && (typeof item === 'object' || typeof item === 'function')){\n if(item instanceof Promise && item.then === Promise.prototype.then){\n return item.then(onSettledFulfill, onSettledReject);\n }\n var then = item.then;\n if (typeof then === 'function') {\n return new Promise(then.bind(item)).then(onSettledFulfill, onSettledReject)\n }\n }\n\n return onSettledFulfill(item);\n}\nPromise.allSettled = function (iterable) {\n return Promise.all(iterableToArray(iterable).map(mapAllSettled));\n};\n\nPromise.reject = function (value) {\n return new Promise(function (resolve, reject) {\n reject(value);\n });\n};\n\nPromise.race = function (values) {\n return new Promise(function (resolve, reject) {\n iterableToArray(values).forEach(function(value){\n Promise.resolve(value).then(resolve, reject);\n });\n });\n};\n\n/* Prototype Methods */\n\nPromise.prototype['catch'] = function (onRejected) {\n return this.then(null, onRejected);\n};\n\nfunction getAggregateError(errors){\n if(typeof AggregateError === 'function'){\n return new AggregateError(errors,'All promises were rejected');\n }\n\n var error = new Error('All promises were rejected');\n\n error.name = 'AggregateError';\n error.errors = errors;\n\n return error;\n}\n\nPromise.any = function promiseAny(values) {\n return new Promise(function(resolve, reject) {\n var promises = iterableToArray(values);\n var hasResolved = false;\n var rejectionReasons = [];\n\n function resolveOnce(value) {\n if (!hasResolved) {\n hasResolved = true;\n resolve(value);\n }\n }\n\n function rejectionCheck(reason) {\n rejectionReasons.push(reason);\n\n if (rejectionReasons.length === promises.length) {\n reject(getAggregateError(rejectionReasons));\n }\n }\n\n if(promises.length === 0){\n reject(getAggregateError(rejectionReasons));\n } else {\n promises.forEach(function(value){\n Promise.resolve(value).then(resolveOnce, rejectionCheck);\n });\n }\n });\n};\n", "'use strict';\n\nvar Promise = require(52);\n\nmodule.exports = Promise;\nPromise.prototype.finally = function (f) {\n return this.then(function (value) {\n return Promise.resolve(f()).then(function () {\n return value;\n });\n }, function (err) {\n return Promise.resolve(f()).then(function () {\n throw err;\n });\n });\n};\n", "'use strict';\n\nmodule.exports = require(52);\nrequire(53);\nrequire(55);\nrequire(54);\nrequire(57);\nrequire(58);\n", "'use strict';\n\n// This file contains then/promise specific extensions that are only useful\n// for node.js interop\n\nvar Promise = require(52);\nvar asap = require(49);\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nPromise.denodeify = function (fn, argumentCount) {\n if (\n typeof argumentCount === 'number' && argumentCount !== Infinity\n ) {\n return denodeifyWithCount(fn, argumentCount);\n } else {\n return denodeifyWithoutCount(fn);\n }\n};\n\nvar callbackFn = (\n 'function (err, res) {' +\n 'if (err) { rj(err); } else { rs(res); }' +\n '}'\n);\nfunction denodeifyWithCount(fn, argumentCount) {\n var args = [];\n for (var i = 0; i < argumentCount; i++) {\n args.push('a' + i);\n }\n var body = [\n 'return function (' + args.join(',') + ') {',\n 'var self = this;',\n 'return new Promise(function (rs, rj) {',\n 'var res = fn.call(',\n ['self'].concat(args).concat([callbackFn]).join(','),\n ');',\n 'if (res &&',\n '(typeof res === \"object\" || typeof res === \"function\") &&',\n 'typeof res.then === \"function\"',\n ') {rs(res);}',\n '});',\n '};'\n ].join('');\n return Function(['Promise', 'fn'], body)(Promise, fn);\n}\nfunction denodeifyWithoutCount(fn) {\n var fnLength = Math.max(fn.length - 1, 3);\n var args = [];\n for (var i = 0; i < fnLength; i++) {\n args.push('a' + i);\n }\n var body = [\n 'return function (' + args.join(',') + ') {',\n 'var self = this;',\n 'var args;',\n 'var argLength = arguments.length;',\n 'if (arguments.length > ' + fnLength + ') {',\n 'args = new Array(arguments.length + 1);',\n 'for (var i = 0; i < arguments.length; i++) {',\n 'args[i] = arguments[i];',\n '}',\n '}',\n 'return new Promise(function (rs, rj) {',\n 'var cb = ' + callbackFn + ';',\n 'var res;',\n 'switch (argLength) {',\n args.concat(['extra']).map(function (_, index) {\n return (\n 'case ' + (index) + ':' +\n 'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' +\n 'break;'\n );\n }).join(''),\n 'default:',\n 'args[argLength] = cb;',\n 'res = fn.apply(self, args);',\n '}',\n \n 'if (res &&',\n '(typeof res === \"object\" || typeof res === \"function\") &&',\n 'typeof res.then === \"function\"',\n ') {rs(res);}',\n '});',\n '};'\n ].join('');\n\n return Function(\n ['Promise', 'fn'],\n body\n )(Promise, fn);\n}\n\nPromise.nodeify = function (fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n var callback =\n typeof args[args.length - 1] === 'function' ? args.pop() : null;\n var ctx = this;\n try {\n return fn.apply(this, arguments).nodeify(callback, ctx);\n } catch (ex) {\n if (callback === null || typeof callback == 'undefined') {\n return new Promise(function (resolve, reject) {\n reject(ex);\n });\n } else {\n asap(function () {\n callback.call(ctx, ex);\n })\n }\n }\n }\n};\n\nPromise.prototype.nodeify = function (callback, ctx) {\n if (typeof callback != 'function') return this;\n\n this.then(function (value) {\n asap(function () {\n callback.call(ctx, null, value);\n });\n }, function (err) {\n asap(function () {\n callback.call(ctx, err);\n });\n });\n};\n", "'use strict';\n\nvar Promise = require(52);\n\nmodule.exports = Promise;\nPromise.enableSynchronous = function () {\n Promise.prototype.isPending = function() {\n return this.getState() == 0;\n };\n\n Promise.prototype.isFulfilled = function() {\n return this.getState() == 1;\n };\n\n Promise.prototype.isRejected = function() {\n return this.getState() == 2;\n };\n\n Promise.prototype.getValue = function () {\n if (this._y === 3) {\n return this._z.getValue();\n }\n\n if (!this.isFulfilled()) {\n throw new Error('Cannot get a value of an unfulfilled promise.');\n }\n\n return this._z;\n };\n\n Promise.prototype.getReason = function () {\n if (this._y === 3) {\n return this._z.getReason();\n }\n\n if (!this.isRejected()) {\n throw new Error('Cannot get a rejection reason of a non-rejected promise.');\n }\n\n return this._z;\n };\n\n Promise.prototype.getState = function () {\n if (this._y === 3) {\n return this._z.getState();\n }\n if (this._y === -1 || this._y === -2) {\n return 0;\n }\n\n return this._y;\n };\n};\n\nPromise.disableSynchronous = function() {\n Promise.prototype.isPending = undefined;\n Promise.prototype.isFulfilled = undefined;\n Promise.prototype.isRejected = undefined;\n Promise.prototype.getValue = undefined;\n Promise.prototype.getReason = undefined;\n Promise.prototype.getState = undefined;\n};\n", "'use strict';\n\nmodule.exports = window.jQuery;" ] }