{"version":3,"names":[],"mappings":"","sources":["app.js"],"sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o= charsLimit) && (controlKeys.indexOf(e.which.toString()) < 0)) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t})\n\t\t.on('change keyup mouseup', 'textarea[data-character-limit]', function () {\n\t\t\tvar text = $.trim($(this).val()),\n\t\t\t\tcharsLimit = $(this).data('character-limit'),\n\t\t\t\tcharsUsed = text.length,\n\t\t\t\tcharsRemain = charsLimit - charsUsed;\n\n\t\t\tif (charsRemain < 0) {\n\t\t\t\t$(this).val(text.slice(0, charsRemain));\n\t\t\t\tcharsRemain = 0;\n\t\t\t}\n\n\t\t\t$(this).next('div.char-count').find('.char-remain-count').html(charsRemain);\n\t\t});\n\n\n\t// Listen for header stuck state\n\t$(window).on('scroll', function () {\n\t\tif (window.matchMedia('(max-width: 1024px)').matches) {\n\t\t\treturn;\n\t\t}\n\t\tvar scroll = $(window).scrollTop();\n\t\tif (scroll < 120) {\n\t\t\t$('.header-sticky').removeClass('is-sticky');\n\t\t}\n\t\tif (scroll >= 200) {\n\t\t\t$('.header-sticky').addClass('is-sticky');\n\t\t}\n\n\t});\n\tgtmtool.initUData();\n\n // google tag manager event for search bar\n $(document).on('click', '.suggestions-hit, .suggestions-product-link', function () {\n var targetClass = $(this).get(0).className;\n var $parent;\n var resultsNbr;\n if (targetClass.includes('suggestions-hit')) {\n $parent = $(this).closest('.suggestions-hitgroup');\n resultsNbr = $parent.find('.suggestions-hit').length;\n } else if (targetClass.includes('suggestions-product-link')) {\n $parent = $(this).closest('.suggestions-products');\n resultsNbr = $parent.find('.suggestions-product').length;\n }\n sessionStorage.setItem('datalayerEvt:search',\n JSON.stringify({\n name: 'search',\n data: {\n search_term: $(this).text().replace(/\\n/g, ''),\n search_category: 'site search',\n search_results: resultsNbr,\n search_method: \"text search\"\n }\n })\n );\n });\n \n $('form[name=simpleSearch]').on('submit', function() {\n sessionStorage.setItem('datalayerEvt:search',\n JSON.stringify({\n name: 'search',\n data: {\n search_term: $('.suggestions-phrase .completed').text(),\n search_category: 'site search',\n search_results: \"eval:parseInt($(document).find('#productsCount').data('productscount'), 10)\",\n search_method: \"text search\"\n }\n })\n );\n });\n\n\t/**\n\t * initialize search suggestions, pending the value of the site preference(enhancedSearchSuggestions)\n\t * this will either init the legacy(false) or the beta versions(true) of the the search suggest feature.\n\t * */\n\tvar $searchContainer = $('.header-search');\n\tif (SitePreferences.LISTING_SEARCHSUGGEST_LEGACY) {\n\t\tsearchsuggest.init($searchContainer, Resources.SIMPLE_SEARCH);\n\t} else {\n\t\tsearchsuggestbeta.init($searchContainer, Resources.SIMPLE_SEARCH);\n\t}\n\n\t// add show/hide navigation elements\n\t$('.secondary-navigation .toggle').click(function () {\n\t\t$(this).toggleClass('expanded').next('ul').toggle();\n\t});\n\n\t// add generic toggle functionality\n\t$('.toggle').next('.toggle-content').hide();\n\t$('.toggle').click(function () {\n\t\t$(this).toggleClass('expanded').next('.toggle-content').toggle();\n\t});\n\n\t//if you click on anything except the modal itself or the \"open modal\" link, close the modal\n\t$(document).click(function (event) {\n\t\tif ($(event.target).closest('.ui-widget-overlay').length == 1) {\n\t\t\tdialog.close();\n\t\t}\n\t});\n\n\t// open dialog for \n\t$(document).on('click', 'a[data-action=\"openDialog\"]', function (e) {\n\t\te.preventDefault();\n\t\tvar $this = $(this);\n\t\tvar widthSize = util.isDesktopSize() ? '600' : '96%';\n\t\tvar href = $this.data('href');\n\t\tvar popinId = $this.data('popinId');\n\t\tvar popinDiv = popinId && $this.parents().eq(1) !== null ? $this.parents().eq(1).find('#' + popinId) : null;\n\t\tvar popinDefinition = {\n\t\t\toptions: {\n\t\t\t\twidth: widthSize,\n\t\t\t\tdialogClass: $this.data('popinClass'),\n\t\t\t\tmodal: true,\n\t\t\t\tdraggable: false,\n\t\t\t\tresizable: false,\n\t\t\t\tshow: 'fade',\n\t\t\t\topen: function () {\n\t\t\t\t\t$('.close-dialog').on('click', function () {\n\t\t\t\t\t\tdialog.close();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (href && href !== '#') {\n\t\t\tpopinDefinition.url = href;\n\t\t} else if (popinDiv !== null && popinDiv.length > 0) {\n\t\t\tpopinDefinition.html = popinDiv.html();\n\t\t}\n\t\tif (popinDefinition.url || popinDefinition.html) {\n\t\t\tdialog.open(popinDefinition);\n\t\t}\n\t});\n\n\t// subscribe email box\n\tvar $subscribeEmail = $('.subscribe-email');\n\tif ($subscribeEmail.length > 0) {\n\t\t$subscribeEmail.focus(function () {\n\t\t\tvar val = $(this.val());\n\t\t\tif (val.length > 0 && val !== Resources.SUBSCRIBE_EMAIL_DEFAULT) {\n\t\t\t\treturn; // do not animate when contains non-default value\n\t\t\t}\n\n\t\t\t$(this).animate({ color: '#999999' }, 500, 'linear', function () {\n\t\t\t\t$(this).val('').css('color', '#333333');\n\t\t\t});\n\t\t}).blur(function () {\n\t\t\tvar val = $.trim($(this.val()));\n\t\t\tif (val.length > 0) {\n\t\t\t\treturn; // do not animate when contains value\n\t\t\t}\n\t\t\t$(this).val(Resources.SUBSCRIBE_EMAIL_DEFAULT)\n\t\t\t\t.css('color', '#999999')\n\t\t\t\t.animate({ color: '#333333' }, 500, 'linear');\n\t\t});\n\t}\n\n\t$('.privacy-policy').on('click', function (e) {\n\t\te.preventDefault();\n\t\tdialog.open({\n\t\t\turl: $(e.target).attr('href'),\n\t\t\toptions: {\n\t\t\t\theight: 600\n\t\t\t}\n\t\t});\n\t});\n\n\t// Original DW menu\n\t// main menu toggle\n\t$('.menu-toggle').on('click', function () {\n\t\t$('#wrapper').toggleClass('menu-active');\n\t});\n\t$('.menu-category li .menu-item-toggle').on('click', function (e) {\n\t\te.preventDefault();\n\t\tvar $parentLi = $(e.target).closest('li');\n\t\t$parentLi.siblings('li').removeClass('active').find('.menu-item-toggle').removeClass('fa-chevron-up active').addClass('fa-chevron-right');\n\t\t$parentLi.toggleClass('active');\n\t\t$(e.target).toggleClass('fa-chevron-right fa-chevron-up active');\n\t});\n\n\t// Move searchbox out of the way if it overlays with the topbar\n\tvar checkSearchboxOverlap = function () {\n\t\tif ($('.wrapper-header-search').length && $('.menu-category').length) {\n\t\t\tvar searchbox = $('.wrapper-header-search')[0].getBoundingClientRect();\n\t\t\tvar navigation = $('.menu-category.level-1 li:visible').last()[0].getBoundingClientRect();\n\n\t\t\tif (searchbox.left < navigation.right) {\n\t\t\t\t$('.wrapper-header-search').addClass('overlapping');\n\t\t\t} else {\n\t\t\t\t$('.wrapper-header-search').removeClass('overlapping');\n\t\t\t}\n\t\t}\n\t}\n\tcheckSearchboxOverlap();\n\t$(window).on('resize', _.debounce(checkSearchboxOverlap, 50));\n\n\t// Search tooggle on mobile\n\t$('.searchbox-toggle').on('click', function () {\n\t\t$('.header-search').toggleClass('is-expanded');\n\t\t$(\".searchbox .searchbox-input\").trigger(\"focus\");\n\t\t$('.menu-slide').removeClass('is-open');\n\n\t\t//Update Sticky Filters topspace\n\t\tvar $filterContainer = $('.search-result-refinements');\n\t\tif (window.matchMedia('(max-width: 1024px)').matches) {\n\t\t\t$filterContainer.stickySidebar(\"updateSticky\");\n\t\t}\n\t});\n\n\t// Check if the page is scollable if the refinements panel is closed\n\t$(document).on('refinements:after-reload', function() {\n\t\tif (!$('.search-result-refinements').hasClass('is-refinement-slider-open') && $('body').css('overflow') == 'hidden') {\n\t\t\t$('body').css('overflow', '');\n\t\t}\n\t})\n\t\n\t// Open the refinements menu on the inspiration page\n\t$(document).on(\"click\", '.refinements-slide-toggle', function(e) {\n\t\t$('.search-result-refinements').addClass('is-refinement-slider-open');\n\t\t\n\t\t// Set the background to dark\n\t\t$('#primary').addClass('backdrop');\n\n\t\t// Make the page unscrollable\n\t\t$('body').css('overflow', 'hidden');\n\t});\n\n\t// Close the refinements menu on the inspiration page\n\t$(document).on('click', '.refinements-close, .hidden-refinements .backdrop', function(e) {\n\t\t$('.search-result-refinements').removeClass('is-refinement-slider-open');\n\n\t\t// Remove the dark background\n\t\t$('#primary').removeClass('backdrop');\n\n\t\t// Remove the unscrollable page\n\t\t$('body').css('overflow', '');\n\t});\n\n\tvar $inspirationMenu = $('.inspiration-submenu-links');\n\tif ($inspirationMenu.length) {\n\t\t// Iterate over each elements to see if they are visible\n\t\t// If no children are visible, remove the sumbmenu arrow\n\t\tvar removeInspirationSubmenuArrow = true;\n\t\t$inspirationMenu.children().each(function(i, el) { \n\t\t\tif (!$(this).hasClass('show-on-desktop')) {\n\t\t\t\tremoveInspirationSubmenuArrow = false;\n\t\t\t}\n\t\t});\n\t\t\n\t\t// Hide the submenu arrow if inspiration has no children\n\t\tif ($inspirationMenu.children().length == 0) {\n\t\t\tremoveInspirationSubmenuArrow = true;\n\t\t}\n\t\tif (removeInspirationSubmenuArrow) {\n\t\t\t$('#inspiration-header-item').removeClass('has-sub-menu');\n\t\t}\n\t}\n\n\t$('.searchbox-submit').on(\"click\", function (e) {\n\t\tif ($('.searchbox-input').val() == \"\" || $('.searchbox-input').attr('placeholder') == $('.searchbox-input').val())\n\t\t\te.preventDefault();\n\t});\n\n\t// Paprika and Cassis menu\n\t$('.menu-toggle').on('click', function () {\n\t\t$('.menu-slide').toggleClass('is-open');\n\t});\n\t$('.menu-close').on('click', function () {\n\t\tif ($('#wrapper').hasClass('menu-active')) {\n\t\t\t$('#wrapper').removeClass('menu-active');\n\t\t}\n\t\t$('.menu-slide').removeClass('is-open');\n\t});\n\t$('.menu-category li .has-sub-menu').on('click', function (e) {\n\t\tif (window.matchMedia('(max-width: 1023px)').matches) {\n\t\t\te.preventDefault();\n\t\t\t$(this).siblings('.level-2').toggleClass('is-expanded');\n\t\t\t$(this).toggleClass('close-sub-menu');\n\t\t}\n\t});\n\n\n\t// Cassis sticky menu\n\t$(window).on('scroll resize', function (e) {\n\t\tvar slidingHeader = $('.wrapper-header.cassis, .wrapper-navigation.cassis');\n\t\tif ($(this).scrollTop() > 250 && window.matchMedia('(min-width: 1024px)').matches) {\n\t\t\tslidingHeader.addClass(\"is-sticky slideDown\");\n\t\t\t// Show searchbox if suggestions are already displayed\n\t\t\tif ($('#search-suggestions').css('display') == 'block') {\n\t\t\t\t$('.header-search').addClass('is-expanded');\n\t\t\t}\n\t\t} else {\n\t\t\tslidingHeader.removeClass(\"is-sticky slideDown\");\n\t\t}\n\t});\n\n\t// On desktop and Paprika, reveal or not elements in the filter with show more/less link\n\tif ($(\".refinement-reveal-link\").length) {\n\t\trevealElementsFilter();\n\t\t$(window).on('resize', function(){\n\t\t\trevealElementsFilter();\n\t\t});\n\t}\n\n\t// Hide mini-cart if usermenu is visble\n\t$('.user-info').on('mouseenter', function () {\n\t\t$('.mini-cart-content').hide();\n\t})\n\n\tif (util.isDesktopSize()) {\n\t\tvar timeoutToClear = null;\n\t\tvar accountInfoPanel = $('.mini-account');\n\t\tvar fadeOutPanelAfterTimeout = function () {\n\t\t\tif (timeoutToClear !== null) {\n\t\t\t\tclearTimeout(timeoutToClear);\n\t\t\t}\n\t\t\ttimeoutToClear = setTimeout(function () {\n\t\t\t\taccountInfoPanel.fadeOut(100);\n\t\t\t}, 200);\n\t\t};\n\n\t\t$('.header-usermenu').on('mousemove', function (e) {\n\t\t\tif (accountInfoPanel.is(':visible') && $('.header-usermenu').is(e.target)) {\n\t\t\t\tfadeOutPanelAfterTimeout();\n\t\t\t}\n\t\t});\n\n\t\t$('.user-info').on('mouseover', function () {\n\t\t\taccountInfoPanel.fadeIn(100);\n\t\t});\n\n\t\taccountInfoPanel.on('mouseover', function () {\n\t\t\t$('.mini-cart-content').hide();\n\t\t}).on('mouseleave', function (e) {\n\t\t\tvar isLeave = $(e.target).is('.mini-account-wrapper');\n\t\t\tif (isLeave) { // Prevent layer from closing when user hovering the autocomplete field.\n\t\t\t\tfadeOutPanelAfterTimeout();\n\t\t\t}\n\t\t});\n\n\t\t$('.mini-cart-total').on('mouseover', function () {\n\t\t\tif (timeoutToClear !== null) {\n\t\t\t\tclearTimeout(timeoutToClear);\n\t\t\t}\n\t\t\taccountInfoPanel.fadeOut(100);\n\t\t})\n\t}\n\n\t// GTM event search result click\n\t$('.wrapper-navigation').on('click', 'a', function (e) {\n\t\tgtmtool.searchResultClick($(this), null, $(this));\n\t});\n\n\t// GTM event newsletter signup email submit\n\t$('body').on('submit', 'form[id*=newsletterupdate]', function (e) {\n\t\tgtmtool.newsletterSignupClick($(this));\n\t});\n\n\t// Footer toogle on mobile\n\t$('.footer-column-title').on('click', function (e) {\n\t\te.preventDefault();\n\t\tlet columnContent = $(this).siblings('.footer-column-content');\n\t\tcolumnContent.toggleClass('is-expanded');\n\t\tlet markerIcon = $(this).closest('.footer-column').children('i.column-toggle');\n\t\tlet oldDropdownMarkerNewAttr = columnContent.hasClass(\"is-expanded\") ? \"icon-arrowdown\" : \"icon-arrowup\";\n\t\tlet newDropdownMarkerNewAttr = columnContent.hasClass(\"is-expanded\") ? \"icon-arrowup\" : \"icon-arrowdown\";\n\t\tmarkerIcon.addClass(newDropdownMarkerNewAttr).removeClass(oldDropdownMarkerNewAttr);\n\t});\n\n\t$('.locale-switcher-toggle').on('click', function() {\n\t\t$(this).toggleClass('show');\n\t\tvar icon = $(this).find('i');\n\t\tif (icon.hasClass('icon-arrowup')) {\n\t\t\ticon.switchClass('icon-arrowup', 'icon-arrowdown');\n\t\t} else {\n\t\t\ticon.switchClass('icon-arrowdown', 'icon-arrowup');\n\t\t}\n\t});\n\n\t// Init Sliders / method in require product-slider\n\trequire('./pages/product/product-slider').initProductSlider();\n\n\t// newsletter subscribe dialog\n\tvar $newsletterPopinElement = $('#newsletter-popin');\n\tvar localeCookie = cookie.getCookie('locale_url');\n\tvar localeCookieCreationDate = cookie.getCookie('localeCookieCreationDate');\n\tvar currentDate = new Date();\n\tvar currentDateMinutes = Math.round(currentDate.getTime() / 1000 / 60);\n\tvar cookieCreationMinutes = localeCookieCreationDate ? Math.round(new Date(localeCookieCreationDate).getTime() / 1000 / 60) : currentDateMinutes;\n\tvar cookieFromNow = currentDateMinutes - cookieCreationMinutes;\n\tvar minutesBeforePopin = SitePreferences.MINUTES_BEFORE_NEWSLETTER_POPIN;\n\n\tif ($newsletterPopinElement.length > 0 && !!localeCookie && cookieFromNow >= minutesBeforePopin) {\n\t\tdialog.open({\n\t\t\thtml: $newsletterPopinElement,\n\t\t\toptions: {\n\t\t\t\tdraggable: false,\n\t\t\t\tmodal: true,\n\t\t\t\tdialogClass: 'cep-dialog',\n\t\t\t\tresizable: false,\n\t\t\t\twidth: 300\n\t\t\t}\n\t\t});\n\t\tcurrentDate.setMonth(currentDate.getMonth() + SitePreferences.MONTHS_BEFORE_NEWSLETTER_COOKIE_EXPIRE);\n\t\tcookie.setCookie('subscribed_newsletter', 'true', currentDate, '/', '', false);\n\t\tgtmtool.newsletterPopupDisplay();\n\t}\n\n\t// Toggle account nav bar on mobile\n\t$('.account-nav-title').on('click', function (e) {\n\t\t$(this).siblings('.account-nav-list').toggleClass('is-expanded');\n\t\tvar icon = $(this).find('i');\n\t\tif (icon.hasClass('icon-arrowup')) {\n\t\t\ticon.switchClass('icon-arrowup', 'icon-arrowdown');\n\t\t} else {\n\t\t\ticon.switchClass('icon-arrowdown', 'icon-arrowup');\n\t\t}\n\t});\n\n\t// Toggle create account dialog\n\tvar enableAccountCreationPopin = SitePreferences.ENABLE_ACCOUNT_CREATION_POPIN;\n\tif (enableAccountCreationPopin) {\n\t\tvar localeCookie = cookie.getCookie('locale_url');\n\t\tvar localeCookieCreationDate = cookie.getCookie('localeCookieCreationDate');\n\t\tvar currentDate = new Date();\n\t\tvar currentDateMinutes = Math.round(currentDate.getTime() / 1000 / 60);\n\t\tvar cookieCreationMinutes = localeCookieCreationDate ? Math.round(new Date(localeCookieCreationDate).getTime() / 1000 / 60) : currentDateMinutes;\n\t\tvar cookieFromNow = currentDateMinutes - cookieCreationMinutes;\n\t\tvar createAccountDialogSessionCookie = cookie.getCookie('account-dialog');\n\t\tvar minutesBeforeAccountCreationPopin = SitePreferences.MINUTES_BEFORE_ACCOUNT_CREATION_POPIN;\n\t\tvar isOnEligiblePage = ![\"account\", \"cart\", \"checkout\"].includes(window.pageContext.ns);\n\t\t\n\t\tif (!createAccountDialogSessionCookie && isOnEligiblePage && !!localeCookie && cookieFromNow >= minutesBeforeAccountCreationPopin) {\n\t\t\tdialog.open({\n\t\t\t\turl: window.Urls.createAccountDialog, \n\t\t\t\toptions : {\n\t\t\t\t\tdraggable : false,\n\t\t\t\t\tmodal: true,\n\t\t\t\t\tdialogClass : 'cep-dialog',\n\t\t\t\t\tresizable: false,\n\t\t\t\t\twidth: 600\n\t\t\t\t}\n\t\t\t});\n\t\t\tcookie.setCookie('account-dialog', 'true');\n\t\t}\n\t}\n\n\t// init GTM global events\n\t$('#wrapper').on('click', '.social-link', function () {\n\t\tgtmtool.socialLinkClick($(this));\n\t});\n\n\t// Scroll to top button\n\t$(window).on('scroll', function () {\n\t\tif ($(this).scrollTop() > 1200) {\n\t\t\t$(\".scrolltop\").fadeIn('slow');\n\t\t} else {\n\t\t\t$(\".scrolltop\").fadeOut('slow');\n\t\t}\n\t});\n\n\t$(\".scrolltop\").click(function () {\n\t\t$(\"html, body\").animate({ scrollTop: 0 }, 'slow');\n\t});\n\n\t// Submenu img gtm event\n\t$('.html-slot-container').find('a').on('click', function (e) {\n\t\tgtmtool.subMenuImageEvent();\n\t});\n\n\t//Accordions\n\t$('body').on('click', '.accordion-section-title, .accordion-section-subtitle', function () {\n\t\t$(this).siblings('div').toggleClass('active').slideToggle(350);\n\t\tvar icon = $(this).find('i');\n\t\tif (icon.hasClass('icon-arrowup')) {\n\t\t\ticon.switchClass('icon-arrowup', 'icon-arrowdown');\n\t\t} else {\n\t\t\ticon.switchClass('icon-arrowdown', 'icon-arrowup');\n\t\t}\n\t});\n\t//Size guide tabs\n\t$('#guide-tabs').tabs();\n}\n/**\n * @private\n * @function\n * @description Adds class ('js') to html for css targeting and loads js specific styles.\n */\nfunction initializeDom() {\n\t// add class to html for css targeting\n\t$('html').addClass('js');\n\tif (SitePreferences.LISTING_INFINITE_SCROLL) {\n\t\t$('html').addClass('infinite-scroll');\n\t}\n\t// load js specific styles\n\tutil.limitCharacters();\n}\n\n/**\n * @description On desktop and Paprika, reveal or not elements in the filter with show more/less link depending on the cutoff threshold\n */\nfunction revealElementsFilter() {\n\tif (window.innerWidth >= 1024) {\n\t\t$('#main').on('click', '.refinement-reveal-link .refinement-show-label', function () {\n\t\t\t$(this).parent().siblings('ul').children('li.hide').toggleClass('show hide');\n\t\t\t$(this).parent().find('.refinement-reveal-container').toggleClass('show hide');\n\t\t});\n\t\t$('#main').on('click', '.refinement-reveal-link .refinement-hide-label', function () {\n\t\t\tlet cutoffthreshold = parseInt($(this).parent().siblings('ul').data('filterCutoffthreshold')) + 1;\n\t\t\t$(this).parent().siblings('ul').find('li.show:nth-child(n+' + cutoffthreshold + ')').toggleClass('show hide');\n\t\t\t$(this).parent().find('.refinement-reveal-container').toggleClass('show hide');\n\t\t});\n\t\tif ($('.refinement-item.has-subtitle.active').length) {\n\t\t\t$('.refinement-reveal-link .refinement-show-label').trigger('click');\n\t\t}\n\t}\n}\n\nvar pages = {\n\taccount: require('./pages/account'),\n\tcart: require('./pages/cart'),\n\tcheckout: require('./pages/checkout'),\n\tcompare: require('./pages/compare'),\n\tproduct: require('./pages/product'),\n\tregistry: require('./pages/registry'),\n\tsearch: require('./pages/search'),\n\tstorefront: require('./pages/storefront'),\n\twishlist: require('./pages/wishlist'),\n\tstorelocator: require('./pages/storelocator'),\n\tsplashpage: require('./pages/splashpage'),\n\torderconfirmation: require('./pages/orderconfirmation'),\n\tpagedesigner: require('./pages/pagedesigner')\n};\n\nvar app = {\n\tinit: function () {\n\t\tif (document.cookie.length === 0) {\n\t\t\t$('
').addClass('browser-compatibility-alert').append($('

').addClass('browser-error').html(Resources.COOKIES_DISABLED)).appendTo('#browser-check');\n\t\t}\n\t\tinitializeDom();\n\t\tinitializeEvents();\n\n\t\t// init specific global components\n\t\tcountries.init();\n\t\ttooltip.init();\n\t\tminicart.init();\n\t\tvalidator.init();\n\t\trating.init();\n\t\tsearchplaceholder.init();\n\t\tcq.init();\n\t\tlazyload.init();\n\t\tlazyLoading.init();\n\t\timgTileSwitch.init();\n\t\tsizeproduct.init();\n\t\t// init custom css for pages\n\t\tutil.getDynamicCssFilesForContent();\n\t\t// execute page specific initializations\n\t\t$.extend(page, window.pageContext);\n\t\tvar ns = page.ns;\n\t\tif (ns && pages[ns] && pages[ns].init) {\n\t\t\tpages[ns].init();\n\t\t}\n\t}\n};\n\n// general extension functions\n(function () {\n\tString.format = function () {\n\t\tvar s = arguments[0];\n\t\tvar i, len = arguments.length - 1;\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tvar reg = new RegExp('\\\\{' + i + '\\\\}', 'gm');\n\t\t\ts = s.replace(reg, arguments[i + 1]);\n\t\t}\n\t\treturn s;\n };\n\n $.fn.textWidth = function (text, font) {\n $.fn.textWidth.fakeEl = $('').hide().appendTo(document.body);\n $.fn.textWidth.fakeEl.text(text || this.val() || this.text())\n .css('font', font || this.css('font'));\n var width = $.fn.textWidth.fakeEl.width();\n $.fn.textWidth.fakeEl.remove();\n return width;\n };\n})();\n\n// initialize app\n$(document).ready(function () {\n\tapp.init();\n});\n\n\n},{\"./cookie\":6,\"./cookieprivacy\":7,\"./countries\":8,\"./cq\":9,\"./dialog\":11,\"./googledatatag.js\":15,\"./img-tile-switch\":17,\"./jquery-ext\":19,\"./lazyLoading.js\":20,\"./lazyload\":21,\"./minicart\":22,\"./page\":23,\"./pages/account\":24,\"./pages/cart\":25,\"./pages/checkout\":32,\"./pages/compare\":35,\"./pages/orderconfirmation\":36,\"./pages/pagedesigner\":37,\"./pages/product\":42,\"./pages/product/product-slider\":44,\"./pages/registry\":49,\"./pages/search\":50,\"./pages/splashpage\":51,\"./pages/storefront\":52,\"./pages/storelocator\":53,\"./pages/wishlist\":54,\"./rating\":59,\"./searchplaceholder\":60,\"./searchsuggest\":62,\"./searchsuggest-beta\":61,\"./sizeproduct\":63,\"./tooltip\":68,\"./util\":69,\"./validator\":70,\"lodash\":78}],2:[function(require,module,exports){\n /* eslint-disable */\n 'use strict';\n \n var threeDS2utils = require('./threeds2-js-utils');\n /**\n * @function\n * @description Initializes Adyen Secured Fields Billing events\n */\n function initializeBillingEvents() {\n var isOneClick = false;\n $('.js-billing-submit').on('click', function (e) {\n var radioVal = $('.payment-method-options').val();\n if ('CREDIT_CARD' == radioVal) {\n\n if (isOneClick) {\n $('input.adyen-checkout__card__holderName__input').removeAttr('required');\n window.CardValid = true;\n }\n\n if (!window.CardValid) {\n return false;\n }\n clearCardData();\n var oneClickCard = window.AdyenOneClick;\n setBrowserData();\n if (isOneClick) {\n $('#dwfrm_billing_paymentMethods_creditCard_selectedCardID').val($('#adyenCreditCardList option:selected').attr('id'));\n $('#dwfrm_billing_paymentMethods_creditCard_type').val($('#adyenCreditCardList option:selected').val());\n $('#dwfrm_billing_paymentMethods_creditCard_adyenEncryptedSecurityCode').val(oneClickCard.state.data.encryptedSecurityCode);\n }\n else {\n $('#dwfrm_billing_paymentMethods_creditCard_selectedCardID').val(\"\");\n copyCardData(window.AdyenCard);\n }\n }\t\n else if (radioVal == \"Adyen\"){\t\n var selectedMethod = $('[name=\"brandCode\"]:checked').val();\n componentDetailsValid(selectedMethod);\n }\n \n e.preventDefault();\n $('.form-data-error').html('');\n $(this).siblings('.js-billing-submit-hidden').trigger('click');\n });\n\n if ($('#adyenCreditCardList').length > 0) {\n\n $('.toggle-saved-card').on('click', function () {\n $('.saved-card-row').show();\n $('.card-block').first().trigger('click');\n });\n\n $('.card-block').on('click', function () {\n $('.card-block').removeClass('selected');\n\n if ($(this).hasClass('card-block-reset')) {\n $('#adyenCreditCardList').val($('#reset-selected-cards').val());\n $('.saved-card-row').hide();\n } else {\n $('#adyenCreditCardList').val($('#' + $(this).data('cardid')).val());\n }\n\n $(\"#adyenCreditCardList\").change();\n $(this).addClass('selected');\n });\n\n $('#adyenCreditCardList').on('change', function () {\n var selectedCard = $('#adyenCreditCardList').val();\n var AdyenCheckoutObject = new AdyenCheckout(window.Configuration);\n if(window.AdyenOneClick){\n window.AdyenOneClick.unmount();\n }\n initializeOneClick(AdyenCheckoutObject, selectedCard);\n window.CardValid = false;\n if (selectedCard !== \"\") {\n isOneClick = true;\n $(\"#selectedCard\").slideDown(\"slow\");\n $(\"#newCard\").slideUp(\"slow\");\n\n }\n else {\n isOneClick = false;\n $(\"#selectedCard\").slideUp(\"slow\");\n $(\"#newCard\").slideDown(\"slow\");\n }\n });\n\n }\n }\n \n function initializeOneClick(AdyenCheckoutObject, selectedCard) {\n \tvar hideCVC = false;\n \tif(selectedCard == \"bcmc\"){\n \t\thideCVC = true;\n \t}\n \t\n\t var cardNode = document.getElementById('oneClickCard');\n window.AdyenOneClick = AdyenCheckoutObject.create('card', {\n // Mandatory fields\n type: selectedCard,\n details: (selectedCard == \"bcmc\") ? [] : [{\"key\": \"cardDetails.cvc\", \"type\": \"cvc\"}],\n oneClick: true, //<--- enable oneClick 'mode'\n hideCVC: hideCVC,\n storedDetails: {\n \"card\": {\n \"expiryMonth\": \"\",\n \"expiryYear\": \"\",\n \"holderName\": \"\",\n \"number\": \"\"\n }\n },\n // Events\n onChange: function(state) {\n // checks whether card was valid then was changed to be invalid\n \tif(selectedCard == \"maestro\"){\n \t\twindow.CardValid = true;\n \t}\n \telse {\n \t\twindow.CardValid = state.isValid;\n \t}\n }\n });\n window.AdyenOneClick.mount(cardNode);\n }\n \n function parseOpenInvoiceComponentData(state) {\n \t$('#dwfrm_adyPaydata_dateOfBirth').val(state.data.personalDetails.dateOfBirth);\n \t$('#dwfrm_adyPaydata_telephoneNumber').val(state.data.personalDetails.telephoneNumber);\n \t$('#dwfrm_adyPaydata_gender').val(state.data.personalDetails.gender);\n }\n \n //Check the validity of checkout component\t\n function componentDetailsValid(selectedMethod){\t\n var klarnaComponent = window.klarnaComponent\n \t//set data from components\t\n switch(selectedMethod) {\n case \"ideal\":\n if (idealComponent.componentRef.state.isValid) {\t\n $('#dwfrm_adyPaydata_issuer').val(idealComponent.componentRef.state.data.issuer);\n }\t\n return idealComponent.componentRef.state.isValid;\n case \"klarna\":\n if(klarnaComponent){\n if (klarnaComponent.state.isValid) {\n parseOpenInvoiceComponentData(klarnaComponent.state);\n if($('#ssnValue')){\n $('#dwfrm_adyPaydata_socialSecurityNumber').val($('#ssnValue').val());\n }\n }\n return klarnaComponent.state.isValid;\n }\n else{\n //New Klarna integration is without component\n return true;\n }\n case \"afterpay_default\":\n if (afterpayComponent.componentRef.state.isValid) {\n parseOpenInvoiceComponentData(afterpayComponent.componentRef.state);\n }\n return afterpayComponent.componentRef.state.isValid;\n case \"ratepay\":\n $('#dwfrm_adyPaydata_dateOfBirth').val($(\"#ratepay_dob\").val());\n $('#dwfrm_adyPaydata_gender').val($(\"#ratepay_gender\").val());\n return true;\n default:\n return true;\n }\n }\n\n function copyCardData(card) {\n $('#dwfrm_billing_paymentMethods_creditCard_type').val(card.state.brand);\n $('#dwfrm_billing_paymentMethods_creditCard_adyenEncryptedCardNumber').val(card.state.data.encryptedCardNumber);\n $('#dwfrm_billing_paymentMethods_creditCard_adyenEncryptedExpiryMonth').val(card.state.data.encryptedExpiryMonth);\n $('#dwfrm_billing_paymentMethods_creditCard_adyenEncryptedExpiryYear').val(card.state.data.encryptedExpiryYear);\n $('#dwfrm_billing_paymentMethods_creditCard_adyenEncryptedSecurityCode').val(card.state.data.encryptedSecurityCode);\n $('#dwfrm_billing_paymentMethods_creditCard_owner').val(card.state.data.holderName);\n if(window.storeDetails){\n $('#dwfrm_billing_paymentMethods_creditCard_saveCard').val(window.storeDetails);\n }\n else {\n $('#dwfrm_billing_paymentMethods_creditCard_saveCard').val(false);\n }\n }\n \n function clearCardData() {\n $('#dwfrm_billing_paymentMethods_creditCard_type').val(\"\");\n $('#dwfrm_billing_paymentMethods_creditCard_adyenEncryptedCardNumber').val(\"\");\n $('#dwfrm_billing_paymentMethods_creditCard_adyenEncryptedExpiryMonth').val(\"\");\n $('#dwfrm_billing_paymentMethods_creditCard_adyenEncryptedExpiryYear').val(\"\");\n $('#dwfrm_billing_paymentMethods_creditCard_adyenEncryptedSecurityCode').val(\"\");\n $('#dwfrm_billing_paymentMethods_creditCard_owner').val(\"\");\n }\n \n function setBrowserData() {\n var browserData = threeDS2utils.getBrowserInfo();\n $('#dwfrm_billing_paymentMethods_creditCard_browserInfo').val(JSON.stringify(browserData));\n };\n\n /**\n * @function\n * @description Initializes Adyen Checkout My Account events\n */\n function initializeAccountEvents() {\n $('#add-card-submit').on('click', function (e) {\n \te.preventDefault();\n if (window.AdyenCard.isValid) {\n \tcopyCardData(window.AdyenCard);\n setBrowserData();\n \t$('#add-card-submit-hidden').trigger('click');\n }\n });\n }\n\n\n /**\n * If selectedCard is used do not encrypt the number and holderName field\n * @param selectedCard\n * @returns\n */\n function getCardData(selectedCard) {\n\n var cardData = {\n cvc: $('#creditCard_cvn').val(),\n expiryMonth: $('#creditCard_expiration_month').val(),\n expiryYear: $('#creditCard_expiration_year').val(),\n generationtime: $('#adyen_generationtime').val()\n };\n\n if (!selectedCard) {\n cardData.number = $('#creditCard_number').val();\n cardData.holderName = $('#creditCard_owner').val();\n }\n\n return cardData;\n }\n\n function maskValue(value) {\n if (value && value.length > 4) {\n return value.replace(/\\d(?=\\d{4})/g, '*');\n } else {\n return '';\n }\n }\n\n/**\n * @function\n * @description Initializes Adyen CSE billing events\n */\n\nexports.initBilling = function() {\n\tinitializeBillingEvents();\n}; \n\nexports.initAccount = function() {\n\tinitializeAccountEvents();\n};\n\n\n\n},{\"./threeds2-js-utils\":67}],3:[function(require,module,exports){\n'use strict';\n\nvar progress = require('./progress'),\n\tutil = require('./util');\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\toptions.url = util.toAbsoluteUrl(options.url);\n\t// return if no url exists or url matches a current request\n\tif (!options.url || currentRequests[options.url]) {\n\t\treturn;\n\t}\n\n\tcurrentRequests[options.url] = true;\n\n\t// make the server call\n\t$.ajax({\n\t\tdataType: 'json',\n\t\turl: options.url,\n\t\tasync: (typeof options.async === 'undefined' || options.async === null) ? true : options.async,\n\t\tdata: options.data || {}\n\t})\n\t// success\n\t.done(function (response) {\n\t\tif (options.callback) {\n\t\t\toptions.callback(response);\n\t\t}\n\t})\n\t// failed\n\t.fail(function (xhr, textStatus) {\n\t\tif (textStatus === 'parsererror') {\n\t\t\twindow.alert(Resources.BAD_RESPONSE);\n\t\t}\n\t\tif (options.callback) {\n\t\t\toptions.callback(null);\n\t\t}\n\t})\n\t// executed on success or fail\n\t.always(function () {\n\t\t// remove current request from hash\n\t\tif (currentRequests[options.url]) {\n\t\t\tdelete currentRequests[options.url];\n\t\t}\n\t});\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\toptions.url = util.toAbsoluteUrl(options.url);\n\t// return if no url exists or url matches a current request\n\tif (!options.url || currentRequests[options.url]) {\n\t\treturn;\n\t}\n\n\tcurrentRequests[options.url] = true;\n\n\t// make the server call\n\t$.ajax({\n\t\tdataType: 'html',\n\t\turl: util.ajaxUrl(options.url),\n\t\tdata: options.data,\n\t\tmethod: options.method || 'GET',\n\t\txhrFields: {\n\t\t\twithCredentials: true\n\t\t}\n\t})\n\t.done(function (response) {\n\t\t// success\n\t\tif (options.target) {\n\t\t\t$(options.target).empty().html(response);\n\t\t}\n\t\tif (options.callback) {\n\t\t\toptions.callback(response);\n\t\t}\n\t})\n\t.fail(function (xhr, textStatus) {\n\t\t// failed\n\t\tif (textStatus === 'parsererror') {\n\t\t\twindow.alert(Resources.BAD_RESPONSE);\n\t\t}\n\t\toptions.callback(null, textStatus);\n\t})\n\t.always(function () {\n\t\tprogress.hide();\n\t\t// remove current request from hash\n\t\tif (currentRequests[options.url]) {\n\t\t\tdelete currentRequests[options.url];\n\t\t}\n\t});\n};\n\n/**\n * @function\n * @description Helper method to add parameter to ajax serialized data\n * @param data : serialized form data, param : String, value : String\n * */\n\nvar appendParameterToAjaxRequestData = function(data,param, value) {\n\tif (!value) {\n\t\tvalue = '';\n\t}\n\tif (!!param) {\n\t\treturn (data.length > 1) ? data + '&' + param + '=' + value : param + '=' + value;\n\t}\n\treturn data;\n}\n\n\n/**\n * @function\n * @description Helper method to append dw form action to ajax serialized data\n * this is based on action button system (dw forms)\n * @param buttonId : String, data : serialized form data\n * */\nvar appendActionToAjaxRequest = function(buttonId, data) {\n\tif (!!buttonId && !!data) {\n\t\tvar $button = $('[name*='+ buttonId +']');\n\t\tif (!!$button) {\n\t\t\treturn appendParameterToAjaxRequestData(data, $button.attr('name'));\n\t\t}\n\t}\n\treturn data;\n}\n\nexports.getJson = getJson;\nexports.load = load;\nexports.appendParameterToAjaxRequestData = appendParameterToAjaxRequestData;\nexports.appendActionToAjaxRequest = appendActionToAjaxRequest;\n\n},{\"./progress\":56,\"./util\":69}],4:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('./dialog'),\n\tpage = require('./page'),\n\tutil = require('./util');\n\nvar selectedList = [];\nvar maxItems = 1;\nvar bliUUID = '';\n\n/**\n * @private\n * @function\n * description Gets a list of bonus products related to a promoted product\n */\nfunction getBonusProducts() {\n\tvar o = {};\n\to.bonusproducts = [];\n\n\tvar i, len;\n\tfor (i = 0, len = selectedList.length; i < len; i++) {\n\t\tvar p = {\n\t\t\tpid: selectedList[i].pid,\n\t\t\tqty: selectedList[i].qty,\n\t\t\toptions: {}\n\t\t};\n\t\tvar a, alen, bp = selectedList[i];\n\t\tif (bp.options) {\n\t\t\tfor (a = 0, alen = bp.options.length; a < alen; a++) {\n\t\t\t\tvar opt = bp.options[a];\n\t\t\t\tp.options = {optionName:opt.name, optionValue:opt.value};\n\t\t\t}\n\t\t}\n\t\to.bonusproducts.push({product:p});\n\t}\n\treturn o;\n}\n\nvar selectedItemTemplate = function (data) {\n\tvar attributes = '';\n\tfor (var attrID in data.attributes) {\n\t\tvar attr = data.attributes[attrID];\n\t\tattributes += '

  • \\n';\n\t\tattributes += '' + attr.displayName + ': ';\n\t\tattributes += '' + attr.displayValue + '\\n';\n\t\tattributes += '
  • ';\n\t}\n\tattributes += '
  • \\n';\n\tattributes += 'Qty: ';\n\tattributes += '' + data.qty + '';\n\treturn [\n\t\t'
  • ',\n\t\t'',\n\t\t'
    ' + data.name + '
    ',\n\t\t'
      ',\n\t\tattributes,\n\t\t'
        ',\n\t\t'
      • '\n\t].join('\\n');\n};\n\n// hide swatches that are not selected or not part of a Product Variation Group\nvar hideSwatches = function () {\n\t$('.bonus-product-item:not([data-producttype=\"master\"]) .swatches li').not('.selected').not('.variation-group-value').hide();\n\t// prevent unselecting the selected variant\n\t$('.bonus-product-item .swatches .selected').on('click', function () {\n\t\treturn false;\n\t});\n};\n\n/**\n * @private\n * @function\n * @description Updates the summary page with the selected bonus product\n */\nfunction updateSummary() {\n\tvar $bonusProductList = $('#bonus-product-list');\n\tif (selectedList.length === 0) {\n\t\t$bonusProductList.find('li.selected-bonus-item').remove();\n\t} else {\n\t\tvar ulList = $bonusProductList.find('ul.selected-bonus-items').first();\n\t\tvar i, len;\n\t\tfor (i = 0, len = selectedList.length; i < len; i++) {\n\t\t\tvar item = selectedList[i];\n\t\t\tvar li = selectedItemTemplate(item);\n\t\t\t$(li).appendTo(ulList);\n\t\t}\n\t}\n\n\t// get remaining item count\n\tvar remain = maxItems - selectedList.length;\n\t$bonusProductList.find('.bonus-items-available').text(remain);\n\tif (remain <= 0) {\n\t\t$bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n\t} else {\n\t\t$bonusProductList.find('.select-bonus-item').removeAttr('disabled');\n\t}\n}\n\nfunction initializeGrid () {\n\tvar $bonusProduct = $('#bonus-product-dialog'),\n\t\t$bonusProductList = $('#bonus-product-list'),\n\tbliData = $bonusProductList.data('line-item-detail');\n\tmaxItems = bliData.maxItems;\n\tbliUUID = bliData.uuid;\n\n\tif (bliData.itemCount >= maxItems) {\n\t\t$bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n\t}\n\n\tvar cartItems = $bonusProductList.find('.selected-bonus-item');\n\tcartItems.each(function () {\n\t\tvar ci = $(this);\n\t\tvar product = {\n\t\t\tuuid: ci.data('uuid'),\n\t\t\tpid: ci.data('pid'),\n\t\t\tqty: ci.find('.item-qty').text(),\n\t\t\tname: ci.find('.item-name').html(),\n\t\t\tattributes: {}\n\t\t};\n\t\tvar attributes = ci.find('ul.item-attributes li');\n\t\tattributes.each(function () {\n\t\t\tvar li = $(this);\n\t\t\tproduct.attributes[li.data('attributeId')] = {\n\t\t\t\tdisplayName:li.children('.display-name').html(),\n\t\t\t\tdisplayValue:li.children('.display-value').html()\n\t\t\t};\n\t\t});\n\t\tselectedList.push(product);\n\t});\n\n\t$bonusProductList.on('click', '.bonus-product-item a[href].swatchanchor:not(.unselectable)', function (e) {\n\t\te.preventDefault();\n\t\tvar url = this.href,\n\t\t\t$this = $(this);\n\t\turl = util.appendParamsToUrl(url, {\n\t\t\t'source': 'bonus',\n\t\t\t'format': 'ajax'\n\t\t});\n\t\t$.ajax({\n\t\t\turl: url,\n\t\t\tsuccess: function (response) {\n\t\t\t\t$this.closest('.bonus-product-item').empty().html(response);\n\t\t\t\thideSwatches();\n\t\t\t}\n\t\t});\n\t})\n\t.on('change', '.input-text', function () {\n\t\t$bonusProductList.find('.select-bonus-item').removeAttr('disabled');\n\t\t$(this).closest('.bonus-product-form').find('.quantity-error').text('');\n\t})\n\t.on('click', '.select-bonus-item', function (e) {\n\t\te.preventDefault();\n\t\tif (selectedList.length >= maxItems) {\n\t\t\t$bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n\t\t\t$bonusProductList.find('.bonus-items-available').text('0');\n\t\t\treturn;\n\t\t}\n\n\t\tvar form = $(this).closest('.bonus-product-form'),\n\t\t\tdetail = $(this).closest('.product-detail'),\n\t\t\tuuid = form.find('input[name=\"productUUID\"]').val(),\n\t\t\tqtyVal = form.find('input[name=\"Quantity\"]').val(),\n\t\t\tqty = (isNaN(qtyVal)) ? 1 : (+qtyVal);\n\n\t\tif (qty > maxItems) {\n\t\t\t$bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n\t\t\tform.find('.quantity-error').text(Resources.BONUS_PRODUCT_TOOMANY);\n\t\t\treturn;\n\t\t}\n\n\t\tvar product = {\n\t\t\tuuid: uuid,\n\t\t\tpid: form.find('input[name=\"pid\"]').val(),\n\t\t\tqty: qty,\n\t\t\tname: detail.find('.product-name').text(),\n\t\t\tattributes: detail.find('.product-variations').data('attributes'),\n\t\t\toptions: []\n\t\t};\n\n\t\tvar optionSelects = form.find('.product-option');\n\n\t\toptionSelects.each(function () {\n\t\t\tproduct.options.push({\n\t\t\t\tname: this.name,\n\t\t\t\tvalue: $(this).val(),\n\t\t\t\tdisplay: $(this).children(':selected').first().html()\n\t\t\t});\n\t\t});\n\t\tselectedList.push(product);\n\t\tupdateSummary();\n\t})\n\t.on('click', '.remove-link', function (e) {\n\t\te.preventDefault();\n\t\tvar container = $(this).closest('.selected-bonus-item');\n\t\tif (!container.data('uuid')) { return; }\n\n\t\tvar uuid = container.data('uuid');\n\t\tvar i, len = selectedList.length;\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (selectedList[i].uuid === uuid) {\n\t\t\t\tselectedList.splice(i, 1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tupdateSummary();\n\t})\n\t.on('click', '.add-to-cart-bonus', function (e) {\n\t\te.preventDefault();\n\t\tvar url = util.appendParamsToUrl(Urls.addBonusProduct, {bonusDiscountLineItemUUID: bliUUID});\n\t\tvar bonusProducts = getBonusProducts();\n\t\tif (bonusProducts.bonusproducts[0].product.qty > maxItems) {\n\t\t\tbonusProducts.bonusproducts[0].product.qty = maxItems;\n\t\t}\n\t\t// make the server call\n\t\t$.ajax({\n\t\t\ttype: 'POST',\n\t\t\tdataType: 'json',\n\t\t\tcache: false,\n\t\t\tcontentType: 'application/json',\n\t\t\turl: url,\n\t\t\tdata: JSON.stringify(bonusProducts)\n\t\t})\n\t\t.done(function () {\n\t\t\t// success\n\t\t\tpage.refresh();\n\t\t})\n\t\t.fail(function (xhr, textStatus) {\n\t\t\t// failed\n\t\t\tif (textStatus === 'parsererror') {\n\t\t\t\twindow.alert(Resources.BAD_RESPONSE);\n\t\t\t} else {\n\t\t\t\twindow.alert(Resources.SERVER_CONNECTION_ERROR);\n\t\t\t}\n\t\t})\n\t\t.always(function () {\n\t\t\t$bonusProduct.dialog('close');\n\t\t});\n\t})\n\t.on('click', '#more-bonus-products', function (e) {\n\t\te.preventDefault();\n\t\tvar uuid = $('#bonus-product-list').data().lineItemDetail.uuid;\n\n\t\t//get the next page of choice of bonus products\n\t\tvar lineItemDetail = JSON.parse($('#bonus-product-list').attr('data-line-item-detail'));\n\t\tlineItemDetail.pageStart = lineItemDetail.pageStart + lineItemDetail.pageSize;\n\t\t$('#bonus-product-list').attr('data-line-item-detail', JSON.stringify(lineItemDetail));\n\n\t\tvar url = util.appendParamsToUrl(Urls.getBonusProducts, {\n\t\t\tbonusDiscountLineItemUUID: uuid,\n\t\t\tformat: 'ajax',\n\t\t\tlazyLoad: 'true',\n\t\t\tpageStart: lineItemDetail.pageStart,\n\t\t\tpageSize: $('#bonus-product-list').data().lineItemDetail.pageSize,\n\t\t\tbonusProductsTotal: $('#bonus-product-list').data().lineItemDetail.bpTotal\n\t\t});\n\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\tcache: false,\n\t\t\tcontentType: 'application/json',\n\t\t\turl: url\n\t\t})\n\t\t.done(function (data) {\n\t\t\t//add the new page to DOM and remove 'More' link if it is the last page of results\n\t\t\t$('#more-bonus-products').before(data);\n\t\t\tif ((lineItemDetail.pageStart + lineItemDetail.pageSize) >= $('#bonus-product-list').data().lineItemDetail.bpTotal) {\n\t\t\t\t$('#more-bonus-products').remove();\n\t\t\t}\n\t\t})\n\t\t.fail(function (xhr, textStatus) {\n\t\t\tif (textStatus === 'parsererror') {\n\t\t\t\twindow.alert(Resources.BAD_RESPONSE);\n\t\t\t} else {\n\t\t\t\twindow.alert(Resources.SERVER_CONNECTION_ERROR);\n\t\t\t}\n\t\t});\n\t});\n}\n\nvar bonusProductsView = {\n\t/**\n\t * @function\n\t * @description Open the list of bonus products selection dialog\n\t */\n\tshow: function (url) {\n\t\tvar $bonusProduct = $('#bonus-product-dialog');\n\t\t// create the dialog\n\t\tdialog.open({\n\t\t\ttarget: $bonusProduct,\n\t\t\turl: url,\n\t\t\toptions: {\n\t\t\t\twidth: 795,\n\t\t\t\ttitle: Resources.BONUS_PRODUCTS\n\t\t\t},\n\t\t\tcallback: function () {\n\t\t\t\tinitializeGrid();\n\t\t\t\thideSwatches();\n\t\t\t}\n\t\t});\n\t},\n\t/**\n\t * @function\n\t * @description Open bonus product promo prompt dialog\n\t */\n\tloadBonusOption: function () {\n\t\tvar\tself = this,\n\t\t\tbonusDiscountContainer = document.querySelector('.bonus-discount-container');\n\t\tif (!bonusDiscountContainer) { return; }\n\n\t\t// get the html from minicart, then trash it\n\t\tvar bonusDiscountContainerHtml = bonusDiscountContainer.outerHTML;\n\t\tbonusDiscountContainer.parentNode.removeChild(bonusDiscountContainer);\n\n\t\tdialog.open({\n\t\t\thtml: bonusDiscountContainerHtml,\n\t\t\toptions: {\n\t\t\t\twidth: 400,\n\t\t\t\ttitle: Resources.BONUS_PRODUCT,\n\t\t\t\tbuttons: [{\n\t\t\t\t\ttext: Resources.SELECT_BONUS_PRODUCTS,\n\t\t\t\t\tclick: function () {\n\t\t\t\t\t\tvar uuid = $('.bonus-product-promo').data('lineitemid'),\n\t\t\t\t\t\t\turl = util.appendParamsToUrl(Urls.getBonusProducts, {\n\t\t\t\t\t\t\t\tbonusDiscountLineItemUUID: uuid,\n\t\t\t\t\t\t\t\tsource: 'bonus',\n\t\t\t\t\t\t\t\tformat: 'ajax',\n\t\t\t\t\t\t\t\tlazyLoad: 'false',\n\t\t\t\t\t\t\t\tpageStart: 0,\n\t\t\t\t\t\t\t\tpageSize: 10,\n\t\t\t\t\t\t\t\tbonusProductsTotal: -1\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t$(this).dialog('close');\n\t\t\t\t\t\tself.show(url);\n\t\t\t\t\t}\n\t\t\t\t}, {\n\t\t\t\t\ttext: Resources.NO_THANKS,\n\t\t\t\t\tclick: function () {\n\t\t\t\t\t\t$(this).dialog('close');\n\t\t\t\t\t}\n\t\t\t\t}]\n\t\t\t},\n\t\t\tcallback: function () {\n\t\t\t\t// show hide promo details\n\t\t\t\t$('.show-promo-details').on('click', function () {\n\t\t\t\t\t$('.promo-details').toggleClass('visible');\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nmodule.exports = bonusProductsView;\n\n},{\"./dialog\":11,\"./page\":23,\"./util\":69}],5:[function(require,module,exports){\n'use strict';\n\nvar page = require('./page'),\n\tutil = require('./util'),\n\tTPromise = require('promise');\n\nvar _currentCategory = '',\n\tMAX_ACTIVE = 6;\n\n/**\n * @private\n * @function\n * @description Verifies the number of elements in the compare container and updates it with sequential classes for ui targeting\n */\nfunction refreshContainer() {\n\tvar $compareContainer = $('.compare-items');\n\tvar $compareItems = $compareContainer.find('.compare-item');\n\tvar numActive = $compareItems.filter('.active').length;\n\n\tif (numActive < 2) {\n\t\t$('#compare-items-button').attr('disabled', 'disabled');\n\t} else {\n\t\t$('#compare-items-button').removeAttr('disabled');\n\t}\n\n\t$compareContainer.toggle(numActive > 0);\n}\n/**\n * @private\n * @function\n * @description Adds an item to the compare container and refreshes it\n */\nfunction addToList(data) {\n\t// get the first compare-item not currently active\n\tvar $item = $('.compare-items .compare-item').not('.active').first(),\n\t\t$productTile = $('#' + data.uuid);\n\n\tif ($item.length === 0) {\n\t\tif ($productTile.length > 0) {\n\t\t\t$productTile.find('.compare-check')[0].checked = false;\n\t\t}\n\t\twindow.alert(Resources.COMPARE_ADD_FAIL);\n\t\treturn;\n\t}\n\n\t// if already added somehow, return\n\tif ($('[data-uuid=\"' + data.uuid + '\"]').length > 0) {\n\t\treturn;\n\t}\n\t// set as active item\n\t$item.addClass('active')\n\t\t.attr('data-uuid', data.uuid)\n\t\t.attr('data-itemid', data.itemid)\n\t\t.data('uuid', data.uuid)\n\t\t.data('itemid', data.itemid)\n\t\t.append($(data.img).clone().addClass('compare-item-image'));\n}\n/**\n * @private\n * @function\n * description Removes an item from the compare container and refreshes it\n */\nfunction removeFromList($item) {\n\tif ($item.length === 0) { return; }\n\t// remove class, data and id from item\n\t$item.removeClass('active')\n\t\t.removeAttr('data-uuid')\n\t\t.removeAttr('data-itemid')\n\t\t.data('uuid', '')\n\t\t.data('itemid', '')\n\t\t// remove the image\n\t\t.find('.compare-item-image').remove();\n}\n\nfunction addProductAjax(args) {\n\tvar promise = new TPromise(function (resolve, reject) {\n\t\t$.ajax({\n\t\t\turl: Urls.compareAdd,\n\t\t\tdata: {\n\t\t\t\tpid: args.itemid,\n\t\t\t\tcategory: _currentCategory\n\t\t\t},\n\t\t\tdataType: 'json'\n\t\t}).done(function (response) {\n\t\t\tif (!response || !response.success) {\n\t\t\t\treject(new Error(Resources.COMPARE_ADD_FAIL));\n\t\t\t} else {\n\t\t\t\tresolve(response);\n\t\t\t}\n\t\t}).fail(function (jqxhr, status, err) {\n\t\t\treject(new Error(err));\n\t\t});\n\t});\n\treturn promise;\n}\n\nfunction removeProductAjax(args) {\n\tvar promise = new TPromise(function (resolve, reject) {\n\t\t$.ajax({\n\t\t\turl: Urls.compareRemove,\n\t\t\tdata: {\n\t\t\t\tpid: args.itemid,\n\t\t\t\tcategory: _currentCategory\n\t\t\t},\n\t\t\tdataType: 'json'\n\t\t}).done(function (response) {\n\t\t\tif (!response || !response.success) {\n\t\t\t\treject(new Error(Resources.COMPARE_REMOVE_FAIL));\n\t\t\t} else {\n\t\t\t\tresolve(response);\n\t\t\t}\n\t\t}).fail(function (jqxhr, status, err) {\n\t\t\treject(new Error(err));\n\t\t});\n\t});\n\treturn promise;\n}\n\nfunction shiftImages() {\n\treturn new TPromise(function (resolve) {\n\t\tvar $items = $('.compare-items .compare-item');\n\t\t$items.each(function (i, item) {\n\t\t\tvar $item = $(item);\n\t\t\t// last item\n\t\t\tif (i === $items.length - 1) {\n\t\t\t\treturn removeFromList($item);\n\t\t\t}\n\t\t\tvar $next = $items.eq(i + 1);\n\t\t\tif ($next.hasClass('active')) {\n\t\t\t\t// remove its own image\n\t\t\t\t$next.find('.compare-item-image').detach().appendTo($item);\n\t\t\t\t$item.addClass('active')\n\t\t\t\t\t.attr('data-uuid', $next.data('uuid'))\n\t\t\t\t\t.attr('data-itemid', $next.data('itemid'))\n\t\t\t\t\t.data('uuid', $next.data('uuid'))\n\t\t\t\t\t.data('itemid', $next.data('itemid'));\n\t\t\t}\n\t\t});\n\t\tresolve();\n\t});\n}\n\n/**\n * @function\n * @description Adds product to the compare table\n */\nfunction addProduct(args) {\n\tvar promise;\n\tvar $items = $('.compare-items .compare-item');\n\tvar $cb = $(args.cb);\n\tvar numActive = $items.filter('.active').length;\n\tif (numActive === MAX_ACTIVE) {\n\t\tif (!window.confirm(Resources.COMPARE_CONFIRMATION)) {\n\t\t\t$cb[0].checked = false;\n\t\t\treturn;\n\t\t}\n\n\t\t// remove product using id\n\t\tvar $firstItem = $items.first();\n\t\tpromise = removeItem($firstItem).then(function () {\n\t\t\treturn shiftImages();\n\t\t});\n\t} else {\n\t\tpromise = TPromise.resolve(0);\n\t}\n\treturn promise.then(function () {\n\t\treturn addProductAjax(args).then(function () {\n\t\t\taddToList(args);\n\t\t\tif ($cb && $cb.length > 0) { $cb[0].checked = true; }\n\t\t\trefreshContainer();\n\t\t});\n\t}).then(null, function () {\n\t\tif ($cb && $cb.length > 0) { $cb[0].checked = false; }\n\t});\n}\n\n/**\n * @function\n * @description Removes product from the compare table\n * @param {object} args - the arguments object should have the following properties: itemid, uuid and cb (checkbox)\n */\nfunction removeProduct(args) {\n\tvar $cb = args.cb ? $(args.cb) : null;\n\treturn removeProductAjax(args).then(function () {\n\t\tvar $item = $('[data-uuid=\"' + args.uuid + '\"]');\n\t\tremoveFromList($item);\n\t\tif ($cb && $cb.length > 0) { $cb[0].checked = false; }\n\t\trefreshContainer();\n\t}, function () {\n\t\tif ($cb && $cb.length > 0) { $cb[0].checked = true; }\n\t});\n}\n\nfunction removeItem($item) {\n\tvar uuid = $item.data('uuid'),\n\t\t$productTile = $('#' + uuid);\n\treturn removeProduct({\n\t\titemid: $item.data('itemid'),\n\t\tuuid: uuid,\n\t\tcb: ($productTile.length === 0) ? null : $productTile.find('.compare-check')\n\t});\n}\n\n/**\n * @private\n * @function\n * @description Initializes the DOM-Object of the compare container\n */\nfunction initializeDom() {\n\tvar $compareContainer = $('.compare-items');\n\t_currentCategory = $compareContainer.data('category') || '';\n\tvar $active = $compareContainer.find('.compare-item').filter('.active');\n\t$active.each(function () {\n\t\tvar $productTile = $('#' + $(this).data('uuid'));\n\t\tif ($productTile.length === 0) {return;}\n\t\t$productTile.find('.compare-check')[0].checked = true;\n\t});\n\t// set container state\n\trefreshContainer();\n}\n\n/**\n * @private\n * @function\n * @description Initializes the events on the compare container\n */\nfunction initializeEvents() {\n\t// add event to buttons to remove products\n\t$('.compare-item').on('click', '.compare-item-remove', function () {\n\t\tremoveItem($(this).closest('.compare-item'));\n\t});\n\n\t// Button to go to compare page\n\t$('#compare-items-button').on('click', function () {\n\t\tpage.redirect(util.appendParamToURL(Urls.compareShow, 'category', _currentCategory));\n\t});\n\n\t// Button to clear all compared items\n\t// rely on refreshContainer to take care of hiding the container\n\t$('#clear-compared-items').on('click', function () {\n\t\t$('.compare-items .active').each(function () {\n\t\t\tremoveItem($(this));\n\t\t});\n\t});\n}\n\nexports.init = function () {\n\tinitializeDom();\n\tinitializeEvents();\n};\n\nexports.addProduct = addProduct;\nexports.removeProduct = removeProduct;\n\n},{\"./page\":23,\"./util\":69,\"promise\":79}],6:[function(require,module,exports){\n'use strict';\n\n/**\n * @function cookie used to read/create/remove cookies\n */\nvar cookie = {\n\tgetCookie: function (sName) {\n\t\treturn decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\\\s*' + encodeURIComponent(sName).replace(/[\\-\\.\\+\\*]/g, '\\\\$&') + '\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$'), '$1')) || null;\n\t},\n\tsetCookie: function (sName, sValue, vEnd, sPath, sDomain, bSecure) {\n\t\tif (!sName || /^(?:expires|max\\-age|path|domain|secure)$/i.test(sName)) {\n\t\t\treturn false;\n\t\t}\n\t\tvar sExpires = '';\n\n\t\tif (vEnd) {\n\t\t\tswitch (vEnd.constructor) {\n\t\t\tcase Number:\n\t\t\t\tsExpires = vEnd === Infinity ? '; expires=Fri, 31 Dec 9999 23:59:59 GMT' : '; max-age=' + vEnd;\n\t\t\t\tbreak;\n\t\t\tcase String:\n\t\t\t\tsExpires = '; expires=' + vEnd;\n\t\t\t\tbreak;\n\t\t\tcase Date:\n\t\t\t\tsExpires = '; expires=' + vEnd.toUTCString();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tdocument.cookie = encodeURIComponent(sName) + '=' + encodeURIComponent(sValue) + sExpires + (sDomain ? ';domain=' + sDomain : '') + (sPath ? ';path=' + sPath : '') + (bSecure ? ';secure' : '');\n\t},\n\tdeleteCookie: function (sName, sPath, sDomain) {\n\t\tif (!sName) {\n\t\t\treturn false;\n\t\t}\n\t\tdocument.cookie = encodeURIComponent(sName) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '');\n\t\treturn true;\n\t}\n};\n\nmodule.exports = cookie;\n\n},{}],7:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('./dialog');\n\n/**\n * @function cookieprivacy\tUsed to display/control the scrim containing the cookie privacy code\n **/\nmodule.exports = function () {\n\t/**\n\t * If we have not accepted cookies AND we're not on the Privacy Policy page, then show the notification\n\t * NOTE: You will probably want to adjust the Privacy Page test to match your site's specific privacy / cookie page\n\t */\n\tif (SitePreferences.COOKIE_HINT === true && document.cookie.indexOf('dw_cookies_accepted') < 0) {\n\t\t// check for privacy policy page\n\t\tif ($('.wrapper-cookies:visible').length === 0) {\n\t\t\t$('.wrapper-cookies').show();\n\t\t\t$('.cookies-message .cookies-close').click(function () {\n\t\t\t\t$('.wrapper-cookies').hide();\n\t\t\t\tenableCookies();\n\t\t\t});\n\t\t}\n\t} else {\n\t\t// Otherwise, we don't need to show the asset, just enable the cookies\n\t\tenableCookies();\n\t}\n\n\tfunction enableCookies() {\n\t\tif (document.cookie.indexOf('dw=1') < 0) {\n\t\t\trequire('./cookie').setCookie('dw', '1', Infinity, '/', '', false);\n\t\t}\n\t\tif (document.cookie.indexOf('dw_cookies_accepted') < 0) {\n\t\t\trequire('./cookie').setCookie('dw_cookies_accepted', '1', Infinity, '/', '', false);\n\t\t}\n\t}\n};\n\n},{\"./cookie\":6,\"./dialog\":11}],8:[function(require,module,exports){\n'use strict';\nvar cookie = require('./cookie');\n\nfunction changeLocaleCookie(target) {\n\tvar localeToSet = target.is('select') ? target.find(':selected').data('locale') : target.data('locale');\n\tcookie.setCookie('locale_url', localeToSet, Infinity, '/');\n\tcookie.setCookie('localeCookieCreationDate', decodeURIComponent(new Date().toUTCString()), Infinity, '/');\n}\n\nexports.init = function init () {\n\t$('#change-language').on('change', function (e) {\n\t\tvar target = $(this); \n\t\t\n\t\tchangeLocaleCookie(target);\n\t\t\n\t\tdocument.location.href= target.val();\n\t});\n\t\n\t$('.change-country').on('click', function (e) {\n\t\tvar target = $(this);\n\t\t\n\t\tchangeLocaleCookie(target);\n\t});\n};\n\n},{\"./cookie\":6}],9:[function(require,module,exports){\n'use strict';\n/* global CQuotient */\n\nfunction clickThruAfter() {\n\tvar recommenderName = localStorage.getItem('cq.recommenderName');\n\tvar currentProductId = $('[itemprop=\"productID\"]').data('masterid') || '';\n\tif (!recommenderName) {return;}\n\tvar anchors;\n\tif (localStorage.getItem('cq.anchors')) {\n\t\tanchors = localStorage.getItem('cq.anchors');\n\t\tlocalStorage.removeItem('cq.anchors');\n\t}\n\tlocalStorage.removeItem('cq.recommenderName');\n\tif (window.CQuotient) {\n\t\tCQuotient.activities.push({\n\t\t\tactivityType: 'clickReco',\n\t\t\tparameters: {\n\t\t\t\tcookieId: CQuotient.getCQCookieId(),\n\t\t\t\tuserId: CQuotient.getCQUserId(),\n\t\t\t\trecommenderName: recommenderName,\n\t\t\t\tanchors: anchors || '',\n\t\t\t\tproducts: {\n\t\t\t\t\tid: currentProductId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\nexports.init = function () {\n\t// set cookie before click through from product tile\n\t$('body').on('click', '.product-tile[data-recommendername] a', function () {\n\t\t// if currently on a product page, send its productId as the anchor\n\t\tif (window.pageContext.type === 'product') {\n\t\t\tlocalStorage.setItem('cq.anchors', $('[itemprop=\"productID\"]').data('masterid') || '');\n\t\t}\n\t\tvar recommenderName = $(this).parents('.product-tile').data('recommendername');\n\t\tlocalStorage.setItem('cq.recommenderName', recommenderName);\n\t});\n\n\tclickThruAfter();\n};\n\n},{}],10:[function(require,module,exports){\n/**\n * @function \n * @description used in beforeShowDay option of datepicker to exclude sundays from clickable days\n * @param date {Date}\n * @return true if date is sunday\n * */\nfunction excludeSundays (date) {\n\treturn date.getDay() === 0;\n}\n\n/**\n * @function \n * @description jquery datepicker equivalent no weekends\n * @param date\n * @return true if date is in weekend\n * */\nfunction excludeWeekends (date){\n\tvar day = date.getDay();\n\treturn !( day > 0 && day < 6 );\n}\n\n/**\n * @function \n * @description exclude days if they are in days list\n * @param date {Date}\n * @return true if date is in shipping days exclusion list\n * */\nfunction excludeSpecialDays (date, daysList) {\n\tif (!daysList){\n\t\tdaysList = window.ShippingDaysToExclude;\n\t}\n\tvar dateString = jQuery.datepicker.formatDate('dd/mm/yy', date);\n\treturn daysList.indexOf(dateString) !== -1;\n}\n\n/**\n * @function \n * @description exclude sundays and special days, return array for datepicker plugin\n * @param date {Date}\n * @return [Boolean, String, String] as required by jquery datepicker plugin\n * */\nfunction sundaySpecial (date) {\n\treturn excludeSpecialDays(date) || excludeSundays(date) ? [false, '', ''] : [true, '', ''];;\n}\n\n/**\n * @function \n * @description exclude weekends and special days, return array for datepicker plugin\n * @param date {Date}\n * @return [Boolean, String, String] as required by jquery datepicker plugin\n * */\nfunction weekendSpecial (date) {\n\treturn excludeSpecialDays(date) || excludeWeekends(date) ? [false, '', ''] : [true, '', ''];\n}\n\nmodule.exports.datePickerExcludeSundays = excludeSundays;\nmodule.exports.excludeWeekends = excludeWeekends;\nmodule.exports.excludeSpecialDays = excludeSpecialDays;\nmodule.exports.sundaySpecial = sundaySpecial;\nmodule.exports.weekendSpecial = weekendSpecial;\n},{}],11:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('./ajax'),\n util = require('./util'),\n _ = require('lodash'),\n imagesLoaded = require('imagesloaded');\n\nvar dialog = {\n /**\n * @function\n * @description Appends a dialog to a given container (target)\n * @param {Object} params params.target can be an id selector or an jquery object\n */\n create: function (params) {\n var $target, id;\n\n if (typeof params.target === 'string') {\n if (params.target.charAt(0) === '#') {\n $target = $(params.target);\n } else {\n $target = $('#' + params.target);\n }\n } else if (params.target instanceof jQuery) {\n $target = params.target;\n } else {\n $target = $('#dialog-container');\n }\n\n // if no element found, create one\n if ($target.length === 0) {\n if ($target.selector && $target.selector.charAt(0) === '#') {\n id = $target.selector.substr(1);\n $target = $('
        ').attr('id', id).addClass('dialog-content').appendTo('body');\n }\n }\n\n // create the dialog\n this.$container = $target;\n this.$container.dialog(_.merge({}, this.settings, params.options || {}));\n },\n /**\n * @function\n * @description Opens a dialog using the given url (params.url) or html (params.html)\n * @param {Object} params\n * @param {Object} params.url should contain the url\n * @param {String} params.html contains the html of the dialog content\n */\n open: function (params) {\n // close any open dialog\n this.close();\n if (params.url) {\n params.url = util.appendParamToURL(params.url, 'format', 'ajax');\n ajax.load({\n url: params.url,\n data: params.data,\n callback: function (response) {\n params.content = response;\n this.create(params);\n this.openWithContent(params);\n }.bind(this)\n });\n } else if (params.html) {\n this.create(params);\n this.openWithContent(params);\n }\n },\n /**\n * @description populate the dialog with html content, then open it\n **/\n openWithContent: function (params) {\n var content, position, callback;\n\n if (!this.$container) {\n return;\n }\n content = params.content || params.html;\n if (!content) {\n return;\n }\n this.$container.empty().html(content);\n if (!this.$container.dialog('isOpen')) {\n this.$container.dialog('open');\n }\n\n if (params.options) {\n position = params.options.position;\n }\n if (!position) {\n position = this.settings.position;\n }\n imagesLoaded(this.$container).on('done', function () {\n this.$container.dialog('option', 'position', position);\n }.bind(this));\n\n callback = (typeof params.callback === 'function') ? params.callback : function () {};\n callback();\n },\n /**\n * @description Replace the content of current dialog\n * @param {object} params\n * @param {string} params.url - If the url property is provided, an ajax call is performed to get the content to replace\n * @param {string} params.html - If no url property is provided, use html provided to replace\n */\n replace: function (params) {\n if (!this.$container) {\n return;\n }\n if (params.url) {\n params.url = util.appendParamToURL(params.url, 'format', 'ajax');\n ajax.load({\n url: params.url,\n data: params.data,\n callback: function (response) {\n params.content = response;\n this.openWithContent(params);\n }.bind(this)\n });\n } else if (params.html) {\n this.openWithContent(params);\n }\n },\n /**\n * @function\n * @description Closes the dialog\n */\n close: function () {\n if (!this.$container) {\n return;\n }\n this.$container.dialog('close');\n },\n /**\n * @function\n * @description Submits the dialog form with the given action\n * @param {String} The action which will be triggered upon form submit\n */\n submit: function (action) {\n var $form = this.$container.find('form:first');\n // set the action\n $('').attr({\n name: action,\n type: 'hidden'\n }).appendTo($form);\n // serialize the form and get the post url\n var data = $form.serialize();\n var url = $form.attr('action');\n // make sure the server knows this is an ajax request\n if (data.indexOf('ajax') === -1) {\n data += '&format=ajax';\n }\n // post the data and replace current content with response content\n $.ajax({\n type: 'POST',\n url: url,\n data: data,\n dataType: 'html',\n success: function (html) {\n this.$container.html(html);\n }.bind(this),\n failure: function () {\n window.alert(Resources.SERVER_ERROR);\n }\n });\n },\n exists: function () {\n return this.$container && (this.$container.length > 0);\n },\n isActive: function () {\n return this.exists() && (this.$container.children.length > 0);\n },\n settings: {\n autoOpen: false,\n height: 'auto',\n modal: true,\n overlay: {\n opacity: 0.5,\n background: 'black'\n },\n resizable: false,\n title: '',\n width: '800',\n close: function () {\n $(this).dialog('close');\n },\n position: {\n my: 'center',\n at: 'center',\n of: window,\n collision: 'flipfit'\n }\n }\n};\n\nmodule.exports = dialog;\n},{\"./ajax\":3,\"./util\":69,\"imagesloaded\":77,\"lodash\":78}],12:[function(require,module,exports){\n'use strict';\n\nvar validatoriban = require('./validatoriban');\n\nfunction initIbanForm() {\n\tvar formRow = $('.form-row.form-row-button:nth-child(1)');\n\tvar ibanCountry = $('.countryiban');\n\tvar ibanValue = $('.iban');\n\n\tvalidatoriban.init();\n\n\t/* Add example of a valid iban at the end of the form */\n\tibanCountry.change(function() {\n\t\tvar ibanValidExample = Resources.EXAMPLE_LABEL + ' : ' + Resources[\"VALIDEXAMPLE_IBAN_\" + $(this).val()];\n\t\t\n\t\tif (formRow.find('.valid-iban-example').length == 0) {\n\t\t\tformRow.append('

        '+ ibanValidExample + '

        ');\n\t\t}\n\t\telse {\n\t\t\t$('.valid-iban-example').text(ibanValidExample);\n\t\t}\n\t\t/* If the country change, checks again if the iban value is correct */\n\t\tibanValue.valid();\n\t});\n\tibanCountry.trigger('change');\n\n\t/* Adding whitespaces on iban input every 4 characters */\n\tibanValue.keyup(function(e) {\n\n\t\t/* Only if the pressed key is not delete (Otherwise a space character will automatically be added if you try to delete it) */\n\t\tif(e.keyCode !== 8 && e.keyCode !== 46) {\n\n\t\t\t/* Replace non-alphanumeric characters by empty, then replace lowercase by uppercase */\n\t\t\tvar v = $(this).val().replace(/[^\\da-zA-Z]/g, '');\n\t\t\tv = v.replace(/([a-z])/, function(str) { return str.toUpperCase(); });\n\n\t\t\tvar reg = new RegExp(\".{4}\",\"g\");\n\t\t\tvar reformat = v.replace(reg, function(a, b, c) {\n\t\t\t\treturn a + ' ';\n\t\t\t});\n\t\t\t$(this).val(reformat);\n\t\t}\n\t});\n}\n\nexports.init = function() {\n initIbanForm();\n}\n},{\"./validatoriban\":72}],13:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('./ajax'),\n\tutil = require('./util');\n/**\n * @function\n * @description Load details to a given gift certificate\n * @param {String} id The ID of the gift certificate\n * @param {Function} callback A function to called\n */\nexports.checkBalance = function (id, callback) {\n\t// load gift certificate details\n\tvar url = util.appendParamToURL(Urls.giftCardCheckBalance, 'giftCertificateID', id);\n\n\tajax.getJson({\n\t\turl: url,\n\t\tcallback: callback\n\t});\n};\n\n},{\"./ajax\":3,\"./util\":69}],14:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('./ajax'),\n\tminicart = require('./minicart'),\n\tutil = require('./util');\n\nvar setAddToCartHandler = function (e) {\n\te.preventDefault();\n\tvar form = $(this).closest('form');\n\n\tvar options = {\n\t\turl: util.ajaxUrl(form.attr('action')),\n\t\tmethod: 'POST',\n\t\tcache: false,\n\t\tdata: form.serialize()\n\t};\n\t$.ajax(options).done(function (response) {\n\t\tif (response.success) {\n\t\t\tajax.load({\n\t\t\t\turl: Urls.minicartGC,\n\t\t\t\tdata: {lineItemId: response.result.lineItemId},\n\t\t\t\tcallback: function (response) {\n\t\t\t\t\tminicart.show(response);\n\t\t\t\t\tform.find('input,textarea').val('');\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tform.find('span.error').hide();\n\t\t\tfor (var id in response.errors.FormErrors) {\n\t\t\t\tvar $errorEl = $('#' + id).addClass('error').removeClass('valid').next('.error');\n\t\t\t\tif (!$errorEl || $errorEl.length === 0) {\n\t\t\t\t\t$errorEl = $('');\n\t\t\t\t\t$('#' + id).after($errorEl);\n\t\t\t\t}\n\t\t\t\t$errorEl.text(response.errors.FormErrors[id].replace(/\\\\'/g, '\\'')).show();\n\t\t\t}\n\t\t}\n\t}).fail(function (xhr, textStatus) {\n\t\t// failed\n\t\tif (textStatus === 'parsererror') {\n\t\t\twindow.alert(Resources.BAD_RESPONSE);\n\t\t} else {\n\t\t\twindow.alert(Resources.SERVER_CONNECTION_ERROR);\n\t\t}\n\t});\n};\n\nexports.init = function () {\n\t$('#AddToBasketButton').on('click', setAddToCartHandler);\n};\n\n},{\"./ajax\":3,\"./minicart\":22,\"./util\":69}],15:[function(require,module,exports){\nfunction getCustomContext (context) {\n\tswitch (window.pageContext.type) {\n\t\tcase 'MyAccount':\n\t\t\treturn 'wishlist';\n\t\tcase 'search':\n\t\t\treturn 'category';\n\t\tdefault :\n\t\t\treturn 'product';\n\t};\n}\n\ngetDatalayerEventInSessionStorage = function() {\n var storageEvts = [];\n for (var i = 0; i < sessionStorage.length; i++) {\n var key = sessionStorage.key(i);\n if (key.includes('datalayerEvt')) {\n try {\n var evt = JSON.parse(sessionStorage.getItem(key));\n for (const evtData in evt.data) {\n evtDataValue = evt.data[evtData];\n if (typeof(evtDataValue) === 'string' && evtDataValue.includes('eval:')) {\n evt.data[evtData] = eval(evtDataValue.slice('eval:'.length))\n }\n }\n storageEvts.push(evt);\n sessionStorage.removeItem(key);\n } catch (_e) {\n continue;\n }\n }\n }\n if (storageEvts.length === 0) {\n return;\n }\n for (var i = 0; i < storageEvts.length; i++) {\n var evt = storageEvts[i];\n $(window).trigger('datalayer:push-event', evt);\n }\n}\n\ncleanupSessionStorage = function() {\n for (let i = 0; i < sessionStorage.length; i++) {\n var key = sessionStorage.key(i);\n if (key.includes('datalayerEvt') || key.includes('datalayer')) {\n sessionStorage.removeItem(key);\n }\n }\n}\n\ngetDatalayerEventInURL = function() {\n var eventDataMapping = [\n {\n name: 'user login',\n eventName: 'user login',\n data: {\n user_logged: 'yes',\n user_id: window.uDataFooter.user_id,\n }\n },\n {\n name: 'user logout',\n eventName: 'user logout',\n data: {\n user_logged: 'no',\n user_id: window.uDataFooter.user_id,\n }\n },\n {\n name: 'form success:newsletter',\n eventName: 'form success',\n data: {\n form_name: \"newsletter subscription\",\n form_details1: $('form[id*=newsletterupdate]').length > 0\n ? $('form[id*=newsletterupdate]').parent().data('tmsFormDetails1')\n : sessionStorage.getItem('datalayer:newsletterLocation')\n }\n },\n {\n name: 'form success:registration',\n eventName: 'form success',\n data: {\n form_name: \"user registration\"\n }\n }\n ]\n\n var urlSearchParams = new URLSearchParams(window.location.search);\n if (!urlSearchParams.has('datalayerEvt') && !urlSearchParams.has('original')) {\n return;\n }\n \n var triggerDatalayerPushEvent = function (evtStr) {\n var urlEvt = JSON.parse(evtStr);\n var evtName = urlEvt.name;\n var evtAdditionalData = urlEvt.data;\n for (let i = 0; i < eventDataMapping.length; i++) {\n const evt = eventDataMapping[i];\n if (evtName === evt.name) {\n var evtData = {};\n Object.assign(evtData, evt.data);\n Object.assign(evtData, evtAdditionalData);\n $(window).trigger('datalayer:push-event', {\n name: evt.eventName,\n data: evtData\n });\n }\n }\n }\n\n if (urlSearchParams.has('original')) {\n var urlParamsArray = urlSearchParams.get('original').split('?');\n if(urlParamsArray.length > 1){\n var originalSearch = urlSearchParams.get('original').split('?')[1];\n var originalSearchParams = new URLSearchParams(originalSearch);\n triggerDatalayerPushEvent(decodeURIComponent(originalSearchParams.get('datalayerEvt')));\n }\n } else {\n triggerDatalayerPushEvent(decodeURIComponent(urlSearchParams.get('datalayerEvt')));\n }\n}\n\nmonitorDatalayerForms = function() {\n var errorDescriptionMapping = [\n ['firstname-error', 'Invalid first name'], \n ['lastname-error', 'Invalid last name'], \n ['email-error', 'Invalid email address'], \n ['address1-error', 'Invalid address'], \n ['cpHouseNr-error', 'Invalid house number'], \n ['postal-error', 'Invalid postal code'], \n ['city-error', 'Invalid city'], \n ['loyaltycardid-error', 'Invalid loyalty card id']\n ];\n $('form[datalayer-monitor-form]')\n .on('submit', function(e) {\n if (!$(this).valid()) {\n var errorArray = [];\n $(this).validate().errors().each(function () {\n if ($(this).css('display') === 'none') {\n return;\n }\n var decomposedId = $(this).attr('id').split('_');\n var formErrorTypeId = decomposedId[decomposedId.length - 1];\n for (let i = 0; i < errorDescriptionMapping.length; i++) {\n const error = errorDescriptionMapping[i];\n if (error[0] === formErrorTypeId) {\n errorArray.push(error[1]);\n }\n }\n });\n $(window).trigger('datalayer:push-event', {\n name: 'form error',\n data: {\n form_error_message: errorArray.join(' / '),\n form_name: $(this).parent().data('tms-form-name'),\n form_details1: $(this).parent().data('tms-form-details1')\n }\n });\n }\n });\n}\n\nmodule.exports = {\n\tinitDataLayer : function () {\n\t\twindow.dataLayer = window.dataLayer || [];\n\t},\n\n\tinitUData : function () {\n\t\twindow.udata = window.udata || [];\n\n $(window).on('datalayer:push-event', function (_e, eventData) {\n\t\t\tif (!(Object.hasOwn(eventData, 'name') && Object.hasOwn(eventData, 'data'))) {\n return;\n }\n var name = eventData.name;\n var data = eventData.data;\n var uDataGAObj = {\n event_name: name\n }\n Object.assign(uDataGAObj, data);\n window.udata.push(uDataGAObj);\n });\n\t\t$(window).trigger('datalayer:push-event',\n {\n name: \"page navigation\",\n data: {\n env_country: window.uDataFooter.country.toLowerCase(),\n\t\t\t\tenv_currency: window.uDataFooter.currency.toLowerCase(),\n\t\t\t\tpage_language: window.uDataFooter.pageLanguage,\n\t\t\t\tpage_name: window.uDataFooter.pageName,\n\t\t\t\tpage_template: window.templateData ? window.templateData.GA4Template : 'other',\n\t\t\t\tuser_id: window.uDataFooter.user_id,\n\t\t\t\tuser_logged: window.uDataFooter.user_logged\n }\n });\n\n getDatalayerEventInURL();\n getDatalayerEventInSessionStorage();\n cleanupSessionStorage();\n monitorDatalayerForms();\n $(document).on('ajaxComplete', monitorDatalayerForms);\n\t},\n\t/**\n\t * Just extends dataLayer Object on specific actions\n\t * to use it, require it and call public function on specific action.\n\t * */\n\t// dataLayer socialInteraction : on social share link click\n\tsocialLinkClick : function (target) {\n\t\tthis.initDataLayer();\n\t\tvar socialPlatform = target.data('social-platform');\n\t\tvar socialAction = target.data('social-action');\n\t\t\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"socialInteraction\",\n\t\t\t'socialNetwork' : socialPlatform,\n\t\t\t'socialAction' : socialAction\n\t\t});\n\t},\n\t/**\n * @function\n * @description dataLayer pagelistSeeMore : infinite scroll see more\n * */ \n\tinfiniteScrollSeeMoreClick : function () {\n\t\tthis.initDataLayer();\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"pagelistSeeMore\"\n\t\t});\n\t},\n \n\t/**\n * @function \n * @description dataLayer pagelistTop : scroll to top on page list click\n * */\n\tscrollTopListPageClick : function () {\n\t\tthis.initDataLayer();\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"pagelistTop\"\n\t\t});\n\t},\n\t/**\n * @function \n * @description push 'ourRecommandations' click event in datalayer\n * @param target {jQuery.Object}\n */\n\trecommendationProductClick : function (target) {\n\t\tthis.initDataLayer();\n\t\tvar productName = target.closest('.grid-tile, .product-tile').data('product-name');\n\t\tvar pageType = window.pageContext.analyticsType || window.pageContext.type;\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"ourRecommandations\",\n\t\t\t'pageType' : pageType,\n\t\t\t'productName' : productName\n\t\t});\n\t},\n /**\n * @function \n * @description push 'lastViewedProducts' click event in datalayer\n * @param target {jQuery.Object}\n */\n lastVisitedProductClick : function (target) {\n this.initDataLayer();\n\t\tvar destProductName = target.closest('.grid-tile').data('product-name');\n var pageType = window.pageContext.analyticsType || window.pageContext.type;\n \n window.dataLayer.push({\n event : \"lastViewedProducts\",\n pageType : pageType,\n productName : window.CurrentProductName,\n destProductName : destProductName\n }) \n },\n\t/**\n * @function \n * @description dataLayer pdp : click on add to wishlist button\n * @param target {jQuery.Object}\n * @param context {String}\n */\n\taddToWishListButtonClick : function (target, context) {\n\t\tthis.initDataLayer();\n\t\tvar productName = target.data('product-name');\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"addToWishlist\",\n\t\t\t'pageType' : context || window.pageContext.type,\n\t\t\t'productName' : productName\n\t\t});\n\t},\n\t/**\n * @function \n * @description push 'crossSelling' click event in datalayer\n * @param target {jQuery.Object}\n * @param context {String}\n */\n\tcrossSellingClick : function (target, context) {\n\t\tthis.initDataLayer();\n\t\tvar productName = target.data('product-name');\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"crossSelling\",\n\t\t\t'pageType' : context || window.pageContext.type,\n\t\t\t'productName' : productName\n\t\t});\n\t},\n\t/**\n * @function \n * @description push 'filtering' click event in datalayer\n * @param target {jQuery.Object}\n */\n\tproductListFilteringClick : function (target) {\n var eventName = target.closest('li.refinement-item').hasClass('selected') ? \"list filter removal\" : \"list filter\";\n var listName = $('.search-result-content').data('tms-product-list') ? \"product assortment: \" + $('.search-result-content').data('tms-product-list').toLowerCase() : \"product assortment\";\n\t\tvar filteringAction = target.closest('ul').data('filter-type');\n\t\tvar filteringValue = target.data('filter-value') || target.data('value');\n var filters = [{\n category: filteringAction,\n name: filteringValue\n }];\n\n\t\t$(window).trigger('datalayer:push-event', {\n name: eventName,\n data: {\n list_name: listName,\n list_filters: filters,\n }\n });\n\t},\n\t//dataLayer cart remove product\n\tcartRemoveProduct : function (target) {\n\t\tthis.initDataLayer();\n\t\tvar product = target.closest('.cart-row').data('product');\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"removeFromCart\", \n\t\t\t'ecommerce' : {\n\t\t\t\t'remove' : {\n\t\t\t\t\t'products' : [\n\t\t\t\t\t product\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\t//dataLayer login facebook connect\n\tloginFacebookConnect : function (context) {\n\t\tthis.initDataLayer();\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"facebookConnect\",\n\t\t\t'pageType' : \"$pagetype\"\n\t\t});\n\t},\n\t//dataLayer global add to cart\n\taddToCartClick : function (target, context) {\n\t\tthis.initDataLayer();\n\t\t\n\t\tcontext = getCustomContext(window.pageContext);\n\t\tvar productName = target.data('product-name');\n\t\t\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"addToCart\",\n\t\t\t'pageType' : context,\n\t\t\t'productName' : productName\n\t\t});\t\n\t},\n\t//dataLayer global add all to cart\n\taddAllToCartClick : function () {\n var productForms = $('#product-set-list, #wishlist-items').find('form:not(.pdpForm)').toArray();\n var productsToProcess = [];\n\n for (let i = 0; i < productForms.length; i++) {\n const $productForm = $(productForms[i]);\n if ($productForm.closest('.product-set-item').find('.product-variations').find('.swatch-item-size.selected').length > 0) {\n productsToProcess.push($productForm.closest('.product-set-item'));\n }\n }\n\n var productsToPush = []\n for (let i = 0; i < productsToProcess.length; i++) {\n var product = productsToProcess[i];\n var productID = $(product).data('tms-product-id');\n var eComProducts = Array.from(window.GTMProduct.ecommerce.detail.products);\n var eComProduct;\n for (let j = 0; j < eComProducts.length; j++) {\n if (eComProducts[j].id === productID) {\n eComProduct = eComProducts[j];\n break;\n }\n }\n var productToPush = {};\n var productSku = $(product).find('.swatch-item-size.selected').data('productean');\n productToPush.id = productID;\n productToPush.name = eComProduct.name;\n productToPush.list = 'product detail';\n productToPush.quantity = 1;\n productToPush.new_total_quantity = (parseInt($(`.mini-cart-product[data-product-id=${productSku}]`).data('qty')) || 0) + productToPush.quantity;\n productToPush.price = eComProduct.price;\n productToPush.color = $(product).find('.product-variations').data('attributes').color.value;\n productToPush.size = $(product).find('.product-variations').data('attributes').size.displayValue;\n productsToPush.push(productToPush);\n }\n $(window).trigger('datalayer:push-event', {\n name: 'cart addition',\n data: {\n cart_method: \"click: button\",\n products: productsToPush\n }\n });\n\t},\n\t/**\n * @function \n * @description dataLayer product-list/quickview go to product details page\n */\n\topenProductDetailsClick : function (target) {\n\t\tif (window.pageContext.type === 'search') {\n\t\t\tthis.searchResultClick(target, 'product');\n\t\t} else {\n\t\t\tthis.initDataLayer();\n\t\t\tvar productName = target.closest('.product-tile').data('product-name');\n\t\t\twindow.dataLayer.push({\n\t\t\t\t'event' : \"productPageView\",\n\t\t\t\t'pageType' : window.pageContext.analyticsType || window.pageContext.type,\n\t\t\t\t'productName' : productName\n\t\t\t});\n\t\t\t// enhanced ecommerce productClick\n\t\t\tvar productData = target.closest('.grid-tile').data('product');\n\t\t\tvar position = target.closest('.product-tile').data('position');\n\t\t\tdataLayer.push({\n\t\t\t 'event': 'productClick',\n\t\t\t 'ecommerce': {\n\t\t\t 'click': {\n\t\t\t 'actionField': {'list': pageContext['categoryName'] || pageContext['analyticsProductType']}, // Optional list property.\n\t\t\t 'products': [{\n\t\t\t 'name': productData.name, // Name or ID is required.\n\t\t\t 'id': productData.id,\n\t\t\t 'price': productData.price,\n\t\t\t 'category': productData.category,\n\t\t\t 'variant': productData.variant,\n\t\t\t 'position': position,\n\t\t\t\t\t 'marque': productData.marque\n\t\t\t }]\n\t\t\t }\n\t\t\t }\n\t\t\t});\n\t\t}\n\t},\n /**\n * @function\n * @description dataLayer search page click on result\n * @param target {jQuery.Object}\n * @param type {String} Optional\n * @param container {jQuery.Object}\n */\n\tsearchResultClick : function (target, type, container) {\n\t\tthis.initDataLayer();\n var resultContainer = target.closest('li');\n\t\tvar resultName; \n\t\tif (container) {\n\t\t\tresultName = container.data('result-name');\n\t\t} else {\n\t\t\tresultName = resultContainer.data('type') ? resultContainer.data('result-name') : target.closest('.product-tile').data('product-name');\n\t\t}\n\t\t\n\t\twindow.dataLayer.push({\n\t\t\tevent : \"searchResults\",\n\t\t\tresultType : type || target.data('type'),\n\t\t\tresultName : resultName\n\t\t});\n\t},\n\t//dataLayer content FAQ question clicked\n\tfaqQuestionClicked : function (target) {\n\t\tthis.initDataLayer();\n\t\tvar questionClicked = target.attr('id');\n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"faq\",\n\t\t\t'questionClicked' : questionClicked\n\t\t});\n\t},\n /**\n * @function \n * @description enhanced ecommerce pagelist product impressions \n */\n\tmeasureProductImpressions : function (target, context) {\n\t\tthis.initDataLayer();\n\t\tvar impressions = [];\n\t\t\n\t\t// needed to know real tile position on page, this assumes .grid-tile is only tiles from product list\n\t\tvar $productsList = $('.grid-tile');\n\t\ttarget.each(function (index) {\n\t\t\tvar $productLi = $(this);\n\t\t\tvar productData = $productLi.data('product');\n\t\t\t\n\t\t\tif(productData){\n\t\t\t\t// calculate index of product in product list\n\t\t\t\tproductData.position = $productsList.index($productLi)+1;\n\t\t\t\tproductData.list = context || pageContext.categoryName;\n\t\t\t\timpressions.push(productData);\n\t\t\t}\n\t\t});\n\t\ttarget.attr('data-count', '');\n\t\t// Product impressions are sent by pushing an impressions object\n\t\t// containing one or more impressionFieldObjects.\n\t\tdataLayer.push({\n\t\t\t\"ecommerce\": {\n\t\t\t\t\"impressions\": impressions\n\t\t\t}\n\t\t});\n\t},\n\tmeasureProductDetailsViews : function (target) {\n\t\tthis.initDataLayer();\n\t\tvar products = [];\n\t\ttarget.each(function () {\n\t\t\tvar productData = $(this).data('product');\n\t\t\tif(productData){\n\t\t\t\tproductData.price = $(this).find('meta[itemprop=\"price\"]').attr('content');\n\t\t\t\tproducts.push(productData);\n\t\t\t}\n\t\t});\n\t\tdataLayer.push({\n\t\t\t\"ecommerce\": {\n\t\t\t\t\"detail\": {\n\t\t\t\t\t\"products\": products\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t},\n\t// dataLayer extended ecommerce : add product to cart\n\taddProductToCartExtended : function (target) {\n\t\tthis.initDataLayer();\n\t\tvar products = [];\n\t\tif (window.pageContext.type === 'product') {\n\t\t\ttarget.each(function () {\n\t\t\t\tvar productContainer = $(this).closest(\"#product-content, [id^=item-]\");\n\t\t\t\tvar productID = productContainer.data('product-id');\n\t\t\t\tvar productDatas = window.GTMProduct ? window.GTMProduct.ecommerce.detail.products : [productContainer.data('product')];\n\t\t\t\tif(productDatas){\n\t\t\t\t\tproductDatas.forEach(function (product) {\n\t\t\t\t\t\tif (product.id === productID) {\n\t\t\t\t\t\t\tproduct.quantity = productContainer.find('#Quantity').val() || 1;\n\t\t\t\t\t\t\tproducts.push(product);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t});\n\t\t} else { \n\t\t\t// wishlist add to cart case\n\t\t\ttarget.each(function () {\n\t\t\t\tvar productContainer = $(this).closest('.wishlist-item');\n\t\t\t\tvar productData = productContainer.data('product'); \n productData.quantity = '1';\n\t\t\t\tproducts.push(productData);\n\t\t\t});\n\t\t}\n\t\t\n\t\t// Measure adding a product to a shopping cart by using an 'add' actionFieldObject\n\t\t// and a list of productFieldObjects.\n\t\tdataLayer.push({\n\t\t\t\"event\": \"addToBasket\",\n\t\t\t\"ecommerce\": {\n\t\t\t\t\"add\": { \t// 'add' actionFieldObject measures.\n\t\t\t\t\t'products': products\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\t// dataLayer extended ecommerce : checkout step load\n\tcheckoutStepsExtended : function (event) {\n\t\tvar stepsMapping = {\n\t\t\t1 : \"cart\",\n\t\t\t2 : \"login\",\n\t\t\t3 : \"shipping details\",\n\t\t\t4 : \"billing details\",\n\t\t\t5 : \"payment details\"\n\t\t}\n\t\tvar step = $('.checkout-progress-indicator').data('checkout-step');\n\t\tvar productsArray = window.productsOrdereduData || [];\n for (let i = 0; i < productsArray.length; i++) {\n var cartRow = $('.cart-row').filter(function (_i, cartRow) {\n return $(cartRow).data('product').EAN.includes(productsArray[i].id);\n });\n productsArray[i].id2 = cartRow.find('[data-sku]').data('sku');\n }\n\t\t$(window).trigger('datalayer:push-event',\n {\n name: \"checkout step\",\n data: {\n checkout_step_name: stepsMapping[step],\n\t\t\t\tcheckout_step: step,\n\t\t\t\tproducts : productsArray\n }\n });\n\t},\n /**\n * @function\n * @description push homeBannerClick event\n */\n homeBannerClick : function (target) {\n this.initDataLayer();\n var currentGridElement = target.closest('div');\n var container = target.closest('.home-contentasset');\n // assets may have mlultiple configurations, so we try to find image multiple ways\n var image = target.find('img').length > 0 ? target.find('img') : (currentGridElement.find('img').length > 0 ? currentGridElement.find('img') : null);\n\t\tvar imageName = image ? image.attr('alt') : 'no_image';\n // position must be defined on content-asset container\n var allHomeContents = $('.home-contentasset .grid-row>div');\n var posInPage = allHomeContents.index(currentGridElement) + 1;\n \n\t\twindow.dataLayer.push({\n\t\t\t'event' : \"homeBannerClic\",\n\t\t\t'pageType' : window.pageContext.type,\n\t\t\t'imageName' : imageName,\n 'position' : posInPage\n\t\t});\n },\n /**\n * @function \n * @description enhanced ecommerce product view event\n * */\n productViewEnhancedEvent : function () {\n\t\tthis.initDataLayer();\n\t\tvar data = window.GTMProduct;\n\t\tif (data && 'ecommerce' in data && 'detail' in data.ecommerce) {\n\t\t\twindow.dataLayer.push(data);\n\t\t}\n\t},\n\t/**\n\t * @function\n\t * @description add the EAN to the product, on click on a size (PDP)\n\t */\n\tselectProductSize : function (target){\n\t\tif(\"productean\" in target.parentNode.dataset){\n\t\t\tthis.initDataLayer();\n\t\t\tvar EAN = target.parentNode.dataset.productean\n\t\t\twindow.dataLayer.push({\n\t\t\t\t\"ecommerce\": {\n\t\t\t\t\t\"detail\": {\n\t\t\t\t\t\t\"products\" :\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"EAN\" : EAN\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\t}\n\t\t\t});\n\t\t}\n\t},\n /**\n * @function \n * @description newsletter signup click\n * @TODO make event in gtm\n */\n newsletterSignupClick : function (target) {\n sessionStorage.setItem('datalayer:newsletterLocation', target.parent().data().tmsFormDetails1);\n },\n /**\n * @function \n * @description newsletter popup display\n * */\n newsletterPopupDisplay : function (){ \n \tthis.initDataLayer();\n \tvar context = window.pageContext.title;\n \t\n \twindow.dataLayer.push(\n \t{\n \t\t'event' : 'newsletterPopupShown',\n \t\t'pageType' : window.pageContext.type,\n \t\t'context' : context \n \t}\n \t);\n },\n /**\n * @function \n * @description productCare click \n */\n productCareClick : function (target) {\n this.initDataLayer();\n window.dataLayer.push({\n 'event' : 'productCareClick',\n 'pageType' : window.pageContext.type\n });\n },\n /**\n * @function \n * @description productComposition click \n */\n productCompositionClick : function (target) {\n this.initDataLayer();\n window.dataLayer.push({\n 'event' : 'productCompositionClick',\n 'pageType' : window.pageContext.type\n });\n },\n /**\n * @function\n * @description measure account creation after order confirmation page\n */\n accountCreationAfterOrder : function () {\n this.initDataLayer();\n window.dataLayer.push({\n 'event' : 'accountCreateAfterOrder',\n 'pageType' : window.pageContext.type\n });\n },\n /**\n * @function \n * @description measure account creations\n */\n accountCreationEvent : function (submittedForm) {\n this.initDataLayer();\n var identifier = submittedForm.find('[id$=_loyaltycardid]').length > 0 ? 'Card' : 'Email';\n window.dataLayer.push({\n 'event' : 'accountCreated',\n 'pageType' : window.pageContext.type,\n 'identifier' : identifier\n });\n },\n /**\n * @function \n * @description measure order confirmations, gtmOrder object is generated in page, by dw script\n */\n measureOrderConfirmation : function (confirmation) {\n var productsArray = window.productsOrdereduData || null;\n for (let i = 0; i < productsArray.length; i++) {\n var lineItem = $('.product-list-item').filter(function (_i, lineItem) {\n return $(lineItem).data('product').EAN.includes(productsArray[i].id);\n });\n productsArray[i].id = productsArray[i].id.toUpperCase();\n productsArray[i].id2 = lineItem.find('[data-sku]').data('sku').toUpperCase();\n }\n\t\t$(window).trigger('datalayer:push-event',\n {\n name: \"order\",\n data: {\n order_id : window.gtmOrder.tsCheckoutOrderNr,\n\t\t\t\torder_payment_value : window.gtmOrder.totalGrossPrice,\n\t\t\t\torder_payment_method : window.gtmOrder.paymentMethod,\n\t\t\t\tproducts : productsArray\n }\n });\n },\n /**\n * @function \n * @description measure video playing\n */\n playingVideoProductPage : function(pid) {\n this.initDataLayer();\n window.dataLayer.push({\n 'event' : 'VideoPlayed',\n 'pageType' : window.pageContext.type,\n 'productName' : pid\n });\n\t},\n\t/**\n\t * * @function \n\t * * @description submenu image click rate\n\t * */\n\tsubMenuImageEvent : function() {\n\t\tthis.initDataLayer();\n\t\twindow.dataLayer.push({\n\t\t\t'event' : 'submenuImageClick',\n\t\t\t'pageType' : window.pageContext.type,\n\t\t});\n\t}\n}\n},{}],16:[function(require,module,exports){\nvar A = 'A'.charCodeAt(0),\n Z = 'Z'.charCodeAt(0);\n\n/**\n * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to\n * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616.\n *\n * @param {string} iban the IBAN\n * @returns {string} the prepared IBAN\n */\nfunction iso13616Prepare(iban) {\n iban = iban.toUpperCase();\n iban = iban.substr(4) + iban.substr(0,4);\n\n return iban.split('').map(function(n){\n var code = n.charCodeAt(0);\n if (code >= A && code <= Z){\n // A = 10, B = 11, ... Z = 35\n return code - A + 10;\n } else {\n return n;\n }\n }).join('');\n}\n\n/**\n * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064.\n *\n * @param iban\n * @returns {number}\n */\nfunction iso7064Mod97_10(iban) {\n var remainder = iban,\n block;\n\n while (remainder.length > 2){\n block = remainder.slice(0, 9);\n remainder = parseInt(block, 10) % 97 + remainder.slice(block.length);\n }\n\n return parseInt(remainder, 10) % 97;\n}\n\n/**\n * Parse the BBAN structure used to configure each IBAN Specification and returns a matching regular expression.\n * A structure is composed of blocks of 3 characters (one letter and 2 digits). Each block represents\n * a logical group in the typical representation of the BBAN. For each group, the letter indicates which characters\n * are allowed in this group and the following 2-digits number tells the length of the group.\n *\n * @param {string} structure the structure to parse\n * @returns {RegExp}\n */\nfunction parseStructure(structure){\n // split in blocks of 3 chars\n var regex = structure.match(/(.{3})/g).map(function(block){\n\n // parse each structure block (1-char + 2-digits)\n var format,\n pattern = block.slice(0, 1),\n repeats = parseInt(block.slice(1), 10);\n\n switch (pattern){\n case \"A\": format = \"0-9A-Za-z\"; break;\n case \"B\": format = \"0-9A-Z\"; break;\n case \"C\": format = \"A-Za-z\"; break;\n case \"F\": format = \"0-9\"; break;\n case \"L\": format = \"a-z\"; break;\n case \"U\": format = \"A-Z\"; break;\n case \"W\": format = \"0-9a-z\"; break;\n }\n\n return '([' + format + ']{' + repeats + '})';\n });\n\n return new RegExp('^' + regex.join('') + '$');\n}\n\n/**\n * Create a new Specification for a valid IBAN number.\n *\n * @param countryCode Two first characters of the given iban value\n * @param length String size required (for each contry code)\n * @param structure Pattern used to build regex, (depending of the country code). Example for LU : \"F03A13\"\n * \"F03A13\" split into strings of 3 characters: \"F03\" and \"A13\" \n * F = digits only, A = alphanumeric characters, so here we're expecting 3 digits followed by 13 alphanumeric characters.\n * For more infos, see parseStructure function.\n * @constructor\n */\nfunction Specification(countryCode, length, structure){\n\n this.countryCode = countryCode;\n this.length = length;\n this.structure = structure;\n}\n\n/**\n * Lazy-loaded regex (parse the structure and construct the regular expression the first time we need it for validation)\n */\nSpecification.prototype._regex = function(){\n return this._cachedRegex || (this._cachedRegex = parseStructure(this.structure))\n};\n\n/**\n * Check if the passed iban is valid according to this specification.\n *\n * @param {String} iban the iban to validate\n * @returns {boolean} true if valid, false otherwise\n */\nSpecification.prototype.isValid = function(iban){\n return this.length == iban.length\n && this.countryCode === iban.slice(0,2)\n && this._regex().test(iban.slice(4))\n && iso7064Mod97_10(iso13616Prepare(iban)) == 1;\n};\n\nvar IBAN = {\n countries: {},\n init: function() {\n var self = this;\n function addSpecification(IBAN){\n self.countries[IBAN.countryCode] = IBAN;\n }\n addSpecification(new Specification(\"BE\", 16, \"F03F07F02\"));\n addSpecification(new Specification(\"DE\", 22, \"F08F10\"));\n addSpecification(new Specification(\"FR\", 27, \"F05F05A11F02\"));\n addSpecification(new Specification(\"LU\", 20, \"F03A13\"));\n addSpecification(new Specification(\"NL\", 18, \"U04F10\"));\n addSpecification(new Specification(\"AT\", 20, \"F16\"));\n },\n isValid: function(iban) {\n var self = this;\n var countryStructure = self.countries[iban.slice(0,2)];\n return !!countryStructure && countryStructure.isValid(iban);\n },\n}\n\nmodule.exports = IBAN;\n},{}],17:[function(require,module,exports){\nexports.init = function() {\n\t// Set a max with detection for mobile\n\tvar isMobile = window.matchMedia(\"only screen and (max-width: 770px)\");\n\t\n\tif (!isMobile.matches) {\n\t\t$('.search-result-content').on('mouseenter mouseleave', '.img-tile-switch', function() {\n\t\t\tvar $this = $(this);\n\t\t\tvar source = $this.attr('src');\n\t\t\tvar newSource = $this.attr('data-alt-src');\n\n\t\t\tif (source && newSource && source !== \"null\" && newSource !== \"null\") {\n\t\t\t\t$this.attr('data-alt-src', source);\n\t\t\t\t$this.attr('src', newSource);\n\t\t\t}\n\t\t});\n\t} else {\n\t\t$('.img-tile-switch').each(function(idx, elem) {\n\t\t\t$(elem).attr('data-alt-src', null);\n\t\t});\n\t}\n};\n},{}],18:[function(require,module,exports){\n'use strict';\n\nexports.init = function () {\n var processInspirationContent = function() {\n var wrapper = $('.inspiration-content-wrapper');\n var positions = wrapper.data('positions');\n var items = wrapper.children();\n if (items.length === 0 || positions.length === 0) {\n return;\n }\n items.each(function(i, item) {\n let $item = $(item);\n let itemPosition = Math.max(positions[i], 0);\n if (i + 1 > positions.length) {\n return;\n }\n $item.detach();\n $(`.search-result-items[data-ul-num=${wrapper.data('ul-num')}]`).find('.grid-tile').eq(itemPosition - 2).after($item);\n });\n wrapper.remove();\n }\n processInspirationContent();\n $(window).on('productGridUpdated refinements:after-reload', processInspirationContent);\n};\n\n},{}],19:[function(require,module,exports){\n'use strict';\n// jQuery extensions\n\nmodule.exports = function () {\n\t// params\n\t// toggleClass - required\n\t// triggerSelector - optional. the selector for the element that triggers the event handler. defaults to the child elements of the list.\n\t// eventName - optional. defaults to 'click'\n\t$.fn.toggledList = function (options) {\n\t\tif (!options.toggleClass) { return this; }\n\t\tvar list = this;\n\t\treturn list.on(options.eventName || 'click', options.triggerSelector || list.children(), function (e) {\n\t\t\te.preventDefault();\n\t\t\tvar classTarget = options.triggerSelector ? $(this).parent() : $(this);\n\t\t\tclassTarget.toggleClass(options.toggleClass);\n\t\t\t// execute callback if exists\n\t\t\tif (options.callback) {options.callback();}\n\t\t});\n\t};\n\n\t$.fn.syncHeight = function () {\n\t\tvar arr = $.makeArray(this);\n\t\tarr.sort(function (a, b) {\n\t\t\treturn $(a).height() - $(b).height();\n\t\t});\n\t\treturn this.height($(arr[arr.length - 1]).height());\n\t};\n};\n\n},{}],20:[function(require,module,exports){\n'use strict';\n/* global CQuotient */\n\nexports.init = function () {\n\t// set image src \n\t$(\".img-tile-switch\").each(function(){\n\t\tvar newSource = $(this).attr('data-loading');\n\t\t$(this).attr('src', newSource);\n\t});\n};\n\n},{}],21:[function(require,module,exports){\n'use strict';\n/* global CQuotient */\n\nexports.init = function () {\n\t// set lazy load image\n\t$(\".lazy\").lazyload({\n\t\tscrollDirection: 'vertical',\n\t\tdelay: 0\n\t});\n\n\t$(\".img-slider\").each(function(){\n\t\tvar newSource = $(this).attr('data-original');\n\t\t$(this).css('backgroundImage','url('+newSource+')');\n\t});\n};\n\n},{}],22:[function(require,module,exports){\n'use strict';\n\nvar util = require('./util'),\n\tbonusProductsView = require('./bonus-products-view');\n\nvar timer = {\n\tid: null,\n\tclear: function () {\n\t\tif (this.id) {\n\t\t\twindow.clearTimeout(this.id);\n\t\t\tdelete this.id;\n\t\t}\n\t},\n\tstart: function (duration, callback) {\n\t\tthis.id = setTimeout(callback, duration);\n\t}\n};\n\nvar minicart = {\n\tinit: function () {\n\t\tthis.$el = $('#mini-cart');\n\t\tthis.$content = this.$el.find('.mini-cart-content');\n\n\t\t// events\n\t\tthis.$el.find('.mini-cart-total').on('mouseenter', function () {\n\t\t\tif (this.$content.not(':visible') && window.innerWidth > 800) {\n\t\t\t\tthis.slide();\n\t\t\t}\n\t\t}.bind(this));\n\n\t\tthis.$content.on('mouseenter', function () {\n\t\t\ttimer.clear();\n\t\t}).on('mouseleave', function () {\n\t\t\ttimer.clear();\n\t\t\ttimer.start(30, this.close.bind(this));\n\t\t}.bind(this));\n\t},\n\t/**\n\t * @function\n\t * @description Shows the given content in the mini cart\n\t * @param {String} A HTML string with the content which will be shown\n\t */\n\tshow: function (html) {\n\t\tthis.$el.html(html);\n\t\tutil.scrollBrowser(0);\n\t\tthis.init();\n\t\tthis.slide();\n\t\tbonusProductsView.loadBonusOption();\n\t},\n\t/**\n\t * @function\n\t * @description Slides down and show the contents of the mini cart\n\t */\n\tslide: function () {\n\t\ttimer.clear();\n\t\t// show the item\n\t\tthis.$content.slideDown(50);\n\t\t// after a time out automatically close it\n\t\ttimer.start(2000, this.close.bind(this));\n\t},\n\t/**\n\t * @function\n\t * @description Closes the mini cart with given delay\n\t */\n\tclose: function () {\n\t\ttimer.clear();\n\t\tthis.$content.slideUp(50);\n\t}\n};\n\nmodule.exports = minicart;\n\n},{\"./bonus-products-view\":4,\"./util\":69}],23:[function(require,module,exports){\n'use strict';\n\nvar util = require('./util');\n\nvar page = {\n\ttitle: '',\n\ttype: '',\n\tparams: util.getQueryStringParams(window.location.search.substr(1)),\n\tredirect: function (newURL) {\n\t\tsetTimeout(function () {\n\t\t\twindow.location.href = newURL;\n\t\t}, 0);\n\t},\n\trefresh: function () {\n\t\tsetTimeout(function () {\n\t\t\twindow.location.assign(window.location.href);\n\t\t}, 500);\n\t}\n};\n\nmodule.exports = page;\n\n},{\"./util\":69}],24:[function(require,module,exports){\n'use strict';\n\nvar giftcert = require('../giftcert'),\n\ttooltip = require('../tooltip'),\n\tutil = require('../util'),\n\tdialog = require('../dialog'),\n\tpage = require('../page'),\n\tgtmtool = require('../googledatatag.js'),\n\tvalidator = require('../validator'),\n\tibanForm = require('../formiban'),\n\tadyenCheckout = require('../adyen-checkout');\n\nfunction initializeNewAccountFields(target) {\n\tvar $target= target || $('#main');\n\n\t$target.on('change', '.hasDatepicker', function () {\n\t\t$(this.form).validate().element(this);\n\t});\n\t\n\t$target.on('change','[id*=\"_login_registerselector_loyaltyaccount\"]', function () {\n\t\tvar form = this.form;\n\t\t$(form).submit();\n\t});\n\n\t$target.on('change','[id*=\"_login_guestchoice\"]', function () {\n\t\tvar form = this.form;\n\t\t$(form).submit();\n\t});\n\t\n\tutil.initializeDatePicker('_loyalty_birthday');\n\tutil.initializeDatePicker('_customer_birthday');\n\t\n\t$target.on('submit', 'form[id*=\"_login_registerselector\"], form[id*=\"_login_guestchoice\"]', function(e){\n\t\te.preventDefault();\n\t\t$.post(\n\t\t\tutil.ajaxUrl(this.action),\n\t\t\t$(this).serialize(),\n\t\t\tfunction (data) {\n\t\t\t\t$target.html(data);\n\t\t\t\tutil.initializeDatePicker('_loyalty_birthday');\n\t\t\t\tutil.initializeDatePicker('_customer_birthday');\n\n\t\t\t\tif ($('.toggle-login:visible, .toggle-register:visible').length > 0) {\n\t\t\t\t\t$('.returning-customers, .toggle-register').hide();\n\t\t\t\t\t$('.create-account-content, .guestcheckout-form, .toggle-login').show();\n\t\t\t\t\t$('.trigger-register, .trigger-guest').fadeIn();\n\t\t\t\t}\n\n\t\t\t\tvalidator.init();\n\t\t\t}\n\t\t);\n\t});\n\n\tvalidator.init();\n}\n\n/**\n * @function \n * @description Initialize address fields events, specific validation, datepicker...\n * */\n\nfunction initializeAddressFields(){\n\tvar $main = $('#main');\n\t// initialize datepicker on dateField \n\tutil.initializeDatePicker('_customer_birthday');\n\t// we want to validate country specific fields when country selection change\n\t$main.on('change', '[id*=_address_country]', function () {\n\t\tvar $postalElement = $(this).parents('form').first().find('[id*=_address_postal]');\n\t\tif ($postalElement.val()) {\n\t\t\t$postalElement.valid();\n\t\t}\n\t\t\n\t\t// get phone dialcode for country and init if needed\n\t\trequire('../validatorhelper').changePhoneDialForCountry($(this));\n\t});\n}\n\n/**\n * @function\n * @description Initializes the events on the address form (apply, cancel, delete)\n * @param {Element} form The form which will be initialized\n */\nfunction initializeAddressForm() {\n\tvar $form = $('#edit-address-form');\n\n\t$form.find('input[name=\"format\"]').remove();\n\ttooltip.init();\n\t//$(\"\").attr({type:\"hidden\", name:\"format\", value:\"ajax\"}).appendTo(form);\n\n\t$form.on('click', '.apply-button', function (e) {\n\t\te.preventDefault();\n\t\tif (!$form.valid()) {\n\t\t\treturn false;\n\t\t}\n\t\tvar url = util.appendParamToURL($form.attr('action'), 'format', 'ajax');\n\t\tvar applyName = $form.find('.apply-button').attr('name');\n\t\tvar options = {\n\t\t\turl: url,\n\t\t\tdata: $form.serialize() + '&' + applyName + '=x',\n\t\t\ttype: 'POST'\n\t\t};\n\t\t$.ajax(options).done(function (data) {\n\t\t\tif (typeof(data) !== 'string') {\n\t\t\t\tif (data.success) {\n\t\t\t\t\tdialog.close();\n\t\t\t\t\tpage.refresh();\n\t\t\t\t} else {\n\t\t\t\t\twindow.alert(data.message);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$('#dialog-container').html(data);\n\t\t\t\taccount.init();\n\t\t\t\ttooltip.init();\n\t\t\t}\n\t\t});\n\t})\n\t.on('click', '.cancel-button, .close-button', function (e) {\n\t\te.preventDefault();\n\t\tdialog.close();\n\t})\n\t.on('click', '.delete-button', function (e) {\n\t\te.preventDefault();\n\t\tif (window.confirm(String.format(Resources.CONFIRM_DELETE, Resources.TITLE_ADDRESS))) {\n\t\t\tvar url = util.appendParamsToUrl(Urls.deleteAddress, {\n\t\t\t\tAddressID: $form.find('#addressid').val(),\n\t\t\t\tformat: 'ajax'\n\t\t\t});\n\t\t\t$.ajax({\n\t\t\t\turl: url,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tdataType: 'json'\n\t\t\t}).done(function (data) {\n\t\t\t\tif (data.status.toLowerCase() === 'ok') {\n\t\t\t\t\tdialog.close();\n\t\t\t\t\tpage.refresh();\n\t\t\t\t} else if (data.message.length > 0) {\n\t\t\t\t\twindow.alert(data.message);\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\tdialog.close();\n\t\t\t\t\tpage.refresh();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n\tvalidator.init();\n}\n/**\n * @private\n * @function\n * @description Toggles the list of Orders\n */\nfunction toggleFullOrder () {\n\t$('.order-items')\n\t\t.find('li.hidden:first')\n\t\t.prev('li')\n\t\t.append('View All')\n\t\t.children('.toggle')\n\t\t.click(function () {\n\t\t\t$(this).parent().siblings('li.hidden').show();\n\t\t\t$(this).remove();\n\t\t});\n}\n/**\n * @private\n * @function\n * @description Binds the events on the address form (edit, create, delete)\n */\nfunction initAddressEvents() {\n\tvar addresses = $('#addresses');\n\tif (addresses.length === 0) { return; }\n}\n/**\n * @private\n * @function\n * @description Binds the events of the payment methods list (delete card)\n */\nfunction initPaymentEvents() {\n\t$('.add-card').on('click', function (e) {\n\t\te.preventDefault();\n\t\tdialog.open({\n\t\t\turl: $(e.target).attr('href'),\n\t\t\toptions: {\n open: initializePaymentForm\n }\n\t\t});\n\t});\n\n\tvar paymentList = $('.payment-list');\n\tif (paymentList.length === 0) { return; }\n\n\tutil.setDeleteConfirmation(paymentList, String.format(Resources.CONFIRM_DELETE, Resources.TITLE_CREDITCARD));\n\n\t$('form[name=\"payment-remove\"]').on('submit', function (e) {\n\t\te.preventDefault();\n\t\t// override form submission in order to prevent refresh issues\n\t\tvar button = $(this).find('.delete');\n\t\t$('').attr({\n\t\t\ttype: 'hidden',\n\t\t\tname: button.attr('name'),\n\t\t\tvalue: button.attr('value') || 'delete card'\n\t\t}).appendTo($(this));\n\t\tvar data = $(this).serialize();\n\t\t$.ajax({\n\t\t\ttype: 'POST',\n\t\t\turl: $(this).attr('action'),\n\t\t\tdata: data\n\t\t})\n\t\t.done(function () {\n\t\t\tpage.redirect(Urls.paymentsList);\n\t\t});\n\t});\n}\n\nfunction initializePaymentForm() {\n $('#CreditCardForm').on('click', '.cancel-button', function (e) {\n e.preventDefault();\n dialog.close();\n\t});\n\t\n\tif (SitePreferences.ADYEN_SF_ENABLED) {\n\t\tadyenCheckout.initAccount();\n\t}\n}\n\n/**\n * @private\n * @function\n * @description init events for the loginPage\n */\nfunction initLoginPage() {\n\t//o-auth binding for which icon is clicked\n\t$('.oAuthIcon').bind('click', function () {\n\t\t$('#OAuthProvider').val(this.id);\n\t});\n\n\t//toggle the value of the rememberme checkbox\n\t$('#dwfrm_login_rememberme').bind('change', function () {\n\t\tif ($('#dwfrm_login_rememberme').attr('checked')) {\n\t\t\t$('#rememberme').val('true');\n\t\t} else {\n\t\t\t$('#rememberme').val('false');\n\t\t}\n\t});\n\n\t//Mobile login box toggle\n\t$('body').on('click', '.toggle-register', function () {\n\t\t$('.create-account-content, .guestcheckout-form').slideDown();\n\t\t$('.returning-customers').slideUp();\n\t\t$('.toggle-login').fadeIn();\n\t\t$('.toggle-register').fadeOut();\n\t\t$('.trigger-register, .trigger-guest').fadeIn();\n\t}).on('click', '.toggle-login', function () {\n\t\t$('.create-account-content, .guestcheckout-form').slideUp();\n\t\t$('.returning-customers').slideDown();\n\t\t$('.toggle-login').fadeOut();\n\t\t$('.toggle-register').fadeIn();\n\t\t$('.trigger-register').fadeOut();\n\t}).on('click', '.trigger-guest', function () {\n\t\t$('input[id*=\"_guestchoice_guestcheckoutchoice\"]').trigger('click');\n\t}).on('click', '.trigger-register', function () {\n\t\t$('input[id*=\"_guestchoice_createaccountchoice\"]').trigger('click');\n\t}).on('click', '.trigger-guest, .trigger-register', function () {\n\t\t$(document).ajaxComplete(function() {\n\t\t\tif ($(\".guestcheckout-login\")) {\n\t\t\t\t$(\"html, body\").animate({ scrollTop: $(\".guestcheckout-login\").offset().top - $(window).height() / 2 }, 100);\n\t\t\t}\n\t\t});\n\t});\n}\n/**\n * @private\n * @function\n * @description Binds the events of the order, address and payment pages\n */\nfunction initializeEvents() {\n\t$('#main').on('submit', '[id$=_login_register]', function () {\n\t\tgtmtool.accountCreationEvent($(this));\n\t});\n\t\n\ttoggleFullOrder();\n\tinitAddressEvents();\n\tinitPaymentEvents();\n\tinitLoginPage();\n}\n\n/**\n * @function\n * @description Initialize account overview events, dialogs, validator\n * */\nfunction initializeOverview() {\n\tvar $newLoginDialogContainer = $('#new-login-dialog');\n\tif ($newLoginDialogContainer.length > 0) {\n\t\tdialog.open({\n\t\t\thtml: $newLoginDialogContainer,\n\t\t\toptions : {\n\t\t\t\tdraggable : false,\n\t\t\t\tmodal: true,\n\t\t\t\tdialogClass : 'cep-dialog',\n\t\t\t\tresizable: false,\n\t\t\t\twidth: 300\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @private\n * @function\n * @description Bind textarea char remaining\n */\nfunction textAreaRemaining(maxLen) {\n\tvar text_max = !!maxLen ? maxLen : 1000;\n\t$('.input-textarea').after('
        ');\n\t$('.input-textarea').next('.charrem').html(text_max + Resources.CHARREMAINING);\n\t\n\t$('#main').on('keyup', '.input-textarea', function() {\n\t\tvar text_length = $(this).val().length;\n\t\tvar text_remaining = text_max - text_length;\n\t\t$(this).siblings('.charrem').html(text_remaining + Resources.CHARREMAINING);\n\t\tif (text_length > text_remaining) {\n\t\t\t$(this).val($(this).val().substring(0, text_max-1));\n\t\t}\t\n\t});\n}\n\n/**\n * @private\n * @function\n * @description initialize customer service specific events\n */\nfunction initializeCustomerService() {\n\tif ($('.pt_customer-service').length === 0) {\n\t\treturn;\n\t}\n\ttextAreaRemaining(500);\n\tinitOrderNumberField($('[id$=\"myquestion\"]').val());\n\t$('.pt_customer-service').on('change', '[id$=\"myquestion\"]', function (){\n\t\tinitOrderNumberField($(this).val());\n\t});\n\tvalidator.init();\n\n\t// Scroll to error message\n\tvar $errorMsg = $('.pt_customer-service .login-wserror .error-message');\n\tif ($errorMsg.length > 0) {\n\t\tvar errorMessagePosition = $errorMsg.offset().top;\n\t\tif (errorMessagePosition !== 0) {\n\t\t\tutil.scrollBrowser(errorMessagePosition - 100);\n\t\t}\n\t}\n\t\n}\n\n/**\n * @private\n * @function\n * @description init ordernumber field\n */\nfunction initOrderNumberField(questionValue) {\n\tif (questionValue == 'ORDER') {\n\t\t$.ajax(Urls.contactUsOrderNumberField).done(function (data) {\n\t\t\t$('.contact-ordernumber').html(data);\n\t\t});\n\t} else {\n\t\t$('.contact-ordernumber').empty();\n\t}\n}\n\n/**\n * @function\n * @description initialize event on orderreturn page\n */\n\nfunction initOrderReturnPage() {\n\tvar $trackingLink = $('.order-return-tracking-link');\n\tvar $trackingSelect = $('.order-return-tracking-select');\n\n\t$trackingSelect.on('change', function() {\n\t\t$trackingLink.attr('href', $(this).val());\n\t})\n}\n\nvar account = {\n\tinit: function () {\n\t\tinitializeCustomerService();\n\t\tinitializeAddressFields();\n\t\tinitializeNewAccountFields();\n\t\tinitializeEvents();\n\t\tgiftcert.init();\n\t\tibanForm.init();\n\t\tinitializeOverview();\n\t\tinitOrderReturnPage()\n\t},\n\tinitCartLogin: function () {\n\t\tinitLoginPage();\n\t},\n\tinitializeNewAccountFields: initializeNewAccountFields\n};\n\nmodule.exports = account;\n\n},{\"../adyen-checkout\":2,\"../dialog\":11,\"../formiban\":12,\"../giftcert\":14,\"../googledatatag.js\":15,\"../page\":23,\"../tooltip\":68,\"../util\":69,\"../validator\":70,\"../validatorhelper\":71}],25:[function(require,module,exports){\n'use strict';\n\nvar account = require('./account'),\n\tbonusProductsView = require('../bonus-products-view'),\n\tproductSliderRecomm = require('./product/product-slider-recomm'),\n\tproductSlider = require('./product/product-slider'),\n\tprogress = require('../progress'),\n\tdialog = require('../dialog'),\n gtmtool = require('../googledatatag.js'),\n\tajax = require('../ajax'),\n\tproducttile = require('../product-tile'),\n\tutil = require('../util');\n\nvar $target = $(\"#primary\");\n\n/**\n * @function \n * @description show coupon input if checked\n * */\nfunction initCouponInputVisibility() {\n\tvar $couponCheckEl = $('.cart-coupon-check input');\n\tvar couponChecked = $couponCheckEl.is(':checked');\n\tif (couponChecked) {\n\t\tvar $icon = $couponCheckEl.siblings('.coupon-check-label').find('i');\n\t\t$('.cart-coupon-code').show();\n\t\tif ($icon.hasClass('icon-arrowdown')) {\n\t\t\t$icon.switchClass('icon-arrowdown', 'icon-arrowup');\n\t\t}\n\n\t\t$(window).scrollTop($('.cart-promo-code').offset().top - 80);\n\t}\n\n\tvar inputManualCode = $('input[id^=\"manual-code\"]');\n\n\tinputManualCode.on('input', function () {\n\t\t$('input[type=\"hidden\"].coupon-code').val($(this).val());\n\t\t$('#add-coupon').removeAttr('disabled');\n\t});\n\n\tvar userCoupons = $('.available-coupons');\n\tif (userCoupons.length > 0) {\n\t\tinputManualCode.addClass('disabled');\n\t\t\n\t\t$('#enable-manual-code-checked').on('change', function() {\n\t\t\t$('input[type=\"hidden\"].coupon-code').val('');\n\t\t\tif ($(this).is(':checked')) {\n\t\t\t\tinputManualCode.removeClass('disabled');\n\t\t\t\tinputManualCode.focus();\n\t\t\t}\n\t\t});\n\n\t\t$('#manual-code').on('click', function(e) {\n\t\t\te.preventDefault();\n\t\t\t$('#enable-manual-code-checked').click();\n\t\t})\n\n\t\tif ($('.error-message').length > 0) {\n\t\t\t$('#enable-manual-code-checked').attr('checked', 'checked');\n\t\t\tinputManualCode.removeClass('disabled');\n\t\t}\n\n\t\tuserCoupons.children('input').on('change', function() {\n\t\t\t$('input[type=\"hidden\"].coupon-code').val($(this).val());\n\t\t\t$('#add-coupon').removeAttr('disabled');\n\t\t\tinputManualCode.addClass('disabled');\n\t\t});\n\t}\n\n\t$('form').on('submit', function() {\n\t\tvar manualCouponValue = inputManualCode.val();\n\t\tvar checkedUserCoupon = userCoupons.children('input:checked');\n\n\t\tif (!inputManualCode.is(':disabled') && manualCouponValue !== null) {\n\t\t\t$('input[type=\"hidden\"].coupon-code').val(manualCouponValue);\n\t\t}\n\t\t\n\t\tif (userCoupons.length > 0 && checkedUserCoupon.length > 0 && !$('#enable-manual-code-checked').is(':checked')) {\n\t\t\t$('input[type=\"hidden\"].coupon-code').val(checkedUserCoupon.val());\n\t\t}\n\t});\n\n\tinputManualCode.on('focus', function() {\n\t\t$(this).attr('placeholder', '');\n\t}).on('blur', function() {\n\t\t$(this).attr('placeholder', Resources.PLACEHOLDER_COUPON);\n\t});\n\n\tif ($('.error-message').length > 0 && inputManualCode.val() === \"\") {\n\t\t$('#add-coupon').attr('disabled','disabled');\n\t}\n\n}\n\n/**\n * @function \n * @description performs a generic ajax cart submit\n * */\nfunction postAjaxCartForm(action) {\n\t\n\tvar $form = $('[name=\"dwfrm_cart\"]');\n\tvar data = ajax.appendParameterToAjaxRequestData($form.serialize(),action);\n\tprogress.show($target);\n\t// make ajax request\n\tajax.load({\n\t\turl : $form.attr('action'),\n\t\tdata : data,\n\t\ttarget : $target,\n\t\tmethod : \"POST\",\n\t\tcallback : function () {\n\t\t\tinitCouponInputVisibility();\n\t\t\tproductSlider.initProductSlider();\n\t\t\tcheckQuantityError();\n checkHeaderVisibility();\n resetMinicart();\n checkProgressIndicatorVisibility();\n\t\t}\n\t});\n}\n\nfunction checkQuantityError() {\n\tvar $quantityProductError = $('.js-invalid-quantity');\n\n\tif ($quantityProductError.length > 0) {\n\t\t$('.invalid-quantity-top').show();\n\t}\n}\n\nfunction checkHeaderVisibility() {\n if ($('#main').find('.cart-empty').length > 0) {\n $('.cart-empty-header').removeClass('visually-hidden');\n $('.cart-header').addClass('visually-hidden');\n }\n}\n\nfunction resetMinicart() {\n if ($('#main').find('.cart-empty').length > 0) {\n $('.mini-cart-quantity').text('0');\n $('.mini-cart-content').remove();\n }\n}\n\nfunction checkProgressIndicatorVisibility() {\n if ($('#main').find('.cart-empty').length > 0 && $('#main').find('.checkout-progress-indicator').length > 0) {\n $('.checkout-progress-indicator').remove();\n }\n}\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{\n\tvar removeItemEvent = false;\n\tvar $primary = $('#primary');\n\t\n\tinitCouponInputVisibility();\n\n\tcheckQuantityError();\n\n\t// Toggle product informations\n\t$primary.on('click', '.tab-label', function (e) {\n\t\t$(this).next('.tab-content').toggleClass('is-expanded');\n\t\t$(this).find('i').toggleClass('icon-arrowdown icon-arrowup');\n\t});\n\t\n\t// page empty basket product recommendation configuration\n\tvar $homePushProductSlider = $('.product-homepush .product-slider');\n\t$homePushProductSlider\n\t\t.jcarousel({\n\t\t\twrap: 'last'\n\t\t});\n\n\tif(util.isMobile()){\n\t\t$homePushProductSlider.jcarouselSwipe();\n\t}\n\t// Init Einstein Recommandation Slider on the page empty basket .\n\tproductSliderRecomm.init();\n \n // GTM checkout steps indicator\n gtmtool.checkoutStepsExtended();\n \n // GTM initialize data products position in product slider\n\tutil.initializeProductPositions($('.product-homepush .product-tile'));\n\t\n\t$primary.on('click', '.item-edit-details a', function (e) {\n\t\te.preventDefault();\n\t\t\n\t\tvar $this = $(this);\n\t\tvar url = $this.attr('href');\n\t\turl = util.appendParamsToUrl(url, {\n\t\t\t'source': 'editlineitem'\n\t\t});\n\t\t\n\t\tvar targetParent = $this.parents(\".cart-row\");\n\t\tvar replaceTarget = targetParent.find('.item-edit').first();\t\t\n\t\t\n\t\t$.ajax({\n\t\t\turl: util.ajaxUrl(url),\n\t\t\tsuccess: function (response) {\n\t\t\t\t$('.item-edit').empty();\n\t\t\t\t$('.item-details').show();\n\t\t\t\t$('.item-price').show();\n\t\t\t\t$('.item-user-actions').show();\n\t\t\t\t\n\t\t\t\ttargetParent.find('.item-details').hide();\n\t\t\t\ttargetParent.find('.item-price').hide();\n\t\t\t\ttargetParent.find('.item-user-actions').hide();\n\t\t\t\treplaceTarget.html(response);\n\t\t\t\treplaceTarget.show();\n\t\t\t\t\n\t\t\t\trequire('./checkout/editLineItem').init();\n\t\t\t}\n\t\t});\n\t})\n\t.on('click', '.bonus-item-actions a, .item-details .bonusproducts a', function (e) {\n\t\te.preventDefault();\n\t\tbonusProductsView.show(this.href);\n\t})\n\t.on('change', 'input[id^=\"manual-code\"]', function (e) {\n\t\t$(this).val($(this).val().toUpperCase());\n\t})\n\t.on('keydown', 'input[id^=\"manual-code\"]', function (e) { // override enter key for coupon code entry\n\t\tif (e.keyCode === 13) { \n\t\t\te.preventDefault();\n\t\t\tif ($(this).val().length > 0) {\n\t\t\t\t$(this).val($(this).val().toUpperCase());\n\t\t\t\t$('#add-coupon').click();\n\t\t\t}\n\t\t}\n\t})\n\t.on('click', '.delete-in-cart', function (e) { //to prevent multiple submissions of the form when removing a product from the cart\n\t\te.preventDefault();\n\t\tpostAjaxCartForm($(this).attr('name'));\n\t})\n\t.on('change', '.qty-select', function (e) {\n\t\te.preventDefault();\n\t\tpostAjaxCartForm('dwfrm_cart_updateCart');\n\t})\n\t.on('click', '.qty-add, .qty-sub', function (e) {\n\t\te.preventDefault();\n\t\tvar $input = $(this).siblings('input');\n\t\tvar count = $(this).data('value');\n\t\t$input.val(count);\n\t\t$input.trigger('change');\n\t\tpostAjaxCartForm('dwfrm_cart_updateCart');\n\t})\n\t.on('click', '.add-to-cart', function (e) {\n\t\te.preventDefault();\n\t\tpostAjaxCartForm($(this).attr('name'));\n\t})\n\t.on('change', '.cart-coupon-check input', function () {\n\t\tif ($(this).closest('.cart-coupon-check').hasClass('customer-has-coupon')) {\n\t\t\t$('#add-coupon').click();\n\t\t}\n\t\t$('.cart-coupon-code').slideToggle();\n\t\tvar $icon = $(this).siblings('.coupon-check-label').find('i');\n\t\tif ($icon.hasClass('icon-arrowdown')) {\n\t\t\t$icon.switchClass('icon-arrowdown', 'icon-arrowup');\n\t\t} else {\n\t\t\t$icon.switchClass('icon-arrowup', 'icon-arrowdown');\n\t\t}\n\t})\n // Datalayer events\n .on('change', '.qty-select', function (e) {\n if (e.isTrigger) {\n return;\n }\n var products = Array.from(window.productsOrdereduData);\n var oldInputVal = parseInt($(this).get(0).defaultValue);\n var inputVal = parseInt($(this).val());\n for (let i = 0; i < products.length; i++) {\n var product = products[i];\n delete product.category;\n product.list = 'basket';\n product.new_total_quantity = inputVal;\n product.quantity = Math.abs(product.quantity - inputVal);\n }\n $(window).trigger('datalayer:push-event', {\n name: oldInputVal > inputVal ? 'cart removal' : 'cart addition',\n data: {\n cart_method: \"input: typed\",\n products: products\n }\n });\n })\n .on('click', '.delete-in-cart', function () {\n var deletedProductId = $(this).closest('.cart-row[data-product-id]').data('product-id').toString();\n var products = Array.from(window.productsOrdereduData);\n var productsToPush = [];\n for (let i = 0; i < products.length; i++) {\n if ($(this).closest('[data-product]').data('product').EAN.includes(deletedProductId)) {\n productsToPush.push(products[i]);\n }\n }\n for (let i = 0; i < productsToPush.length; i++) {\n var product = products[i];\n delete product.category;\n product.list = 'basket';\n if (product.id === deletedProductId) {\n product.new_total_quantity = 0;\n product.quantity = 0;\n } else {\n product.new_total_quantity = product.quantity;\n }\n }\n $(window).trigger('datalayer:push-event', {\n name: 'cart removal',\n data: {\n cart_method: \"click: trashcan\",\n products: productsToPush\n }\n });\n })\n .on('click', '.qty-sub', function () {\n var products = Array.from(window.productsOrdereduData);\n var productsToPush = [];\n for (let i = 0; i < products.length; i++) {\n if ($(this).closest('[data-product]').data('product').EAN.includes(products[i].id)) {\n productsToPush.push(products[i]);\n }\n }\n var inputVal = parseInt($(this).siblings('input').val());\n for (let i = 0; i < productsToPush.length; i++) {\n var product = productsToPush[i];\n delete product.category;\n product.list = 'basket';\n product.new_total_quantity = inputVal;\n product.quantity = Math.abs(product.quantity - inputVal);\n }\n $(window).trigger('datalayer:push-event', {\n name: 'cart removal',\n data: {\n cart_method: \"click: +/-\",\n products: productsToPush\n }\n });\n })\n .on('click', '.qty-add', function () {\n var products = Array.from(window.productsOrdereduData);\n var productsToPush = [];\n for (let i = 0; i < products.length; i++) {\n if ($(this).closest('[data-product]').data('product').EAN.includes(products[i].id)) {\n productsToPush.push(products[i]);\n }\n }\n var inputVal = parseInt($(this).siblings('input').val());\n for (let i = 0; i < productsToPush.length; i++) {\n var product = products[i];\n delete product.category;\n product.list = 'basket';\n product.new_total_quantity = inputVal;\n product.quantity = Math.abs(product.quantity - inputVal);\n }\n $(window).trigger('datalayer:push-event', {\n name: 'cart addition',\n data: {\n cart_method: \"click: +/-\",\n products: productsToPush\n }\n });\n })\n\t.on('change', '#giftwrap-check', function () {\n\t\tpostAjaxCartForm($('#trigger-giftwrap').val());\n\t})\n\t.on('click', '.grid-tile a:not([class^=product-slider])', function (e) {\n\t\t// GTM cart recommendations click\n\t\tgtmtool.openProductDetailsClick($(this));\n\t\tgtmtool.recommendationProductClick($(this));\n\t})\n\t.on('click', '.cart-line-image', function (e) {\n\t\tvar $lineImages = $('.cart-line-dialog-image');\n\t\tif (util.isMobileSize() && $lineImages.length > 0) {\n\t\t\te.preventDefault();\n\t\t\tvar dialogWidth = $(window).width() > 400 ? 400 : 315;\n\t\t\tdialog.open({\n\t\t\t\thtml: $lineImages,\n\t\t\t\toptions : {\n\t\t\t\t\tdraggable : false,\n\t\t\t\t\tmodal: true,\n\t\t\t\t\tdialogClass : 'cart-line-dialog',\n\t\t\t\t\twidth: dialogWidth,\n\t\t\t\t\tresizable: false,\n\t\t\t\t\topen: function () {\n\t\t\t\t\t\t$lineImages.removeClass('visually-hidden');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\n \t// check the checkbox when creating a new account in checkout identification step\n\tvar $registrationCheckbox = $('.form-login-register.default-checked-choice .input-checkbox');\n\tif ($registrationCheckbox.is(':unchecked')) {\n\t\t$registrationCheckbox.prop('checked', true);\n\t}\n\n\t// GTM attach account creation event\n\t$primary.on('submit', '[id$=_login_register]', function (e) {\n gtmtool.accountCreationEvent($(this));\n });\n\t\n\t// init color change on product recommendations\n\tproducttile.init();\n\t\n\taccount.initializeNewAccountFields($primary);\n}\n\nexports.init = function () {\n\tinitializeEvents();\n\taccount.initCartLogin();\n};\n\n},{\"../ajax\":3,\"../bonus-products-view\":4,\"../dialog\":11,\"../googledatatag.js\":15,\"../product-tile\":55,\"../progress\":56,\"../util\":69,\"./account\":24,\"./checkout/editLineItem\":29,\"./product/product-slider\":44,\"./product/product-slider-recomm\":43}],26:[function(require,module,exports){\n'use strict';\n\nvar util = require('../../util');\nvar shipping = require('./shipping');\n\n/**\n * @function\n * @description Selects the first address from the list of addresses\n */\nexports.init = function () {\n\tvar $form = $('.address');\n\t// select address from list\n\t$('select[name$=\"_addressList\"]', $form).on('change', function () {\n\t\tvar selected = $(this).children(':selected').first();\n\t\tvar selectedAddress = $(selected).data('address');\n\t\tif (!selectedAddress) { return; }\n\t\tutil.fillAddressFields(selectedAddress, $form);\n\t\t// re-validate the form\n\t\t$form.validate().form();\n\t});\n};\n\n},{\"../../util\":69,\"./shipping\":34}],27:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('../../ajax'),\n\tformPrepare = require('./formPrepare'),\n\tgiftcard = require('../../giftcard'),\n\tutil = require('../../util'),\n\tadyenCheckout = require('../../adyen-checkout');\n\n/**\n * @function\n * @description Fills the Credit Card form with the passed data-parameter and clears the former cvn input\n * @param {Object} data The Credit Card data (holder, type, masked number, expiration month/year)\n */\nfunction setCCFields(data) {\n\tvar $creditCard = $('[data-method=\"CREDIT_CARD\"]');\n\t$creditCard.find('input[name$=\"creditCard_owner\"]').val(data.holder).trigger('change');\n\t$creditCard.find('select[name$=\"_type\"]').val(data.type).trigger('change');\n\t$creditCard.find('input[name*=\"_creditCard_number\"]').val(data.maskedNumber).trigger('change');\n\t$creditCard.find('[name$=\"_month\"]').val(data.expirationMonth).trigger('change');\n\t$creditCard.find('[name$=\"_year\"]').val(data.expirationYear).trigger('change');\n\t$creditCard.find('input[name$=\"_cvn\"]').val('').trigger('change');\n\t$creditCard.find('[name$=\"creditCard_selectedCardID\"]').val(data.selectedCardID).trigger('change');\n}\n\n/**\n * @function\n * @description Updates the credit card form with the attributes of a given card\n * @param {String} cardID the credit card ID of a given card\n */\nfunction populateCreditCardForm(cardID) {\n\t// load card details\n\tvar url = util.appendParamToURL(Urls.billingSelectCC, 'creditCardUUID', cardID);\n\tajax.getJson({\n\t\turl: url,\n\t\tcallback: function (data) {\n\t\t\tif (!data) {\n\t\t\t\twindow.alert(Resources.CC_LOAD_ERROR);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tsetCCFields(data);\n\t\t}\n\t});\n}\n\n/**\n * @function\n * @description Changes the payment method form depending on the passed paymentMethodID\n * @param {String} paymentMethodID the ID of the payment method, to which the payment method form should be changed to\n */\nfunction updatePaymentMethod(paymentMethodID) {\n\tvar $paymentMethods = $('.payment-method');\n\n\tvar $selectedPaymentMethod = $paymentMethods.filter('[data-method=\"' + paymentMethodID + '\"]');\n\tif ($selectedPaymentMethod.length === 0) {\n\t\t$selectedPaymentMethod = $('[data-method=\"Custom\"]');\n\t}\n\n\t// ensure checkbox of payment method is checked\n\t$('input[name$=\"_selectedPaymentMethodID\"]').removeAttr('checked');\n\t$('input[value=' + paymentMethodID + ']').prop('checked', 'checked');\n\n\tformPrepare.validateForm();\n}\n\n/**\n* @function\n* @description Changes the payment type or issuerId of the selected payment method\n* @param {String, Boolean} value of payment type or issuerId and a test value to see which one it is, to which the payment type or issuerId should be changed to\n*/\nfunction updatePaymentType(selectedPayType, issuerType) {\n\tif(issuerType){\n\t\t$('[name=\"issuer\"]').val(selectedPayType);\n\t\t$('#dwfrm_adyPaydata_issuer').val(selectedPayType);\n\t}\n\telse{\n\t\t$('input[name=\"brandCode\"]').removeAttr('checked');\n\t\t$('input[value=' + selectedPayType + ']').prop('checked', 'checked');\n\t}\n\t// if the payment type has hidden fields reveal it\n\n\t$('.checkout-component-' + selectedPayType).show();\n\tformPrepare.validateForm();\n}\n\n/**\n * @function\n * @description Adyen - Initializes the visibility of HPP fields\n */\nfunction initializeHPPFields () {\n\tif($('[name=\"brandCode\"]:checked').hasClass('openInvoice')) {\n\t\t$('.additionalfield').hide().find('input').val('');\n\t\t$('.additionalfield.' + $('.checkout-billing').find('select.country').val()).show();\n\t} else {\n\t\t$('.additionalfield').hide().find('input').val('');\n\t}\n}\nfunction removePriceKlarnaAjax() {\n\t// COSummary-RemovePriceKlarna\n\tvar url = Urls.removePriceKlarna;\n\t$.ajax({\n dataType: 'json',\n url: url,\n method: 'GET',\n\t\tsuccess: function (response) {\n\t\t\tvar $summary = $('#secondary.summary');\n\t\t\t// load the updated summary area\n\t\t\t$summary.load(Urls.summaryRefreshURL + \"?\" + $.param({ checkoutstep: 5 }));\n\t\t},\n\t\terror: function (response) {\n\t\t}\n });\n\n}\nfunction adjustPriceKlarnaAjax() {\n\t// COSummary-AdjustPriceKlarna\n\tvar url = Urls.adjustPriceKlarna;\n\t$.ajax({\n dataType: 'json',\n url: url,\n method: 'GET',\n\t\tsuccess: function (response) {\n\t\t\tvar $summary = $('#secondary.summary');\n\t\t\t// load the updated summary area\n\t\t\t$summary.load(Urls.summaryRefreshURL + \"?\" + $.param({ checkoutstep: 5 }));\n\t\t},\n\t\terror: function(response) {\n\t\t}\n });\n\n}\n\n/**\n * @function\n * @description loads billing address, Gift Certificates, Coupon and Payment methods\n */\nexports.init = function () {\n\tvar $checkoutForm = $('.checkout-billing');\n\tvar $addGiftCert = $('#add-giftcert');\n\tvar $giftCertCode = $('input[name$=\"_giftCertCode\"]');\n\tvar $addCoupon = $('#add-coupon');\n\tvar $couponCode = $('input[name$=\"_couponCode\"]');\n\tvar $selectPaymentMethod = $('.payment-method-options');\n\tvar selectedPaymentMethod = $selectPaymentMethod.find(':checked').val();\n\tvar $payType = $('[name=\"brandCode\"]');\n\tvar $issuer = $('.issuer');\n\tvar selectedPayType = $payType.find(':checked').val();\n\n\tif (!selectedPayType || selectedPayType !== 'klarna') {\n\t\tremovePriceKlarnaAjax();\n\t}\n\n\t// default payment method to 'CREDIT_CARD'\n\tupdatePaymentMethod((selectedPaymentMethod) ? selectedPaymentMethod : 'CREDIT_CARD');\n\t$selectPaymentMethod.on('click', 'input[type=\"radio\"]', function () {\n\t\tupdatePaymentMethod($(this).val());\n\t\tif ($(this).val() == 'Adyen' && $payType.length > 0) {\n\t\t\t// set payment type of Adyen to the first one\n\t\t\tupdatePaymentType((selectedPayType) ? selectedPayType : $payType[0].value, false);\n\t\t} else {\n\t\t\t$payType.removeAttr('checked');\n\t\t}\n\t});\n\n\t$issuer.on('change', function () {\n\t\tupdatePaymentType($(this).val(), true);\n\t});\n\n\t$payType.on('change', function() {\n\t\t$('#selectedIssuer').val(\"\");\n\t\t$issuer.hide();\n\n\t\t$('[class*=\"checkout-component-\"]').hide();\n\t\t$('.card-payment-content, .сredit-cart-button').hide();\n\t\t$('.checkoutComponent').show();\n\t\t$('.checkout-component-' + $(this).val()).show();\n\t\t$('[name$=\"selectedBrandCode\"]').val($(this).val());\n\t\tif ($(this).siblings( \".issuer\").length > 0) {\n\t\t\t$('#selectedIssuer').val($(this).siblings(\".issuer\").val());\n\t\t\t$(this).siblings('.issuer').show();\n\t\t\t$('[name$=\"selectedIssuer\"]').val($(this).val());\n\t\t}\n\t\t$('[name*=\"selectedPaymentMethodID\"]').val($(this).val() === 'CREDIT_CARD' ? $(this).val() : 'Adyen');\n\t\tvar $cartHolderName = $('input.adyen-checkout__card__holderName__input');\n\t\tif ($(this).val() !== 'CREDIT_CARD') {\n\t\t\t$cartHolderName.removeAttr('required');\n\t\t\t$cartHolderName.addClass('valid');\n\t\t\t$cartHolderName.removeClass('error');\n\t\t\t$('[name*=\"selectedPaymentMethodID\"]').val('Adyen');\n\t\t} else {\n\t\t\t$cartHolderName.attr('required', 'required');\n\t\t\t$('[name*=\"selectedPaymentMethodID\"]').val($(this).val());\n\t\t}\n\t\tif ($(this).val() === 'klarna') {\n\t\t\t// make an ajax call if KLARNA selected\n\t\t\tadjustPriceKlarnaAjax();\n\t\t} else {\n\t\t\t// remove price Klarna if Klarna not selected\n\t\t\tremovePriceKlarnaAjax();\n\n\t\t}\n\t});\n\n var refreshCustomCVVTooltip = function() {\n let $el = $('.credit-card-security-code-tooltip');\n let $cvvFieldCtnr = $('.card-payment-content');\n let $cvvField = $('.adyen-checkout__field__cvc, .adyen-checkout__field--securityCode').find('.adyen-checkout__label__text');\n let positions = { x: 0, y: 0 };\n let mobileBreakpoint = 1024;\n\n if (!$cvvFieldCtnr.is(':visible') || ($cvvFieldCtnr.find('.adyen-checkout__spinner').length > 0 && $('.adyen-checkout__spinner').is(':visible'))) {\n $el.hide();\n return;\n } else {\n $el.show();\n }\n positions.x = $cvvField.offset().left + $cvvField.textWidth() + 10;\n positions.y = ($cvvField.offset().top - $cvvField.height() / 2) - 10;\n if ($(window).width() < mobileBreakpoint) {\n positions.y = ($cvvField.offset().top - $cvvField.height() / 2) - 4;\n }\n $el.css('left', positions.x);\n $el.css('top', positions.y);\n }\n\n\t$('.payment-selector').on('click', function () {\n\t\t$('.payment-selector').removeClass('selected');\n\t\t$(this).find('.input-radio').prop(\"checked\", true).trigger('change');\n\t\t$(this).addClass('selected');\n\t\tif($(this).hasClass('credit-card-selector')) {\n\t\t\t$('.card-payment-content, .сredit-cart-button').show();\n refreshCustomCVVTooltip();\n\t\t}\n });\n\n $('.card-payment-content').on('DOMSubtreeModified', function () {\n refreshCustomCVVTooltip();\n });\n\n $(window).on('resize', refreshCustomCVVTooltip);\n\n\t$('.payment-selector').each(function () {\n\t\tif( $(this).find('.input-radio').is(\":checked\")) {\n\t\t\t$(this).addClass('selected');\n\t\t}\n\t});\n\n\t// select credit card from list\n\t$('#creditCardList').on('change', function () {\n\t\tvar cardUUID = $(this).val();\n\t\tif (!cardUUID) {return;}\n\t\tpopulateCreditCardForm(cardUUID);\n\n\t\t// remove server side error\n\t\t$('.required.error').removeClass('error');\n\t\t$('.error-message').remove();\n\t});\n\n\t$('#check-giftcert').on('click', function (e) {\n\t\te.preventDefault();\n\t\tvar $balance = $('.balance');\n\t\tif ($giftCertCode.length === 0 || $giftCertCode.val().length === 0) {\n\t\t\tvar error = $balance.find('span.error');\n\t\t\tif (error.length === 0) {\n\t\t\t\terror = $('').addClass('error').appendTo($balance);\n\t\t\t}\n\t\t\terror.html(Resources.GIFT_CERT_MISSING);\n\t\t\treturn;\n\t\t}\n\n\t\tgiftcard.checkBalance($giftCertCode.val(), function (data) {\n\t\t\tif (!data || !data.giftCertificate) {\n\t\t\t\t$balance.html(Resources.GIFT_CERT_INVALID).removeClass('success').addClass('error');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$balance.html(Resources.GIFT_CERT_BALANCE + ' ' + data.giftCertificate.balance).removeClass('error').addClass('success');\n\t\t});\n\t});\n\n\t$addGiftCert.on('click', function (e) {\n\t\te.preventDefault();\n\t\tvar code = $giftCertCode.val(),\n\t\t\t$error = $checkoutForm.find('.giftcert-error');\n\t\tif (code.length === 0) {\n\t\t\t$error.html(Resources.GIFT_CERT_MISSING);\n\t\t\treturn;\n\t\t}\n\n\t\tvar url = util.appendParamsToUrl(Urls.redeemGiftCert, {giftCertCode: code, format: 'ajax'});\n\t\t$.getJSON(url, function (data) {\n\t\t\tvar fail = false;\n\t\t\tvar msg = '';\n\t\t\tif (!data) {\n\t\t\t\tmsg = Resources.BAD_RESPONSE;\n\t\t\t\tfail = true;\n\t\t\t} else if (!data.success) {\n\t\t\t\tmsg = data.message.split('<').join('<').split('>').join('>');\n\t\t\t\tfail = true;\n\t\t\t}\n\t\t\tif (fail) {\n\t\t\t\t$error.html(msg);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\twindow.location.assign(Urls.billing);\n\t\t\t}\n\t\t});\n\t});\n\n\t$addCoupon.on('click', function (e) {\n\t\te.preventDefault();\n\t\tvar $error = $checkoutForm.find('.coupon-error'),\n\t\t\tcode = $couponCode.val();\n\t\tif (code.length === 0) {\n\t\t\t$error.html(Resources.COUPON_CODE_MISSING);\n\t\t\treturn;\n\t\t}\n\n\t\tvar url = util.appendParamsToUrl(Urls.addCoupon, {couponCode: code, format: 'ajax'});\n\t\t$.getJSON(url, function (data) {\n\t\t\tvar fail = false;\n\t\t\tvar msg = '';\n\t\t\tif (!data) {\n\t\t\t\tmsg = Resources.BAD_RESPONSE;\n\t\t\t\tfail = true;\n\t\t\t} else if (!data.success) {\n\t\t\t\tmsg = data.message.split('<').join('<').split('>').join('>');\n\t\t\t\tfail = true;\n\t\t\t}\n\t\t\tif (fail) {\n\t\t\t\t$error.html(msg);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//basket check for displaying the payment section, if the adjusted total of the basket is 0 after applying the coupon\n\t\t\t//this will force a page refresh to display the coupon message based on a parameter message\n\t\t\tif (data.success && data.baskettotal === 0) {\n\t\t\t\twindow.location.assign(Urls.billing);\n\t\t\t}\n\t\t});\n\t});\n\n\t// trigger events on enter\n\t$couponCode.on('keydown', function (e) {\n\t\tif (e.which === 13) {\n\t\t\te.preventDefault();\n\t\t\t$addCoupon.click();\n\t\t}\n\t});\n\t$giftCertCode.on('keydown', function (e) {\n\t\tif (e.which === 13) {\n\t\t\te.preventDefault();\n\t\t\t$addGiftCert.click();\n\t\t}\n\t});\n\n\t$('#dwfrm_billing').on('keydown', function(e) {\n\t\tif (e.which === 13) {\n\t\t\te.preventDefault();\n\t\t\t$('.payment-selector.selected').parent().find('[name*=minisummary_submit]').click();\n\t\t}\n\t});\n\n\t// Bind submit on minisummary buttons\n\t$('[name*=minisummary_submit]').on('click', function (e) {\n\t\te.preventDefault();\n\t\tif ($(this).is('#creditcard-submit')) {\n\t\t\t$('[name*=\"selectedPaymentMethodID\"]').val('CREDIT_CARD');\n\t\t} else {\n\t\t\t$('[name*=\"selectedPaymentMethodID\"]').val('Adyen');\n\t\t}\n\t\tvar cgvCheckbox = $(this).siblings('.cart-cgv').find('[id*=\"cgv-checkbox-2-\"]');\n\t\tvar bankSelect = $(this).parent().siblings().find(\".adyen-checkout__dropdown__element--active\");\n\t\tif (!bankSelect.length && $(\"#component_ideal\").length) {\n\t\t\t$(this).parent().siblings().find(\".alert_nobankselected\").show();\n\t\t}\n\t\telse {\n\t\t\t$(this).parent().siblings().find(\".alert_nobankselected\").hide();\n\t\t}\n\t\t\n\t\tif (cgvCheckbox.length && !cgvCheckbox.prop(\"checked\")) {\n\t\t\t$(this).siblings('.alert_cgv').show();\n\t\t} else if ($(this).siblings('.submit-order button, .billing-button').length) {\n\t\t\t$(this).siblings('.js-billing-submit').click();\n\t\t\tif($(this).hasClass('js-loader-billing')){\n\t\t\t\t$(this).attr('disabled', 'disabled');\n\t\t\t\t$(this).addClass('loader-checkout');\n\t\t\t\t$(this).empty();\n\t\t\t}\n\t\t} else {\n\t\t\t$('.submit-order button, .billing-button').click();\n\t\t\tif($(this).hasClass('js-loader-billing')){\n\t\t\t\t$(this).attr('disabled', 'disabled');\n\t\t\t\t$(this).addClass('loader-checkout');\n\t\t\t\t$(this).empty();\n\t\t\t}\n\t\t}\n\t});\n\n\t$('#main')\n\t.on('change', '[name*=_billing_addressList]', function (){\n\t\tvar addressID = $(this).val();\n\t\tif (addressID != \"\") {\n\t\t\t$('#select_billing_address_id').val(addressID);\n\t\t\t$(this.form).submit();\n\t\t}\n\t\t\n\t})\n\t.on('change', '[name*=_addressFields_country]', function () {\n\t\trequire('../../validatorhelper').changePhoneDialForCountry($(this));\n\t})\n\t.on('keydown', '.tel-number', function (e) {\n\t\tvar originalEvent = e.originalEvent;\n\t\tif (!util.isAuthorizedKeyForPhoneInput(originalEvent.code, originalEvent.keyCode)) {\n\t\t\te.preventDefault();\n\t\t}\n\t});\n\n\t$('input[name=\"brandCode\"]').on('change', function(e) {\n\t\t$(\"#dwfrm_adyPaydata_issuer\").val(\"\");\n\t\t$('[class*=\"checkout-component-\"]').hide();\n\t\t$('.checkoutComponent').show();\n\t\t$('.checkout-component-' + $(this).val()).show();\n\t});\n\n\tif (SitePreferences.ADYEN_SF_ENABLED) {\n\t\tadyenCheckout.initBilling();\n\t}\n};\n\n},{\"../../adyen-checkout\":2,\"../../ajax\":3,\"../../giftcard\":13,\"../../util\":69,\"../../validatorhelper\":71,\"./formPrepare\":30}],28:[function(require,module,exports){\n'use strict';\n\nfunction bpostShopService() {\n\t$('body').on('mouseenter', '#bpost-store-locator .store-list-item', function() {\n\t\tvar schedulesEl = $(this).find('.shop-schedules');\n\t\tvar text = schedulesEl.text().replace(/^\\s*/, \"\").replace(/\\s*$/, \"\");\n\n\t\tvar bpostID = $(this).attr('itemid');\n\t\tvar country = $(this).children('input[name=\"parcelCountryCode\"]').val();\n\n\t\tif (text.length != 0) {\n\t\t\treturn;\n\t\t}\n\t\t$.ajax({\n\t\t\turl: window.mapRessources.urls.getBpostShopOpeningHours,\n\t\t\tdataType: 'json',\n\t\t\ttype: 'GET',\n\t\t\tdata: {\n\t\t\t\tbpostID: bpostID,\n\t\t\t\tcountry: country\n\t\t\t},\n\t\t\tsuccess:function(data) {\n\t\t\t\tvar openingHours = data;\n\n\t\t\t\tfor (var i = 0; i < openingHours.length; i++) {\n\t\t\t\t\tschedulesEl.append('
        '+openingHours[i].weekday+': '+openingHours[i].morning+' '+openingHours[i].afternoon+'
        ');\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(xhr, status, error) {\n\t\t\t\tconsole.log(error);\n\t\t\t}\n\t\t});\n\t});\n}\n\nexports.init = function() {\n bpostShopService();\n};\n},{}],29:[function(require,module,exports){\n'use strict';\n\nvar addToCart = require('../product/addToCart'),\n\tajax = require('../../ajax'),\n\timage = require('../product/image'),\n\tprogress = require('../../progress'),\n\tproductStoreInventory = require('../../storeinventory/product'),\n\ttooltip = require('../../tooltip'),\n\tutil = require('../../util'),\n\tavailability = require('../product/availability');\n\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 (clickedObj) {\n\tvar qty = $(clickedObj).parents(\".cart-row\").find('.product-content').find('.edit-qty #qtySelect option:selected').val(),\n\t\tparams = {\n\t\t\tQuantity: isNaN(qty) ? '1' : qty\n\t\t};\n\t\n\tajax.load({\n\t\turl: util.appendParamsToUrl($(clickedObj).attr('href'), params),\n\t\ttarget: $(clickedObj).parents(\".cart-row\").find('.item-edit')\n\t});\n};\n\nfunction initializeEvents(){\n\tvar $itemEdit = $('.item-edit');\n\t\n\t$itemEdit.on('click', '.cancelEdit', function (e) {\n\t\te.preventDefault();\n\t\t\n\t\tvar targetParent = $(this).parents(\".cart-row\");\n\t\ttargetParent.find('.item-edit').first().hide();\n\t\ttargetParent.find('.item-details').show();\n\t\ttargetParent.find('.item-price').show();\n\t\ttargetParent.find('.item-user-actions').show();\n\t});\n\t\n\t// click on swatch - should replace product content with new variant\n\t$itemEdit.on('click', '.product-variations .swatchanchor:not(.unselectable)', function (e) {\n\t\te.preventDefault();\n\t\tupdateContent(this);\n\t});\n\n\t// change drop down variation attribute - should replace product content with new variant\n\t$itemEdit.on('change', '.variation-select', function () {\n\t\tif ($(this).val().length === 0) { return; }\n\t\tupdateContent(this);\n\t});\n}\n\nexports.init = initializeEvents;\n},{\"../../ajax\":3,\"../../progress\":56,\"../../storeinventory/product\":65,\"../../tooltip\":68,\"../../util\":69,\"../product/addToCart\":38,\"../product/availability\":39,\"../product/image\":41}],30:[function(require,module,exports){\n'use strict';\n\nvar _ = require('lodash');\n\nvar $form, $continue, $requiredInputs, validator;\n\nvar hasEmptyRequired = function () {\n\t// filter out only the visible fields\n\tvar requiredValues = $requiredInputs.filter(':visible').map(function () {\n\t\treturn $(this).val();\n\t});\n\treturn _(requiredValues).contains('');\n};\n\nvar validateForm = function () {\n\t// only validate form when all required fields are filled to avoid\n\t// throwing errors on empty form\n\tif (!validator) {\n\t\treturn;\n\t}\n\tif (isAllRequiredInputsValid(validator, $requiredInputs) && !hasEmptyRequired()) {\n\t\tif (validator.form()) {\n\t\t\t$continue.removeAttr('disabled');\n\t\t}\n\t} else {\n\t\t$continue.attr('disabled', 'disabled');\n\t}\n};\n\nvar validateEl = function () {\n\tif ($(this).val() === '') {\n\t\t$continue.attr('disabled', 'disabled');\n\t} else {\n\t\t// Enable continue button if all required fields are valid.\n\t\tif (isAllRequiredInputsValid(validator, $requiredInputs) && !hasEmptyRequired()) {\n\t\t\t$continue.removeAttr('disabled');\n\t\t} else {\n\t\t\t$continue.attr('disabled', 'disabled');\n\t\t}\n\t}\n};\n\nvar isAllRequiredInputsValid = function(validator, $inputs) {\n\tvar validateInputs = $inputs.map(function () {\n\t\treturn validator.element(this);\n\t});\n\treturn $.inArray(false, validateInputs) === -1;\n}\n\nvar init = function (opts) {\n\tif (!opts.formSelector || !opts.continueSelector) {\n\t\tthrow new Error('Missing form and continue action selectors.');\n\t}\n\t$form = $(opts.formSelector);\n\t$continue = $(opts.continueSelector);\n\tvalidator = $form.validate();\n\t$requiredInputs = $('.required', $form).find(':input');\n\tvalidateForm();\n\t// start listening\n\t$requiredInputs.on('change', validateEl);\n\t$requiredInputs.filter('input').on('keyup', _.debounce(validateEl, 200));\n};\n\nexports.init = init;\nexports.validateForm = validateForm;\nexports.validateEl = validateEl;\n\n},{\"lodash\":78}],31:[function(require,module,exports){\n'use strict'\n\nexports.init = function () {\n\t// Homepage slider configuration\n\t$('.header-usermenu-mobile .slider-ups-banner-only-mobile').on('jcarousel:create jcarousel:reload', function () {\n var element = $(this),\n width = element.innerWidth();\n element.jcarousel('items').css('width', Math.ceil(width) + 'px');\n });\n\n\t// Homepage Slider UPS on mobile\n\t$('.header-usermenu-mobile .slider-ups-banner-only-mobile').jcarousel({\n\t\twrap: 'circular'\n\t})\n\t.jcarouselAutoscroll({\n\t\tinterval: 4000\n\t})\n\t.jcarouselSwipe();\n}\n},{}],32:[function(require,module,exports){\n'use strict';\n\nvar address = require('./address'),\n\tbilling = require('./billing'),\n\tmultiship = require('./multiship'),\n gtmtool = require('../../googledatatag.js'),\n\tshipping = require('./shipping'),\n\theader = require('./header');\n\n/**\n * @function Initializes the page events depending on the checkout stage (shipping/billing)\n */\nexports.init = function () {\n\theader.init();\n\taddress.init();\n\tif ($('.checkout-shipping').length > 0) {\n\t\tshipping.init();\n\t} else if ($('.checkout-multi-shipping').length > 0) {\n\t\tmultiship.init();\n\t} else {\n\t\tbilling.init();\n\t}\n // GTM checkout steps indicator\n gtmtool.checkoutStepsExtended();\n\n\t//if on the order review page and there are products that are not available diable the submit order button\n\tif ($('.order-summary-footer').length > 0) {\n\t\tif ($('.notavailable').length > 0) {\n\t\t\t$('.order-summary-footer .submit-order .button-fancy-large').attr('disabled', 'disabled');\n\t\t}\n\t}\n};\n\n},{\"../../googledatatag.js\":15,\"./address\":26,\"./billing\":27,\"./header\":31,\"./multiship\":33,\"./shipping\":34}],33:[function(require,module,exports){\n'use strict';\n\nvar address = require('./address'),\n\tformPrepare = require('./formPrepare'),\n\tdialog = require('../../dialog'),\n\tutil = require('../../util');\n\n/**\n * @function\n * @description Initializes gift message box for multiship shipping, the message box starts off as hidden and this will display it if the radio button is checked to yes, also added event handler to listen for when a radio button is pressed to display the message box\n */\nfunction initMultiGiftMessageBox() {\n\t$.each($('.item-list'), function () {\n\t\tvar $this = $(this);\n\t\tvar $giftMessage = $this.find('.gift-message-text');\n\n\t\t//handle initial load\n\t\t$giftMessage.toggleClass('hidden', $('input[name$=\"_isGift\"]:checked', this).val() !== 'true');\n\n\t\t//set event listeners\n\t\t$this.on('change', function () {\n\t\t\t$giftMessage.toggleClass('hidden', $('input[name$=\"_isGift\"]:checked', this).val() !== 'true');\n\t\t});\n\t});\n}\n\n\n/**\n * @function\n * @description capture add edit adddress form events\n */\nfunction addEditAddress(target) {\n\tvar $addressForm = $('form[name$=\"multishipping_editAddress\"]'),\n\t\t$addressDropdown = $addressForm.find('select[name$=_addressList]'),\n\t\t$addressList = $addressForm.find('.address-list'),\n\t\tadd = true,\n\t\tselectedAddressUUID = $(target).parent().siblings('.select-address').val();\n\n\t$addressDropdown.on('change', function (e) {\n\t\te.preventDefault();\n\t\tvar selectedAddress = $addressList.find('select').val();\n\t\tif (selectedAddress !== 'newAddress') {\n\t\t\tselectedAddress = $.grep($addressList.data('addresses'), function (add) {\n\t\t\t\treturn add.UUID === selectedAddress;\n\t\t\t})[0];\n\t\t\tadd = false;\n\t\t\t// proceed to fill the form with the selected address\n\t\t\tutil.fillAddressFields(selectedAddress, $addressForm);\n\t\t} else {\n\t\t\t//reset the form if the value of the option is not a UUID\n\t\t\t$addressForm.find('.input-text, .input-select').val('');\n\t\t}\n\t});\n\n\t$addressForm.on('click', '.cancel', function (e) {\n\t\te.preventDefault();\n\t\tdialog.close();\n\t});\n\n\t$addressForm.on('submit', function (e) {\n\t\te.preventDefault();\n\t\t$.getJSON(Urls.addEditAddress, $addressForm.serialize(), function (response) {\n\t\t\tif (!response.success) {\n\t\t\t\t// @TODO: figure out a way to handle error on the form\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar address = response.address,\n\t\t\t\t$shippingAddress = $(target).closest('.shippingaddress'),\n\t\t\t\t$select = $shippingAddress.find('.select-address'),\n\t\t\t\t$selected = $select.find('option:selected'),\n\t\t\t\tnewOption = '';\n\t\t\tdialog.close();\n\t\t\tif (add) {\n\t\t\t\t$('.shippingaddress select').removeClass('no-option').append(newOption);\n\t\t\t\t$('.no-address').hide();\n\t\t\t} else {\n\t\t\t\t$('.shippingaddress select').find('option[value=\"' + address.UUID + '\"]').html(newOption);\n\t\t\t}\n\t\t\t// if there's no previously selected option, select it\n\t\t\tif ($selected.length === 0 || $selected.val() === '') {\n\t\t\t\t$select.find('option[value=\"' + address.UUID + '\"]').prop('selected', 'selected').trigger('change');\n\t\t\t}\n\t\t});\n\t});\n\n\t//preserve the uuid of the option for the hop up form\n\tif (selectedAddressUUID) {\n\t\t//update the form with selected address\n\t\t$addressList.find('option').each(function () {\n\t\t\t//check the values of the options\n\t\t\tif ($(this).attr('value') === selectedAddressUUID) {\n\t\t\t\t$(this).prop('selected', 'selected');\n\t\t\t\t$addressDropdown.trigger('change');\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @function\n * @description shows gift message box in multiship, and if the page is the multi shipping address page it will call initmultishipshipaddress() to initialize the form\n */\nexports.init = function () {\n\tinitMultiGiftMessageBox();\n\tif ($('.cart-row .shippingaddress .select-address').length > 0) {\n\t\tformPrepare.init({\n\t\t\tcontinueSelector: '[name$=\"addressSelection_save\"]',\n\t\t\tformSelector: '[id$=\"multishipping_addressSelection\"]'\n\t\t});\n\t}\n\t$('.edit-address').on('click', 'a', function (e) {\n\t\tdialog.open({url: this.href, options: {open: function () {\n\t\t\taddress.init();\n\t\t\taddEditAddress(e.target);\n\t\t}}});\n\t});\n};\n\n},{\"../../dialog\":11,\"../../util\":69,\"./address\":26,\"./formPrepare\":30}],34:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('../../ajax'),\n\tprogress = require('../../progress'),\n\tvalidator = require('../../validator'),\n\tstorelocator= require('../../storelocator'),\n\tdatepickerutil = require('../../datepickerutil'),\n\tutil = require('../../util'),\n\tbpostservice = require('./bpostshopservice');\n\nvar shippingMethods;\nvar methodSwitched = false;\n/**\n * @function\n * @description Initializes gift message box, if shipment is gift\n */\nfunction giftMessageBox() {\n\t// show gift message box, if shipment is gift\n\t$('.gift-message-text').toggleClass('hidden', $('input[name$=\"_shippingAddress_isGift\"]:checked').val() !== 'true');\n}\n\n/**\n * @function\n * @description updates the order summary based on a possibly recalculated basket after a shipping promotion has been applied\n */\nfunction updateSummary() {\n\tvar $summary = $('#secondary.summary');\n\t// indicate progress\n\tprogress.show($summary);\n\n\t// load the updated summary area\n\t$summary.load(Urls.summaryRefreshURL, function () {\n\t\t// hide edit shipping method link\n\t\t$summary.fadeIn('fast');\n\t\t$summary.find('.checkout-mini-cart .minishipment .header a').hide();\n\t\t$summary.find('.order-totals-table .order-shipping .label a').hide();\n\t});\n}\n\n/**\n * @function\n * @description Helper method which constructs a URL for an AJAX request using the\n * entered address information as URL request parameters.\n */\nfunction getShippingMethodURL(url, extraParams) {\n\tvar $form = $('.address');\n\tvar params = {\n\t\taddress1: $form.find('input[name$=\"_address1\"]').val(),\n\t\taddress2: $form.find('input[name$=\"_address2\"]').val(),\n\t\tcountryCode: $form.find('select[id$=\"_country\"]').val(),\n\t\tstateCode: $form.find('select[id$=\"_state\"]').val(),\n\t\tpostalCode: $form.find('input[name$=\"_postal\"]').val(),\n\t\tcity: $form.find('input[name$=\"_city\"]').val()\n\t};\n\treturn util.appendParamsToUrl(url, $.extend(params, extraParams));\n}\n\n/**\n * @function\n * @description all shipping forms should have this AJAX submit method\n * they all reload entire primary content, actions and data are set in form template\n */\nfunction genericShippingFormAjaxHandler(e) {\n\te.preventDefault();\n\tvar href = util.ajaxUrl(this.action);\n\tajax.load({\n\t\turl: href,\n\t\tdata: $(this).serialize(),\n\t\tmethod: 'post',\n\t\ttarget: $('#primary'),\n\t\tcallback: function () {\n\t\t\tinitDeliveryDatePicker();\n\t\t\tvalidator.init();\n\t\t\tinitializeEvents();\n\t\t}\n\t});\n}\n\n/**\n * Used to initialize delivery preferred day datepicker\n * */\nfunction initDeliveryDatePicker(){\n\tvar restrictedDays = getRestrictedDatepickerDays();\n\tvar fromDate = getMinDeliveryDatepickerDate();\n\tutil.initializeDatePicker('_shippingAddress_deliveryDate', {\n\t\tbeforeShowDay: restrictedDays,\n\t\tmaxDate: \"+2w\",\n\t\tminDate: fromDate\n\t});\n}\n/**\n * Get the good restriction function for delivery days\n * */\nfunction getRestrictedDatepickerDays () {\n\tvar country = $('[id*=_addressFields_country]').val();\n\tvar restrictedDatePickerFunction;\n\tswitch (country){\n\t\tcase 'NL' :\n\t\t\t// exclude if date is excluded explicitly in shipping method or if it is sunday\n\t\t\trestrictedDatePickerFunction = datepickerutil.sundaySpecial;\n\t\t\tbreak;\n\t\tdefault : \n\t\t\t// exclude if date is excluded explicitly in shipping method or if it is weekend\n\t\t\trestrictedDatePickerFunction = datepickerutil.weekendSpecial;\n\t\t\tbreak;\n\t}\n\treturn restrictedDatePickerFunction;\n}\n\n/**\n * Get start delivery date\n * */\nfunction getMinDeliveryDatepickerDate() {\n\treturn $('#deliveryDateBeforeBreakpoint').val();\n}\n\n/**\n * @function \n * @description DOM element check to see if there is a favourite store displayed\n */\nfunction isFavouriteStore() {\n\treturn $('.favourite-store-name').length > 0;\n}\n\n\n/**\n * @function click event for store locator radio buttons\n * */\nfunction initializeStoreLocatorEvents() {\n\t// storeselected is the event triggered when store is clicked on map or on list\n\tmapRessources.storeSelected = function(id, storeData) {\n\t\tvar $storeList = $(\"#store-locator-container .results-list\");\n\t\tif (id && storeData) {\n\t\t\tvar storeListElement = $('[name=storeLocator_storeID][id='+ id +']');\n\t\t\tstorelocator.scrollToStore(id);\n\t\t\tstoreListElement.click();\n\t\t\t\n\t\t\tif (storeListElement.length < 1) {\n\t\t\t\tvar latitude = storeData.lat;\n\t\t\t\tvar longitude = storeData.lon;\n\t\t\t\tstorelocator.searchNearestPoint(latitude, longitude, null, $storeList);\n\t\t\t}\n\t\t}\n\t\tif (id) {\n\t\t\t$('input[name*=\"storeid\"]').val(id);//Store input\n\t\t\t$('input[name*=\"parcelshopid\"]').val(id);//DPD input\n\t\t\t$('[name*=shippingAddress_save]').show();\n\t\t\tmethodSwitched = true;\n\t\t}\n\t}\n\t// set default zoom for storelocator map\n\tmapRessources.defaultZoom = 9;\n\t\n\t// initialize store locator map\n\t\n\tif (document.readyState == \"loaded\" || document.readyState == \"complete\") {\n\t\tstorelocator.init();\n\t\tif (isFavouriteStore() && $('.shipping-method-radio:checked').val() === 'store') {\n\t\t\t$('#store-locator-container, .shipping-method-tri').hide();\n\t\t}\n\t} else {\n\t\t$(window).on('DOMContentLoaded', function () {\n\t\t\tstorelocator.init();\n\t\t\tif (isFavouriteStore() && $('.shipping-method-radio:checked').val() === 'store') {\n\t\t\t\t$('#store-locator-container, .shipping-method-tri').hide();\n\t\t\t}\n\t\t});\n\t}\n\t\n\tstorelocator.updateSelectedStoreStyle($('[name=storeLocator_storeID]:checked').val());\n\t\n\t// Check on init if a store is selected\n\tif ($('[name=storeLocator_storeID]:checked').length > 0 && $('[name=storeLocator_storeID]:checked').val().length > 0) {\n\t\tmethodSwitched = true;\n\t}\n\n\t// show more button event for shipping store locator \n\t$('#primary').on('click', '.store-list-show-more a', function (e) {\n\t\te.preventDefault();\n\t\tshowNextStores($(this));\n\t});\n\t\n\t$('#store-locator-container').on('change', '[name*=\"storeLocator_storeID\"]', function () {\n\t\tvar value = $(this).val();\n\t\t$('input[name*=\"storeid\"]').val(value);//store input\n\t\t$('input[name*=\"parcelshopid\"]').val(value);//DPD input\n\t\t$('[name*=shippingAddress_save]').show();\n\t});\n\n\t$('.store-locator--shipping').on('click', '.locate-store', function (e) {\n\t\t$('[id*=\"_storelocator_storeToSelect\"]').val($(this).parents('li').attr('itemid'));\n\t\t\n\t\t// Update the map only on desktop\n\t\tif (!window.matchMedia('(max-width: 1023px)').matches) {\n\t\t\tstorelocator.storeToSelect();\n\t\t}\n\n\t\t$('[name*=_singleshipping_shippingAddress_save]').trigger(\"click\");\n\t});\n\n\t$('body').on('click', '.js-show-schedules', function (e) {\n\t\te.preventDefault();\n\t\tvar shopSchedules = $(this).next('.shop-schedules')\n\t\tshopSchedules.toggleClass('show');\n\n\t\tif (shopSchedules.hasClass(\"show\")) {\n\t\t\t$(this).find(\"i\").switchClass(\"icon-arrowdown\", \"icon-arrowup\");\n\t\t} else {\n\t\t\t$(this).find(\"i\").switchClass(\"icon-arrowup\", \"icon-arrowdown\");\n\t\t}\n\t});\n\n\n\t$('.store-locator-show').on('click', function () {\n\t\t$('.store-locator--shipping').removeClass('list-hidden');\n\t});\n\n\t$('.store-map').on('click', function (e) {\n\t\tif (window.matchMedia('(max-width: 1023px)').matches) {\n\t\t\t$('.store-locator--shipping').removeClass('list-hidden');\n\t\t}\n\t});\n}\n\n/**\n * @function \n * @description show more button for mobile shipping store locator\n * @param $element {jQuery.Object}\n * */\nfunction showNextStores($element){\n\tvar $elementLi = $element.closest('li');\n\t$elementLi.nextAll(':hidden:lt(6)').show();\n\t$elementLi.hide();\n}\n\nfunction initializeEvents() {\n\t// initialize store locator if we need it\n\tif ($('[id=store-locator-container]').length) {\n\t\tinitializeStoreLocatorEvents();\n\t}\n}\n\nexports.init = function () {\n\tvalidator.init();\n\t$('input[name$=\"_shippingAddress_isGift\"]').on('click', giftMessageBox);\n\t$('#main')\n\t.on('submit', '.shipping-country-selector', genericShippingFormAjaxHandler)\n\t.on('submit', '[id*=_shipping_methods_selector]', genericShippingFormAjaxHandler)\n\t.on('submit', '[id*=_shippingAddress_select_shippingaddress]', genericShippingFormAjaxHandler)\n\t.on('change', '.shipping-country-selector [name*=_country]', function () {\n\t\t$(this.form).submit();\n\t})\n\t.on('change', '[name*=_shippingAddress_shippingMethodID]', function (e) {\n\t\t$(this.form).submit();\n\t})\n\t.on('change', '[name*=_singleshipping_addressList]', function (){\n\t\tvar addressID = $(this).val();\n\t\t$('#select_shipping_address_id').val(addressID);\n\t\t$(this.form).submit();\n\t})\n\t.on('change', '.shipping-method-radio', function (){\n\t\tvar shippingMethodID = $(this).val();\n\t\t$('#hiddenShippingMethodID').val(shippingMethodID);\n\t\t$('.shipping-method-selector').submit();\n\t\t$('.shipping-store-noid').hide();\n\t\tmethodSwitched = false;\n\t})\n\t.on('change', '.checkout-shipping [id*=_addressFields_country]', function () {\n\t\tvar $postalElement = $(this).parents('form').first().find('[id*=_addressFields_postal]');\n\t\tif ($postalElement.val()) {\n\t\t\t$postalElement.valid();\n\t\t}\n\t})\n\t.on('click', '[name*=minisummary_submit]', function () {\n\t\tif ($('.input-radio.shipping-method-radio').is(':checked')) {\n\t\t\t$('[name*=_singleshipping_shippingAddress_save]').trigger(\"click\");\n\t\t}\n\t\telse {\n\t\t\t$('.shipping-choose-option').removeClass('hidden');\n\t\t}\n\t})\n\t.on('submit', '.checkout-shipping', function (e) {\n\t\tvar $selectedMethod = $('[name$=_shippingMethodID]:checked');\n\t\tvar selectedMethodValue = $selectedMethod.val();\n\t\tvar storeMandatoryMethods = ['store', 'bpost', 'dhl', 'dhl-de', 'dpd', 'chronopost', 'mondialrelay'];\n\n\t\tif (isFavouriteStore() && selectedMethodValue === 'store') {\n\t\t\t$('input[name*=\"_shippingAddress_addressFields_storeid\"]').val($('input#shipping-method-store').data('favstoreid'));\n\t\t} else if (!methodSwitched && storeMandatoryMethods.indexOf(selectedMethodValue) >= 0) {\n\t\t\te.preventDefault();\n\t\t\t$('.shipping-store-noid').show();\n\t\t}\n\t\t\n\t})\n\t.on('click', '#btn-favourite-store', function (e) {\n\t\t$('#btn-favourite-store').remove();\n\t\t$('.favourite-store-name').remove();\n\t\t$('#store-locator-container, label[for*=shipping-method-store] .shipping-method-tri').show();\n\t\tstorelocator.setZoom(mapRessources.defaultZoom);\n\t});\n\t\n\tinitDeliveryDatePicker();\n\tgiftMessageBox();\n\tinitializeEvents();\n\tbpostservice.init();\n};\n},{\"../../ajax\":3,\"../../datepickerutil\":10,\"../../progress\":56,\"../../storelocator\":66,\"../../util\":69,\"../../validator\":70,\"./bpostshopservice\":28}],35:[function(require,module,exports){\n'use strict';\n\nvar addProductToCart = require('./product/addToCart'),\n\tajax = require('../ajax'),\n\tpage = require('../page'),\n\tproductTile = require('../product-tile'),\n\tquickview = require('../quickview');\n\n/**\n * @private\n * @function\n * @description Binds the click events to the remove-link and quick-view button\n */\nfunction initializeEvents() {\n\t$('#compare-table').on('click', '.remove-link', function (e) {\n\t\te.preventDefault();\n\t\tajax.getJson({\n\t\t\turl: this.href,\n\t\t\tcallback: function () {\n\t\t\t\tpage.refresh();\n\t\t\t}\n\t\t});\n\t})\n\t.on('click', '.open-quick-view', function (e) {\n\t\te.preventDefault();\n\t\tvar url = $(this).closest('.product').find('.thumb-link').attr('href');\n\t\tquickview.show({\n\t\t\turl: url,\n\t\t\tsource: 'quickview'\n\t\t});\n\t});\n\n\t$('#compare-category-list').on('change', function () {\n\t\t$(this).closest('form').submit();\n\t});\n}\n\nexports.init = function () {\n\tproductTile.init();\n\tinitializeEvents();\n\taddProductToCart();\n};\n\n},{\"../ajax\":3,\"../page\":23,\"../product-tile\":55,\"../quickview\":58,\"./product/addToCart\":38}],36:[function(require,module,exports){\n'use strict';\n\nvar account = require('./account'),\n\tajax = require('../ajax'),\n\tgtmtool = require('../googledatatag.js'),\n\tutil = require('../util'),\n\tdialog = require('../dialog'),\n\tvalidator = require('../validator')\n;\n\nvar $target = $('#checkout-secondary-login');\n\n/**\n * @function\n * @description initializeEvents\n */\n\nfunction initializeEvents()\n{\t\n\tvalidator.init();\n\taccount.initializeNewAccountFields($target);\n\tgtmtool.measureOrderConfirmation($('.confirmation'));\n\n\t$('#main').on('submit', '[id$=login_register]', function () {\n\t\tgtmtool.accountCreationAfterOrder();\n\t});\n\n\t// sponsorship popin\n\tvar $sponsorshipPopinElement = $('#sponsorship-popin')\n\tif($sponsorshipPopinElement.length > 0){\n\t\tdialog.open({\n\t\t\thtml: $sponsorshipPopinElement,\n\t\t\toptions : {\n\t\t\t\tdraggable : false,\n\t\t\t\tmodal: true,\n\t\t\t\tdialogClass : 'cep-dialog',\n\t\t\t\tresizable: false,\n\t\t\t\twidth: 300\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\t$('#main').on('submit', '.orderUpdate-form', function (e) {\n\t\te.preventDefault();\n\t\tvar $this = $(this);\n\t\tvar $phone = $this.find('[name*=\"phone\"]').val();\n\t\tif ($phone !== '') {\n\t\t\t$.ajax({\n\t\t\t\turl: this.action,\n\t\t\t\ttype: this.method,\n\t\t\t\tdata: serializeFakeForm($this),\n\t\t\t\tsuccess: function (response) {\n\t\t\t\t\tif (response.success) { \n\t\t\t\t\t\t$this.hide();\n\t\t\t\t\t\t$('.confirm-message').html(response.message);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$('.error-message').html(response.message);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n}\n\nfunction serializeFakeForm(form) {\n\tvar ret = [];\n\t$.each(form.find('input'), function () {\n\t\tret.push(encodeURIComponent(this.name) + \"=\" + encodeURIComponent($(this).val()));\n\t});\n\n\treturn ret.join(\"&\").replace(/%20/g, \"+\");\n}\n\nexports.init = function () {\n\tinitializeEvents();\n};\n\n},{\"../ajax\":3,\"../dialog\":11,\"../googledatatag.js\":15,\"../util\":69,\"../validator\":70,\"./account\":24}],37:[function(require,module,exports){\n'use strict';\n\nexports.init = function () {\n\t// Homepage slider configuration\n\t$('.home-slider').on('jcarousel:create jcarousel:reload', function () {\n\t\t\tvar element = $(this),\n\t\t\twidth = element.innerWidth();\n\t\t\telement.jcarousel('items').css('width', Math.ceil(width) + 'px');\n\t\t})\n\t\t.jcarousel({\n\t\t\twrap: 'last'\n\t\t})\n\t\t.jcarouselAutoscroll({\n\t\t\tinterval: 5000\n\t\t})\n\t\t.jcarouselSwipe();\n\t$('.home-slider .slider-control--prev').jcarouselControl({\n\t\ttarget: '-=1'\n\t});\n\t$('.home-slider .slider-control--next').jcarouselControl({\n\t\ttarget: '+=1'\n\t});\n\t$('.home-slider .slider-pagination')\n\t\t.on('jcarouselpagination:active', 'a', function () {\n\t\t\t$(this).addClass('is-active');\n\t\t})\n\t\t.on('jcarouselpagination:inactive', 'a', function () {\n\t\t\t$(this).removeClass('is-active');\n\t\t})\n\t\t.jcarouselPagination({\n\t\t\titem: function (page) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t});\n};\n\n},{}],38:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('../../dialog'),\n\tminicart = require('../../minicart'),\n\tpage = require('../../page'),\n\tutil = require('../../util'),\n\tTPromise = require('promise'),\n gtmtool = require('../../googledatatag.js'),\n\t_ = require('lodash');\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) {\n\tvar $form = $(form),\n\t\t$qty = $form.find('input[name=\"Quantity\"]');\n\tif ($qty.length === 0 || isNaN($qty.val()) || parseInt($qty.val(), 10) === 0) {\n\t\t$qty.val('1');\n\t}\n\treturn TPromise.resolve($.ajax({\n\t\ttype: 'POST',\n\t\turl: util.ajaxUrl(Urls.addProduct),\n\t\tdata: $form.serialize()\n\t}));\n};\n\n/**\n * @description Handler to handle the add to cart event\n */\nvar addToCart = function (e) {\n\te.preventDefault();\n\tvar $form = $(this).closest('form');\n \n // google tag manager add to cart events\n gtmtool.addToCartClick($form);\n\tgtmtool.addProductToCartExtended($form);\n \n\tif ($(this).hasClass('add-to-cart-disabled')){\n\t\t$form.find('.add-to-cart-error-msg').show();\n\t}\n\n\taddItemToCart($form).then(function (response) {\n // Datalayer event\n var products = Array.from(window.GTMProduct.ecommerce.detail.products);\n var productsToPush = []\n var productSku = $('.swatch-item-size.selected').data('productean');\n for (let i = 0; i < products.length; i++) {\n var product = products[i];\n var productToPush = {};\n productToPush.id = product.id;\n productToPush.name = product.name;\n productToPush.list = 'product detail';\n productToPush.quantity = 1;\n productToPush.new_total_quantity = (parseInt($(`.mini-cart-product[data-product-id=${productSku}]`).data('qty')) || 0) + productToPush.quantity;\n productToPush.price = product.price;\n\t\t\tproductToPush.color = $('.product-variations').data('attributes').color.value;\n\t\t\tproductToPush.size = $('.product-variations').data('attributes').size.displayValue;\n\n productsToPush.push(productToPush);\n }\n $(window).trigger('datalayer:push-event', {\n name: 'cart addition',\n data: {\n cart_method: \"click: button\",\n products: productsToPush\n }\n });\n\n\t\tvar $uuid = $form.find('input[name=\"uuid\"]');\n\t\tif ($uuid.length > 0 && $uuid.val().length > 0) {\n\t\t\tpage.refresh();\n\t\t} else {\n\t\t\t// do not close quickview if adding individual item that is part of product set\n\t\t\t// @TODO should notify the user some other way that the add action has completed successfully\n\t\t\tif (!$(this).hasClass('sub-product-item')) {\n\t\t\t\tdialog.close();\n\t\t\t}\n\t\t\tminicart.show(response);\n\t\t}\n\t}.bind(this));\n};\n\n/**\n * @description Handler to handle the add all items to cart event\n */\nvar addAllToCart = function (e) {\n\te.preventDefault();\n \n var productForms = $('#product-set-list, #wishlist-items').find('form:not(.pdpForm)').toArray();\n var formsToProcess = [];\n\n for (let i = 0; i < productForms.length; i++) {\n const $productForm = $(productForms[i]);\n if ($productForm.closest('.product-set-item').find('.product-variations').find('.swatch-item-size.selected').length > 0) {\n formsToProcess.push($productForm.get(0));\n }\n }\n \n // google tag manager add to cart event\n gtmtool.addAllToCartClick();\n\n util.processPromises(formsToProcess, addItemToCart).then(function (response) {\n dialog.close();\n // show the final response only, which would include all the other items\n minicart.show(response);\n });\n};\n\nfunction disabledAction(e) {\n\te.preventDefault();\n\tvar $form = $(this).closest('form');\n\t$form.find('.add-to-cart-error-msg').show();\n}\n\n/**\n * @function\n * @description Binds the click event to a given target for the add-to-cart handling\n */\nmodule.exports = function () {\n\t$('.add-to-cart[disabled]').attr('title', $('.availability-msg').text());\n\t$('.wishlist-list').on('click', '.add-to-cart', addToCart);\n\t$('.product-detail').on('click', '.add-to-cart', addToCart);\n\t$('#main').on('click', '.add-to-cart-disabled', disabledAction);\n\t$('#add-all-to-cart').on('click', addAllToCart);\n};\n\n},{\"../../dialog\":11,\"../../googledatatag.js\":15,\"../../minicart\":22,\"../../page\":23,\"../../util\":69,\"lodash\":78,\"promise\":79}],39:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('../../ajax'),\n\tutil = require('../../util');\n\nvar updateContainer = function (data) {\n\tvar $availabilityMsg = $('#pdpMain .availability .availability-msg');\n\tvar message; // this should be lexically scoped, when `let` is supported (ES6)\n\tif (!data) {\n\t\t$availabilityMsg.html(Resources.ITEM_STATUS_NOTAVAILABLE);\n\t\treturn;\n\t}\n\t$availabilityMsg.empty();\n\t// Look through levels ... if msg is not empty, then create span el\n\tif (data.levels.IN_STOCK > 0) {\n\t\tif (data.levels.PREORDER === 0 && data.levels.BACKORDER === 0 && data.levels.NOT_AVAILABLE === 0) {\n\t\t\t// Just in stock\n\t\t\tmessage = Resources.IN_STOCK;\n\t\t} else {\n\t\t\t// In stock with conditions ...\n\t\t\tmessage = data.inStockMsg;\n\t\t}\n\t\t$availabilityMsg.append('

        ' + message + '

        ');\n\t}\n\tif (data.levels.PREORDER > 0) {\n\t\tif (data.levels.IN_STOCK === 0 && data.levels.BACKORDER === 0 && data.levels.NOT_AVAILABLE === 0) {\n\t\t\tmessage = Resources.PREORDER;\n\t\t} else {\n\t\t\tmessage = data.preOrderMsg;\n\t\t}\n\t\t$availabilityMsg.append('

        ' + message + '

        ');\n\t}\n\tif (data.levels.BACKORDER > 0) {\n\t\tif (data.levels.IN_STOCK === 0 && data.levels.PREORDER === 0 && data.levels.NOT_AVAILABLE === 0) {\n\t\t\tmessage = Resources.BACKORDER;\n\t\t} else {\n\t\t\tmessage = data.backOrderMsg;\n\t\t}\n\t\t$availabilityMsg.append('

        ' + message + '

        ');\n\t}\n\tif (data.inStockDate !== '') {\n\t\t$availabilityMsg.append('

        ' + String.format(Resources.IN_STOCK_DATE, data.inStockDate) + '

        ');\n\t}\n\tif (data.levels.NOT_AVAILABLE > 0) {\n\t\tif (data.levels.PREORDER === 0 && data.levels.BACKORDER === 0 && data.levels.IN_STOCK === 0) {\n\t\t\tmessage = Resources.NOT_AVAILABLE;\n\t\t} else {\n\t\t\tmessage = Resources.REMAIN_NOT_AVAILABLE;\n\t\t}\n\t\t$availabilityMsg.append('

        ' + message + '

        ');\n\t}\n};\n\nvar getAvailability = function () {\n\tajax.getJson({\n\t\turl: util.appendParamsToUrl(Urls.getAvailability, {\n\t\t\tpid: $('#pid').val(),\n\t\t\tQuantity: $(this).val()\n\t\t}),\n\t\tcallback: updateContainer\n\t});\n};\n\nmodule.exports = function () {\n\t$('#pdpMain').on('change', '.pdpForm input[name=\"Quantity\"]', getAvailability);\n};\n\n},{\"../../ajax\":3,\"../../util\":69}],40:[function(require,module,exports){\n'use strict';\n\nvar Validator = require('../../validator');\n\n/**\n * @private\n * @function\n * @description Binds events to the back in stock functionality \n */\nfunction initializeEvents() {\n\t$('body').on('submit', '.backInStock-form', function (e) {\n\t\te.preventDefault();\n\t\tvar $this = $(this);\n\t\tvar $email = $this.find('[name*=\"backinstock_email\"]').val();\n\t\tvar $newsletterEmail = $('#newsletterBackInStockEmail');\n\t\tif ($email !== '' && Validator.regex.email.test($email)) {\n\t\t\t$this.find('error').addClass('hidden');\n\t\t\t$.ajax({\n\t\t\t\turl: this.action,\n\t\t\t\ttype: this.method,\n\t\t\t\tdata: serializeFakeForm($this),\n\t\t\t\tsuccess: function (response) {\n\t\t\t\t\tif (response) {\n\t\t\t\t\t\t$this.hide();\n\t\t\t\t\t\t$('.form-backinstock, .product-back-in-stock-container').hide();\n\t\t\t\t\t\t$this.next('.bis_message').show();\n\t\t\t\t\t\t$newsletterEmail.val($email);\n\n // Datalayer event\n var products = Array.from(window.GTMProduct.ecommerce.detail.products);\n var productsToPush = []\n var productSku = $('.swatch-item-size.selected').data('productean');\n for (let i = 0; i < products.length; i++) {\n var product = products[i];\n var productToPush = {};\n productToPush.id = product.id;\n productToPush.name = product.name;\n productToPush.list = 'product detail';\n productToPush.quantity = 1;\n productToPush.new_total_quantity = (parseInt($(`.mini-cart-product[data-product-id=${productSku}]`).data('qty')) || 0) + productToPush.quantity;\n productToPush.price = product.price;\n productToPush.color = $('.product-variations').data('attributes').color.value;\n\t\t\t productToPush.size = $('.product-variations').data('attributes').size.displayValue;\n \n productsToPush.push(productToPush);\n }\n $(window).trigger('datalayer:push-event', {\n name: 'interaction',\n data: {\n interaction_name: 'click: out of stock request',\n products: productsToPush\n }\n });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\t$this.find('.error').removeClass('hidden');\n\t\t}\n\t});\n}\n\nfunction serializeFakeForm(form) {\n\tvar ret = [];\n\t$.each(form.find('input'), function () {\n\t\tret.push(encodeURIComponent(this.name) + \"=\" + encodeURIComponent($(this).val()));\n\t});\n\n\treturn ret.join(\"&\").replace(/%20/g, \"+\");\n}\n\nexports.init = function () {\n\tinitializeEvents();\n};\n},{\"../../validator\":70}],41:[function(require,module,exports){\n'use strict';\nvar dialog = require('../../dialog'),\n\tutil = require('../../util'),\n\tgtmtool = require('../../googledatatag.js');\n\n/**\n * @description Replaces the images in the image container, for eg. when a different color was clicked.\n */\nvar replaceImages = function () {\n\tvar $newImages = $('#update-images'),\n\t\t$imageContainer = $('#pdpMain .product-image-container');\n\tif ($newImages.length === 0) { return; }\n\n\t$imageContainer.html($newImages.html());\n\t$newImages.remove();\n\tremoveJcarousel();\n\tremoveElevateZoom();\n\tinitProductImageView();\n};\n\n/**\n * @description Remove jCarousel if exists\n */\nvar removeJcarousel = function () {\n\tif (typeof $('.product-thumbnails').data('jcarousel') !== 'undefined') {\n\t\t// Destroy jCarousel instance\n\t\t$('.product-thumbnails').jcarousel('destroy');\n\t\t$('.product-thumbnails').jcarouselSwipe('destroy');\n\t\t$('.product-thumbnails, .thumbnail-link').off();\n\t\t// Destroy jCarousel Control instance\n\t\tif (typeof $('.product-thumbnails .product-thumbnails-control--prev').data('jcarouselcontrol') !== 'undefined') {\n\t\t\t$('.product-thumbnails .product-thumbnails-control--prev').jcarouselControl('destroy');\n\t\t}\n\t\tif (typeof $('.product-thumbnails .product-thumbnails-control--next').data('jcarouselcontrol') !== 'undefined') {\n\t\t\t$('.product-thumbnails .product-thumbnails-control--next').jcarouselControl('destroy');\n\t\t}\n\t\t// Destroy jCarousel Pagination instance\n\t\tif (typeof $('.product-thumbnails .product-thumbnails-pagination').data('jcarouselpagination') !== 'undefined') {\n\t\t\t$('.product-thumbnails .product-thumbnails-pagination').jcarouselPagination('destroy');\n\t\t}\n\t\t// Remove inline styles, Remove unused swipe attributes\n\t\t$('.product-thumbnails, #thumbnails-list, .thumb').removeAttr('style');\n\t}\n\tif (typeof $('.main-image').data('jcarousel') !== 'undefined') {\n\t\t$('.main-image').jcarousel('destroy');\n\t\t$('.main-image').off();\n\t\t$('.product-thumbnails, .thumbnail-link').off();\n\t\tif (typeof $('.main-image-prev').data('jcarouselcontrol') !== 'undefined') {\n\t\t\t$('.main-image-prev').jcarouselControl('destroy');\n\t\t}\n\t\tif (typeof $('.main-image-next').data('jcarouselcontrol') !== 'undefined') {\n\t\t\t$('.main-image-next').jcarouselControl('destroy');\n\t\t}\n\t}\n};\n\n/**\n * @description Remove elevateZoom if exists\n */\nvar removeElevateZoom = function () {\n\tif (typeof $('.zoomContainer') !== 'undefined') {\n\t\t// Remove Elevate Zoom if exists\n\t\t$('.zoomContainer').remove();\n\t\tvar mainImage = $(\".primary-image\");\n\t\tmainImage.removeData('elevateZoom');\n\t\tmainImage.removeData('zoomImage');\n\t\tif ($('.zoomWrapper').length > 0) {\n\t\t\t$('.product-image.main-image').append(mainImage);\n\t\t\t$('.zoomWrapper').remove();\n\t\t}\n\t}\n};\n\n/**\n * @description Enables the zoom viewer on the product detail page\n */\nvar initElevateZoom = function () {\n\t// Init elevate Zoom\n\t$(\".primary-image\").elevateZoom({\n\t\tresponsive: true,\n\t\tcursor: 'pointer',\n\t\timageCrossfade: true,\n\t\tzoomWindowWidth: 400,\n\t\tzoomWindowHeight: 500,\n\t\tborderSize: 1,\n\t\tborderColor: 'e9dcd9'\n\t});\n};\n\n/**\n * @description Creates element for video\n */\nvar prepareVideoElements = function (device) {\n\t$('.video-item').remove();\n\t$('.product-video-button-play').off().removeClass('playing');\n\tinitPlayer();\n\tvar $videoButton = $(\".video-button\");\n\tswitch (device) {\n\t\tcase 'desktop':\n\t\t\t$('.main-image ul').prepend('
      • ');\n\t\t\t$videoButton.prependTo('#thumbnails-list');\n\t\t\t$videoButton.replaceWith(function () {\n\t\t\t\treturn $('
      • ', {\n\t\t\t\t\tclass: 'thumb video-button',\n\t\t\t\t\thtml: this.innerHTML\n\t\t\t\t});\n\t\t\t});\n\t\t\t$('.product-video-button-play').show();\n\t\t\tbreak;\n\t\tcase 'mobile':\n\t\t\tif ($videoButton.length > 0) {\n\t\t\t\t$videoButton.detach().insertAfter('#thumbnails-list');\n\t\t\t\t$videoButton.replaceWith(function () {\n\t\t\t\t\treturn $('
        ', {\n\t\t\t\t\t\tclass: 'video-button',\n\t\t\t\t\t\thtml: this.innerHTML\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\t$('#thumbnails-list').prepend('
      • ');\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\t$('.product-image-model-size').hide();\n\tsetTimeout(function () {\n\t\t$('.product-video-button-play').trigger('click');\n\t}, 200);\n};\n\nfunction stickySidebar () {\n\tvar $pdpSidebar = $('.product-detail-content:not(.product-set)');\n\t$pdpSidebar.stickySidebar({\n\t\tcontainerSelector: '.pdp-main',\n\t\ttopSpacing: $('body').hasClass('cassis') ? 120 : 10,\n\t\tbottomSpacing: 10,\n\t\tresizeSensor: true,\n\t\tminWidth: 1024\n\t});\n}\n\nvar createImages = function () {\n\t$('.productthumbnail').each(function () {\n\t\tvar atts = $(this).data('img');\n\t\t$(this).attr({\n\t\t\tsrc: atts.smurl\n\t\t});\n\t});\n\n\tvar primaryImageContainer = document.querySelector('.main-image');\n\tvar primaryImage = document.querySelector('.primary-image');\n\tvar videoButton = document.querySelector('.product-video-button-play');\n\tif (primaryImageContainer !== null && primaryImage !== null && primaryImage.dataset !== null) {\n\t\tvar imageLength = primaryImage.dataset.imageLength;\n\t\tif (imageLength > 1) {\n\t\t\tprimaryImageContainer.innerHTML = '';\n\t\t\tvar primaryImageList = document.createElement('ul');\n\t\t\tfor(var i = 0; i < imageLength; i++) {\n\t\t\t\tvar primaryImageListElement = document.createElement('li');\n\t\t\t\tvar newImg = document.createElement('img');\n\t\t\t\tnewImg.src = primaryImage.dataset['image' + i];\n\t\t\t\tnewImg.setAttribute('data-zoom-image', primaryImage.dataset['zoom' + i]);\n\t\t\t\tnewImg.classList.add('img-tile-switch');\n\t\t\t\tnewImg.classList.add('primary-image');\n\t\t\t\tprimaryImageListElement.appendChild(newImg);\n\t\t\t\tprimaryImageList.appendChild(primaryImageListElement);\n\t\t\t}\n\t\t\tprimaryImageContainer.appendChild(primaryImageList);\n\t\t}\n\n\t\tvar modelSize = document.querySelector('.product-image-model-size');\n\t\tprimaryImageContainer.appendChild(modelSize);\n\t}\n\n\tif (videoButton !== null) {\n\t\tprepareVideoElements('desktop');\n\t}\n}\n\n/**\n * @description Enables jcarousel on product detail page on desktop\n */\nvar initDesktopSwiper = function (resize) {\n\n if (!resize) {\n createImages();\n }\n\n $('.product-image-model-size').show();\n\n if ($('.product-set').length > 0 && $('.product-image.main-image').find('img').length > 1) {\n var primaryImageContainer = document.querySelector('.main-image');\n\n if (primaryImageContainer !== null) {\n if (!resize) {\n createImages();\n } else {\n var modelSize = document.querySelector('.product-image-model-size');\n if (modelSize !== null) {\n primaryImageContainer.appendChild(modelSize);\n }\n }\n\n // Set jCarousel\n $(primaryImageContainer).on('jcarousel:create jcarousel:reload', function () {\n var thisCarousel = $(this);\n // Init position\n thisCarousel.jcarousel('scroll', 0, false);\n\n // Thumbnails events\n $('.thumbnail-link').on('click', function () {\n thisCarousel.jcarousel('scroll', $('.thumbnail-link').index(this), true);\n });\n\n if ($(primaryImageContainer).jcarousel('target').hasClass('video-item')) {\n $('.product-image-model-size').hide();\n }\n });\n\n // Init Carousel\n $(primaryImageContainer).jcarousel();\n\n $(primaryImageContainer).on('jcarousel:targetin', 'li', function () {\n if ($('.product-video-button-play').length > 0) {\n if ($(this).hasClass('video-item') && $('.jw-video').length < 1) {\n $('.product-image-model-size').hide();\n setTimeout(function () {\n $('.product-video-button-play').trigger('click');\n }, 200);\n } else {\n if ($(this).hasClass('video-item') && !$('.product-video-button-play').hasClass('playing')) {\n $('#product-video').fadeIn();\n $('.product-image-model-size').hide();\n $('.product-video-button-play').addClass('playing');\n jwplayer(\"product-video\").play();\n } else {\n $(\".product-video-button-play\").removeClass('playing');\n jwplayer(\"product-video\").stop();\n $('.product-image-model-size').show();\n $('#product-video').fadeOut();\n }\n }\n }\n });\n }\n\n\n // Prev callback\n $('.main-image-prev')\n .on('jcarouselcontrol:active', function () {\n $(this).removeClass('inactive');\n })\n .on('jcarouselcontrol:inactive', function () {\n $(this).addClass('inactive');\n })\n .jcarouselControl({\n target: '-=1'\n });\n\n // Next callback\n $('.main-image-next')\n .on('jcarouselcontrol:active', function () {\n $(this).removeClass('inactive');\n })\n .on('jcarouselcontrol:inactive', function () {\n $(this).addClass('inactive');\n })\n .jcarouselControl({\n target: '+=1'\n });\n\n $('.main-image-prev, .main-image-next').show();\n }\n};\n\nvar initTabletSwiper = function (resize) {\n\tvar primaryImageContainer = document.querySelector('.main-image');\n\n\tif (primaryImageContainer !== null) {\n\t\tif (!resize) {\n\t\t\tcreateImages();\n\t\t} else {\n\t\t\tvar modelSize = document.querySelector('.product-image-model-size');\n\t\t\tif (modelSize !== null) {\n\t\t\t\tprimaryImageContainer.appendChild(modelSize);\n\t\t\t}\n\t\t}\n\n\t\t// Set jCarousel\n\t\t$(primaryImageContainer).on('jcarousel:create jcarousel:reload', function () {\n\t\t\tvar thisCarousel = $(this);\n\t\t\t// Init position\n\t\t\tthisCarousel.jcarousel('scroll', 0, false);\n\n\t\t\t// Thumbnails events\n\t\t\t$('.thumbnail-link').on('click', function() {\n\t\t\t\tthisCarousel.jcarousel('scroll', $('.thumbnail-link').index(this), true);\n\t\t\t});\n\n\t\t\tif ($(primaryImageContainer).jcarousel('target').hasClass('video-item')) {\n\t\t\t\t$('.product-image-model-size').hide();\n\t\t\t}\n\t\t});\n\n\t\t// Init Carousel\n\t\t$(primaryImageContainer).jcarousel();\n\n\t\t$(primaryImageContainer).on('jcarousel:targetin', 'li', function() {\n\t\t\tif ($('.product-video-button-play').length > 0) {\n\t\t\t\tif ($(this).hasClass('video-item') && $('.jw-video').length < 1) {\n\t\t\t\t\t$('.product-image-model-size').hide();\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t$('.product-video-button-play').trigger('click');\n\t\t\t\t\t}, 200);\n\t\t\t\t} else {\n\t\t\t\t\tif ($(this).hasClass('video-item') && !$('.product-video-button-play').hasClass('playing')) {\n\t\t\t\t\t\t$('#product-video').fadeIn();\n\t\t\t\t\t\t$('.product-image-model-size').hide();\n\t\t\t\t\t\t$('.product-video-button-play').addClass('playing');\n\t\t\t\t\t\tjwplayer(\"product-video\").play();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$(\".product-video-button-play\").removeClass('playing');\n\t\t\t\t\t\tjwplayer(\"product-video\").stop();\n\t\t\t\t\t\t$('.product-image-model-size').show();\n\t\t\t\t\t\t$('#product-video').fadeOut();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\n\t// Prev callback\n\t$('.main-image-prev')\n\t\t.on('jcarouselcontrol:active', function() {\n\t\t\t$(this).removeClass('inactive');\n\t\t})\n\t\t.on('jcarouselcontrol:inactive', function() {\n\t\t\t$(this).addClass('inactive');\n\t\t})\n\t\t.jcarouselControl({\n\t\t\ttarget: '-=1'\n\t\t});\n\n\t// Next callback\n\t$('.main-image-next')\n\t\t.on('jcarouselcontrol:active', function() {\n\t\t\t$(this).removeClass('inactive');\n\t\t})\n\t\t.on('jcarouselcontrol:inactive', function() {\n\t\t\t$(this).addClass('inactive');\n\t\t})\n\t\t.jcarouselControl({\n\t\t\ttarget: '+=1'\n\t\t});\n\n\t$('.main-image-prev, .main-image-next').show();\n};\n\n/**\n * @description Enables jcarousel on product detail page on mobile\n */\nvar initMobileSwiper = function () {\n\t// Check for elevateZoom\n\t// removeElevateZoom();\n\tprepareVideoElements('mobile');\n\n\t// Swap thumbnail images with large ones\n\t$('.productthumbnail').each(function () {\n\t\tvar atts = $(this).data('img');\n\t\t$(this).attr({\n\t\t\tsrc: atts.lgurl\n\t\t});\n\t});\n\t\n\t// Set jCarousel\n\t$('.product-thumbnails').off()\n\t.on('jcarousel:create jcarousel:reload', function () {\n\t\tvar element = $(this),\n\t\twidth = element.innerWidth();\n\t\telement.jcarousel('items').css('width', Math.ceil(width) + 'px');\n\t\t$('.product-video-button-play').on('click', function () {\n\t\t\telement.jcarousel('scroll', $('.video-item'), false);\n\t\t})\n\t})\n\t.jcarousel()\n\t.jcarouselSwipe();\n\n\t$('.product-thumbnails').on('jcarousel:targetin', 'li', function() {\n\t\tif ($('.product-video-button-play').length > 0) {\n\t\t\tif ($(this).hasClass('video-item') && $('.jw-video').length < 1) {\n\t\t\t\t$('.product-image-model-size').hide();\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t$('.product-video-button-play').trigger('click');\n\t\t\t\t}, 200);\n\t\t\t} else {\n\t\t\t\tif ($(this).hasClass('video-item')) {\n\t\t\t\t\t$('.product-image-model-size').hide();\n\t\t\t\t\t$('#product-video').fadeIn();\n\t\t\t\t\t$('.product-video-button-play').addClass('playing').hide();\n\t\t\t\t\tjwplayer(\"product-video\").play();\n\t\t\t\t} else {\n\t\t\t\t\t$(\".product-video-button-play\").removeClass('playing');\n\t\t\t\t\tjwplayer(\"product-video\").stop();\n\t\t\t\t\t$('.product-image-model-size, .product-video-button-play').show();\n\t\t\t\t\t$('#product-video').fadeOut();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\t\n\t// jCarousel controls\n\t$('.product-thumbnails .product-thumbnails-control--prev')\n\t\t.on('jcarouselcontrol:active', function() {\n\t\t\t$(this).removeClass('inactive');\n\t\t})\n\t\t.on('jcarouselcontrol:inactive', function() {\n\t\t\t$(this).addClass('inactive');\n\t\t})\n\t\t.jcarouselControl({\n\t\t\ttarget: '-=1'\n\t\t});\n\t\n\t$('.product-thumbnails .product-thumbnails-control--next')\n .on('jcarouselcontrol:active', function() {\n\t\t\t$(this).removeClass('inactive');\n\t\t})\n\t\t.on('jcarouselcontrol:inactive', function() {\n\t\t\t$(this).addClass('inactive');\n\t\t}).jcarouselControl({\n\t\t\ttarget: '+=1'\n\t\t});\n\t\n\t// jCarousel pagination\n\t$('.product-thumbnails .product-thumbnails-pagination')\n\t\t.on('jcarouselpagination:active', 'a', function () {\n\t\t\t$(this).addClass('is-active');\n\t\t\t// $('.close-video-control').hide();\n\t\t})\n\t\t.on('jcarouselpagination:inactive', 'a', function () {\n\t\t\t$(this).removeClass('is-active');\n\t\t})\n\t\t.jcarouselPagination({\n\t\t\titem: function (page) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t});\n\n\t// Zoom with pinch support\n\t$('.thumbnail-link:not(.product-video-button-play)').on('click', function () {\n\t\t\tvar megazoom = $('#megazoom'),\n\t\t\thiRes = $(this).data('zoom-image');\n\t\t// Remove megazoom if exists\n\t\tif (megazoom.length > 0 ) {\n\t\t\tmegazoom.remove();\n\t\t}\n\t\t\n\t\t// Init megazoom \n\t\t$('
        ').attr('id', 'megazoom').appendTo(document.body);\n\t\t$('').attr({src: hiRes, class: 'megazoom-image'}).appendTo($('#megazoom'));\n\t\t\n\t\t// Add thumbnails\n\t\t$('#thumbnails-list').clone().attr('id', 'megazoom-thumbs').removeAttr('style').appendTo($('#megazoom'));\n\t\t\n\t\t// Clean inline styles on thumbnails and images\n\t\t$('#megazoom .thumb').removeAttr('style');\n\n\t\t$('#megazoom').dialog({\n\t\t\tdraggable : false,\n\t\t\tmodal: true,\n\t\t\tdialogClass : 'megazoom-container',\n\t\t\tresizable: false\n\t\t});\n\t\t\n\t\t// Remove default dialog title bar\n\t\t$('.megazoom-container .ui-dialog-titlebar').remove();\n\t\t\n\t\t// Make image zoomable\n\t\t$('.megazoom-image').panzoom({\n\t\t\tcontain: 'invert',\n\t\t\tminScale: 1\n\t\t});\n\t\t\n\t\t// Swap main image \n\t\t$('#megazoom .thumbnail-link').on('click', function (e) {\n\t\t\te.preventDefault();\n\t\t\thiRes = $(this).data('zoom-image');\n\t\t\t$('.megazoom-image').panzoom(\"reset\");\n\t\t\t$('.megazoom-image').attr('src', hiRes);\n\t\t});\n\t\t\n\t\t//Add close button\n\t\t$('')\n\t\t\t.attr({\n\t\t\t\thref: '#',\n\t\t\t\tclass: 'megazoom-close'\n\t\t\t\t})\n\t\t\t.html('')\n\t\t\t.appendTo($('.megazoom-container'));\n\t\t\n\t\t$('.megazoom-close').on('click', function (e) {\n\t\t\te.preventDefault();\n\t\t\t$('#megazoom').panzoom(\"destroy\");\n\t\t\t$('#megazoom').remove();\n\t\t\t$(\".primary-image\").hide();\n\t\t});\n\t});\n};\n\nvar initProductImageView = function (resize) {\n\tstickySidebar();\n\tresize = resize ? resize : false;\n\tif (resize) {\n\t\tremoveJcarousel();\n\t}\n\tif (window.matchMedia('(max-width: 640px)').matches) {\n\t\t$('.carousel-controls').addClass('visually-hidden');\n\t\tif (!$('.product-thumbnails').data('jcarousel')) {\n\t\t\tinitMobileSwiper();\n\t\t}\n\t}\n\tif (window.matchMedia('(min-width: 641px) and (max-width: 1023px)').matches) {\n\t\t$('.carousel-controls').removeClass('visually-hidden');\n\t\tif ($('.zoomContainer').length < 1 || resize) {\n\t\t\tinitTabletSwiper();\n\t\t}\n\t}\n\tif (window.matchMedia('(min-width: 1024px)').matches) {\n\t\t$('.carousel-controls').addClass('visually-hidden');\n\t\tif ($('.zoomContainer').length < 1 || resize) {\n $('.carousel-controls').removeClass('visually-hidden');\n\t\t\tinitDesktopSwiper();\n\t\t\tif ($('.product-set').length < 1) {\n\t\t\t\tinitElevateZoom();\n\t\t\t}\n\t\t}\n\t}\n};\n\nvar getAspect = function() {\n\tswitch (getDeviceType()) {\n\t\tcase \"desktop\":\n\t\t\treturn \"4:6\";\n\t\tcase \"tablet\":\n\t\tcase \"mobile\":\n\t\tdefault:\n\t\t\treturn \"9:16\";\n\t}\n};\n\n/**\n * @description is layout mobile or desktop\n */\nvar isMobile = function() {\n\tif (window.matchMedia('(min-width: 640px)').matches) {\n\t\treturn false;\n\t} else {\n\t\treturn true;\n\t}\n};\n\n/**\n * @description set the player and events related\n */\nvar initPlayer = function() {\n\t$(document).on('click', '.product-video-button-play', function () {\n\t\t// Forbid play button to be hit when video are playing\n\t\tif(!$(this).hasClass('playing')) {\n\t\t\t$(this).addClass('playing');\n\t\t\tif(isMobile()) {\n\t\t\t\t$('.product-video-button-play').hide();\n\t\t\t}\n\n\t\t\t// Get video information\n\t\t\tvar videoID = atob($(this).attr('rel'));\n\t\t\tvar videoUrl = atob($(this).attr('data-video'));\n\t\t\tvar pid = $(this).data('pid');\n\n\t\t\t// Show the video container and init the player\n\t\t\tjwplayer(\"product-video\").setup({\n\t\t\t\t\"mediaid\": videoID,\n\t\t\t\t\"file\": videoUrl,\n\t\t\t\t\"aspectratio\" : getAspect(),\n\t\t\t \"autostart\": true,\n\t\t\t \"mute\": true,\n\t\t\t\t\"stretching\": \"uniform\"\n\t\t\t});\n\t\t\t\n\t\t\tjwplayer(\"product-video\").on('play', function(){\n\t\t\t\tgtmtool.playingVideoProductPage(pid);\n\t\t\t});\n\n\t\t\tjwplayer(\"product-video\").on('complete', function () {\n\t\t\t\tswitch (getDeviceType()) {\n\t\t\t\t\tcase \"desktop\":\n\t\t\t\t\t\tjwplayer(\"product-video\").stop();\n\t\t\t\t\t\t$('.video-item').append('');\n\t\t\t\t\t\t$('#replay-video').on('click', function () {\n\t\t\t\t\t\t\tjwplayer(\"product-video\").play();\n\t\t\t\t\t\t\t$(this).remove();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"tablet\":\n\t\t\t\t\t\t$('.main-image-next').trigger('click');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"mobile\":\n\t\t\t\t\t\t$('.product-thumbnails-control--next').trigger('click');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tjwplayer(\"product-video\").stop();\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t//delete cache play video\n\t\t\tlocalStorage.removeItem('jwplayerLocalId');\n\t\t}\n\t});\n};\n/**\n * @description get device type for carousel rebuild\n **/\n\nvar getDeviceType = function () {\n\tvar windowWidth = $(window).width();\n\tvar device = 'mobile';\n\tif (640 <= windowWidth && windowWidth <= 1023) {\n\t\tdevice = 'tablet';\n\t} else if (windowWidth >= 1024) {\n\t\tdevice = 'desktop';\n\t}\n\treturn device;\n};\n\nfunction debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n}\n\n/**\n * @description by default, this function sets up zoom and event handler for thumbnail click\n **/\nmodule.exports = function () {\n\tinitProductImageView();\n\n\tvar device = getDeviceType();\n\n\tvar doResize = debounce(function() {\n\t\tif (device !== getDeviceType()) {\n\t\t\tinitProductImageView(true);\n\t\t}\n\t\tdevice = getDeviceType();\n\t}, 250);\n\n\twindow.addEventListener('resize', doResize);\n};\n\n\nexports.init = initPlayer();\nmodule.exports.replaceImages = replaceImages;\nmodule.exports.initPlayer = initPlayer;\n},{\"../../dialog\":11,\"../../googledatatag.js\":15,\"../../util\":69}],42:[function(require,module,exports){\n'use strict';\n\nvar pushbanner = require('../../pushbanner'),\n dialog = require('../../dialog'),\n\tproductStoreInventory = require('../../storeinventory/product'),\n\ttooltip = require('../../tooltip'),\n\tutil = require('../../util'),\n\taddToCart = require('./addToCart'),\n\tavailability = require('./availability'),\n\timage = require('./image'),\n\tproductNav = require('./productNav'),\n\tproductSet = require('./productSet'),\n\trecommendations = require('./recommendations'),\n\tproductTile = require('../../product-tile'),\n gtmtool = require('../../googledatatag.js'),\n\tvariant = require('./variant'),\n\tbackinstock = require('./backinstock'),\n\tproductRecommSlider = require('./product-slider-recomm');\n\n/**\n * @description Initialize product detail page with reviews, recommendation and product navigation.\n */\nfunction initializeDom() {\n\tproductNav();\n\trecommendations();\n\tproductRecommSlider.init();\n\ttooltip.init();\n}\n\n/**\n * @description Initialize event handlers on product detail page\n */\nfunction initializeEvents() {\n\tvar $pdpMain = $('#pdpMain');\n\n\taddToCart();\n\tavailability();\n\tvariant();\n\timage();\n\tproductSet();\n\tproductTile.init();\n\tif (SitePreferences.STORE_PICKUP) {\n\t\tproductStoreInventory.init();\n\t}\n\n\tvar category = '';\n\tvar productContent = $('#product-content').data('product-categories');\n\tvar productSetContent = $('.product-set-content').data('product-categories');\n\n\tif (productContent) {\n\t\tcategory = productContent.split(',');\n\t} else if (productSetContent) {\n\t\tcategory = productSetContent.split(',');\n\t}\n $(window).trigger('datalayer:push-event',\n {\n name: \"product view\",\n data: {\n products: [\n {\n id: window.GTMProduct.ecommerce.detail.products[0].id,\n category: category,\n name: window.GTMProduct.ecommerce.detail.products[0].name,\n price: window.GTMProduct.ecommerce.detail.products[0].price\n }\n ]\n }\n });\n\n\t// Add to Wishlist and Add to Gift Registry links behaviors\n\t$pdpMain.on('click', '[data-action=\"wishlist\"], [data-action=\"gift-registry\"]', function () {\n\t\tvar data = util.getQueryStringParams($('.pdpForm').serialize());\n\t\tif (data.cartAction) {\n\t\t\tdelete data.cartAction;\n\t\t}\n\t\tvar url = util.appendParamsToUrl(this.href, data);\n\t\tthis.setAttribute('href', url);\n\t});\n\n\t$pdpMain.on('click', '.wishlist-disabled', function (e) {\n\t\te.preventDefault();\n\t\t$(e.target).closest('.js-product-action-container').find('.add-to-wishlist-error-msg').show();\n\t});\n\t\n\t// product options\n\t$pdpMain.on('change', '.product-options select', function () {\n\t\tvar salesPrice = $pdpMain.find('.product-add-to-cart .price-sales');\n\t\tvar selectedItem = $(this).children().filter(':selected').first();\n\t\tsalesPrice.text(selectedItem.data('combined'));\n\t});\n\n\t// prevent default behavior of thumbnail link and add this Button\n\t$pdpMain.on('click', '.thumbnail-link, .unselectable a', function (e) {\n\t\te.preventDefault();\n\t});\n\n\t// link to size-chart-link\n\t$pdpMain.on('click', '.size-chart-link a', function (e) {\n\t\te.preventDefault();\n\t\tvar widthSize= util.isDesktopSize() ? '1024': '100%';\n\t\tvar url = $(e.target).attr('href');\n\t\turl = util.ajaxUrl(url);\n\t\tdialog.open({\n\t\t\turl: url,\n\t\t\toptions : {\n\t\t\t\tdraggable : false,\n\t\t\t\tmodal: true,\n\t\t\t\tdialogClass : 'size-dialog',\n\t\t\t\twidth: widthSize,\n\t\t\t\tresizable: false,\n\t\t\t\topen: function () {\n\t\t\t\t\t$('#guide-tabs').tabs();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n\n\t// Open size chart modal on PDP Size chart tab\n\t$pdpMain.on('click', '.tab-size-chart-link', function (e) {\n\t\te.preventDefault();\n\t\tvar widthSize= util.isDesktopSize() ? '1024': '100%';\n\t\tvar url = $(e.target).closest('.tab').data('sizechartlink');\n\t\turl = util.ajaxUrl(url);\n\t\tdialog.open({\n\t\t\turl: url,\n\t\t\toptions : {\n\t\t\t\tdraggable : false,\n\t\t\t\tmodal: true,\n\t\t\t\tdialogClass : 'size-dialog',\n\t\t\t\twidth: widthSize,\n\t\t\t\tresizable: false,\n\t\t\t\topen: function () {\n\t\t\t\t\t$('#guide-tabs').tabs();\n\t\t\t\t},\n\t\t\t\tclose: function () {\n\t\t\t\t\t$('.tab-size-chart-link').find('i').switchClass('icon-arrowup', 'icon-arrowdown');\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n \n // Toggle product informations\n\t$pdpMain.on('click', '.tab-label', function (e) {\n var $tabContent = $(this).next('.tab-content');\n\t\t$tabContent.toggleClass('is-expanded');\n \n if ($tabContent.hasClass('is-expanded')) {\n $tabContent.slideDown();\n } else {\n $tabContent.slideUp();\n }\n\t\t$(this).find('i').toggleClass('icon-arrowdown icon-arrowup');\n\t});\n \n // init GTM product view event\n\tgtmtool.productViewEnhancedEvent();\n\n $pdpMain.on('click', '.socloz', function() {\n var products = Array.from(window.GTMProduct.ecommerce.detail.products);\n var productsToPush = []\n var productSku = $('.swatch-item-size.selected').data('productean');\n for (let i = 0; i < products.length; i++) {\n var product = products[i];\n var productToPush = {};\n productToPush.id = product.id;\n productToPush.name = product.name;\n productToPush.list = 'product detail';\n productToPush.quantity = 1;\n productToPush.new_total_quantity = (parseInt($(`.mini-cart-product[data-product-id=${productSku}]`).data('qty')) || 0) + productToPush.quantity;\n productToPush.price = product.price;\n productToPush.color = $('.product-variations').data('attributes').color.value;\n productToPush.size = $('.product-variations').data('attributes').size.displayValue;\n productToPush.category = $('#product-content').data('product-categories').split(',');\n\n productsToPush.push(productToPush);\n }\n $(window).trigger('datalayer:push-event', {\n name: \"interaction\",\n data: {\n interaction_name: \"click: in-store reservation\",\n products: productsToPush\n }\n });\n });\n\t\n\t// init GTM product share events\n $pdpMain.on('click', '.social-share', function () {\n gtmtool.socialLinkClick($(this));\n });\n // init GTM product wishlist add event\n $pdpMain.on('click', '.wishlist-link', function () {\n gtmtool.addToWishListButtonClick($(this));\n });\n \n // init GTM product care instruction click event\n $pdpMain.on('click', '.product-care-instruction .tab-label', function (e) {\n gtmtool.productCareClick();\n });\n \n // init GTM product composition click event\n $pdpMain.on('click', '.product-composition .tab-label', function (e) {\n gtmtool.productCompositionClick();\n });\t\n \n // init GTM product last visited click events\n $pdpMain.on('click', '.product-last-visited a.name-link,.product-last-visited a.thumb-link', function () {\n gtmtool.lastVisitedProductClick($(this));\n });\n \n // init GTM data products position in product slider\n\tutil.initializeProductPositions($('.product-recommendations .product-tile'));\n \n // init GTM product last visited click events\n $pdpMain.on('click', '.product-recommendations a.name-link,.product-recommendations a.thumb-link', function () {\n gtmtool.recommendationProductClick($(this));\n gtmtool.openProductDetailsClick($(this));\n });\n\t\n\t// Return button\n\t$('a.return-link').on('click', function (e) {\n\t\te.preventDefault();\n\t\tvar referrerCurrentSite = document.referrer.indexOf(Resources.SITEHOST);\n\t\tif (referrerCurrentSite < 8 && referrerCurrentSite != -1) {\n\t\t\twindow.history.back();\n\t\t} else {\n\t\t\twindow.location.href=this.href;\n\t\t}\n\t});\n}\n\n\n/**\n * @description Initialize some DOM elements on mobile\n */\nfunction initializeMobileView() {\n\tif (util.isMobileSize()) {\n\t\t// Move social network links\n\t\t$('.paprika .socialsharing').appendTo('.product-infos');\n\t} else {\n\t\t$('.paprika .socialsharing').insertAfter('.wishlist-add');\n\t}\n}\n\nfunction showProductStockMsg() {\n\t$('.swatch-link-size').each(function() {\n\t\tvar stockMsg = $(this).find('.stock-infos-hidden');\n\n\t\tif (stockMsg.length != 0) {\n\t\t\t$(this).attr('title', stockMsg[0].textContent);\n\t\t}\n\t});\n}\n\nfunction ObserveProductVariations() {\n\tshowProductStockMsg();\n\n\tvar predictive = document.querySelector('div[id=\"product-content\"]');\n\tif (predictive) {\n\t\tvar mut = new MutationObserver(function(mutations, observer) {\n\t\t\tmutations.forEach(function(mutation) {\n\t\t\t\tshowProductStockMsg();\n\t\t\t});\n\t\t});\n\t\tmut.observe(predictive, {\n\t\t\tsubtree: true,\n\t\t\tchildList: true,\n\t\t\tattributes: false\n\t\t});\n\t}\n}\n\nfunction toggleSearchBar() {\n\tif ($(window).width() < 480) {\n\t\tif ($('.header-search.searchbox').hasClass('is-expanded')) {\n\t\t\t$('.header-search.searchbox').removeClass('is-expanded');\n\t\t}\n\t}\n}\n\nvar product = {\n\tinitializeEvents: initializeEvents,\n\tinit: function () {\n pushbanner.init();\n\t\tinitializeDom();\n\t\tinitializeEvents();\n\t\tbackinstock.init();\n\t\tinitializeMobileView();\n\t\tObserveProductVariations();\n\t\ttoggleSearchBar();\n\t\t// Bind mobile init on resize\n\t\t$(window).on('resize', function(){\n\t\t\tinitializeMobileView();\n\t\t});\n\t}\n};\n\nmodule.exports = product;\n\n},{\"../../dialog\":11,\"../../googledatatag.js\":15,\"../../product-tile\":55,\"../../pushbanner\":57,\"../../storeinventory/product\":65,\"../../tooltip\":68,\"../../util\":69,\"./addToCart\":38,\"./availability\":39,\"./backinstock\":40,\"./image\":41,\"./product-slider-recomm\":43,\"./productNav\":45,\"./productSet\":46,\"./recommendations\":47,\"./variant\":48}],43:[function(require,module,exports){\n'use strict';\n\nvar productSlider = require(\"./product-slider\");\n\nexports.init = function() {\n var recommElements = document.querySelectorAll('div[id^=cq_recomm_slot]');\n if (recommElements)\n {\n var muts = [];\n var mutHandler = function(index) {\n return new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n productSlider.initProductSlider();\n muts[index].disconnect();\n });\n });\n }\n recommElements.forEach((el, index) => {\n muts.push(mutHandler(index))\n muts[index].observe(el, {\n subtree: true,\n childList: true,\n attributes: false\n });\n })\n }\n}\n},{\"./product-slider\":44}],44:[function(require,module,exports){\n'use strict';\n\nvar progress = require('../../progress'),\n\tlazyload = require('../../lazyload'),\n\tlazyLoading = require('../../lazyLoading'),\n\tutil = require('../../util');\n\nvar initProductSlider = function()\n{\n\t// Slider on push products\n\t$('.product-slider')\n\t\t.on('jcarousel:create jcarousel:reload', function() {\n\t\t\tvar element = $(this),\n\t\t\t\titemsCount = element.jcarousel('items').length,\n\t\t\t\twidth = element.innerWidth();\n\n\t\t\tif (width >= 1024) {\n\t\t\t if (element.parents('.cbp-recommendations').length) {\n width = width / 3;\n } else {\n width = width / 5;\n }\n\t\t\t} else if (width > 800){\n if (element.parents('.cbp-recommendations').length) {\n width = width / 3;\n } else {\n width = width / 4;\n }\n\t\t\t} else if (width > 480) {\n\t\t\t\twidth = width / 2;\n\t\t\t}\n\t\t\telement.jcarousel('items').css('width', Math.ceil(width) + 'px');\n\t\t\tlazyLoading.init();\n\t\t\tlazyload.init();\n\t\t})\n\t\t.jcarousel({\n\t\t\twrap: 'circular'\n\t\t}).jcarouselSwipe();\n\t\n\t$('.product-slider .product-slider-control--prev')\n\t\t.on('jcarouselcontrol:active', function() {\n\t\t\t$(this).removeClass('is-inactive');\n\t\t})\n\t\t.on('jcarouselcontrol:inactive', function() {\n\t\t\t$(this).addClass('is-inactive');\n\t\t})\n\t\t.jcarouselControl({\n\t\t\ttarget: '-=1'\n\t\t});\n\t\n\t$('.product-slider .product-slider-control--next')\n\t\t.on('jcarouselcontrol:active', function() {\n\t\t\t$(this).removeClass('is-inactive');\n\t\t})\n\t\t.on('jcarouselcontrol:inactive', function() {\n\t\t\t$(this).addClass('is-inactive');\n\t\t})\n\t\t.jcarouselControl({\n\t\t\ttarget: '+=1'\n\t\t});\n\t$('.product-slider .product-slider-pagination')\n\t\t.on('jcarouselpagination:active', 'a', function () {\n\t\t\tlazyload.init();\n\t\t\t$(this).addClass('is-active');\n\t\t})\n\t\t.on('jcarouselpagination:inactive', 'a', function () {\n\t\t\t$(this).removeClass('is-active');\n\t\t})\n\t\t.jcarouselPagination({\n\t\t\titem: function (page) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t});\n}\n\nexports.initProductSlider = initProductSlider;\n\n\n},{\"../../lazyLoading\":20,\"../../lazyload\":21,\"../../progress\":56,\"../../util\":69}],45:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('../../ajax'),\n\tutil = require('../../util');\n\n/**\n * @description loads product's navigation\n **/\nmodule.exports = function () {\n\tvar $pidInput = $('.pdpForm input[name=\"pid\"]').last(),\n\t\t$navContainer = $('#product-nav-container');\n\t// if no hash exists, or no pid exists, or nav container does not exist, return\n\tif (window.location.hash.length <= 1 || $pidInput.length === 0 || $navContainer.length === 0) {\n\t\treturn;\n\t}\n\n\tvar pid = $pidInput.val(),\n\t\thash = window.location.hash.substr(1),\n\t\turl = util.appendParamToURL(Urls.productNav + '?' + hash, 'pid', pid);\n\n\tajax.load({\n\t\turl: url,\n\t\ttarget: $navContainer\n\t});\n};\n\n},{\"../../ajax\":3,\"../../util\":69}],46:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('../../ajax'),\n\ttooltip = require('../../tooltip'),\n\tutil = require('../../util');\n\nmodule.exports = function () {\n\tvar $addToCart = $('#add-to-cart'),\n\t\t$addAllToCart = $('#add-all-to-cart'),\n\t\t$productSetList = $('#product-set-list');\n\n var updateVariantsID = function () {\n $('.product-set-item').each(function() {\n var $productSetItem = $(this).closest('.product-set-item');\n var newID = $productSetItem.find('.product-number span').data('id');\n $productSetItem.attr('id', `item-${newID}`).attr('data-product-id', newID);\n });\n }\n\n\tvar updateAddToCartButtons = function () {\n if ($productSetList.find('.add-to-cart').length > 0) {\n $addAllToCart.removeAttr('disabled');\n $addToCart.removeAttr('disabled');\n } else {\n\t\t\t$addAllToCart.attr('disabled', 'disabled');\n\t\t\t// product set does not have an add-to-cart button, but product bundle does\n\t\t\t$addToCart.attr('disabled', 'disabled');\n\t\t}\n\t};\n\n var updateTotalSetPrice = function () {\n var $selectedItemsPrice = $('.selected-items-total');\n var $products = $productSetList.find('.product-set-item');\n var selectedProductsID = [];\n\n for (let i = 0; i < $products.length; i++) {\n const $product = $($products[i]);\n if ($product.find('.product-variations').find('.swatch-item-size.selected').length > 0) {\n selectedProductsID.push($product.attr('data-product-id'));\n }\n }\n\n var url = Urls.getSetItemsPrice;\n url = util.appendParamToURL(url, 'products', JSON.stringify(selectedProductsID));\n ajax.load({\n url: url,\n target: $selectedItemsPrice,\n callback: function() {\n if ($selectedItemsPrice.find('.selected-items-total-inner').data('selected-products-id').length > 0) {\n $selectedItemsPrice.removeClass('visually-hidden');\n } else {\n $selectedItemsPrice.addClass('visually-hidden');\n }\n }\n })\n }\n\n\tif ($productSetList.length > 0) {\n\t\tupdateAddToCartButtons();\n\t}\n\t// click on swatch for product set\n\t$productSetList.on('click', '.product-set-item .swatchanchor', function (e) {\n\t\te.preventDefault();\n var url = Urls.getSetItem + this.search;\n\t\tvar $container = $(this).closest('.product-set-item');\n\t\tvar qty = $container.find('form input[name=\"Quantity\"]').first().val();\n\n\t\tajax.load({\n\t\t\turl: util.appendParamToURL(url, 'Quantity', isNaN(qty) ? '1' : qty),\n\t\t\ttarget: $container,\n\t\t\tcallback: function () {\n updateVariantsID();\n\t\t\t\tupdateAddToCartButtons();\n updateTotalSetPrice();\n\t\t\t\ttooltip.init();\n\t\t\t}\n\t\t});\n\t});\n};\n\n},{\"../../ajax\":3,\"../../tooltip\":68,\"../../util\":69}],47:[function(require,module,exports){\n'use strict';\n\nvar util = require('../../util');\n\n/**\n * @description Creates product recommendation carousel using jQuery jcarousel plugin\n **/\nmodule.exports = function () {\n\tvar $carousel = $('.product-slider');\n\tif (!$carousel || $carousel.length === 0 || $carousel.children().length === 0) {\n\t\treturn;\n\t}\n\t$carousel.jcarousel().jcarouselSwipe();\n\t$('#carousel-recommendations .jcarousel-prev')\n\t\t.on('jcarouselcontrol:active', function () {\n\t\t\t$(this).removeClass('inactive');\n\t\t})\n\t\t.on('jcarouselcontrol:inactive', function () {\n\t\t\t$(this).addClass('inactive');\n\t\t})\n\t\t.jcarouselControl({\n\t\t\ttarget: '-=1'\n\t\t});\n\n\t$('#carousel-recommendations .jcarousel-next')\n\t\t.on('jcarouselcontrol:active', function () {\n\t\t\t$(this).removeClass('inactive');\n\t\t})\n\t\t.on('jcarouselcontrol:inactive', function () {\n\t\t\t$(this).addClass('inactive');\n\t\t})\n\t\t.jcarouselControl({\n\t\t\ttarget: '+=1'\n\t\t});\n};\n\n},{\"../../util\":69}],48:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('../../ajax'),\n\timage = require('./image'),\n\tprogress = require('../../progress'),\n\tproductStoreInventory = require('../../storeinventory/product'),\n\tproductSlider = require('./product-slider'),\n\ttooltip = require('../../tooltip'),\n\tsizeproduct = require('../../sizeproduct'),\n\tgtmtool = require('../../googledatatag.js'),\n\tutil = require('../../util');\n\n/**\n * We replace recommendations like dw make it for images, it allow us to refresh product recommendations by variation group\n * */\n\nfunction updateRecommendations() {\n\tvar $newRecommendations = $('#update-recommendations');\n\tif ($newRecommendations && $newRecommendations.length > 0) {\n\t\t$('#cross-selling-products').html($newRecommendations.html());\n\t\t$newRecommendations.remove();\n\t}\n}\n\n/**\n * Replace product infos\n * */\nfunction updateProductInfos() {\n\tvar $newProductInfos = $('#update-productinfos');\n\tif ($newProductInfos && $newProductInfos.length > 0) {\n\t\t$('.product-infos').html($newProductInfos.html());\n\t\t$newProductInfos.remove();\n\t}\n}\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,tabStatus) {\n\tvar $pdpForm = $('.pdpForm');\n\tvar qty = $pdpForm.find('input[name=\"Quantity\"]').first().val();\n\tvar params = {\n\t\tQuantity: isNaN(qty) ? '1' : qty,\n\t\tformat: 'ajax',\n\t\tproductlistid: $pdpForm.find('input[name=\"productlistid\"]').first().val()\n\t};\n\n\tprogress.show($('#pdpMain'));\n\n\tajax.load({\n\t\turl: util.appendParamsToUrl(href, params),\n\t\ttarget: $('#product-content'),\n\t\tcallback: function () {\n\t\t\tif (SitePreferences.STORE_PICKUP) {\n\t\t\t\tproductStoreInventory.init();\n\t\t\t}\n\t\t\tupdatePriceForMobile();\n\t\t\timage.replaceImages();\n\t\t\timage.initPlayer();\n\t\t\tupdateRecommendations();\n\t\t\tproductSlider.initProductSlider();\n\t\t\ttooltip.init();\n\t\t\tsizeproduct.init(tabStatus);\n\t\t\tupdateProductInfos();\n\t\t}\n\t});\n};\n\n/**\n * @function\n * @description Due to responsive problems, we have to replace mobile \n * displayed price by new displayed price returned with Product-Variation\n * */\nfunction updatePriceForMobile() {\n\tif ($('.product-set-item').length > 1) {\n\t\t$('.product-set-item').each(function() {\n\t\t\t$(this).find('.product-detail.on-mobile .product-price').html($(this).find('.product-set-content .product-price').html())\n\t\t});\n\t} else {\n\t\t$('.product-detail.on-mobile .product-price').html($('.product-detail-content .product-price').html());\n\t}\n}\n\nmodule.exports = function () {\n\tvar $pdpMain = $('#pdpMain');\n\t// hover on swatch - should update main image with swatch image\n\t$pdpMain.on('mouseenter mouseleave', '.swatchanchor', function () {\n\t\tvar largeImg = $(this).data('lgimg'),\n\t\t\t$imgZoom = $pdpMain.find('.main-image'),\n\t\t\t$mainImage = $pdpMain.find('.primary-image');\n\n\t\tif (!largeImg) { return; }\n\t\t// store the old data from main image for mouseleave handler\n\t\t$(this).data('lgimg', {\n\t\t\thires: $imgZoom.attr('href'),\n\t\t\turl: $mainImage.attr('src'),\n\t\t\talt: $mainImage.attr('alt'),\n\t\t\ttitle: $mainImage.attr('title')\n\t\t});\n\t\t// set the main image\n\t\timage.setMainImage(largeImg);\n\t});\n\n\t// click on swatch - should replace product content with new variant\n\t$pdpMain.on('click', '.product-detail .swatchanchor', function (e) {\n\t\te.preventDefault();\n\t\tif($('#product-video').is(\":visible\")){\n\t\t\tif(util.isMobile() || util.isMobileSize){\n\t\t\t\t$(\".product-thumbnails-radiobutton.is-active\").trigger(\"click\");\n\t\t\t}else{\n\t\t\t\t$(\".thumbnail-link:first\").trigger(\"click\");\n\t\t\t}\n\t\t}\n\t\tvar $parentLi = $(this).parents('li');\n\t\tvar tabStatus = 0;\n\n\t\tif ($parentLi.hasClass('selected')) {\n\t\t\treturn;\n\t\t}\n\t\tif($('.size-selector-tab').find('.active').length > 0){\n\t\t\tvar sizeSelectActive = $('.size-selector-tab').find('.active').attr('class');\n\t\t\tvar twoSize = $('.size-selector-tab-two').attr('class');\n\t\t\ttabStatus = sizeSelectActive.includes(twoSize) ? 2 : 1;\n\t\t}\n\t\tupdateContent(this.href, tabStatus);\n\t\tif(e.target.classList.contains('swatch-link-size')){\n\t\t\tgtmtool.selectProductSize(e.target)\n\t\t}\n\t});\n\n\t// change drop down variation attribute - should replace product content with new variant\n\t$pdpMain.on('change', '.variation-select', function () {\n\t\tif ($(this).val().length === 0) { return; }\n\t\tupdateContent($(this).val(),0);\n\t});\n};\n\n},{\"../../ajax\":3,\"../../googledatatag.js\":15,\"../../progress\":56,\"../../sizeproduct\":63,\"../../storeinventory/product\":65,\"../../tooltip\":68,\"../../util\":69,\"./image\":41,\"./product-slider\":44}],49:[function(require,module,exports){\n'use strict';\n\nvar addProductToCart = require('./product/addToCart'),\n\tajax = require('../ajax'),\n\tquickview = require('../quickview'),\n\tutil = require('../util');\n\n/**\n * @function\n * @description Loads address details to a given address and fills the address form\n * @param {String} addressID The ID of the address to which data will be loaded\n */\nfunction populateForm(addressID, $form) {\n\t// load address details\n\tvar url = Urls.giftRegAdd + addressID;\n\tajax.getJson({\n\t\turl: url,\n\t\tcallback: function (data) {\n\t\t\tif (!data || !data.address) {\n\t\t\t\twindow.alert(Resources.REG_ADDR_ERROR);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// fill the form\n\t\t\t$form.find('[name$=\"_addressid\"]').val(data.address.ID);\n\t\t\t$form.find('[name$=\"_firstname\"]').val(data.address.firstName);\n\t\t\t$form.find('[name$=\"_lastname\"]').val(data.address.lastName);\n\t\t\t$form.find('[name$=\"_address1\"]').val(data.address.address1);\n\t\t\t$form.find('[name$=\"_address2\"]').val(data.address.address2);\n\t\t\t$form.find('[name$=\"_city\"]').val(data.address.city);\n\t\t\t$form.find('[name$=\"_country\"]').val(data.address.countryCode).trigger('change');\n\t\t\t$form.find('[name$=\"_postal\"]').val(data.address.postalCode);\n\t\t\t$form.find('[name$=\"_state\"]').val(data.address.stateCode);\n\t\t\t$form.find('[name$=\"_phone\"]').val(data.address.phone);\n\t\t\t// $form.parent('form').validate().form();\n\t\t}\n\t});\n}\n\n/**\n * @private\n * @function\n * @description Initializes events for the gift registration\n */\nfunction initializeEvents() {\n\tvar $eventAddressForm = $('form[name$=\"_giftregistry\"]'),\n\t\t$beforeAddress = $eventAddressForm.find('fieldset[name=\"address-before\"]'),\n\t\t$afterAddress = $eventAddressForm.find('fieldset[name=\"address-after\"]');\n\n\t$('.usepreevent').on('click', function () {\n\t\t// filter out storefront toolkit\n\t\t$(':input', $beforeAddress).not('[id^=\"ext\"]').not('select[name$=\"_addressBeforeList\"]').each(function () {\n\t\t\tvar fieldName = $(this).attr('name'),\n\t\t\t\t$afterField = $afterAddress.find('[name=\"' + fieldName.replace('Before', 'After') + '\"]');\n\t\t\t$afterField.val($(this).val()).trigger('change');\n\t\t});\n\t});\n\t$eventAddressForm.on('change', 'select[name$=\"_addressBeforeList\"]', function () {\n\t\tvar addressID = $(this).val();\n\t\tif (addressID.length === 0) { return; }\n\t\tpopulateForm(addressID, $beforeAddress);\n\t})\n\t.on('change', 'select[name$=\"_addressAfterList\"]', function () {\n\t\tvar addressID = $(this).val();\n\t\tif (addressID.length === 0) { return; }\n\t\tpopulateForm(addressID, $afterAddress);\n\t});\n\n\t$('form[name$=\"_giftregistry_items\"]').on('click', '.item-details a', function (e) {\n\t\te.preventDefault();\n\t\tvar productListID = $('input[name=productListID]').val();\n\t\tquickview.show({\n\t\t\turl: e.target.href,\n\t\t\tsource: 'giftregistry',\n\t\t\tproductlistid: productListID\n\t\t});\n\t});\n}\n\nexports.init = function () {\n\tinitializeEvents();\n\taddProductToCart();\n\n\tutil.setDeleteConfirmation('.item-list', String.format(Resources.CONFIRM_DELETE, Resources.TITLE_GIFTREGISTRY));\n};\n\n},{\"../ajax\":3,\"../quickview\":58,\"../util\":69,\"./product/addToCart\":38}],50:[function(require,module,exports){\n'use strict';\n\nvar pushbanner = require('../pushbanner'),\n compareWidget = require('../compare-widget'),\n\tproductTile = require('../product-tile'),\n inspirationContent = require('../inspiration-content'),\n\tprogress = require('../progress'),\n\tgtmtool = require('../googledatatag.js'),\n\tstorelocator = require('../storelocator'),\n\tlazyload = require('../lazyload'),\n\tlazyLoading = require('../lazyLoading'),\n\tproductSliderRecomm = require('./product/product-slider-recomm'),\n\tutil = require('../util'),\n\t_ = require('lodash');\n\nfunction stickyFilters() {\n\tvar $filterContainer = $('.grid-wrapper:not(.hidden-refinements) .search-result-refinements');\n\t$filterContainer.stickySidebar({\n\t\tcontainerSelector: '.grid-wrapper',\n\t\tinnerWrapperSelector: '.search-result-refinements-inner',\n\t\ttopSpacing: function() {\n\t\t\treturn $(\".header-sticky\").outerHeight();\n\t\t},\n\t\tstickyClass: 'is-affixed',\n\t\tbottomSpacing: 20,\n\t\tresizeSensor: true\n\t});\n}\n\nfunction infiniteScroll(event,ignorePlaceHolder) {\n\t// getting the hidden div, which is the placeholder for the next page\n\tvar loadingPlaceHolder = $('.infinite-scroll-placeholder[data-loading-state=\"unloaded\"]');\n\t// get url hidden in DOM\n\tvar gridUrl = loadingPlaceHolder.attr('data-grid-url');\n\tvar gridUrlPage = loadingPlaceHolder.attr('data-grid-page');\n\tvar gridUrlName = loadingPlaceHolder.attr('data-grid-name');\n\tvar gridUrlNum = loadingPlaceHolder.attr('data-grid-num');\n\t\n\tif (loadingPlaceHolder.length === 1 && (ignorePlaceHolder || util.elementInViewport(loadingPlaceHolder.get(0), 250)) ) {\n\t\t// switch state to 'loading'\n\t\t// - switches state, so the above selector is only matching once\n\t\t// - shows loading indicator\n\t\tloadingPlaceHolder.attr('data-loading-state', 'loading');\n\t\tloadingPlaceHolder.addClass('infinite-scroll-loading');\n\n\n\t\t// named wrapper function, which can either be called, if cache is hit, or ajax repsonse is received\n\t\tvar fillEndlessScrollChunk = function (html) {\n\t\t\tloadingPlaceHolder.removeClass('infinite-scroll-loading');\n\t\t\tloadingPlaceHolder.attr('data-loading-state', 'loaded');\n\t\t\t$('div.search-result-content').append(html);\n\t\t\tlazyLoading.init();\n\t\t\tlazyload.init();\n\t\t\tsetTimeout(function () {\n var $filterContainer = $('.grid-wrapper:not(.hidden-refinements) .search-result-refinements');\n\t\t\t\t$filterContainer.stickySidebar('updateSticky');\n\t\t\t}, 500);\n\n\t\t};\n\n\t\t// old condition for caching was `'sessionStorage' in window && sessionStorage[\"scroll-cache_\" + gridUrl]`\n\t\t// it was removed to temporarily address RAP-2649\n\t\tif (false) {\n\t\t\t// if we hit the cache\n\t\t\tfillEndlessScrollChunk(sessionStorage['scroll-cache_' + gridUrl]);\n\t\t} else {\n\t\t\t// else do query via ajax\n\t\t\t$.ajax({\n\t\t\t\ttype: 'GET',\n\t\t\t\tdataType: 'html',\n\t\t\t\turl: gridUrl,\n\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t// google tag manager, push infinite scroll in datalayer\n\t\t\t\t\tgtmtool.infiniteScrollSeeMoreClick();\n\t\t\t\t\t\n\t\t\t\t\t// put response into cache\n\t\t\t\t\ttry {\n\t\t\t\t\t\tsessionStorage['scroll-cache_' + gridUrl] = response;\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// nothing to catch in case of out of memory of session storage\n\t\t\t\t\t\t// it will fall back to load via ajax\n\t\t\t\t\t}\n\t\t\t\t\t// update UI\n\t\t\t\t\tfillEndlessScrollChunk(response);\n $(window).trigger('productGridUpdated');\n\t\t\t\t\t\n\t\t\t\t\t//init product positions\n\t\t\t\t\tutil.initializeProductPositions();\n\t\t\t\t\t\n\t\t\t\t\t// GTM ecommerce measure product impressions\n\t\t\t\t\tgtmtool.measureProductImpressions($('.grid-tile:not([data-count])'));\n\t\t\t\t\t\n\t\t\t\t\tif(window.location.hash){\n\t\t\t\t\t\tfindLastVisitedProduct();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * @private\n * @function\n * @description Restore search result content grid layout\n*/\nfunction restoreGridLayout() {\n var gridLayout;\n try {\n gridLayout = JSON.parse(sessionStorage.getItem('plp_grid_layout'));\n } catch(e) {\n console.error(e);\n return;\n }\n\n let objIsValid = gridLayout !== null && gridLayout.hasOwnProperty('activeGridBtn') && gridLayout.hasOwnProperty('class');\n if (!window.pageContext.ns === 'search' || !objIsValid) {\n return;\n }\n $('.search-result-content').attr('class', gridLayout.class);\n $('.grid-layout-switcher button').removeClass('active');\n $(`#${gridLayout.activeGridBtn}`).addClass('active');\n}\n\n/**\n * @private\n * @function\n * @description replaces breadcrumbs, lefthand nav and product listing with ajax and puts a loading indicator over the product listing\n */\nfunction updateProductListing(url) {\n\tif (!url || url === window.location.href) {\n\t\treturn;\n\t}\n \n\tprogress.show($('.search-result-content'));\n sessionStorage.setItem('plp_grid_layout', JSON.stringify({\n class: $('.search-result-content').attr('class'),\n activeGridBtn: $('.grid-layout-switcher').find('.active').attr('id')\n }));\n\t$('#main').load(util.appendParamToURL(url, 'format', 'ajax'), function () {\n\t\tcompareWidget.init();\n\t\tproductTile.init();\n\t\tlazyLoading.init();\n restoreGridLayout();\n\t\tprogress.hide();\n\t\thistory.pushState(undefined, '', url);\n\t\t//Reactivate sticky filters on grid reload\n\t\tcreatePriceSlider();\n\t\tstickyFilters();\n\t\t$(document).trigger('refinements:after-reload');\n\t});\n}\n\nfunction createPriceSlider() {\n\tvar $slider = $('#price-slider');\n\tif (window.matchMedia('(min-width: 1024px)').matches && $slider.length) {\n\t\tvar prices = $slider.data('prices');\n\t\tvar keys = [];\n\n\t\tfor (var number in prices) {\n\t\t\tif (prices.hasOwnProperty(number)) {\n\t\t\t\tkeys.push(number)\n\t\t\t}\n\t\t}\n\t\tvar value = $slider.data('selectedPriceIndex') || 0;\n\n\t\t$(\"#price-slider\").slider({\n\t\t\tmin: 0,\n\t\t\tmax: keys.length - 1,\n\t\t\tstep: 1,\n\t\t\tvalue: value,\n\t\t\tslide: function (event, ui) {\n\t\t\t\t$('#price-value').text(prices[ui.value].name);\n\t\t\t},\n\t\t\tstop: function (event, ui) {\n\t\t\t\tif (value !== ui.value) {\n\t\t\t\t\tif (ui.value === 0) {\n\t\t\t\t\t\t$('.clear-price a').trigger('click');\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$('.refinement-link--price[data-value=\"' + prices[ui.value].value + '\"]').trigger('click');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n}\n\n/**\n * @private\n * @function\n * @description Initializes events for the following elements:
        \n *

        refinement blocks

        \n *

        updating grid: refinements, pagination, breadcrumb

        \n *

        item click

        \n *

        sorting changes

        \n */\nfunction initializeEvents() {\n\tvar $main = $('#main');\n\t// compare checked\n\t$main.on('click', 'input[type=\"checkbox\"].compare-check', function () {\n\t\tvar cb = $(this);\n\t\tvar tile = cb.closest('.product-tile');\n\n\t\tvar func = this.checked ? compareWidget.addProduct : compareWidget.removeProduct;\n\t\tvar itemImg = tile.find('.product-image a img').first();\n\t\tfunc({\n\t\t\titemid: tile.data('itemid'),\n\t\t\tuuid: tile[0].id,\n\t\t\timg: itemImg,\n\t\t\tcb: cb\n\t\t});\n\n\t});\n\n\t// Store locator search\n\tvar $map = $('#map');\n\tif ($map.length > 0) {\n\t\tstorelocator.init();\n\t}\n\n\t// Toggle refinement main bar on mobile\n\t$main.on('click', '.refinement-titlehead', function() {\n\t\t$(this).next('.refinement-group').toggleClass('is-expanded');\n\t\t$(this).find('i').toggleClass('icon-arrowdown icon-arrowup');\n\t});\n\n\t// handle toggle refinement category blocks\n\t$main.on('click', '.refinement h3', function () {\n\t\t$(this).toggleClass('is-expanded');\n\n\t\tvar $valueContainer = $(this).siblings('.refinement-value-container');\n\t\t$valueContainer.slideToggle();\n\t\t\n\t\t$(this).find('i').toggleClass('icon-arrowdown icon-arrowup');\n\t});\n\n\tvar resetAllRefinementGroups = function () {\n\t\tif (window.innerWidth < 1024) {\n\t\t\t$('.refinement-group .refinement h3.refinement-title.is-expanded').trigger('click');\n\t\t}\n\t}\n\tresetAllRefinementGroups();\n\t$(window).on('resize', _.debounce(resetAllRefinementGroups, 200));\n\t\n\t// handle toggle refinement category blocks on the inspiration page\n\t$main.on('click', '.hidden-refinements .refinement h3', function () {\n\t\tif (window.innerWidth >= 1024) {\n\t\t\t$(this).siblings('.refinement-value-container').slideToggle();\n\t\t}\n\t\t$(this).find('i').toggleClass('icon-arrowdown icon-arrowup');\n\t});\n\n\t// handle events for updating grid\n\t$main.on('click', '.refinements a, .refinement-item a, .pagination a, .breadcrumb-refinement-value a', function (e) {\n\t\t// don't intercept for category and folder refinements, as well as unselectable\n\t\tif ($(this).parents('.category-refinement').length > 0 || $(this).parents('.folder-refinement').length > 0 || $(this).parent().hasClass('unselectable')) {\n\t\t\treturn;\n\t\t}\n\t\te.preventDefault();\n\t\tupdateProductListing(this.href);\n\t});\n\n\t// google tag manager event for filtering\n\t$main.on('click', '.refinement-item a', function (e) {\n\t\t gtmtool.productListFilteringClick($(this));\n\t});\n\n\t// handle events item click. append params.\n\t$main.on('click', '.product-tile a:not(\"#quickviewbutton\")', function () {\n\t\tvar a = $(this);\n\t\t// get current page refinement values\n\t\tvar wl = window.location;\n\n\t\tvar qsParams = (wl.search.length > 1) ? util.getQueryStringParams(wl.search.substr(1)) : {};\n\t\tvar hashParams = (wl.hash.length > 1) ? util.getQueryStringParams(wl.hash.substr(1)) : {};\n\n\t\t// merge hash params with querystring params\n\t\tvar params = $.extend(hashParams, qsParams);\n\t\tif (!params.start) {\n\t\t\tparams.start = 0;\n\t\t}\n\t\t// get the index of the selected item and save as start parameter\n\t\tvar tile = a.closest('.product-tile');\n\t\tvar idx = tile.data('idx') ? + tile.data('idx') : 0;\n\n\t\t// convert params.start to integer and add index\n\t\tparams.start = (+params.start) + (idx + 1);\n\t\t// set the hash and allow normal action to continue\n\t\ta[0].hash = $.param(params);\n\t\tgtmtool.openProductDetailsClick($(this));\n\n\t\tif(SitePreferences.LISTING_INFINITE_SCROLL && $('.pagination').children().length == 0){\n\t\t\tvar pid = $(this).parents('.product-tile').data('itemid');\n\t\t\twindow.location.hash += (window.location.hash != '') ? '&lvpid=' + pid : 'lvpid=' + pid;\n\t\t}\n\t});\n\n\t$main.on('click', '.search-results-content a', function () {\n\t\tgtmtool.searchResultClick($(this));\n\t});\n\n restoreGridLayout();\n\t// handle grid layout change\n\tvar gridLayout1x4Class = 'product-listing-1x4';\n var saveGridLayout = function() {\n sessionStorage.setItem('plp_grid_layout', JSON.stringify({\n class: $('.search-result-content').attr('class'),\n activeGridBtn: $('.grid-layout-switcher').find('.active').attr('id')\n }));\n };\n\t$main.on('click', '#btn-grid-1x2', function () {\n\t\tif ($('.search-result-content').hasClass(gridLayout1x4Class)) {\n\t\t\t$.when($('.search-result-content').fadeOut(250)).done(function() {\n\t\t\t\t$('.search-result-content').removeClass(gridLayout1x4Class);\n\t\t\t\t$('#btn-grid-1x2').addClass('active');\n\t\t\t\t$('#btn-grid-1x4').removeClass('active');\n\t\t\t\t$('.search-result-content').fadeIn(250);\n saveGridLayout();\n\t\t\t});\n\t\t}\n\t}).on('click', '#btn-grid-1x4', function () {\n\t\tif (!$('.search-result-content').hasClass(gridLayout1x4Class)) {\n\t\t\t$.when($('.search-result-content').fadeOut(250)).done(function() {\n\t\t\t\t$('.search-result-content').addClass(gridLayout1x4Class);\n\t\t\t\t$('#btn-grid-1x2').removeClass('active');\n\t\t\t\t$('#btn-grid-1x4').addClass('active');\n\t\t\t\t$('.search-result-content').fadeIn(250);\n saveGridLayout();\n\t\t\t});\n\t\t}\n\t});\n\n\t// handle sorting change\n\t$main.on('change', '.sort-by select', function (e) {\n\t\te.preventDefault();\n\t\tupdateProductListing($(this).find('option:selected').val());\n\n // Datalayer event\n var products = [];\n $('.search-result-items .grid-tile').each(function(_i, tile) {\n let newProductObj = $(tile).data('product');\n newProductObj.color = $('.search-result-items .grid-tile').data('colors-to-show').toString().split(',')[0];\n newProductObj.size = $('.search-result-items .grid-tile').data('sizes-to-show').toString().split(',')[0];\n products.push(newProductObj);\n })\n var productsToPush = []\n var productSku = $('.swatch-item-size.selected').data('productean');\n for (let i = 0; i < products.length; i++) {\n var product = products[i];\n var productToPush = {};\n productToPush.id = product.id;\n productToPush.name = product.name;\n productToPush.list = 'product detail';\n productToPush.quantity = 1;\n productToPush.new_total_quantity = (parseInt($(`.mini-cart-product[data-product-id=${productSku}]`).data('qty')) || 0) + productToPush.quantity;\n productToPush.price = product.price;\n productToPush.color = product.color;\n productToPush.size = product.size;\n\n productsToPush.push(productToPush);\n }\n $(window).trigger('datalayer:push-event', {\n name: \"interaction\",\n data: {\n interaction_name: \"click: sort products\",\n interaction_details1: $(this).find('option:selected').data('sorting-option-id').toLowerCase(),\n products: productsToPush\n }\n })\n\t})\n\t.on('change', '.items-per-page select', function () {\n\t\tvar refineUrl = $(this).find('option:selected').val();\n\t\tif (refineUrl === 'INFINITE_SCROLL') {\n\t\t\t$('html').addClass('infinite-scroll').removeClass('disable-infinite-scroll');\n\t\t} else {\n\t\t\t$('html').addClass('disable-infinite-scroll').removeClass('infinite-scroll');\n\t\t\tupdateProductListing(refineUrl);\n\t\t}\n\t});\n\n\t$main.on('submit', '#search-more-content', function (e) {\n\t\te.preventDefault();\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\tdataType: 'html',\n\t\t\tdata: $(this).serialize(),\n\t\t\turl: util.ajaxUrl($(this).attr('action')),\n\t\t\tsuccess: function (response) {\n\t\t\t\t$('.search-results-content').html(response);\n\t\t\t}\n\t\t});\n\t});\n\n\t// GTM ecommerce measure product impressions\n\tgtmtool.measureProductImpressions($('.grid-tile:not([data-count])'));\n\n\t// load also infinite scroll if we need to scroll to last visited product (lvpid)\n\tif (location.hash) {\n\t\tvar hashParams = util.getQueryStringParams(window.location.hash.substr(1));\n\n\t\tif (hashParams['lvpid'] && history && 'scrollRestoration' in history) {\n\t\t\thistory.scrollRestoration = 'manual';\n\t\t}\n\n\t\tif(Object.keys(hashParams).length === 1 && hashParams['lvpid'])\n\t\t\tfindLastVisitedProduct();\n\t\telse\n\t\t\tupdateProductListing();\n\t}\n\n\tcreatePriceSlider();\n\t//Activate sticky filters on page load\n\tstickyFilters();\n\n\t//Handle sticky sidebar on window resize\n\t//We use debouncing to avoid calling the handler on each resize trigger\n\tfunction stickySidebarResizeHandler() {\n var $filterContainer = $('.grid-wrapper:not(.hidden-refinements) .search-result-refinements');\n\t\tif ($(window).width() >= 1024 && $('.grid-wrapper').hasClass('hidden-refinements')) {\n\t\t\t$filterContainer.stickySidebar('destroy');\n\t\t} else {\n\t\t\t$filterContainer.stickySidebar('initialize');\n\t\t\t$filterContainer.stickySidebar('updateSticky');\n\t\t}\n\t}\n\tvar stickySidebarResizeTimeout;\n\t$(window).on('resize', function () {\n\t\tclearTimeout(stickySidebarResizeTimeout);\n\t\tstickySidebarResizeTimeout = setTimeout(stickySidebarResizeHandler, 100);\n\t})\n}\n\nfunction findLastVisitedProduct(){\n\tvar hashParams = util.getQueryStringParams(window.location.hash.substr(1));\n\tif(hashParams['lvpid'] && SitePreferences.LISTING_INFINITE_SCROLL && $('.pagination').children().length == 0){\n\t\tvar loadingPlaceHolder = $('.infinite-scroll-placeholder[data-loading-state=\"unloaded\"]');\n\t\tvar productTilePlaceHolder = 'ul.search-result-items .product-tile[data-itemid=' + hashParams['lvpid'] + ']';\n\t\t//last visited product not found and products listing not complete\n\t\tif($(productTilePlaceHolder).length === 0 && loadingPlaceHolder.length === 1){\n\t\t\tinfiniteScroll(null,true);//no event, ignorePlaceHolder=true\n\t\t}\n\t\t//last visited product founded or products listing completely loaded\n\t\tif($(productTilePlaceHolder).length === 1 || loadingPlaceHolder.length === 0){\n\t\t\tif($(productTilePlaceHolder).length === 1){\n\t\t\t\tvar tileTop = $(productTilePlaceHolder).offset().top;\n\t\t\t\t$(document).scrollTop(tileTop);\n\t\t\t}\n\t\t\t//we remove 'lvpid' param from the hash\n\t\t\tif(Object.keys(hashParams).length > 1){\n\t\t\t\tvar hashP = 'lvpid=' + hashParams['lvpid'];\n\t\t\t\tvar newHash = window.location.hash.replace('&'+hashP, '').replace(hashP+'&', '').replace(hashP, '');\n\t\t\t\thistory.pushState(\"\", document.title, window.location.pathname + window.location.search + newHash);\n\t\t\t} else {\n\t\t\t\thistory.pushState(\"\", document.title, window.location.pathname + window.location.search);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @description Initialize some DOM elements on mobile\n */\nfunction initializeMobileView() {\n\tif (util.isTabletSize()) {\n\t\t// Change expanded indicator direction\n\t\t$('.refinement-title i').toggleClass('icon-arrowdown icon-arrowup');\n\t}\n}\n\nexports.init = function () {\n pushbanner.init();\n\tcompareWidget.init();\n\tif (SitePreferences.LISTING_INFINITE_SCROLL && [\"category\", \"search\"].includes(window.pageContext.type)) {\n\t\t$(window).on('scroll', infiniteScroll);\n\t}\n\t$('#push-close-btn').on('click', function (e) {\n\t\t$(e.target).parents('.wrapper-pushbanner').slideUp();\n\t})\n\t\n\t//init product positions\n\tutil.initializeProductPositions();\n\t\n\tproductTile.init();\n\tinitializeEvents();\n\tinitializeMobileView();\n\tproductSliderRecomm.init();\n inspirationContent.init();\n};\n\n},{\"../compare-widget\":5,\"../googledatatag.js\":15,\"../inspiration-content\":18,\"../lazyLoading\":20,\"../lazyload\":21,\"../product-tile\":55,\"../progress\":56,\"../pushbanner\":57,\"../storelocator\":66,\"../util\":69,\"./product/product-slider-recomm\":43,\"lodash\":78}],51:[function(require,module,exports){\n'use strict';\n\nvar cookie = require('../cookie'),\n\tutil = require('../util');\n\nexports.init = function () {\n\t$('#main').on('click', '.locale-select', function (e){\n\t\tvar target = $(this);\n\t\tcookie.setCookie('locale_url', target.data('locale') || null, Infinity, '/', '', false);\n\t});\n};\n},{\"../cookie\":6,\"../util\":69}],52:[function(require,module,exports){\n'use strict';\nvar pushbanner = require('../pushbanner'),\n cookie = require('../cookie'),\n\tdialog = require('../dialog'),\n gtmtool = require('../googledatatag.js'),\n util = require('../util'),\n\tproductTile = require('../product-tile'),\n\tproductSliderRecomm = require('./product/product-slider-recomm'),\n\tibanForm = require('../formiban'),\n _ = require('lodash');\n\nexports.init = function () {\n\tproductTile.init();\n\n //Pushbanner Carousel\n pushbanner.init();\n\n\t// Homepage slider configuration\n\t$('.wrapper-slider .home-slider, .header-usermenu-mobile .slider-ups-banner-only-mobile').on('jcarousel:create jcarousel:reload', function () {\n\t\t\tvar element = $(this),\n\t\t\twidth = element.innerWidth();\n\t\t\telement.jcarousel('items').css('width', Math.ceil(width) + 'px');\n\t\t})\n\n\t// Secondary Homepage Slider\n\t$('.wrapper-slider-secondary .home-slider').on('jcarousel:create jcarousel:reload', function () {\n\t\tvar element = $(this),\n\t\twidth = element.innerWidth();\n\t\tif (window.innerWidth >= 1024) {\n\t\t\twidth = width / 4;\n\t\t}\n\t\tif (window.innerWidth > 720 && window.innerWidth < 1024) {\n\t\t\twidth = width / 1.5;\n\t\t}\n\t\telement.jcarousel('items').css('width', Math.ceil(width) + 'px');\n\t});\n\t$(window).on('resize', function () {\n\t\tvar element = $('.wrapper-slider-secondary > .home-slider');\n\t\telement.jcarousel({\n\t\t\twrap: 'last',\n\t\t\tcenter: window.innerWidth < 1024\n\t\t})\n\t\t.jcarouselAutoscroll({\n\t\t\tinterval: 5000\n\t\t})\n\t\t.jcarouselSwipe();\n\t});\n\n\t$('.home-slider').jcarousel({\n\t\twrap: 'last',\n\t\tcenter: window.innerWidth < 1024\n\t});\n\n\t$('.wrapper-slider-secondary > .home-slider').jcarousel({\n\t\t\twrap: 'last',\n\t\t\tcenter: window.innerWidth < 1024\n\t\t})\n\t\t.jcarouselAutoscroll({\n\t\t\tinterval: 5000\n\t\t})\n\t\t.jcarouselSwipe();\n\tvar $mainHomeSlider = $('div:not(.wrapper-slider-secondary) > .home-slider');\n\t$mainHomeSlider.jcarousel({\n\t\t\twrap: 'last',\n\t\t\tcenter: window.innerWidth < 1024\n\t\t})\n\t\t.jcarouselSwipe();\n\tvar scrollTimeout;\n var updateHomeSliderVideoHeight = function () {\n $mainHomeSlider.find('.slider-video-container').css('height', '0px');\n $mainHomeSlider.find('.slider-video-container').css('height', $mainHomeSlider.find('.slider-slides').css('height'));\n }\n\tvar processCustomScrollEvent = function ($sliderTarget) {\n\t\tvar $homeSliderVideos = $mainHomeSlider.find('video');\n\t\tvar $selectedItemVideoEl = $sliderTarget.find('video');\n\t\tvar isVideoEl = $selectedItemVideoEl.length > 0;\n \n updateHomeSliderVideoHeight();\n\t\tif (isVideoEl) {\n\t\t\tclearTimeout(scrollTimeout);\n\t\t\t$homeSliderVideos.prop('currentTime', 0);\n\t\t\t$homeSliderVideos.trigger('play');\n\t\t\t$homeSliderVideos.off('ended');\n\t\t\t$selectedItemVideoEl.one('ended', function() {\n\t\t\t\t$mainHomeSlider.jcarousel('scroll', '+=1');\n\t\t\t});\n\t\t} else {\n\t\t\t$homeSliderVideos.trigger('pause');\n\t\t\tscrollTimeout = setTimeout(function () {\n\t\t\t\tif ($mainHomeSlider.jcarousel('target').find('video').length > 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$mainHomeSlider.jcarousel('scroll', '+=1');\n\t\t\t}, 5000);\n\t\t}\n\t}\n updateHomeSliderVideoHeight();\n $(window).on('resize', _.debounce(updateHomeSliderVideoHeight, 250));\n\t$mainHomeSlider.on('loaded', function () {\n\t\tprocessCustomScrollEvent($($mainHomeSlider.jcarousel('items')[0]));\n\t});\n\t$mainHomeSlider.on('jcarousel:targetin', 'li', function() {\n\t\tprocessCustomScrollEvent($(this));\n\t});\n\t$mainHomeSlider.trigger('loaded');\n\t$('.home-slider .slider-control--prev').jcarouselControl({\n\t\ttarget: '-=1'\n\t});\n\t$('.home-slider .slider-control--next').jcarouselControl({\n\t\ttarget: '+=1'\n\t});\n\t$('.home-slider .slider-pagination')\n\t\t.on('jcarouselpagination:active', 'a', function () {\n\t\t\t$(this).addClass('is-active');\n\t\t})\n\t\t.on('jcarouselpagination:inactive', 'a', function () {\n\t\t\t$(this).removeClass('is-active');\n\t\t})\n\t\t.jcarouselPagination({\n\t\t\titem: function (page) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t});\n\n\t// Homepage Slider UPS on mobile\n\t$('.header-usermenu-mobile .slider-ups-banner-only-mobile').jcarousel({\n\t\twrap: 'circular'\n\t})\n\t.jcarouselAutoscroll({\n\t\tinterval: 4000\n\t})\n\t.jcarouselSwipe();\n\t\n\t// Homepage product recommendation configuration\n\tvar $homePushProductSlider = $('.product-homepush .product-slider');\n\t$homePushProductSlider\n\t\t.jcarousel({\n\t\t\twrap: 'last'\n\t\t});\n\n\tif(util.isMobile()){\n\t\t$homePushProductSlider.jcarouselSwipe();\n\t}\n\t\n\t// GTM home banner click\n\t$('#wrapper').on('click', '.home-contentasset a', function () {\n gtmtool.homeBannerClick($(this));\n });\n \n\t// GTM initialize data products position in product slider\n\tutil.initializeProductPositions($('.product-homepush .product-tile'));\n\t\n\t// GTM home recommendation\n\t$('#wrapper').on('click', '.product-homepush a:not([class^=product-slider])', function (e) {\t\t\n\t\tgtmtool.openProductDetailsClick($(this));\n\t\tgtmtool.recommendationProductClick($(this));\n\t});\n\tvar $homepush = $('.product-homepush')[0];\n\t$(document).on('scroll.gtminviewevent', function (){\n\t\tif (util.elementInViewport($homepush)) {\n\t\t\tgtmtool.measureProductImpressions($('.grid-tile'), pageContext.analyticsProductType);\n\t\t\t$(document).off('scroll.gtminviewevent');\n\t\t}\n\t})\n\t\n\tif (window.SitePreferences.MULTILANG_SITE && !cookie.getCookie('locale_url')) {\n\t\t// dialog selection langue\n\t\tdialog.open({\n\t\t\turl: window.Urls.langSelectionDialog, \n\t\t\toptions : {\n\t\t\t\tdraggable : false,\n\t\t\t\tmodal: true,\n\t\t\t\tdialogClass : 'lang-select-dialog',\n\t\t\t\tresizable: false,\n\t\t\t\twidth: 300\n\t\t\t}\n\t\t});\n\t\t$('.ui-dialog-titlebar').remove();\n\t\t\n\t\t$('body').on('click', '.lang-select-content a', function () {\n\t\t\tvar target = $(this);\n\t\t\tsetLocaleCookie(target.data('locale'));\n\t\t\tdialog.close();\n\t\t});\n\t} else {\n\t\t// init cookie on load to prevent session scoped default\n\t\tvar localeCookie = cookie.getCookie('locale_url');\n\t\tif (localeCookie){\n\t\t\tsetLocaleCookie(localeCookie);\n\t\t} else {\n\t\t\tsetLocaleCookie(window.SitePreferences.CURRENT_LOCALE);\n\t\t}\n\t}\n\n\t// Init Einstein Recommandation Slider on the homepage.\n\tproductSliderRecomm.init();\n\t\n\t// Init Iban form\n\tibanForm.init();\n\n\t//Carousel for brands\n\t$('.homepage-brands-carousel').on('jcarousel:reload jcarousel:create', function () {\n\t\tvar carousel = $(this),\n\t\t\twidth = carousel.innerWidth(),\n\t\t\twindowWidth = $('body').width();\n\t\tif (windowWidth >= 1024) {\n\t\t\twidth = width / 4.4;\n\t\t} else if (windowWidth >= 768) {\n\t\t\twidth = width / 3;\n\t\t}\n\t\tcarousel.jcarousel('items').css('width', Math.ceil(width) + 'px');\n\t}).jcarousel({\n\t\titems: '.homepage-brand-item',\n\t\twrap: 'circular'\n\t}).jcarouselSwipe();\n\t$('.homepage-brands-control-prev').click(function(e) {\n\t\te.preventDefault();\n\t\t$('.homepage-brands-carousel').jcarousel('scroll', '-=1');\n\t});\n\n\t$('.homepage-brands-control-next').click(function(e) {\n\t\te.preventDefault();\n\t\t$('.homepage-brands-carousel').jcarousel('scroll', '+=1');\n\t});\n\t\n\t$('#push-close-btn').on('click', function (e) {\n\t\t$(e.target).parents('.wrapper-pushbanner').slideUp();\n\t})\n\t$('.homepage-brands-carousel .slider-pagination')\n\t\t.on('jcarouselpagination:active', 'a', function () {\n\t\t\t$(this).addClass('is-active');\n\t\t})\n\t\t.on('jcarouselpagination:inactive', 'a', function () {\n\t\t\t$(this).removeClass('is-active');\n\t\t})\n\t\t.jcarouselPagination({\n\t\t\titem: function (page) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t});\n};\n\nfunction setLocaleCookie(locale) {\n\tcookie.setCookie('locale_url', locale, Infinity, '/');\n\tcookie.setCookie('localeCookieCreationDate', decodeURIComponent(new Date().toUTCString()), Infinity, '/');\n}\n},{\"../cookie\":6,\"../dialog\":11,\"../formiban\":12,\"../googledatatag.js\":15,\"../product-tile\":55,\"../pushbanner\":57,\"../util\":69,\"./product/product-slider-recomm\":43,\"lodash\":78}],53:[function(require,module,exports){\n'use strict';\n\nvar storelocator = require('../storelocator.js');\nvar productSliderRecommendation = require('./product/product-slider-recomm');\n\nexports.init = function () {\n\tif (window.mapRessources) {\n\t\t// Event submitted on click on a map icon, submits research form to center map on result and make search on this point\n\t\tmapRessources.storeSelected = function(id, storeData) {\n\t\t\tif (window.mapRessources.context === 'storedetails') {\n\t\t\t\tstorelocator.map.setZoom(mapRessources.selectZoom);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar $storeList = $('#store-locator-container .results-list');\n\t\t\tif (storeData) {\n\t\t\t\tvar latitude = storeData.lat;\n\t\t\t\tvar longitude = storeData.lon;\n\t\t\t\tstorelocator.searchNearestPoint(latitude, longitude, null, $storeList);\t\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// initialize store locator map\n\t\n\tif (document.readyState == 'loaded' || document.readyState == 'complete') {\n\t\tstorelocator.init();\n\t} else {\n\t\t$(window).on('DOMContentLoaded', function () {\n\t\t\tstorelocator.init();\n\t\t});\n\t}\n\t\n\t// Switch tabs on desktop\n\t$('.store-tabs .store-tabs-links a').on('click', function(e) {\n\t\tvar currentAttrValue = $(this).attr('href');\n\t\t\n\t\t// Show/hide tabs\n\t\t$('.store-tab' + currentAttrValue).show().siblings().hide();\n\t\t\n\t\t// Change/remove current tab to active\n\t\t$(this).parent('li').addClass('isactive').siblings().removeClass('isactive');\n\t\te.preventDefault();\n\t});\n\n\t// Show hide accordion on mobile\n\t$('.store-tabs-content .store-accordion-links a').on('click', function(e) {\n\t\tvar currentAttrValue = $(this).attr('href');\n\t\t\n\t\t// Show/hide tabs\n\t\t$('.store-tab' + currentAttrValue).toggle().siblings('[id^=\"tabsStore\"]').hide();\n\t\t\n\t\t// Change/remove current tab to active\n\t\t$(this).parent().toggleClass('acc-active').siblings('.store-accordion-links').removeClass('acc-active');\n\t\t\n\t\te.preventDefault();\n\t});\n\t$('.store-locator').on('click', '.locate-store', function (e) {\n\t\t$('[id*=\"_storelocator_storeToSelect\"]').val($(this).parents('li').attr('itemid'));\n\t\tstorelocator.storeToSelect();\n\n\t\t// Add Css class to show/hide the store list on mobile\n\t\tif (window.matchMedia('(max-width: 1023px)').matches) {\n\t\t\t$('.store-locator').addClass('list-hidden');\n\t\t\t$('html, body').animate({scrollTop: 0}, 0);\n\t\t}\n\t});\n\n\t$('.store-locator-show').on('click', function () {\n\t\t$('.store-locator').removeClass('list-hidden');\n\t});\n\n\t// Toggle filter brands\n\t$('.store-locator-trigger-filter-brands').on('click', function() {\n\t\tlet filterBrands = $('.store-locator-filter-brands');\n\n\t\tif (filterBrands.is(':visible')) {\n\t\t\tfilterBrands.hide();\n\t\t\t$(\".store-locator-trigger-filter-brands .icon-arrowdown\").show();\n\t\t\t$(\".store-locator-trigger-filter-brands .icon-arrowup\").hide();\n\t\t} else {\n\t\t\tfilterBrands.show();\n\t\t\t$(\".store-locator-trigger-filter-brands .icon-arrowup\").show();\n\t\t\t$(\".store-locator-trigger-filter-brands .icon-arrowdown\").hide();\n\t\t}\n\t});\n\n\tproductSliderRecommendation.init();\n}\n},{\"../storelocator.js\":66,\"./product/product-slider-recomm\":43}],54:[function(require,module,exports){\n'use strict';\n\nvar addProductToCart = require('./product/addToCart'),\n\tpage = require('../page'),\n\tutil = require('../util');\n\nexports.init = function () {\n\t// wishlist add to cart events\n\taddProductToCart();\n\t$('#editAddress').on('change', function () {\n\t\tpage.redirect(util.appendParamToURL(Urls.wishlistAddress, 'AddressID', $(this).val()));\n\t});\n\n\t//add js logic to remove the , from the qty feild to pass regex expression on client side\n\t$('.option-quantity-desired input').on('focusout', function () {\n\t\t$(this).val($(this).val().replace(',', ''));\n\t});\n};\n\n},{\"../page\":23,\"../util\":69,\"./product/addToCart\":38}],55:[function(require,module,exports){\n'use strict';\n/**\n * @private\n * @function\n * @description Initializes events on the product-tile for the following elements:\n * - swatches\n * - thumbnails\n */\nfunction initializeEvents() {\n\tvar $main = $('#main');\n\tvar lazyload = require('./lazyload');\n\n\t$main.on('mouseenter', '.swatch-list .swatch', function (e) {\n\t\t// get current thumb details\n\t\tvar $tile = $(this).closest('.product-tile'),\n\t\t\t$thumb = $tile.find('.product-image .thumb-link img').eq(0),\n\t\t\tdata = $(this).find('img').data('replace-href');\n\t\t\n\t\t// Set the tile image to the value src provided on the swatch data attributes\n\t\tif(data != undefined){\n\t\t\t$thumb.attr('src', data);\n\t\t}\n\t});\n\t\n\t$main.on('mouseleave', '.swatch-list', function () {\n\t\t// Restore current thumb image\n\t\tvar $tile = $(this).closest('.product-tile'),\n\t\t$thumb = $tile.find('.product-image .thumb-link img').eq(0);\n\t\t$thumb.attr('src',$($thumb).data('current'));\n\t});\n\n\t// Get video information\n\tvar $tilevideo = $('[id^=tile-video-]');\n\n\tif ($tilevideo.length) {\n\n\t\t$tilevideo.each(function (index) {\n\t\t\t\n\t\t\t$(this).parents('.product-image').css('min-height', '0px');\n\n\t\t\tvar videoID = $(this).attr('rel');\n\t\t\tvar videoUrl = $(this).attr('data-video');\n\n\t\t\t// Changing Id to enable the user to use the same video on a page\n\t\t\t$(this).attr('id', 'tile-video-' + videoID + '-' + index);\n\n\t\t\tjwplayer('tile-video-' + videoID + '-' + index).setup({\n\t\t\t\t'mediaid': atob(videoID),\n\t\t\t\t'file': atob(videoUrl),\n\t\t\t\t'width': '100%',\n\t\t\t\t'height': '100%',\n\t\t\t\t'aspectratio': '9:16'\n\t\t\t});\n\t\t})\n\t\t\n\t}\n\t\n\t\n\t\n}\n\nexports.init = initializeEvents;\n\n},{\"./lazyload\":21}],56:[function(require,module,exports){\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\tvar target = (!container || $(container).length === 0) ? $('body') : $(container);\n\t$loader = $loader || $('.loader');\n\n\tif ($loader.length === 0) {\n\t\t$loader = $('
        ').addClass('loader')\n\t\t\t.append($('
        ').addClass('loader-indicator'), $('
        ').addClass('loader-bg'));\n\t}\n\treturn $loader.appendTo(target).show();\n};\n/**\n * @function\n * @description Hides an AJAX-loader\n */\nvar hide = function () {\n\tif ($loader) {\n\t\t$loader.hide();\n\t}\n};\n\nexports.show = show;\nexports.hide = hide;\n\n},{}],57:[function(require,module,exports){\n'use strict'\n\nvar _ = require('lodash');\n\n// Pushbanner carousel\nfunction init() {\n var $carousel = $('.pushbanner-carousel');\n var itemsNbr = $carousel.children().length;\n var itemIdx = 1;\n\n // If the carousel if not configured, do not proceed further\n if ($carousel.length === 0 || itemsNbr === 0) {\n return;\n }\n var carouselHeight = $carousel.children().get(itemIdx - 1).scrollHeight;\n $carousel.css('height', carouselHeight);\n var top = 0;\n\n var computeCarouselTop = function (itemIdx) {\n var result = 0;\n for (let i = 0; i < itemIdx - 1; i++) {\n result -= $($carousel.children()[i]).outerHeight();\n }\n return result;\n }\n\n if (itemsNbr > 1) {\n setInterval(function () {\n var carouselIsVisible =\n $(document).find($carousel).length > 0 &&\n $(window).scrollTop() <= $('#wrapper-pushbanner').position().top + $('#wrapper-pushbanner').outerHeight();\n if (!carouselIsVisible) {\n return;\n }\n\n // Compute active item index\n itemIdx += 1;\n if (itemIdx > itemsNbr) {\n itemIdx = 1;\n }\n var $nextItem = $($carousel.children()[itemIdx - 1]);\n $carousel.css('height', $nextItem.outerHeight());\n $carousel.children().removeClass('active');\n $nextItem.addClass('active');\n\n top = computeCarouselTop(itemIdx);\n $carousel.css('top', `${top}px`);\n }, 5000);\n\n $(window).on('resize', _.debounce(function () {\n var activeItem = $carousel.find('> li.active');\n $carousel.height(activeItem.outerHeight());\n top = computeCarouselTop(itemIdx);\n $carousel.css('top', `${top}px`);\n }, 200));\n }\n $carousel.css('visibility', 'visible');\n}\n\nexports.init = init;\n},{\"lodash\":78}],58:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('./dialog'),\n\tproduct = require('./pages/product'),\n\tutil = require('./util'),\n\t_ = require('lodash');\n\n\nvar makeUrl = function (url, source, productListID) {\n\tif (source) {\n\t\turl = util.appendParamToURL(url, 'source', source);\n\t}\n\tif (productListID) {\n\t\turl = util.appendParamToURL(url, 'productlistid', productListID);\n\t}\n\treturn url;\n};\n\nvar removeParam = function (url) {\n\tif (url.indexOf('?') !== -1) {\n\t\treturn url.substring(0, url.indexOf('?'));\n\t} else {\n\t\treturn url;\n\t}\n};\n\nvar quickview = {\n\tinit: function () {\n\t\tif (!this.exists()) {\n\t\t\tthis.$container = $('
        ').attr('id', 'QuickViewDialog').appendTo(document.body);\n\t\t}\n\t\tthis.productLinks = $('#search-result-items .thumb-link').map(function (index, thumbLink) {\n\t\t\treturn $(thumbLink).attr('href');\n\t\t});\n\t},\n\n\tsetup: function (qvUrl) {\n\t\tvar $btnNext = $('.quickview-next'),\n\t\t\t$btnPrev = $('.quickview-prev');\n\n\t\tproduct.initializeEvents();\n\n\t\tthis.productLinkIndex = _(this.productLinks).findIndex(function (url) {\n\t\t\treturn removeParam(url) === removeParam(qvUrl);\n\t\t});\n\n\t\t// hide the buttons on the compare page or when there are no other products\n\t\tif (this.productLinks.length <= 1 || $('.compareremovecell').length > 0) {\n\t\t\t$btnNext.hide();\n\t\t\t$btnPrev.hide();\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.productLinkIndex === this.productLinks.length - 1) {\n\t\t\t$btnNext.attr('disabled', 'disabled');\n\t\t}\n\t\tif (this.productLinkIndex === 0) {\n\t\t\t$btnPrev.attr('disabled', 'disabled');\n\t\t}\n\n\t\t$btnNext.on('click', function (e) {\n\t\t\te.preventDefault();\n\t\t\tthis.navigateQuickview(1);\n\t\t}.bind(this));\n\t\t$btnPrev.on('click', function (e) {\n\t\t\te.preventDefault();\n\t\t\tthis.navigateQuickview(-1);\n\t\t}.bind(this));\n\t},\n\n\t/**\n\t * @param {Number} step - How many products away from current product to navigate to. Negative number means navigate backward\n\t */\n\tnavigateQuickview: function (step) {\n\t\t// default step to 0\n\t\tthis.productLinkIndex += (step ? step : 0);\n\t\tvar url = makeUrl(this.productLinks[this.productLinkIndex], 'quickview');\n\t\tdialog.replace({\n\t\t\turl: url,\n\t\t\tcallback: this.setup.bind(this, url)\n\t\t});\n\t},\n\n\t/**\n\t * @description show quick view dialog\n\t * @param {Object} options\n\t * @param {String} options.url - url of the product details\n\t * @param {String} options.source - source of the dialog to be appended to URL\n\t * @param {String} options.productlistid - to be appended to URL\n\t * @param {Function} options.callback - callback once the dialog is opened\n\t */\n\tshow: function (options) {\n\t\tvar url;\n\t\tif (!this.exists()) {\n\t\t\tthis.init();\n\t\t}\n\t\turl = makeUrl(options.url, options.source, options.productlistid);\n\n\t\tdialog.open({\n\t\t\ttarget: this.$container,\n\t\t\turl: url,\n\t\t\toptions: {\n\t\t\t\twidth: 920,\n\t\t\t\ttitle: Resources.QUICK_VIEW_POPUP,\n\t\t\t\topen: function () {\n\t\t\t\t\tthis.setup(url);\n\t\t\t\t\tif (typeof options.callback === 'function') { options.callback(); }\n\t\t\t\t}.bind(this)\n\t\t\t}\n\t\t});\n\t},\n\texists: function () {\n\t\treturn this.$container && (this.$container.length > 0);\n\t}\n};\n\nmodule.exports = quickview;\n\n},{\"./dialog\":11,\"./pages/product\":42,\"./util\":69,\"lodash\":78}],59:[function(require,module,exports){\n'use strict';\n\n/**\n * copied from https://github.com/darkskyapp/string-hash\n */\nfunction hashFn(str) {\n\tvar hash = 5381,\n\t\ti = str.length;\n\n\twhile (i) {\n\t\thash = (hash * 33) ^ str.charCodeAt(--i);\n\t}\n\t/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed\n\t* integers. Since we want the results to be always positive, convert the\n\t* signed int to an unsigned by doing an unsigned bitshift. */\n\treturn hash >>> 0;\n}\n\n/**\n * Create rating based on hash ranging from 2-5\n * @param pid\n */\nfunction getRating(pid) {\n\treturn hashFn(pid.toString()) % 30 / 10 + 2;\n}\n\nmodule.exports = {\n\tinit: function () {\n\t\t$('.product-review').each(function (index, review) {\n\t\t\tvar pid = $(review).data('pid');\n\t\t\tif (!pid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// rating range from 2 - 5\n\t\t\tvar rating = getRating(pid);\n\t\t\tvar baseRating = Math.floor(rating);\n\t\t\tvar starsCount = 0;\n\t\t\tfor (var i = 0; i < baseRating; i++) {\n\t\t\t\t$('.rating', review).append('');\n\t\t\t\tstarsCount++;\n\t\t\t}\n\t\t\t// give half star for anything in between\n\t\t\tif (rating > baseRating) {\n\t\t\t\t$('.rating', review).append('');\n\t\t\t\tstarsCount++;\n\t\t\t}\n\t\t\tif (starsCount < 5) {\n\t\t\t\tfor (var j = 0; j < 5 - starsCount; j++) {\n\t\t\t\t\t$('.rating', review).append('');\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n};\n\n},{}],60:[function(require,module,exports){\n'use strict';\n\n/**\n * @private\n * @function\n * @description Binds event to the place holder (.blur)\n */\nfunction initializeEvents() {\n\t$('#q').focus(function () {\n\t\tvar input = $(this);\n\t\tif (input.val() === input.attr('placeholder')) {\n\t\t\tinput.val('');\n\t\t}\n\t})\n\t.blur(function () {\n\t\tvar input = $(this);\n\t\tif (input.val() === '' || input.val() === input.attr('placeholder')) {\n\t\t\tinput.val(input.attr('placeholder'));\n\t\t}\n\t})\n\t.blur();\n}\n\nexports.init = initializeEvents;\n\n},{}],61:[function(require,module,exports){\n'use strict';\n\nvar util = require('./util');\n\nvar currentQuery = null,\n\tlastQuery = null,\n\trunningQuery = null,\n\tlistTotal = -1,\n\tlistCurrent = -1,\n\tdelay = 30,\n\t$resultsContainer;\n/**\n * @function\n * @description Handles keyboard's arrow keys\n * @param keyCode Code of an arrow key to be handled\n */\nfunction handleArrowKeys(keyCode) {\n\tswitch (keyCode) {\n\t\tcase 38:\n\t\t\t// keyUp\n\t\t\tlistCurrent = (listCurrent <= 0) ? (listTotal - 1) : (listCurrent - 1);\n\t\t\tbreak;\n\t\tcase 40:\n\t\t\t// keyDown\n\t\t\tlistCurrent = (listCurrent >= listTotal - 1) ? 0 : listCurrent + 1;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t// reset\n\t\t\tlistCurrent = -1;\n\t\t\treturn false;\n\t}\n\n\t$resultsContainer.children().removeClass('selected').eq(listCurrent).addClass('selected');\n\t$('input[name=\"q\"]').val($resultsContainer.find('.selected .suggestionterm').first().text());\n\treturn true;\n}\n\nvar searchsuggest = {\n\t/**\n\t * @function\n\t * @description Configures parameters and required object instances\n\t */\n\tinit: function (container, defaultValue) {\n\t\tvar $searchContainer = $(container);\n\t\tvar $searchForm = $searchContainer.find('form[name=\"simpleSearch\"]');\n\t\tvar $searchField = $searchForm.find('input[name=\"q\"]');\n\n\t\t// disable browser auto complete\n\t\t$searchField.attr('autocomplete', 'off');\n\n\t\t// on focus listener (clear default value)\n\t\t$searchField.focus(function () {\n\t\t\tif (!$resultsContainer) {\n\t\t\t\t// create results container if needed\n\t\t\t\t$resultsContainer = $('
        ').attr('id', 'search-suggestions').appendTo($searchContainer);\n\t\t\t}\n\t\t\tif ($searchField.val() === defaultValue) {\n\t\t\t\t$searchField.val('');\n\t\t\t}\n\t\t});\n\t\t// on blur listener\n\t\t$(document).on('click', function (e) {\n\t\t\tif (!$searchContainer.is(e.target)) {\n\t\t\t\tsetTimeout(this.clearResults, 200);\n\t\t\t}\n\t\t}.bind(this));\n\t\t// on key up listener\n\t\t$searchField.keyup(function (e) {\n\n\t\t\t// get keyCode (window.event is for IE)\n\t\t\tvar keyCode = e.keyCode || window.event.keyCode;\n\n\t\t\t// check and treat up and down arrows\n\t\t\tif (handleArrowKeys(keyCode)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// check for an ENTER or ESC\n\t\t\tif (keyCode === 13 || keyCode === 27) {\n\t\t\t\tthis.clearResults();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcurrentQuery = $searchField.val().trim();\n\n\t\t\t// no query currently running, init a update\n\t\t\tif (runningQuery === null) {\n\t\t\t\trunningQuery = currentQuery;\n\t\t\t\tsetTimeout(this.suggest.bind(this), delay);\n\t\t\t}\n\t\t}.bind(this));\n\t},\n\n\t/**\n\t * @function\n\t * @description trigger suggest action\n\t */\n\tsuggest: function () {\n\t\t// check whether query to execute (runningQuery) is still up to date and had not changed in the meanwhile\n\t\t// (we had a little delay)\n\t\tif (runningQuery !== currentQuery) {\n\t\t\t// update running query to the most recent search phrase\n\t\t\trunningQuery = currentQuery;\n\t\t}\n\n\t\t// if it's empty clear the results box and return\n\t\tif (runningQuery.length === 0) {\n\t\t\tthis.clearResults();\n\t\t\trunningQuery = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// if the current search phrase is the same as for the last suggestion call, just return\n\t\tif (lastQuery === runningQuery) {\n\t\t\trunningQuery = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// build the request url\n\t\tvar reqUrl = util.appendParamToURL(Urls.searchsuggest, 'q', runningQuery);\n\t\treqUrl = util.appendParamToURL(reqUrl, 'legacy', 'false');\n\n\t\t// execute server call\n\t\t$.get(reqUrl, function (data) {\n\t\t\tvar suggestionHTML = data,\n\t\t\t\tansLength = suggestionHTML.trim().length;\n\n\t\t\t// if there are results populate the results div\n\t\t\tif (ansLength === 0) {\n\t\t\t\tthis.clearResults();\n\t\t\t} else {\n\t\t\t\t// update the results div\n\t\t\t\t$resultsContainer.html(suggestionHTML).fadeIn(200);\n\t\t\t}\n\n\t\t\t// record the query that has been executed\n\t\t\tlastQuery = runningQuery;\n\t\t\t// reset currently running query\n\t\t\trunningQuery = null;\n\n\t\t\t// check for another required update (if current search phrase is different from just executed call)\n\t\t\tif (currentQuery !== lastQuery) {\n\t\t\t\t// ... and execute immediately if search has changed while this server call was in transit\n\t\t\t\trunningQuery = currentQuery;\n\t\t\t\tsetTimeout(this.suggest.bind(this), delay);\n\t\t\t}\n\t\t\tthis.hideLeftPanel();\n\t\t}.bind(this));\n\t},\n\t/**\n\t * @function\n\t * @description\n\t */\n\tclearResults: function () {\n\t\tif (!$resultsContainer) { return; }\n\t\t$resultsContainer.fadeOut(200, function () {$resultsContainer.empty();});\n\t},\n\t/**\n\t * @function\n\t * @description\n\t */\n\thideLeftPanel: function () {\n\t\t//hide left panel if there is only a matching suggested custom phrase\n\t\tif ($('.search-suggestion-left-panel-hit').length === 1 && $('.search-phrase-suggestion a').text().replace(/(^[\\s]+|[\\s]+$)/g, '').toUpperCase() === $('.search-suggestion-left-panel-hit a').text().toUpperCase()) {\n\t\t\t$('.search-suggestion-left-panel').css('display', 'none');\n\t\t\t$('.search-suggestion-wrapper-full').addClass('search-suggestion-wrapper');\n\t\t\t$('.search-suggestion-wrapper').removeClass('search-suggestion-wrapper-full');\n\t\t}\n\t}\n};\n\nmodule.exports = searchsuggest;\n\n},{\"./util\":69}],62:[function(require,module,exports){\n'use strict';\n\nvar util = require('./util');\n\nvar qlen = 0,\n\tlistTotal = -1,\n\tlistCurrent = -1,\n\tdelay = 300,\n\tfieldDefault = null,\n\tsuggestionsJson = null,\n\t$searchForm,\n\t$searchField,\n\t$searchContainer,\n\t$resultsContainer;\n/**\n * @function\n * @description Handles keyboard's arrow keys\n * @param keyCode Code of an arrow key to be handled\n */\nfunction handleArrowKeys(keyCode) {\n\tswitch (keyCode) {\n\t\tcase 38:\n\t\t\t// keyUp\n\t\t\tlistCurrent = (listCurrent <= 0) ? (listTotal - 1) : (listCurrent - 1);\n\t\t\tbreak;\n\t\tcase 40:\n\t\t\t// keyDown\n\t\t\tlistCurrent = (listCurrent >= listTotal - 1) ? 0 : listCurrent + 1;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t// reset\n\t\t\tlistCurrent = -1;\n\t\t\treturn false;\n\t}\n\n\t$resultsContainer.children().removeClass('selected').eq(listCurrent).addClass('selected');\n\t$searchField.val($resultsContainer.find('.selected .suggestionterm').first().text());\n\treturn true;\n}\nvar searchsuggest = {\n\t/**\n\t * @function\n\t * @description Configures parameters and required object instances\n\t */\n\tinit: function (container, defaultValue) {\n\t\t// initialize vars\n\t\t$searchContainer = $(container);\n\t\t$searchForm = $searchContainer.find('form[name=\"simpleSearch\"]');\n\t\t$searchField = $searchForm.find('input[name=\"q\"]');\n\t\tfieldDefault = defaultValue;\n\n\t\t// disable browser auto complete\n\t\t$searchField.attr('autocomplete', 'off');\n\n\t\t// on focus listener (clear default value)\n\t\t$searchField.focus(function () {\n\t\t\tif (!$resultsContainer) {\n\t\t\t\t// create results container if needed\n\t\t\t\t$resultsContainer = $('
        ').attr('id', 'suggestions').appendTo($searchContainer).css({\n\t\t\t\t\t'top': $searchContainer[0].offsetHeight,\n\t\t\t\t\t'left': 0,\n\t\t\t\t\t'width': $searchField[0].offsetWidth\n\t\t\t\t});\n\t\t\t}\n\t\t\tif ($searchField.val() === fieldDefault) {\n\t\t\t\t$searchField.val('');\n\t\t\t}\n\t\t});\n\t\t// on blur listener\n\t\t$searchField.blur(function () {\n\t\t\tsetTimeout(this.clearResults, 200);\n\t\t}.bind(this));\n\t\t// on key up listener\n\t\t$searchField.keyup(function (e) {\n\n\t\t\t// get keyCode (window.event is for IE)\n\t\t\tvar keyCode = e.keyCode || window.event.keyCode;\n\n\t\t\t// check and treat up and down arrows\n\t\t\tif (handleArrowKeys(keyCode)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// check for an ENTER or ESC\n\t\t\tif (keyCode === 13 || keyCode === 27) {\n\t\t\t\tthis.clearResults();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar lastVal = $searchField.val();\n\n\t\t\t// if is text, call with delay\n\t\t\tsetTimeout(function () {\n\t\t\t\tthis.suggest(lastVal);\n\t\t\t}.bind(this), delay);\n\t\t}.bind(this));\n\t\t// on submit we do not submit the form, but change the window location\n\t\t// in order to avoid https to http warnings in the browser\n\t\t// only if it's not the default value and it's not empty\n\t\t$searchForm.submit(function (e) {\n\t\t\te.preventDefault();\n\t\t\tvar searchTerm = $searchField.val();\n\t\t\tif (searchTerm === fieldDefault || searchTerm.length === 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\twindow.location = util.appendParamToURL($(this).attr('action'), 'q', searchTerm);\n\t\t});\n\t},\n\n\t/**\n\t * @function\n\t * @description trigger suggest action\n\t * @param lastValue\n\t */\n\tsuggest: function (lastValue) {\n\t\t// get the field value\n\t\tvar part = $searchField.val();\n\n\t\t// if it's empty clear the resuts box and return\n\t\tif (part.length === 0) {\n\t\t\tthis.clearResults();\n\t\t\treturn;\n\t\t}\n\n\t\t// if part is not equal to the value from the initiated call,\n\t\t// or there were no results in the last call and the query length\n\t\t// is longer than the last query length, return\n\t\t// #TODO: improve this to look at the query value and length\n\t\tif ((lastValue !== part) || (listTotal === 0 && part.length > qlen)) {\n\t\t\treturn;\n\t\t}\n\t\tqlen = part.length;\n\n\t\t// build the request url\n\t\tvar reqUrl = util.appendParamToURL(Urls.searchsuggest, 'q', part);\n\t\treqUrl = util.appendParamToURL(reqUrl, 'legacy', 'true');\n\n\t\t// get remote data as JSON\n\t\t$.getJSON(reqUrl, function (data) {\n\t\t\t// get the total of results\n\t\t\tvar suggestions = data,\n\t\t\t\tansLength = suggestions.length;\n\n\t\t\t// if there are results populate the results div\n\t\t\tif (ansLength === 0) {\n\t\t\t\tthis.clearResults();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsuggestionsJson = suggestions;\n\t\t\tvar html = '';\n\t\t\tfor (var i = 0; i < ansLength; i++) {\n\t\t\t\thtml += '
        ' + suggestions[i].suggestion + '
        ' + suggestions[i].hits + '
        ';\n\t\t\t}\n\n\t\t\t// update the results div\n\t\t\t$resultsContainer.html(html).show().on('hover', 'div', function () {\n\t\t\t\t$(this).toggleClass = 'selected';\n\t\t\t}).on('click', 'div', function () {\n\t\t\t\t// on click copy suggestion to search field, hide the list and submit the search\n\t\t\t\t$searchField.val($(this).children('.suggestionterm').text());\n\t\t\t\tthis.clearResults();\n\t\t\t\t$searchForm.trigger('submit');\n\t\t\t}.bind(this));\n\t\t}.bind(this));\n\t},\n\t/**\n\t * @function\n\t * @description\n\t */\n\tclearResults: function () {\n\t\tif (!$resultsContainer) { return; }\n\t\t$resultsContainer.empty().hide();\n\t}\n};\n\nmodule.exports = searchsuggest;\n\n},{\"./util\":69}],63:[function(require,module,exports){\nexports.init = function (tabStatus) {\n var initFunctionSize = function () {\n let toggleTab = function (tab, $parent) {\n let $parentEl = $parent || $(document);\n $parentEl.find('.size-selector-tab-one, .size-selector-tab-two').removeClass('active');\n $parentEl.find('.tab-one, .tab-two').hide();\n\n if (tab === 0 || tab === 1) {\n $parentEl.find('.size-selector-tab-one').addClass('active');\n $parentEl.find('.tab-one').show();\n } else if (tab === 2) {\n $parentEl.find('.size-selector-tab-two').addClass('active');\n $parentEl.find('.tab-two').show();\n }\n };\n if (tabStatus !== undefined) {\n toggleTab(tabStatus);\n } else {\n toggleTab(1);\n }\n\n $(document).on('click', '.size-selector-tab-one', function () {\n toggleTab(1, $(this).closest('.size-swatch-wrapper'));\n });\n $(document).on('click', '.size-selector-tab-two', function () {\n toggleTab(2, $(this).closest('.size-swatch-wrapper'));\n });\n\n $(document).on('click', '.size-select-item-mobile', function () {\n $(this).addClass('active');\n });\n }\n initFunctionSize();\n $(window).on('resize', function () {\n initFunctionSize();\n });\n};\n},{}],64:[function(require,module,exports){\n'use strict';\n\nvar _ = require('lodash'),\n\tdialog = require('../dialog'),\n\tTPromise = require('promise'),\n\tutil = require('../util');\n\nvar newLine = '\\n';\nvar storeTemplate = function (store, selectedStoreId, selectedStoreText) {\n\treturn [\n\t\t'
      • ',\n\t\t'\t

        ',\n\t\t'\t\t' + store.address1 + '
        ',\n\t\t'\t\t' + store.city + ', ' + store.stateCode + ' ' + store.postalCode,\n\t\t'\t

        ',\n\t\t'\t

        ' + store.status + '

        ',\n\t\t'\t',\n\t\t'
      • '\n\t].join(newLine);\n};\n\nvar storeListTemplate = function (stores, selectedStoreId, selectedStoreText) {\n\tif (stores && stores.length) {\n\t\treturn [\n\t\t\t'
        ',\n\t\t\t'
          ',\n\t\t\t_.map(stores, function (store) {\n\t\t\t\treturn storeTemplate(store, selectedStoreId, selectedStoreText);\n\t\t\t}).join(newLine),\n\t\t\t'
        ',\n\t\t\t'
        ',\n\t\t\t'
        ',\n\t\t\t'
        '\n\t\t].join(newLine);\n\t} else {\n\t\treturn '
        ' + Resources.INVALID_ZIP + '
        ';\n\t}\n};\n\nvar zipPromptTemplate = function () {\n\treturn [\n\t\t'
        ',\n\t\t'\t',\n\t\t'
        '\n\t].join(newLine);\n};\n\n/**\n * @description test whether zipcode is valid for either US or Canada\n * @return {Boolean} true if the zipcode is valid for either country, false if it's invalid for both\n **/\nvar validateZipCode = function (zipCode) {\n\tvar regexes = {\n\t\tcanada: /^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ]( )?\\d[ABCEGHJKLMNPRSTVWXYZ]\\d$/i,\n\t\tusa: /^\\d{5}(-\\d{4})?$/\n\t},\n\t\tvalid = false;\n\tif (!zipCode) { return; }\n\t_.each(regexes, function (re) {\n\t\tvar regexp = new RegExp(re);\n\t\tvalid = regexp.test(zipCode);\n\t});\n\treturn valid;\n};\n\nvar storeinventory = {\n\tzipPrompt: function (callback) {\n\t\tvar self = this;\n\t\tdialog.open({\n\t\t\thtml: zipPromptTemplate(),\n\t\t\toptions: {\n\t\t\t\ttitle: Resources.STORE_NEAR_YOU,\n\t\t\t\twidth: 500,\n\t\t\t\tbuttons: [{\n\t\t\t\t\ttext: Resources.SEARCH,\n\t\t\t\t\tclick: function () {\n\t\t\t\t\t\tvar zipCode = $('#user-zip').val();\n\t\t\t\t\t\tif (validateZipCode(zipCode)) {\n\t\t\t\t\t\t\tself.setUserZip(zipCode);\n\t\t\t\t\t\t\tif (callback) {\n\t\t\t\t\t\t\t\tcallback(zipCode);\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\t}],\n\t\t\t\topen: function () {\n\t\t\t\t\t$('#user-zip').on('keypress', function (e) {\n\t\t\t\t\t\tif (e.which === 13) {\n\t\t\t\t\t\t\t// trigger the search button\n\t\t\t\t\t\t\t$('.ui-dialog-buttonset .ui-button').trigger('click');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\tgetStoresInventory: function (pid) {\n\t\treturn TPromise.resolve($.ajax({\n\t\t\turl: util.appendParamsToUrl(Urls.storesInventory, {\n\t\t\t\tpid: pid,\n\t\t\t\tzipCode: User.zip\n\t\t\t}),\n\t\t\tdataType: 'json'\n\t\t}));\n\t},\n\t/**\n\t * @description open the dialog to select store\n\t * @param {Array} options.stores\n\t * @param {String} options.selectedStoreId\n\t * @param {String} options.selectedStoreText\n\t * @param {Function} options.continueCallback\n\t * @param {Function} options.selectStoreCallback\n\t **/\n\tselectStoreDialog: function (options) {\n\t\tvar self = this,\n\t\t\tstores = options.stores,\n\t\t\tselectedStoreId = options.selectedStoreId,\n\t\t\tselectedStoreText = options.selectedStoreText,\n\t\t\tstoreList = storeListTemplate(stores, selectedStoreId, selectedStoreText);\n\t\tdialog.open({\n\t\t\thtml: storeList,\n\t\t\toptions: {\n\t\t\t\ttitle: Resources.SELECT_STORE + ' - ' + User.zip,\n\t\t\t\tbuttons: [{\n\t\t\t\t\t\ttext: Resources.CHANGE_LOCATION,\n\t\t\t\t\tclick: function () {\n\t\t\t\t\t\tself.setUserZip(null);\n\t\t\t\t\t\t// trigger the event to start the process all over again\n\t\t\t\t\t\t$('.set-preferred-store').trigger('click');\n\t\t\t\t\t}.bind(this)\n\t\t\t\t}, {\n\t\t\t\t\ttext: Resources.CONTINUE,\n\t\t\t\t\tclick: function () {\n\t\t\t\t\t\tif (options.continueCallback) {\n\t\t\t\t\t\t\toptions.continueCallback(stores);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdialog.close();\n\t\t\t\t\t}\n\t\t\t\t}],\n\t\t\t\topen: function () {\n\t\t\t\t\t$('.select-store-button').on('click', function (e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tvar storeId = $(this).data('storeId');\n\t\t\t\t\t\t// if the store is already selected, don't select again\n\t\t\t\t\t\tif (storeId === selectedStoreId) { return; }\n\t\t\t\t\t\t$('.store-list .store-tile.selected').removeClass('selected')\n\t\t\t\t\t\t\t.find('.select-store-button').text(Resources.SELECT_STORE);\n\t\t\t\t\t\t$(this).text(selectedStoreText)\n\t\t\t\t\t\t\t.closest('.store-tile').addClass('selected');\n\t\t\t\t\t\tif (options.selectStoreCallback) {\n\t\t\t\t\t\t\toptions.selectStoreCallback(storeId);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\tsetUserZip: function (zip) {\n\t\tUser.zip = zip;\n\t\t$.ajax({\n\t\t\ttype: 'POST',\n\t\t\turl: Urls.setZipCode,\n\t\t\tdata: {\n\t\t\t\tzipCode: zip\n\t\t\t}\n\t\t});\n\t},\n\tshippingLoad: function () {\n\t\tvar $checkoutForm = $('.address');\n\t\t$checkoutForm.off('click');\n\t\t$checkoutForm.on('click', 'input[name$=\"_shippingAddress_isGift\"]', function () {\n\t\t\t$(this).parent().siblings('.gift-message-text').toggleClass('hidden', $('input[name$=\"_shippingAddress_isGift\"]:checked').val());\n\t\t});\n\t}\n};\n\nmodule.exports = storeinventory;\n\n},{\"../dialog\":11,\"../util\":69,\"lodash\":78,\"promise\":79}],65:[function(require,module,exports){\n'use strict';\n\nvar _ = require('lodash'),\n\tinventory = require('./');\n\nvar newLine = '\\n';\nvar pdpStoreTemplate = function (store) {\n\treturn [\n\t\t'
      • ',\n\t\t'\t
        ' + store.address1 + ', ' + store.city + ' ' + store.stateCode +\n\t\t' ' + store.postalCode + '
        ',\n\t\t'\t
        ' + store.status + '
        ',\n\t\t'
      • '\n\t].join(newLine);\n};\nvar pdpStoresListingTemplate = function (stores) {\n\tif (stores && stores.length) {\n\t\treturn [\n\t\t\t'
        ',\n\t\t\t(stores.length > 1 ? '\t' + Resources.SEE_MORE + '' : ''),\n\t\t\t'\t
          ',\n\t\t\t_.map(stores, pdpStoreTemplate).join(newLine),\n\t\t\t'\t
        ',\n\t\t\t'
        '\n\t\t].join(newLine);\n\t}\n};\n\nvar storesListing = function (stores) {\n\t// list all stores on PDP page\n\tif ($('.store-list-pdp-container').length) {\n\t\t$('.store-list-pdp-container').remove();\n\t}\n\t$('.availability-results').append(pdpStoresListingTemplate(stores));\n};\n\nvar productInventory = {\n\tsetPreferredStore: function (storeId) {\n\t\tUser.storeId = storeId;\n\t\t$.ajax({\n\t\t\turl: Urls.setPreferredStore,\n\t\t\ttype: 'POST',\n\t\t\tdata: {storeId: storeId}\n\t\t});\n\t},\n\tproductSelectStore: function () {\n\t\tvar self = this;\n\t\tinventory.getStoresInventory(this.pid).then(function (stores) {\n\t\t\tinventory.selectStoreDialog({\n\t\t\t\tstores: stores,\n\t\t\t\tselectedStoreId: User.storeId,\n\t\t\t\tselectedStoreText: Resources.PREFERRED_STORE,\n\t\t\t\tcontinueCallback: storesListing,\n\t\t\t\tselectStoreCallback: self.setPreferredStore\n\t\t\t});\n\t\t}).done();\n\t},\n\tinit: function () {\n\t\tvar $availabilityContainer = $('.availability-results'),\n\t\t\tself = this;\n\t\tthis.pid = $('input[name=\"pid\"]').val();\n\n\t\t$('#product-content .set-preferred-store').on('click', function (e) {\n\t\t\te.preventDefault();\n\t\t\tif (!User.zip) {\n\t\t\t\tinventory.zipPrompt(function () {\n\t\t\t\t\tself.productSelectStore();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tself.productSelectStore();\n\t\t\t}\n\t\t});\n\n\t\tif ($availabilityContainer.length) {\n\t\t\tif (User.storeId) {\n\t\t\t\tinventory.getStoresInventory(this.pid).then(storesListing);\n\t\t\t}\n\n\t\t\t// See more or less stores in the listing\n\t\t\t$availabilityContainer.on('click', '.stores-toggle', function (e) {\n\t\t\t\te.preventDefault();\n\t\t\t\t$('.store-list-pdp .store-list-item').toggleClass('visible');\n\t\t\t\tif ($(this).hasClass('collapsed')) {\n\t\t\t\t\t$(this).text(Resources.SEE_LESS);\n\t\t\t\t} else {\n\t\t\t\t\t$(this).text(Resources.SEE_MORE);\n\t\t\t\t}\n\t\t\t\t$(this).toggleClass('collapsed');\n\t\t\t});\n\t\t}\n\t}\n};\n\nmodule.exports = productInventory;\n\n},{\"./\":64,\"lodash\":78}],66:[function(require,module,exports){\nvar app = app || {};\n\n\nif (typeof mapRessources == \"undefined\" )\n\treturn;\n\n//Configurations to handle differences between store and dpd(parcelshop) delivery \nvar configurations = {\n\t'store':{\n\t\t'urlAll':mapRessources.urls.allStores,\n\t\t'urlNearest':mapRessources.urls.searchNearest,\n\t\t'updateOnSearch':mapRessources.context !== 'storedetails',\n\t\t'fitBounds':mapRessources.context !== 'storedetails',\n\t\t'icons':mapRessources.icons\n\t},\n\t'dpd':{\n\t\t'urlAll':mapRessources.urls.searchNearestParcelShops+'?lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng,\n\t\t'urlNearest':mapRessources.urls.searchNearestParcelShops,\n\t\t'updateOnSearch':true,\n\t\t'fitBounds':true,\n\t\t'icons':mapRessources.dpdIcons\n\t},\n\t'mondialrelay':{\n\t\t'urlAll':mapRessources.urls.searchNearestMondialShops+'?lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng+'&zone='+mapRessources.defaultZone.zone+'&&country='+mapRessources.defaultZone.country,\n\t\t'urlNearest':mapRessources.urls.searchNearestMondialShops,\n\t\t'updateOnSearch':true,\n\t\t'fitBounds':true,\n\t\t'icons':mapRessources.mondialIcons\n\t},\n\t'bpost': {\n\t\t'urlAll':mapRessources.urls.searchNearestBpostShops+'?lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng+'&zone='+mapRessources.defaultZone.zone+'&country='+mapRessources.defaultZone.country,\n\t\t'urlNearest':mapRessources.urls.searchNearestBpostShops,\n\t\t'updateOnSearch':true,\n\t\t'fitBounds':true,\n\t\t'icons':mapRessources.bpostIcons\n\t},\n\t'dhl': {\n\t\t'urlAll':mapRessources.urls.searchNearestDhlShops+'?lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng+'&zone='+mapRessources.defaultCity.city+'&country='+mapRessources.defaultCity.country,\n\t\t'urlNearest':mapRessources.urls.searchNearestDhlShops,\n\t\t'updateOnSearch':true,\n\t\t'fitBounds':true,\n\t\t'icons':mapRessources.dhlIcons\n\t},\n\t'dhl-de': {\n\t\t'urlAll':mapRessources.urls.searchNearestDhlShops+'?lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng+'&zone='+mapRessources.defaultCity.city+'&country='+mapRessources.defaultCity.country,\n\t\t'urlNearest':mapRessources.urls.searchNearestDhlShops,\n\t\t'updateOnSearch':true,\n\t\t'fitBounds':true,\n\t\t'icons':mapRessources.dhlIcons\n\t}\n};\n\nvar StoreLocator = {\n\tmap : null,\n\tgeocoder : null,\n\tsearchMarker : null,\n\thoveredStore : null,\n\tselectedStore: null,\n\tconfiguration: null,\n\tSTORE_LOCATOR_ID: 'storelocator',\n\n\tinit : function() {\n\t\tvar shippingMethodID = $('#shippingMethodID').val() || this.STORE_LOCATOR_ID;\n\n\t\tStoreLocator.configuration = configurations[shippingMethodID === this.STORE_LOCATOR_ID ? 'store' : shippingMethodID];\n\t\t\n\t\tswitch (shippingMethodID) {\n\t\t\tcase \"bpost\" :\n\t\t\t\tStoreLocator.configuration.urlAll = mapRessources.urls.searchNearestBpostShops+'?lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng+'&zone='+mapRessources.defaultZone.zone+'&country='+mapRessources.defaultZone.country;\n\t\t\t\tbreak;\n\t\t\tcase \"mondialrelay\" :\n\t\t\t\tStoreLocator.configuration.urlAll = mapRessources.urls.searchNearestMondialShops+'?lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng+'&zone='+mapRessources.defaultZone.zone+'&country='+mapRessources.defaultZone.country;\n\t\t\t\tbreak;\n\t\t\tcase \"dpd\" :\n\t\t\t\tStoreLocator.configuration.urlAll = mapRessources.urls.searchNearestParcelShops+'?lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng;\n\t\t\t\tbreak;\n\t\t\tcase \"dhl\" :\n\t\t\tcase \"dhl-de\" : {\n\t\t\t\tStoreLocator.configuration.urlAll = mapRessources.urls.searchNearestDhlShops+'?lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng+'&zone='+mapRessources.defaultCity.city+'&country='+mapRessources.defaultCity.country;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"store\" :\n\t\t\t\tStoreLocator.configuration.urlAll = mapRessources.urls.searchNearest+'&lat='+mapRessources.defaultLocation.lat+'&lng='+mapRessources.defaultLocation.lng+'&zone='+mapRessources.defaultZone.zone+'&country='+mapRessources.defaultZone.country;\n\t\t\t\tbreak;\n\t\t\tcase this.STORE_LOCATOR_ID:\n\t\t\tdefault :\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tthis.geocoder = new google.maps.Geocoder();\n\n\t\tthis.map = new google.maps.Map(document.getElementById('map'), {\n\t\t\tzoom: mapRessources.defaultZoom || 8,\n\t\t\tcenter: mapRessources.defaultLocation,\n\t\t\tmapTypeId: google.maps.MapTypeId.ROADMAP,\n\t\t\tpanControl: false,\n\t\t\tzoomControl: true,\n\t\t\tmapTypeControl: false,\n\t\t\tscaleControl: false,\n\t\t\tstreetViewControl: false,\n\t\t\toverviewMapControl: false,\n\t\t\tzoomControlOptions: {\n\t\t\t\tstyle:google.maps.ZoomControlStyle.SMALL\n\t\t\t},\n\t\t\tminZoom : 2\n\t\t});\n\n\t\tthis.map.data.loadGeoJson(StoreLocator.configuration.urlAll, null, this.storeToSelect);\n\t\tthis.updateMapStyle();\n\n\t\tthis.initializeEvents();\n\t\t\n\t\tthis.throwEvent('initMap', this, arguments);\n\t},\n\tremoveMapPoints : function () {\n\t\tvar mapPoints = this.map.data;\n\t\t\n\t\tmapPoints.forEach(function (feature) {\n\t\t\tmapPoints.remove(feature);\n\t\t});\n\t},\n\tinitializeEvents : function() {\n\t\tfunction activeContainer(e) {\n\t\t\t$(\".method-container\").removeClass(\"active\");\n\t\t\t$(this).closest(\".method-container\").addClass(\"active\");\n\t\t\t\n\t\t\tStoreLocator.throwEvent('activeContainer', this, arguments);\n\t\t}\n\t\t\n\t\tthis.map.data.addListener('mouseover', function(event) {\n\t\t\tvar storeId = event.feature.getProperty('ID');\n\t\t\tStoreLocator.hoverStore( storeId );\n\t\t});\n\t\tthis.map.data.addListener('mouseout', function(event) {\n\t\t\tStoreLocator.blurStore();\n\t\t});\n\t\t// click on store in map\n\t\tthis.map.data.addListener('click', function(event) {\n\t\t\tvar storeData = {};\n\t\t\tvar storeId = event.feature.getProperty('ID');\n\t\t\tstoreData.lat = event.latLng.lat();\n\t\t\tstoreData.lon = event.latLng.lng();\n\t\t\tStoreLocator.selectStore( storeId, storeData);\n\t\t\tif ($(\".method-container.active .store-list .list-content[itemid=\" + storeId + \"]\").length == 0) {\n\t\t\t\tactiveContainer.apply($(\".all-stores-container h2\"));\n\t\t\t}\n\t\t\tStoreLocator.scrollToStore( storeId );\n\t\t\tif (window.matchMedia('(max-width: 1023px)').matches) {\n\t\t\t\twindow.setTimeout(function() { // \".store-list\" element need to have an height before we can start the animate function\n\t\t\t\t\t$('html, body').animate({scrollTop: $('.list-content.selected').offset().top}, 400);\n\t\t\t\t}, 400)\n\t\t\t}\n\t\t});\n\t\t$(\".method-container\").on(\"mouseover\", \".store-list .list-content\", function(e){\n\t\t\tStoreLocator.hoverStore($(this).attr(\"itemid\"));\n\t\t});\n\t\t$(\".method-container\").on(\"mouseout\", \".store-list\", function(e) {\n\t\t\tStoreLocator.blurStore();\n\t\t});\n\t\t// click on store in store list\n\t\t$(\".method-container\").on(\"click\", \".store-list .list-content\", function(e) {\n\t\t\tvar storeId = $(this).attr(\"itemid\");\n\t\t\tStoreLocator.selectStore(storeId);\n\t\t\t$(this).change();\n\t\t\t\n\t\t\tvar storeFeature = null;\n\t\t\tvar searchStore = function(feature) {\n\t\t\t\tif(feature.getProperty(\"ID\") == storeId) {\n\t\t\t\t\tstoreFeature = feature;\n\t\t\t\t}\n\t\t\t};\n\t\t\tStoreLocator.map.data.forEach(searchStore);\n\t\t\tif (storeFeature != null) {\n\t\t\t\tvar storeLocation = storeFeature.getGeometry().get();\n\t\t\t\tvar currentBounds = StoreLocator.map.getBounds() \n\n\t\t\t\tif(!currentBounds.contains(storeLocation)){\n\t\t\t\t\tStoreLocator.map.setCenter(storeLocation);\n\t\t\t\t\tStoreLocator.map.setZoom(mapRessources.selectZoom);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\t$(\".store-container\").on(\"click\", \"h2\", activeContainer);\n\t\t$(\".store-container\").on(\"focus click\", \":input\", activeContainer);\n\n\t\t$(\".around-me-container\").on(\"click\", \".locate-me\", function(e){\n\t\t\tvar $arndCtnr = $(this).closest(\".store-locator-content\");\n\t\t\tvar $storeList = $arndCtnr.find(\".results-list\");\n\t\t\tvar regex = StoreLocator.createBrandsRegexSelector();\n\n\t\t\tif (navigator.geolocation) {\n\t\t\t\t//searchNearestPoint(iplocation.lat, iplocation.lng, $storeList);\n\t\t\t\tvar defaultPoint = new google.maps.LatLng(mapRessources.defaultLocation.lat,mapRessources.defaultLocation.lng);\n\t\t\t\tStoreLocator.map.setCenter(defaultPoint);\n\t\t\t\t\n\t\t\t\tnavigator.geolocation.getCurrentPosition(function(position) {\n\t\t\t\t\t//update defaultlocation value with position value\n\t\t\t\t\tmapRessources.defaultLocation.lat = position.coords.latitude;\n\t\t\t\t\tmapRessources.defaultLocation.lng = position.coords.longitude;\n\t\t\t\t\t\n\t\t\t\t\t//geoLoc successFull\n\t\t\t\t\tStoreLocator.searchNearestPoint(position.coords.latitude, position.coords.longitude, {brandRegex: regex}, $storeList);\n\t\t\t\t}, function(error){\n\t\t\t\t\t//geoLoc Fail - IpLocation\n\t\t\t\t\tStoreLocator.searchNearestPoint(mapRessources.defaultLocation.lat, mapRessources.defaultLocation.lng, {brandRegex: regex}, $storeList);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t//old navigator - IpLocation\n\t\t\t\tStoreLocator.searchNearestPoint(mapRessources.defaultLocation.lat, mapRessources.defaultLocation.lng, {brandRegex: regex}, $storeList);\n\t\t\t}\n\t\t});\n\n\t\t$(\".all-stores-container\").on(\"click\", \"h2\", function(e){\n\t\t\tvar defaultPoint = new google.maps.LatLng(mapRessources.defaultLocation.lat,mapRessources.defaultLocation.lng);\n\t\t\tStoreLocator.map.setCenter(defaultPoint);\n\t\t\tStoreLocator.map.setZoom(mapRessources.defaultZoom);\n\t\t\tif (this.searchMarker != null) {\n\t\t\t\tStoreLocator.searchMarker.setMap(null);\n\t\t\t\tStoreLocator.searchMarker = null;\n\t\t\t}\n\t\t});\n\t\t\n\t\t$(\"[id='search-location-submit']\").on(\"click\", function (e) {\n\t\t\te.preventDefault();\n\t\t\tvar address = $(this).parent('[id=search-location]').find('[id*=\"_storelocator_city\"]').val();\n\t\t\tvar countryCode = $('.shipping-country-selector').find('[id*=\"singleshipping_shippingAddress_addressFields_country\"]').val();\n\t\t\tvar $storeList = $(\".store-container .results-list\");\n\t\t\tStoreLocator.geocoder.geocode( { 'address': address, 'region': countryCode }, function(results, status) {\n\t\t\t\tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\t\tvar pointLocation = results[0].geometry.location;\n\t\t\t\t\tvar countryCode = '';\n\t\t\t\t\tfor (var i = 0; i < results[0].address_components.length; i++) {\n\t\t\t\t\t\tvar element = results[0].address_components[i];\n\t\t\t\t\t\tif(element.types[0].indexOf('country') != -1){\n\t\t\t\t\t\t\tcountryCode = element.short_name;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tvar coords = { address: address, countryCode: countryCode };\n\t\t\t\t\tStoreLocator.searchNearestPoint(pointLocation.lat(), pointLocation.lng(), coords, $storeList);\n\t\t\t\t} else {\n\t\t\t\t\tStoreLocator.noStoreFound($storeList);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\t\n\t\t$(\".form-container\").on(\"submit\", \"#search-location\", function(e){\n\t\t\te.preventDefault();\n\t\t\tvar regex = StoreLocator.createBrandsRegexSelector();\n\t\t\tvar address = $(this).find('[id*=\"_storelocator_city\"]').val();\n\t\t\tvar countryCode = $(this).find(\"#country-selector\").val();\n\t\t\tvar $storeList = $(\".allstores-container .results-list\");\n\t\t\tStoreLocator.geocoder.geocode( { 'address': address, 'region': countryCode }, function(results, status) {\n\t\t\t\tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\t\tvar pointLocation = results[0].geometry.location;\n\t\t\t\t\tvar coords = { address: address, countryCode: countryCode, brandRegex: regex};\n\t\t\t\t\tStoreLocator.searchNearestPoint(pointLocation.lat(), pointLocation.lng(), coords, $storeList);\n\t\t\t\t} else {\n\t\t\t\t\tStoreLocator.removeMapPoints();\n\t\t\t\t\tStoreLocator.noStoreFound($storeList);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\t$('.form-container').on('change', 'input[id*=store-type-]', function() {\n\t\t\tif ($('.form-container').find('[id*=\"_storelocator_city\"]').val()) {\n\t\t\t\t$('button[name*=\"_storelocator_findstores\"]').click();\n\t\t\t} else {\n\t\t\t\t$('.locate-me').click();\n\t\t\t}\n\t\t})\n\t\t\n\t},\n\tupdateMapStyle : function() {\n\t\tStoreLocator.map.data.revertStyle();\n\t\tStoreLocator.map.data.setStyle(function(feature){\n\t\t\tvar markerStyle = {\n\t\t\t\ticon: StoreLocator.configuration.icons.classic,\n\t\t\t\ttitle: feature.getProperty('title')\n\t\t\t};\n\t\t\t\n\t\t\tvar markerStoreId = feature.getProperty('ID');\n\t\t\tif (markerStoreId == StoreLocator.selectedStore) {\n\t\t\t\tmarkerStyle.icon = StoreLocator.configuration.icons.active;\n\t\t\t} else if (markerStoreId == StoreLocator.hoveredStore) {\n\t\t\t\tmarkerStyle.icon = StoreLocator.configuration.icons.hover;\n\t\t\t}\n\t\t\t\n\t\t\tvar customStyle = StoreLocator.throwEvent('setCustomStyle', StoreLocator, arguments);\n\t\t\tif (typeof(customStyle) != \"undefined\" && customStyle != null) {\n\t\t\t\tmarkerStyle = jQuery.extend(markerStyle, customStyle);\n\t\t\t}\n\n\t\t\treturn markerStyle;\n\t\t});\n\t\tvar $stores = $(\".store-list .list-content\");\n\t\t$stores.removeClass(\"hover\");\n\t\t$stores.removeClass(\"selected\");\n\t\t$stores.filter(\"[itemid=\" + StoreLocator.hoveredStore + \"]\").addClass(\"hover\");\n\t\t$stores.filter(\"[itemid=\" + StoreLocator.selectedStore + \"]\").addClass(\"selected\");\n\t\t$stores.filter(\"[itemid=\" + StoreLocator.selectedStore + \"]\").find('input[type=\"radio\"]').prop('checked', true);\n\t\t\n\t\tStoreLocator.throwEvent('styleUpdated', StoreLocator, arguments);\n\t},\n\tstoreToSelect : function(){\n\t\tif(typeof($('[id*=\"_storelocator_storeToSelect\"]').val()) != 'undefined' && !!$('[id*=\"_storelocator_storeToSelect\"]').val()) {\n\t\t\tvar storeToSelect = $('[id*=\"_storelocator_storeToSelect\"]').val();\n\t\t\tStoreLocator.scrollToStore(storeToSelect);\n\t\t\tStoreLocator.selectStore(storeToSelect);\n\t\t\t\n\t\t\tif (!StoreLocator.configuration.fitBounds){\n\t\t\t\tvar storeFeature = null;\n\t\t\t\tvar searchStore = function(feature) {\n\t\t\t\t\tif(feature.getProperty(\"ID\") == storeToSelect) {\n\t\t\t\t\t\tstoreFeature = feature;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tStoreLocator.map.data.forEach(searchStore);\n\t\t\t\tif (storeFeature != null) {\n\t\t\t\t\tvar storeLocation = storeFeature.getGeometry().get();\n\t\t\t\t\tvar currentBounds = StoreLocator.map.getBounds() \n\t\t\n\t\t\t\t\tif(!currentBounds.contains(storeLocation)){\n\t\t\t\t\t\tStoreLocator.map.setCenter(storeLocation);\n\t\t\t\t\t\tStoreLocator.map.setZoom(mapRessources.selectZoom);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (StoreLocator.configuration.fitBounds){\n\t\t\tvar bounds = new google.maps.LatLngBounds();\n\t\t\tvar extendBounds = function(feature) {\n\t\t\t\tvar storeLocation = feature.getGeometry().get();\n\t\t\t\tbounds.extend(storeLocation);\n\t\t\t};\n\t\t\tStoreLocator.map.data.forEach(extendBounds);\n\t\t\tStoreLocator.map.fitBounds(bounds);\n\t\t}\n\t\t\n\t\t\t\n\t},\n\thoverStore : function(storeId) {\n\t\tStoreLocator.hoveredStore = storeId;\n\t\tStoreLocator.updateMapStyle();\n\t\t\n\t\tStoreLocator.throwEvent('storeHovered', StoreLocator, arguments);\n\t},\n\tblurStore : function() {\n\t\tStoreLocator.hoveredStore = null;\n\t\tStoreLocator.updateMapStyle();\n\t\t\n\t\tStoreLocator.throwEvent('storeBlured', StoreLocator, arguments);\n\t},\n\tscrollToStore : function(storeId) {\n\t\tif ($(\".method-container.active\").length == 0) {\n\t\t\t$(\".all-stores-container\").addClass(\"active\");\n\t\t}\n\t var scrollPane = $(\".store-list\");\n\t var scrollTarget = scrollPane.find(\".list-content[itemid=\" + storeId + \"]\");\n\t if (scrollTarget.length > 0) {\n\t\t var scrollY = scrollTarget.offset().top + scrollPane.scrollTop() - scrollPane.offset().top;\n\t\t scrollPane.animate({scrollTop : scrollY }, 200);\n\t }\n\t},\n\tupdateSelectedStoreStyle : function (storeId) {\n\t\tStoreLocator.selectedStore = storeId;\n\t\t\n\t\tvar $stores = $(\".store-list .list-content\");\n\t\t$stores.removeClass(\"hover\");\n\t\t$stores.removeClass(\"selected\");\n\t\t$stores.filter(\"[itemid=\" + StoreLocator.hoveredStore + \"]\").addClass(\"hover\");\n\t\t$stores.filter(\"[itemid=\" + StoreLocator.selectedStore + \"]\").addClass(\"selected\");\n\t\t$stores.filter(\"[itemid=\" + StoreLocator.selectedStore + \"]\").find('input[type=\"radio\"]').prop('checked', true);\n\t},\n\tselectStore : function(storeId, storeData) {\n\t\tStoreLocator.selectedStore = storeId;\n\t\tStoreLocator.updateMapStyle();\n\t\t\n\t\tStoreLocator.throwEvent('storeSelected', StoreLocator, arguments);\n\t},\n\tunselectStore : function(storeId) {\n\t\tStoreLocator.selectedStore = storeId; \n\t\tStoreLocator.updateMapStyle();\n\t\t\n\t\tStoreLocator.throwEvent('storeUnselected', StoreLocator, arguments);\n\t},\n\tsearchNearestPoint : function(lat, lng, coords, $storeList) {\n\t\tif (StoreLocator.configuration.updateOnSearch)\n\t\t\tthis.removeMapPoints();\n\t\t\n\t\tvar initArgs = arguments;\n\t\tvar originPoint = new google.maps.LatLng(lat,lng);\n\t\tStoreLocator.map.setCenter(originPoint);\n\t\tif (StoreLocator.searchMarker != null) {\n\t\t\tStoreLocator.searchMarker.setPosition(originPoint);\n\t\t} else {\n\t\t\tStoreLocator.searchMarker = new google.maps.Marker({\n\t\t\t\tmap: StoreLocator.map,\n\t\t\t\tposition: originPoint,\n\t\t\t\ticon: StoreLocator.configuration.icons.target\n\t\t\t});\n\t\t}\n\t\tvar self = this;\n\t\t\n\t\tvar requestData = {\n\t\t\tlat: lat,\n\t\t\tlng: lng\n\t\t};\n\n\t\tif (coords !== null) {\n\t\t\trequestData['country'] = coords.countryCode;\n\t\t\trequestData['zone'] = coords.address;\n\t\t\trequestData['brandRegex'] = coords.brandRegex || [];\n\t\t}\n\n\t\tvar filter = '';\n\t\t$('input[id*=store-type-]').each(function (index, elem) {\n\t\t\tif (!elem.checked) {\n\t\t\t\tfilter += filter.length > 0 ? ',' : '';\n\t\t\t\tfilter += elem.value.toString();\n\t\t\t}\n\t\t});\n\n\t\tif (filter !== '') {\n\t\t\trequestData['excludedtypes'] = filter;\n\t\t}\n\n\t\t$.ajax({\n\t\t\turl: StoreLocator.configuration.urlNearest,\n\t\t\tdataType:\"json\",\n\t\t\tdata: requestData,\n\t\t\tsuccess: function(response) {\n\t\t\t\t$storeList.empty();\n\n let search_brands = [];\n if (response.brandRegex) {\n search_brands = response.brandRegex.split('*');\n if (search_brands[0] == '' && search_brands.length == 1) {\n search_brands = [];\n }\n }\n\t\t\t\t$(window).trigger('datalayer:push-event', {\n\t\t\t\t\tname: 'search',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tsearch_term: response.zone,\n\t\t\t\t\t\tsearch_category: 'store',\n\t\t\t\t\t\tsearch_results: response.features.length,\n\t\t\t\t\t\tsearch_method: 'text search',\n\t\t\t\t\t\tsearch_country: response.country,\n\t\t\t\t\t\tsearch_brands: search_brands\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t$($storeList).parent().find(\".nb-results\").html(response.features.length);\n\t\t\t\t\n\t\t\t\t// Show singular or plurial results\n\t\t\t\tvar storeQuantityResults = $(\".stores-quantity\");\n\t\t\t\tif (response.features.length > 1) {\n\t\t\t\t\tstoreQuantityResults.html(Resources.STORE_LOCATOR_RESULTS);\n\t\t\t\t} else {\n\t\t\t\t\tstoreQuantityResults.html(Resources.STORE_LOCATOR_RESULT);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvar bounds = new google.maps.LatLngBounds();\n\t\t\t\tbounds.extend(originPoint);\n\n\t\t\t\tvar index = 0;\n\t\t\t\tvar storeSelectedInSearch = false;\n\t\t\t\t// is shipping store locator\n\t\t\t\tvar isShippingStorelocator = $storeList.closest('.store-locator--shipping').length > 0;\n\t\t\t\tvar showMoreIndex = 1;\n\t\t\t\t\n\t\t\t\tfor (index;index < response.features.length; index++) {\n\t\t\t\t\tvar feature = response.features[index];\n\t\t\t\t\tvar storeId = feature.ID;\n\t\t\t\t\tvar isModulo = index%5 === 0 && index !== 0 && index !== response.features.length-1;\n\t\t\t\t\tvar $rendering = $(feature.properties.rendering);\n\t\t\t\t\t\n\t\t\t\t\tif (!!StoreLocator.selectedStore && $rendering.is(\"[itemid=\" + StoreLocator.selectedStore + \"]\")) {\n\t\t\t\t\t\t$rendering.addClass(\"selected\");\n\t\t\t\t\t\tstoreSelectedInSearch = true;\n\t\t\t\t\t}\n\t\t\t\t\t// hide shipping store locator results on mobile\n\t\t\t\t\tif (isShippingStorelocator && index > 4) {\n\t\t\t\t\t\t$rendering.addClass(\"show-on-desktop\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$storeList.append($rendering);\n\t\t\t\t\t// add show more button for shipping store locator\n\t\t\t\t\tif ( isShippingStorelocator && isModulo ) {\n\t\t\t\t\t\t$showMoreButton = $('
      • '+ Resources.SEE_MORE +'
      • ');\n\t\t\t\t\t\tif (showMoreIndex > 1){\n\t\t\t\t\t\t\t$showMoreButton.css('display', 'none');\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$storeList.append($showMoreButton);\n\t\t\t\t\t\tshowMoreIndex++;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (StoreLocator.configuration.updateOnSearch){\n\t\t\t\t\t\tstoreToPlaceOnMap = true;\n\t\t\t\t\t\tvar Feature = new google.maps.Data.Feature({'id' : feature.ID});\n\t\t\t\t\t\tvar LatLong = new google.maps.LatLng(feature.geometry.coordinates[1] ,feature.geometry.coordinates[0]);\n\t\t\t\t\t\tFeature.setProperty('ID', feature.ID);\n\t\t\t\t\t\tFeature.setGeometry(LatLong);\n\t\t\t\t\t\tself.map.data.add(Feature);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbounds.extend(new google.maps.LatLng(feature.geometry.coordinates[1] ,feature.geometry.coordinates[0]));\n\t\t\t\t}\n\t\t\t\tif (!storeSelectedInSearch) {\n\t\t\t\t\tStoreLocator.unselectStore();\n\t\t\t\t}\n\n\t\t\t\tif (response.features.length == 0) {\n\t\t\t\t\tStoreLocator.map.setZoom(mapRessources.defaultZoom);\n\t\t\t\t\tStoreLocator.noStoreFound($storeList);\n\t\t\t\t} else {\n\t\t\t\t\tif (StoreLocator.configuration.fitBounds)\n\t\t\t\t\t\tself.map.fitBounds(bounds);\n\t\t\t\t\telse\n\t\t\t\t\t\tStoreLocator.map.setZoom(mapRessources.selectZoom);\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t\tStoreLocator.throwEvent('storeSearched', StoreLocator, $.extend(initArgs, arguments));\n\n\t\t\t\t// Scroll to store after new list been created\n\t\t\t\tvar storeId = parseInt($(\".store-list-item.selected\").attr('itemid')); \n\t\t\t\tStoreLocator.scrollToStore(storeId);\n\t\t\t}\n\n\n\t\t});\n\n\t},\n\tnoStoreFound : function ($storeList){\n\t\t$storeList.empty();\n\t\t$storeList.append(\"

        \" + mapRessources.text.noStore + \"

        \");\n\t},\n\tthrowEvent : function(eventName, eventCaller, eventParams) {\n\t\tif (typeof(mapRessources[eventName]) == \"function\") {\n\t\t\treturn mapRessources[eventName].apply(eventCaller, eventParams)\n\t\t}\n\t},\n\tsetZoom : function (zoomLevel) {\n\t\tStoreLocator.map.setZoom(zoomLevel ? zoomLevel : mapRessources.defaultZoom);\n\t},\n\tcreateBrandsRegexSelector : function() {\n\t\tvar checkedBrands = $('.filter-brand-checkbox:checked');\n\t\tvar regex = \"*\";\n\t\tfor (var index=0;index < checkedBrands.length;index++) {\n\t\t\tregex += checkedBrands[index].getAttribute(\"value\") + \"*\";\n\t\t}\n\t\treturn regex;\n\t}\n}\n\nmodule.exports = StoreLocator;\n},{}],67:[function(require,module,exports){\n!function(e,n){\"object\"===typeof exports&&\"object\"===typeof module?module.exports=n():\"function\"===typeof define&&define.amd?define([],n):\"object\"===typeof exports?exports.ThreedDS2Utils=n():e.ThreedDS2Utils=n()}(this,function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){\"undefined\"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&\"object\"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,\"default\",{enumerable:!0,value:e}),2&n&&\"string\"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,\"a\",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p=\"\",t(t.s=0)}([function(e,n,t){\"use strict\";t.r(n);var r={container:void 0},o={\"01\":[\"250px\",\"400px\"],\"02\":[\"390px\",\"400px\"],\"03\":[\"500px\",\"600px\"],\"04\":[\"600px\",\"400px\"],\"05\":[\"100%\",\"100%\"]};function a(e){return o.hasOwnProperty(e)?e:\"01\"}var i={createIframe:function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:\"0\",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:\"0\",a=arguments.length>4?arguments[4]:void 0;if(!n||0===n.length)throw new Error(\"Name parameter missing for iframe\");e instanceof HTMLElement?r.container=e:r.container=document.body;var i=document.createElement(\"iframe\");i.classList.add(n+\"Class\"),i.width=t,i.height=o,i.name=n,i.setAttribute(\"frameborder\",\"0\"),i.setAttribute(\"border\",\"0\");var d=document.createTextNode(\"

        Your browser does not support iframes.

        \");return i.appendChild(d),r.container.appendChild(i),function(e,n){e.attachEvent?e.attachEvent(\"onload\",function(){n&&\"function\"===typeof n&&n(e.contentWindow)}):e.onload=function(){n&&\"function\"===typeof n&&n(e.contentWindow)}}(i,a),i},createForm:function(e,n,t,r,o){if(!e||!n||!t||!r||!o)throw new Error(\"Not all required parameters provided for form creation\");if(0===e.length||0===n.length||0===t.length||0===r.length||0===o.length)throw new Error(\"Not all required parameters have suitable values\");var a=document.createElement(\"form\");a.style.display=\"none\",a.name=e,a.action=n,a.method=\"POST\",a.target=t;var i=document.createElement(\"input\");return i.name=r,i.value=o,a.appendChild(i),a},getBrowserInfo:function(){var e=window&&window.screen?window.screen.width:\"\",n=window&&window.screen?window.screen.height:\"\",t=window&&window.screen?window.screen.colorDepth:\"\",r=window&&window.navigator?window.navigator.userAgent:\"\",o=!(!window||!window.navigator)&&navigator.javaEnabled(),a=\"\";return window&&window.navigator&&(a=window.navigator.language?window.navigator.language:window.navigator.browserLanguage),{screenWidth:e,screenHeight:n,colorDepth:t,userAgent:r,timeZoneOffset:(new Date).getTimezoneOffset(),language:a,javaEnabled:o}},base64Url:{encode:function(e){var n=window.btoa(e).split(\"=\")[0];return n=(n=n.replace(\"/+/g\",\"-\")).replace(\"///g\",\"_\")},decode:function(e){var n=e;switch((n=(n=n.replace(\"/-/g\",\"+\")).replace(\"/_/g\",\"/\")).length%4){case 0:break;case 2:n+=\"==\";break;case 3:n+=\"=\";break;default:window.console&&window.console.log&&window.console.log(\"### base64url::decodeBase64URL:: Illegal base64url string!\")}try{return window.atob(n)}catch(e){throw new Error(e)}}},config:{challengeWindowSizes:o,validateChallengeWindowSize:a,getChallengeWindowSize:function(e){return o[a(e)]},THREEDS_METHOD_TIMEOUT:1e4,CHALLENGE_TIMEOUT:6e5}};n.default=i}]).default});\n},{}],68:[function(require,module,exports){\n'use strict';\n\n/**\n * @function\n * @description Initializes the tooltip-content and layout\n */\nexports.init = function () {\n\t$(document).tooltip({\n\t\titems: '.tooltip',\n\t\ttrack: true,\n\t\tcontent: function () {\n\t\t\treturn $(this).find('.tooltip-content').html();\n\t\t}\n\t});\n\n\t$('.share-link').on('click', function (e) {\n\t\te.preventDefault();\n\t\tvar target = $(this).data('target');\n\t\tif (!target) {\n\t\t\treturn;\n\t\t}\n\t\t$(target).toggleClass('active');\n\t});\n};\n\n},{}],69:[function(require,module,exports){\n'use strict';\n\nvar _ = require('lodash');\n\nvar util = {\n\t/**\n\t * @function\n\t * @description appends the parameter with the given name and value to the given url and returns the changed url\n\t * @param {String} url the url to which the parameter will be added\n\t * @param {String} name the name of the parameter\n\t * @param {String} value the value of the parameter\n\t */\n\tappendParamToURL: function (url, name, value) {\n\t\t// quit if the param already exists\n\t\tif (url.indexOf(name + '=') !== -1) {\n\t\t\treturn url;\n\t\t}\n\t\tvar separator = url.indexOf('?') !== -1 ? '&' : '?';\n\t\treturn url + separator + name + '=' + encodeURIComponent(value);\n\t},\n\n\t/**\n\t * @function\n\t * @description remove the parameter and its value from the given url and returns the changed url\n\t * @param {String} url the url from which the parameter will be removed\n\t * @param {String} name the name of parameter that will be removed from url\n\t */\n\tremoveParamFromURL: function (url, name) {\n\t\tif (url.indexOf('?') === -1 || url.indexOf(name + '=') === -1) {\n\t\t\treturn url;\n\t\t}\n\t\tvar hash;\n\t\tvar params;\n\t\tvar domain = url.split('?')[0];\n\t\tvar paramUrl = url.split('?')[1];\n\t\tvar newParams = [];\n\t\t// if there is a hash at the end, store the hash\n\t\tif (paramUrl.indexOf('#') > -1) {\n\t\t\thash = paramUrl.split('#')[1] || '';\n\t\t\tparamUrl = paramUrl.split('#')[0];\n\t\t}\n\t\tparams = paramUrl.split('&');\n\t\tfor (var i = 0; i < params.length; i++) {\n\t\t\t// put back param to newParams array if it is not the one to be removed\n\t\t\tif (params[i].split('=')[0] !== name) {\n\t\t\t\tnewParams.push(params[i]);\n\t\t\t}\n\t\t}\n\t\treturn domain + '?' + newParams.join('&') + (hash ? '#' + hash : '');\n\t},\n\n\t/**\n\t * @function\n\t * @description appends the parameters to the given url and returns the changed url\n\t * @param {String} url the url to which the parameters will be added\n\t * @param {Object} params\n\t */\n\tappendParamsToUrl: function (url, params) {\n\t\tvar _url = url;\n\t\t_.each(params, function (value, name) {\n\t\t\t_url = this.appendParamToURL(_url, name, value);\n\t\t}.bind(this));\n\t\treturn _url;\n\t},\n\t/**\n\t * @function\n\t * @description extract the query string from URL\n\t * @param {String} url the url to extra query string from\n\t **/\n\tgetQueryString: function (url) {\n\t\tvar qs;\n\t\tif (!_.isString(url)) { return; }\n\t\tvar a = document.createElement('a');\n\t\ta.href = url;\n\t\tif (a.search) {\n\t\t\tqs = a.search.substr(1); // remove the leading ?\n\t\t}\n\t\treturn qs;\n\t},\n\t/**\n\t * @function\n\t * @description\n\t * @param {String}\n\t * @param {String}\n\t */\n\telementInViewport: function (el, offsetToTop) {\n\t\tif(!el) return;\n\t\tvar top = el.offsetTop,\n\t\t\tleft = el.offsetLeft,\n\t\t\twidth = el.offsetWidth,\n\t\t\theight = el.offsetHeight;\n\n\t\twhile (el.offsetParent) {\n\t\t\tel = el.offsetParent;\n\t\t\ttop += el.offsetTop;\n\t\t\tleft += el.offsetLeft;\n\t\t}\n\n\t\tif (typeof(offsetToTop) !== 'undefined') {\n\t\t\ttop -= offsetToTop;\n\t\t}\n\n\t\tif (window.pageXOffset !== null) {\n\t\t\treturn (\n\t\t\t\ttop < (window.pageYOffset + window.innerHeight) &&\n\t\t\t\tleft < (window.pageXOffset + window.innerWidth) &&\n\t\t\t\t(top + height) > window.pageYOffset &&\n\t\t\t\t(left + width) > window.pageXOffset\n\t\t\t);\n\t\t}\n\n\t\tif (document.compatMode === 'CSS1Compat') {\n\t\t\treturn (\n\t\t\t\ttop < (window.document.documentElement.scrollTop + window.document.documentElement.clientHeight) &&\n\t\t\t\tleft < (window.document.documentElement.scrollLeft + window.document.documentElement.clientWidth) &&\n\t\t\t\t(top + height) > window.document.documentElement.scrollTop &&\n\t\t\t\t(left + width) > window.document.documentElement.scrollLeft\n\t\t\t);\n\t\t}\n\t},\n\n\t/**\n\t * @function\n\t * @description Appends the parameter 'format=ajax' to a given path\n\t * @param {String} path the relative path\n\t */\n\tajaxUrl: function (path) {\n\t\treturn this.appendParamToURL(path, 'format', 'ajax');\n\t},\n\n\t/**\n\t * @function\n\t * @description\n\t * @param {String} url\n\t */\n\ttoAbsoluteUrl: function (url) {\n\t\tif (url.indexOf('http') !== 0 && url.charAt(0) !== '/') {\n\t\t\turl = '/' + url;\n\t\t}\n\t\treturn url;\n\t},\n\t/**\n\t * @function\n\t * @description Loads css dynamically from given urls\n\t * @param {Array} urls Array of urls from which css will be dynamically loaded.\n\t */\n\tloadDynamicCss: function (urls) {\n\t\tvar i, len = urls.length;\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tthis.loadedCssFiles.push(this.loadCssFile(urls[i]));\n\t\t}\n\t},\n\n\t/**\n\t * @function\n\t * @description Loads css file dynamically from given url\n\t * @param {String} url The url from which css file will be dynamically loaded.\n\t */\n\tloadCssFile: function (url) {\n\t\treturn $('').appendTo($('head')).attr({\n\t\t\ttype: 'text/css',\n\t\t\trel: 'stylesheet'\n\t\t}).attr('href', url); // for i.e. <9, href must be added after link has been appended to head\n\t},\n\t// array to keep track of the dynamically loaded CSS files\n\tloadedCssFiles: [],\n \n /**\n * @function\n * @description get custom css file from content if there is and load them into head, \n * use global var cssFilesToLoad {Array} like [\"/on/demandware.static/-/Library-Sites-SharedLibrary-paprika/fr_BE/v1457709478331/mycss.css\", ...]\n */\n getDynamicCssFilesForContent : function() {\n if (window.cssFilesToLoad) {\n window.cssFilesToLoad.map(function (elem) {\n this.loadedCssFiles.push(this.loadCssFile(elem));\n }, this);\n }\n },\n \n /**\n\t * @function\n\t * @description Removes all css files which were dynamically loaded\n\t */\n\tclearDynamicCss: function () {\n\t\tvar i = this.loadedCssFiles.length;\n\t\twhile (0 > i--) {\n\t\t\t$(this.loadedCssFiles[i]).remove();\n\t\t}\n\t\tthis.loadedCssFiles = [];\n\t},\n\t/**\n\t * @function\n\t * @description Extracts all parameters from a given query string into an object\n\t * @param {String} qs The query string from which the parameters will be extracted\n\t */\n\tgetQueryStringParams: function (qs) {\n\t\tif (!qs || qs.length === 0) { return {}; }\n\t\tvar params = {},\n\t\t\tunescapedQS = decodeURIComponent(qs);\n\t\t// Use the String::replace method to iterate over each\n\t\t// name-value pair in the string.\n\t\tunescapedQS.replace(new RegExp('([^?=&]+)(=([^&]*))?', 'g'),\n\t\t\tfunction ($0, $1, $2, $3) {\n\t\t\t\tparams[$1] = $3;\n\t\t\t}\n\t\t);\n\t\treturn params;\n\t},\n\n\tfillAddressFields: function (address, $form) {\n\t\tfor (var field in address) {\n\t\t\tif (field === 'ID' || field === 'UUID' || field === 'key') {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// if the key in address object ends with 'Code', remove that suffix\n\t\t\t// keys that ends with 'Code' are postalCode, stateCode and countryCode\n\t\t\t$form.find('[name$=\"' + field.replace('Code', '') + '\"]').val(address[field]);\n\t\t\t// update the state fields\n\t\t\tif (field === 'countryCode') {\n\t\t\t\t$form.find('[name$=\"country\"]').trigger('change');\n\t\t\t\t// retrigger state selection after country has changed\n\t\t\t\t// this results in duplication of the state code, but is a necessary evil\n\t\t\t\t// for now because sometimes countryCode comes after stateCode\n\t\t\t\t$form.find('[name$=\"state\"]').val(address.stateCode);\n\t\t\t}\n\t\t}\n\t},\n\t/**\n\t * @function\n\t * @description Updates the number of the remaining character\n\t * based on the character limit in a text area\n\t */\n\tlimitCharacters: function () {\n\t\t$('form').find('textarea[data-character-limit]').each(function () {\n\t\t\tvar characterLimit = $(this).data('character-limit');\n\t\t\tvar charCountHtml = String.format(Resources.CHAR_LIMIT_MSG,\n\t\t\t\t'' + characterLimit + '',\n\t\t\t\t'' + characterLimit + '');\n\t\t\tvar charCountContainer = $(this).next('div.char-count');\n\t\t\tif (charCountContainer.length === 0) {\n\t\t\t\tcharCountContainer = $('
        ').insertAfter($(this));\n\t\t\t}\n\t\t\tcharCountContainer.html(charCountHtml);\n\t\t\t// trigger the keydown event so that any existing character data is calculated\n\t\t\t$(this).change();\n\t\t});\n\t},\n\t/**\n\t * @function\n\t * @description Binds the onclick-event to a delete button on a given container,\n\t * which opens a confirmation box with a given message\n\t * @param {String} container The name of element to which the function will be bind\n\t * @param {String} message The message the will be shown upon a click\n\t */\n\tsetDeleteConfirmation: function (container, message) {\n\t\t$(container).on('click', '.delete', function () {\n\t\t\treturn window.confirm(message);\n\t\t});\n\t},\n\t/**\n\t * @function\n\t * @description Scrolls a browser window to a given x point\n\t * @param {String} The x coordinate\n\t */\n\tscrollBrowser: function (xLocation) {\n\t\t$('html, body').animate({scrollTop: xLocation}, 500);\n\t},\n\n\tisMobile: function () {\n\t\tvar mobileAgentHash = ['mobile', 'tablet', 'phone', 'ipad', 'ipod', 'android', 'blackberry', 'windows ce', 'opera mini', 'palm'];\n\t\tvar\tidx = 0;\n\t\tvar isMobile = false;\n\t\tvar userAgent = (navigator.userAgent).toLowerCase();\n\n\t\twhile (mobileAgentHash[idx] && !isMobile) {\n\t\t\tisMobile = (userAgent.indexOf(mobileAgentHash[idx]) >= 0);\n\t\t\tidx++;\n\t\t}\n\t\treturn isMobile;\n\t},\n\t/**\n\t * returns if true if we are on mobile or tablet size screen\n\t * */\n\tisMobileSize: function () {\n\t\treturn $(window).width() < 640;\n\t},\n\tisTabletSize: function () {\n\t\treturn $(window).width() < 800;\n\t}, \n\tisDesktopSize: function () {\n\t\treturn !this.isTabletSize();\n\t},\n\t/**\n\t * initialize datepicker\n\t * @param options : Object to extend options to use when init datepicker, can be used to block selectable days for example\n\t * */\n\tinitializeDatePicker: function (fieldID, options) {\n\t\tvar field = $('[id*='+ fieldID +']');\n\t\tvar config = jQuery.parseJSON(Resources.DATEPICKER_CONFIG);\n\t\tvar yearMonthChangeHandler = {\n\t\t\tonChangeMonthYear: function(y, m, i){\n\t\t\t\tvar d = i.selectedDay;\n\t\t\t\t$(this).datepicker('setDate', new Date(y, m - 1, d));\n\t\t\t}\n\t\t};\n\t\t$.extend(config, yearMonthChangeHandler);\n\t\tif (options) {\n\t\t\t$.extend(config, options);\n\t\t}\n\t\t\n\t\tfield.datepicker(config);\n\t},\n\n\t/**\n\t * @function\n\t * @description initialize product positions on dom elements\n\t * */\n\tinitializeProductPositions : function(target){\n\t\tvar $productsToInit = target || $('.product-tile');\n\t\t$productsToInit.each(\n\t\t\tfunction(index) {\n\t\t\t\tif (!$(this).data('position')) {\n\t\t\t\t\t$(this).attr('data-position', index+1);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t},\n\n\t/**\n\t * @function\n\t * @description check if the typed character is authorized or not on phone input\n\t * keyCode is used by Edge (though it is deprecated), code is implemented by the other browsers\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code\n\t * @param {KeyboardEvent.code} code code of the key pressed, from the KeyboardEvent\n\t * @param {KeyboardEvent.keyCode} keyCode keyCode of the key pressed, from the KeyboardEvent\n\t * @returns {boolean} true or false if authorized or not\n\t */\n\tisAuthorizedKeyForPhoneInput : function(code, keyCode) {\n\t\tvar codes = ['Digit0', 'Digit1', 'Digit2', 'Digit3', 'Digit4', 'Digit5', 'Digit6', 'Digit7', 'Digit8', 'Digit9',\n\t\t\t\t\t'Numpad0', 'Numpad1', 'Numpad2', 'Numpad3', 'Numpad4', 'Numpad5', 'Numpad6', 'Numpad7', 'Numpad8', 'Numpad9',\n\t\t\t\t\t'ArrowLeft', 'ArrowRight', 'Home', 'End', 'Delete', 'Backspace', 'Enter', 'ShiftLeft', 'ShiftRight'];\n\t\tvar keyCodes = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\n\t\t\t\t\t\t96, 97, 98, 99, 100, 101, 102, 103, 104, 105,\n\t\t\t\t\t\t37, 39, 36, 35, 46, 8, 13, 16];\n\n\t\tif (keyCode) {\n\t\t\treturn keyCodes.indexOf(keyCode) !== -1;\n\t\t} else {\n\t\t\treturn codes.indexOf(code) !== -1;\n\t\t}\n\t},\n\n /**\n * @function\n * @description Function used to process an array of Promise synchronously\n * @param {Array} array Array of Promises\n * @param {Function} function Function used to process every Promise\n */\n processPromises: function (array, fn) {\n return array.reduce(function (p, item) {\n return p.then(function () {\n return fn(item);\n });\n }, Promise.resolve());\n }\n};\n\nmodule.exports = util;\n\n},{\"lodash\":78}],70:[function(require,module,exports){\n'use strict';\n\nvar validatorHelper = require('./validatorhelper');\nvar naPhone = /^\\(?([2-9][0-8][0-9])\\)?[\\-\\. ]?([2-9][0-9]{2})[\\-\\. ]?([0-9]{4})(\\s*x[0-9]+)?$/;\nvar regex = {\n\tphone: {\n\t\tus: naPhone,\n\t\tca: naPhone,\n\t\tfr: /^0[1-6]{1}(([0-9]{2}){4})|((\\s[0-9]{2}){4})|((-[0-9]{2}){4})$/,\n\t\tit: /^(([0-9]{2,4})([-\\s\\/]{0,1})([0-9]{4,8}))?$/,\n\t\tjp: /^(0\\d{1,4}- ?)?\\d{1,4}-\\d{4}$/,\n\t\tcn: /.*/,\n\t\tgb: /^((\\(?0\\d{4}\\)?\\s?\\d{3}\\s?\\d{3})|(\\(?0\\d{3}\\)?\\s?\\d{3}\\s?\\d{4})|(\\(?0\\d{2}\\)?\\s?\\d{4}\\s?\\d{4}))(\\s?\\#(\\d{4}|\\d{3}))?$/\n\t},\n\tpostal: {\n\t\tus: /^\\d{5}(-\\d{4})?$/,\n\t\tca: /^[ABCEGHJKLMNPRSTVXY]{1}\\d{1}[A-Z]{1} *\\d{1}[A-Z]{1}\\d{1}$/,\n\t\tfr: /^(F-)?((2[A|B])|[0-9]{2})[0-9]{3}$/,\n\t\tit: /^([0-9]){5}$/,\n\t\tjp: /^([0-9]){3}[-]([0-9]){4}$/,\n\t\tcn: /^([0-9]){6}$/,\n\t\tgb: /^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/\n\t},\n\tnotCC: /^(?!(([0-9 -]){13,19})).*$/,\n\temail: new RegExp(validatorHelper.getFormElement('email').regexp)\n};\n// global form validator settings\nvar settings = {\n\tignore: [],\n\terrorClass: 'error',\n\terrorElement: 'span',\n\tonkeyup: false,\n\tonfocusout: function (element) {\n\t\tif (!this.checkable(element)) {\n\t\t\tthis.element(element);\n\t\t\terrorMessagesException.newsletter();\n\t\t}\n\t}\n};\n\n/**\n * Exceptional processing of error messages.\n * @namespace\n */\nvar errorMessagesException = {\n\t\n\t/**\n\t * @function\n\t * @description Moving the span.error element created after an incorrect format email when subscribing to the newsletter on the footer\n\t */\n\tnewsletter: function () {\n\t\tvar fieldset = document.querySelector('.js-newsletter-error');\n\t\tvar error = document.querySelector('.newsletter-cta-form span.error');\n\t\tif (error !== null && fieldset !== null) {\n\t\t\tfieldset.append(error);\n\t\t}\n\t}\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 */\nvar validatePhone = function (value, el) {\n\tvar country = $(el).closest('form').find('.country');\n\tif (country.length === 0 || country.val().length === 0 || !regex.phone[country.val().toLowerCase()]) {\n\t\treturn true;\n\t}\n\n\tvar rgx = regex.phone[country.val().toLowerCase()];\n\tvar isOptional = this.optional(el);\n\tvar isValid = rgx.test($.trim(value));\n\n\treturn isOptional || isValid;\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\tvar isValid = regex.notCC.test($.trim(value));\n\treturn isValid;\n};\n\n/**\n * @function\n * @description Validates a given email with regex\n * */\nvar validateEmail = function(value, el) {\n\tvar rgx = regex.email;\n\tvar isOptional = this.optional(el);\n\tvar isValid = rgx.test($.trim(value));\n\treturn isOptional || isValid;\n}\n\n/**\n * @function \n * @description Validate address1 fields in address forms\n * */\nvar validateAddress1 = function(value, el) {\n\tvar country = $(el).closest('form').find('.country').val();\n\tvar rgx = new RegExp(validatorHelper.getFormElement('address1', country).regexp);\n\tvar isOptional = this.optional(el);\n\tvar isValid = rgx.test($.trim(value)) && validateMaxLength('address1', value, country);\n\treturn isOptional || isValid;\n}\n\n/**\n * @function \n * @description Validate address2 fields in address forms\n * */\nvar validateAddress2 = function(value, el) {\n\tvar rgx = new RegExp(validatorHelper.getFormElement('address2').regexp);\n\tvar isOptional = this.optional(el);\n\tvar isValid = rgx.test($.trim(value)) && validateMaxLength('address2', value);\n\treturn isOptional || isValid;\n}\n\n/**\n * @function \n * @description Validate address1 fields in address forms\n * */\nvar validateHouseNr = function(value, el) {\n\tvar rgx = new RegExp(validatorHelper.getFormElement('cpHouseNr').regexp);\n\tvar isOptional = this.optional(el);\n\tvar isValid = rgx.test($.trim(value));\n\treturn isOptional || isValid;\n}\n\n/**\n * @function \n * @description Validates dialcode, test if we have a phone number, if phone number is ok too, fill completephone input.\n * */\nvar validateDialCode = function (value, el) {\n\tvar isValidNumber = false;\n\tvar $el = $(el);\n\tvar telcompleteElement = $el.siblings('.tel-complete');\n\tvar telnumberElement = $el.siblings('.tel-number').first();\n\tvar rgx = new RegExp(validatorHelper.getFormElement('dialcode').regexp);\n\tvar isOptional = telnumberElement.val() ? false : this.optional(el);\n\tvar value = $.trim(value);\n\tif (value[0] !== \"+\") {\n\t\tvalue = \"+\" + value;\n\t\tif (value != \"+\") {\n\t\t\t$el.val(value);\n\t\t}\n\t}\n\t\n\tvar isValid = rgx.test(value);\n\tif (isValid) {\n\t\tvar cleandial = value.match(new RegExp(validatorHelper.getFormElement('dialcode').noprefixregexp)).shift();\n\t\ttelnumberElement.attr('placeholder', validatorHelper.getPhoneFormElement(cleandial)['example']);\n\t}\n\t\n\tif (isValid && telnumberElement.val()) {\n\t\t// remove error after validation fix\n\t\tthis.hideThese(this.errorsFor($el));\n\t\t$el.attr('aria-invalid', 'false').attr('aria-describedby', '');\n\t\tif ($el.hasClass('error')) {\n\t\t\t$el.removeClass('error').addClass('valid');\n\t\t}\n\t\tisValidNumber = this.element(telnumberElement);\n\t}\n\tif (isValid && isValidNumber) {\n\t\ttelcompleteElement.val(cleandial + $(telnumberElement).val());\n\t} else {\n\t\ttelcompleteElement.val('');\n\t}\n\t\n\treturn isOptional || isValid;\n}\n\n/**\n * @function \n * @description Validates telnumber, test if we have a dialcode, if dial is ok too, fill completephone input.\n * */\nvar validateTelNumber = function (value, el) {\n\tvar dialcode, isValidDialCode;\n\tvar $el = $(el);\n\tvar dialcodeElement = $el.siblings('.tel-dialcode').first();\n\tvar dialcodeHtmlValue = $.trim(dialcodeElement.val());\n\tisValidDialCode = new RegExp(validatorHelper.getFormElement('dialcode').noprefixregexp).test(dialcodeHtmlValue);\n\tif (isValidDialCode) {\n\t\tdialcode = dialcodeHtmlValue.match(new RegExp(validatorHelper.getFormElement('dialcode').noprefixregexp));\n\t}\n\t\n\tif (dialcode && dialcode.length > 0 ) {\n\t\tdialcode = dialcode[0];\n\t}\n\t\n\tvar isOptional = this.optional(el);\n\tif (!isOptional && !isValidDialCode) {\n\t\treturn false;\n\t}\n\t\n\tvar cleandial = dialcode.match(new RegExp(validatorHelper.getFormElement('dialcode').noprefixregexp)).shift();\n\tvar isValid = new RegExp(validatorHelper.getPhoneFormElement(cleandial)['regexp']).test(value);\n\t\n\treturn isOptional || isValid;\n}\n\n/**\n * @function \n * @description Validates postal code.\n * */\nvar validatePostal = function (value, el) {\n\tvar isValid, isOptional, $el, selectedCountryElement, country, postalFormConfiguration, rgx;\n\t$el = $(el);\n\t// we select addresscountry from parent form, in case we have multiple forms with country in page\n\tselectedCountryElement = $el.parents('form').first().find('[id*=_address_country], [id*=_addressFields_country]');\n\tcountry = selectedCountryElement.val();\n\tpostalFormConfiguration = validatorHelper.getFormElement('postal', country);\n\tisOptional = this.optional(el);\n\tif (!postalFormConfiguration) {\n\t\treturn isOptional;\n\t}\n\t// auto remove spaces\n\tvalue = value.replace(/\\s+/, '');\n\t$el.val(value);\n\t\n\trgx = new RegExp(postalFormConfiguration.regexp);\n\tisValid = rgx.test(value);\n\t\n\treturn isOptional || isValid;\n}\n\n/**\n * @function \n * @description Validates names.\n * */\nvar validateName = function (value, el) {\n\tvar isValid, isOptional, rgx;\n\tisOptional = this.optional(el);\n\trgx = new RegExp(validatorHelper.getFormElement('name').regexp);\n\tisValid = rgx.test(value) && validateMaxLength('name', value);\n\treturn isOptional || isValid;\n}\n\n/**\n * @function \n * @description Validates city.\n * */\nvar validateCity = function (value, el) {\n\tvar isValid, isOptional, rgx;\n\tisOptional = this.optional(el);\n\trgx = new RegExp(validatorHelper.getFormElement('city').regexp);\n\tisValid = rgx.test(value) && validateMaxLength('city', value);\n\treturn isOptional || isValid;\n}\n\n\n/**\n * @function \n * @description Validates fidelity card.\n * */\nvar validateFidelityCardId = function (value, el) {\n\tvar isValid, isOptional, rgx;\n\tisOptional = this.optional(el);\n\trgx = new RegExp(validatorHelper.getFormElement('loyaltycardid').regexp);\n\tisValid = rgx.test(value);\n\treturn isOptional || isValid;\n}\n\n/**\n * @function \n * @description Validates passwords\n * */\nvar validatePassword = function (value, el) {\n\tvar isValid, isOptional, rgx;\n\tisOptional = this.optional(el);\n\tisValid = value.length >= 6;\n\treturn isOptional || isValid;\n}\n\n/**\n * @function\n * @description Validate contact us comment textarea\n*/\nvar validateContactUsComment = function (value, el){\n\tvar isValid, isOptional, formElementConfig;\n isOptional = this.optional(el);\n isValid = validateTextAreaLength('contactus-comment', value);\n return isOptional || isValid;\n}\n/**\n * @function\n * @description Generic validate field length\n*/\nvar validateTextAreaLength = function (name, value) {\n var formElementConfig = validatorHelper.getFormElement(name);\n return value.length >= formElementConfig.minlength && value.length <= formElementConfig.maxlength;\n}\n\n/**\n * @function\n * @description Generic validate textarea length\n*/\nvar validateMaxLength = function (name, value, country) {\n\tif (country) {\n\t\tvar formElementConfig = validatorHelper.getFormElement(name, country);\n\t} else {\n\t\tvar formElementConfig = validatorHelper.getFormElement(name);\n\t}\n return !(formElementConfig && 'maxlength' in formElementConfig) || value.length <= formElementConfig.maxlength;\n}\n\n/**\n * @function\n * @description return length error\n * */\nvar lengthOrErrorMessage = function (args) {\n\tvar el = args[1];\n\tvar country = args[4];\n\tvar value = el.value;\n\tif (country) {\n\t\tvar formElementConfig = validatorHelper.getFormElement(args[2], country);\n\t\treturn validateMaxLength(args[2], value, country) ? args[3] : jQuery.validator.format(Resources.VALIDATE_MAXLENGTH, [formElementConfig['maxlength'] || 250]);\n\t}\n\tvar formElementConfig = validatorHelper.getFormElement(args[2]);\n\treturn validateMaxLength(args[2], value) ? args[3] : jQuery.validator.format(Resources.VALIDATE_MAXLENGTH, [formElementConfig['maxlength'] || 250]);\n}\n\n/**\n * @function \n * @description Dynamic error message for tel number error cases\n * */\nvar generateTextErrorForTelNumber = function (){\n\treturn Resources.INVALID_PHONE;\n}\n\n/**\n * Add postal validation method to jQuery validation plugin.\n * Text fields must have 'postal' css class to be validated as postal\n */\n$.validator.addMethod('postal', validatePostal, Resources.VALIDATE_POSTAL);\n\n/**\n * Add name validation method to jQuery validation plugin.\n * Text fields must have 'name' css class to be validated as name\n */\n$.validator.addMethod('customer-addressid', validateName, function () {\n\targuments[arguments.length] = 'name';\n\targuments[arguments.length+1] = Resources.VALIDATE_ADDRESSID;\n\treturn lengthOrErrorMessage(arguments);\n});\n\n$.validator.addMethod('customer-firstname', validateName, function () {\n\targuments[arguments.length] = 'name';\n\targuments[arguments.length+1] = Resources.VALIDATE_FIRSTNAME;\n\treturn lengthOrErrorMessage(arguments);\n});\n\n$.validator.addMethod('customer-lastname', validateName, function () {\n\targuments[arguments.length] = 'name';\n\targuments[arguments.length+1] = Resources.VALIDATE_LASTNAME;\n\treturn lengthOrErrorMessage(arguments);\n});\n\n/**\n * Add tel number validation\n * */\n$.validator.addMethod('tel-number', validateTelNumber, generateTextErrorForTelNumber);\n$.validator.addMethod('tel-dialcode', validateDialCode, Resources.INVALID_PHONE);\n\n/**\n * Add fidelity card id validation\n * */\n$.validator.addMethod('loyaltycardid', validateFidelityCardId, Resources.INVALID_FIDELITY);\n\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 email validation method to jQuery validation plugin.\n * Text fields must have 'email' css class to be validated\n */\n$.validator.addMethod('email', validateEmail, Resources.VALIDATE_EMAIL);\n\n/**\n * Add password confirmation method to jQuery validation plugin.\n * password fields must have 'password' class\n * */\n$.validator.addMethod('password', validatePassword, Resources.INVALID_PASSWORD);\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\tvar isOptional = this.optional(el);\n\tvar isValid = (!isNaN(value)) && (parseFloat(value) >= 5) && (parseFloat(value) <= 5000);\n\treturn 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\tif ($.trim(value).length === 0) { return true; }\n\treturn (!isNaN(value) && Number(value) >= 0);\n}, ''); // '' should be replaced with error message if needed\n\n/**\n * Add text area min-max length validation to contactus-comment textarea\n*/\n$.validator.addMethod('contactus-comment', validateContactUsComment, Resources.VALIDATE_TEXTAREALENGTH);\n\n/**\n * Add address 1 fields validation\n * */\n$.validator.addMethod('address1', validateAddress1, function () {\n\t\t// we cant keep original arguments if pass a custom method with defined arguments\n\t\t// so we add ours to current arguments object, which is not a real array. see https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Fonctions/arguments\n\t\tvar country = $(arguments[1]).closest('form').find('.country').val();\n\t\targuments[arguments.length] = 'address1';\n\t\targuments[arguments.length+1] = Resources.VALIDATE_ADDRESS1;\n\t\targuments[arguments.length+2] = country;\n\t\treturn lengthOrErrorMessage(arguments);\n\t});\n\n/**\n * Add address 2 fields validation\n * */\n$.validator.addMethod('address2', validateAddress2, function () {\n\targuments[arguments.length] = 'address2';\n\targuments[arguments.length+1] = Resources.VALIDATE_ADDRESSFIELD;\n\treturn lengthOrErrorMessage(arguments);\n});\n\n/**\n * Add city field validation\n * */\n$.validator.addMethod('city', validateCity, function () {\n\targuments[arguments.length] = 'city';\n\targuments[arguments.length+1] = Resources.VALIDATE_CITY;\n\treturn lengthOrErrorMessage(arguments);\n});\n\n/**\n * Add housenr fields validation\n * */\n$.validator.addMethod('cpHouseNr', validateHouseNr, Resources.VALIDATE_HOUSENR);\n\n/**\n * Validate date with european string small format dd/MM/yyyy\n * */\n$.validator.methods.date = function( value, element ) {\n\tvar dateElements = value.split('/');\n\tvar d;\n\tif (dateElements.length >= 2) {\n\t\td = new Date(dateElements[2], dateElements[1], dateElements[0]);\n\t}\n\treturn this.optional( element ) || !/Invalid|NaN/.test(d);\n};\n\n$.extend($.validator.messages, {\n\trequired: Resources.VALIDATE_REQUIRED,\n\tremote: Resources.VALIDATE_REMOTE,\n\turl: Resources.VALIDATE_URL,\n\tdate: Resources.VALIDATE_DATE,\n\tdateISO: Resources.VALIDATE_DATEISO,\n\tnumber: Resources.VALIDATE_NUMBER,\n\tdigits: Resources.VALIDATE_DIGITS,\n\tcreditcard: Resources.VALIDATE_CREDITCARD,\n\tequalTo: Resources.VALIDATE_EQUALTO,\n\tmaxlength: $.validator.format(Resources.VALIDATE_MAXLENGTH),\n\tminlength: $.validator.format(Resources.VALIDATE_MINLENGTH),\n\trangelength: $.validator.format(Resources.VALIDATE_RANGELENGTH),\n\trange: $.validator.format(Resources.VALIDATE_RANGE),\n\tmax: $.validator.format(Resources.VALIDATE_MAX),\n\tmin: $.validator.format(Resources.VALIDATE_MIN)\n});\n\nvar validator = {\n\tregex: regex,\n\tsettings: settings,\n\tinit: function () {\n\t\tvar self = this;\n\t\t$('form:not(.suppress)').each(function () {\n\t\t\t$(this).validate(self.settings);\n\t\t});\n\t},\n\tinitForm: function (f) {\n\t\t$(f).validate(this.settings);\n\t}\n};\n\nmodule.exports = validator;\n\n},{\"./validatorhelper\":71}],71:[function(require,module,exports){\n'use strict';\n/**\n * Helper module to use shared form configuration\n * */\nvar formconfig = require('../scripts/formconfig');\n\n/**\n * @function\n * @description returns a form element for given country or default if there's no country\n * */\nfunction getFormElement(name, country) {\n\tvar formElement;\n\tif (!name) {\n\t\treturn;\n\t}\n\tif (!country) {\n\t\tformElement = formconfig.default.fields[name];\n\t} else {\n\t\tcountry = country.toLowerCase();\n\t\tif(!formconfig[country]) {\n\t\t\tformElement = formconfig.default.fields[name];\n\t\t} else {\n\t\t\tformElement = (country in formconfig && formconfig[country].fields[name]) ? formconfig[country].fields[name] : getFormElement(name, formconfig[country].fallback);\n\t\t}\t\n\t}\n\t\n\treturn formElement;\n};\n\n/**\n * @function\n * @description get specific form element by dial code, phone format is not country specific in object\n * */\nfunction getPhoneFormElement(dialcode) {\n\tvar phoneConfiguration = getFormElement('phone');\n\tif (!dialcode) {\n\t\treturn phoneConfiguration.default;\n\t}\n\treturn phoneConfiguration[dialcode] || phoneConfiguration.default;\n}\n\n/**\n * @function \n * @description get formConfig root element\n * */\nfunction getFormConfigRootElement(countryCode, element, elementGE) {\n\tcountryCode = countryCode ? countryCode.toLowerCase() : '';\n\tvar formRootElement, dialDefault;\n\tif (SitePreferences.GE_ENABLED) {\n\t\tdialDefault = formconfig.default[elementGE];\n\t} else {\n\t\tdialDefault = formconfig.default[element];\n\t}\n\tformconfig[countryCode] ? formRootElement = formconfig[countryCode][element] : formRootElement = dialDefault;\n\treturn formRootElement;\n}\n\n/**\n * @function \n * @description change phone dialcode according to country\n * @param $el\n * */\nfunction changePhoneDialForCountry($el) {\n\tvar value = $el.val();\n\t\n\tvar defaultDialCode = getFormConfigRootElement(value, 'dial', 'dialGE');\n\tvar $dialCodeEl = $el.closest('form').find('.tel-dialcode');\n\tif ( !$dialCodeEl.val() || !$dialCodeEl.next('.tel-number').val() ) {\n\t\t$dialCodeEl.val(defaultDialCode);\n\t\t// simulate focusout to change placeholder and jquery verification on tel field\n\t\t$dialCodeEl.trigger('focusout');\n\t}\n}\n\n\nexports.getFormElement = getFormElement;\nexports.getPhoneFormElement = getPhoneFormElement;\nexports.getFormConfigRootElement = getFormConfigRootElement;\nexports.changePhoneDialForCountry = changePhoneDialForCountry;\n},{\"../scripts/formconfig\":73}],72:[function(require,module,exports){\n'use strict';\n\nvar ibanValidator = require('./iban');\n\tibanValidator.init();\n\nvar validateIBAN = function(value, el) {\n\tvar cleanValue = value.split(' ').join('');\n\tvar countryVal = $('.countryiban').val();\n\tvar isIbanEqCountryCode = value.substring(0,2) == countryVal;\n\treturn this.optional(el) || (ibanValidator.isValid(cleanValue) && isIbanEqCountryCode);\n}\n\n/**\n * Add IBAN confirmation method to jQuery validation plugin.\n * Text fields must have 'iban' class\n * */\n$.validator.addMethod('iban', validateIBAN, Resources.VALIDATE_IBAN);\n\nvar settings = {\n\tignore: [],\n\terrorClass: 'error',\n\terrorElement: 'span',\n};\n\nvar validatoriban = {\n\tsettings: settings,\n\tinit: function () {\n\t\tvar self = this;\n\t\t\n\t\t$('.iban').on('input', function() {\n\t\t\t$(this).valid();\n\t\t});\n\t\t$('form').each(function () {\n\t\t\t$(this).validate(self.settings);\n\t\t});\n\t},\n\tinitForm: function (f) {\n\t\t$(f).validate(this.settings);\n\t}\n};\n\nmodule.exports = validatoriban;\n},{\"./iban\":16}],73:[function(require,module,exports){\nmodule.exports={\n \"default\" : {\n \"fallback\" : \"\",\n \"fields\" : {\n \t\"email\" : {\n \t\t\"regexp\" : \"^[\\\\w\\\\-\\\\.]{1,}@([a-zA-Z\\\\-\\\\d]{1,}\\\\.){1,}[a-zA-Z\\\\-\\\\d]{2,4}$\"\n \t},\n \t\"name\" : {\n \t\t\"regexp\" : \"^[a-zA-ZÀ-ÿ\\\\s\\\\'-]+$\",\n \"maxlength\" : \"50\"\n \t},\n \"postal\" : {\n \"regexp\" : \"^[0-9a-zA-Z]{1,10}$\"\n },\n \"cpHouseNr\" : { \n \t\"regexp\" : \"^[0-9]+([\\\\s\\\\S]+)?$\"\n },\n \"phone\" : {\n \"default\" : {\n \"regexp\" : \"^0[0-9]{9}$\",\n \"example\" : \"0123456789\"\n },\n \"31\" : {\n \t\"regexp\" : \"^0[0-9]{6,9}$\",\n \t\"example\" : \"0601189473\"\n },\n \"32\" : {\n \"regexp\" : \"^0[0-9]{8,9}$\",\n \"example\" : \"0491478925\"\n },\n \"33\" : {\n \"regexp\" : \"^0[0-9]{9}$\",\n \t\"example\" : \"0278985841\"\n },\n \"43\" : {\n \"regexp\" : \"^0[0-9]{7,12}$\",\n \"example\" : \"0676800505012\"\n },\n \"49\" : {\n \"regexp\" : \"^0[0-9]{9,11}$\",\n \t\"example\" : \"015162843760\"\n },\n \"262\" : {\n \t\"regexp\" : \"^[0-9]{10}$\",\n \t\"example\" : \"0123456789\"\n },\n \"590\" : {\n \t\"regexp\" : \"^[0-9]{10}$\",\n \t\"example\" : \"0123456789\"\n },\n \"594\" : {\n \t\"regexp\" : \"^[0-9]{10}$\",\n \t\"example\" : \"0123456789\"\n },\n \"596\" : {\n \t\"regexp\" : \"^[0-9]{10}$\",\n \t\"example\" : \"0123456789\"\n },\n \"352\" : {\n \t\"regexp\" : \"^0[0-9]{5,9}$\",\n \t\"example\" : \"0678478982\"\n },\n \"00\" : {\n \t\"regexp\" : \"^[0-9]{1,13}$\",\n \t\"example\" : \"0123456789\"\n }\n },\n \"address1\" : {\n \t\"regexp\" : \"^[a-zA-Z]+([\\\\s\\\\S]+)?$\",\n \"maxlength\" : \"250\"\n },\n \"address2\" : {\n \"regexp\" : \"^[\\\\s\\\\S]+$\",\n \"maxlength\" : \"30\"\n },\n \"city\" : {\n \"regexp\" : \"^[\\\\D]+$\",\n \"maxlength\" : \"50\"\n },\n \"dialcode\" : {\n \t\"regexp\" : \"^\\\\+[0-9](\\\\-)?[0-9]{0,3}$\",\n \t\"noprefixregexp\" : \"[0-9](\\\\-)?[0-9]{0,3}$\",\n \"dialonlyregexp\" : \"^262|^594|^596|^[0-9](([0-9])?(-[0-9]{3})?)\"\n },\n \"loyaltycardid\" : {\n \t\"regexp\" : \"^[0-9]{12,13}$\"\n },\n \"contactus-comment\" : {\n \t\"minlength\" : \"50\",\n \t\"maxlength\" : \"500\"\n }\n },\n \"dial\" : \"+32\",\n \"dialGE\" : \"+00\"\n },\n \"fr\" : {\n \"fallback\" :\"default\",\n \"fields\" : {\n \t \"postal\" : {\n \"regexp\" : \"^[0-9]{5}$\"\n }\n },\n \"dial\" : \"+33\"\n },\n \"be\" : {\n \"fallback\" :\"default\",\n \"fields\" : {\n \"postal\" : {\n \"regexp\" : \"^[0-9]{4}$\"\n }\n },\n \"dial\" : \"+32\"\n },\n \"lu\" : {\n \"fallback\" :\"be\",\n \"fields\" : {\n \"postal\" : {\n \"regexp\" : \"^[0-9]{4}$\"\n }\n },\n \"dial\" : \"+352\"\n },\n \"nl\" : {\n \"fallback\" :\"default\",\n \"fields\" : {\n \"postal\" : {\n \"regexp\" : \"^[1-9][0-9]{3}[a-zA-Z]{2}$\"\n }\n },\n \"dial\" : \"+31\"\n },\n \"de\" : {\n \"fallback\" :\"default\",\n \"fields\" : {\n \"postal\" : {\n \"regexp\" : \"^[0-9]{5}$\"\n }\n },\n \"dial\" : \"+49\"\n },\n \"at\": {\n \"fallback\" :\"default\",\n \"fields\" : {\n \"postal\" : {\n \"regexp\" : \"^([a-zA-Z]\\\\-)?[0-9]{4}$\"\n }\n },\n \"dial\" : \"+43\"\n }\n}\n},{}],74:[function(require,module,exports){\n(function (process){\n\n// Use the fastest possible means to execute a task in a future turn\n// of the event loop.\n\n// linked list of tasks (single, with head node)\nvar head = {task: void 0, next: null};\nvar tail = head;\nvar flushing = false;\nvar requestFlush = void 0;\nvar isNodeJS = false;\n\nfunction flush() {\n /* jshint loopfunc: true */\n\n while (head.next) {\n head = head.next;\n var task = head.task;\n head.task = void 0;\n var domain = head.domain;\n\n if (domain) {\n head.domain = void 0;\n domain.enter();\n }\n\n try {\n task();\n\n } catch (e) {\n if (isNodeJS) {\n // In node, uncaught exceptions are considered fatal errors.\n // Re-throw them synchronously to interrupt flushing!\n\n // Ensure continuation if the uncaught exception is suppressed\n // listening \"uncaughtException\" events (as domains does).\n // Continue in next event to avoid tick recursion.\n if (domain) {\n domain.exit();\n }\n setTimeout(flush, 0);\n if (domain) {\n domain.enter();\n }\n\n throw e;\n\n } else {\n // In browsers, uncaught exceptions are not fatal.\n // Re-throw them asynchronously to avoid slow-downs.\n setTimeout(function() {\n throw e;\n }, 0);\n }\n }\n\n if (domain) {\n domain.exit();\n }\n }\n\n flushing = false;\n}\n\nif (typeof process !== \"undefined\" && process.nextTick) {\n // Node.js before 0.9. Note that some fake-Node environments, like the\n // Mocha test runner, introduce a `process` global without a `nextTick`.\n isNodeJS = true;\n\n requestFlush = function () {\n process.nextTick(flush);\n };\n\n} else if (typeof setImmediate === \"function\") {\n // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate\n if (typeof window !== \"undefined\") {\n requestFlush = setImmediate.bind(window, flush);\n } else {\n requestFlush = function () {\n setImmediate(flush);\n };\n }\n\n} else if (typeof MessageChannel !== \"undefined\") {\n // modern browsers\n // http://www.nonblocking.io/2011/06/windownexttick.html\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n requestFlush = function () {\n channel.port2.postMessage(0);\n };\n\n} else {\n // old browsers\n requestFlush = function () {\n setTimeout(flush, 0);\n };\n}\n\nfunction asap(task) {\n tail = tail.next = {\n task: task,\n domain: isNodeJS && process.domain,\n next: null\n };\n\n if (!flushing) {\n flushing = true;\n requestFlush();\n }\n};\n\nmodule.exports = asap;\n\n\n}).call(this,require('_process'))\n},{\"_process\":75}],75:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n draining = true;\n var currentQueue;\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n var i = -1;\n while (++i < len) {\n currentQueue[i]();\n }\n len = queue.length;\n }\n draining = false;\n}\nprocess.nextTick = function (fun) {\n queue.push(fun);\n if (!draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],76:[function(require,module,exports){\n/*!\n * eventie v1.0.6\n * event binding helper\n * eventie.bind( elem, 'click', myFn )\n * eventie.unbind( elem, 'click', myFn )\n * MIT license\n */\n\n/*jshint browser: true, undef: true, unused: true */\n/*global define: false, module: false */\n\n( function( window ) {\n\n'use strict';\n\nvar docElem = document.documentElement;\n\nvar bind = function() {};\n\nfunction getIEEvent( obj ) {\n var event = window.event;\n // add event.target\n event.target = event.target || event.srcElement || obj;\n return event;\n}\n\nif ( docElem.addEventListener ) {\n bind = function( obj, type, fn ) {\n obj.addEventListener( type, fn, false );\n };\n} else if ( docElem.attachEvent ) {\n bind = function( obj, type, fn ) {\n obj[ type + fn ] = fn.handleEvent ?\n function() {\n var event = getIEEvent( obj );\n fn.handleEvent.call( fn, event );\n } :\n function() {\n var event = getIEEvent( obj );\n fn.call( obj, event );\n };\n obj.attachEvent( \"on\" + type, obj[ type + fn ] );\n };\n}\n\nvar unbind = function() {};\n\nif ( docElem.removeEventListener ) {\n unbind = function( obj, type, fn ) {\n obj.removeEventListener( type, fn, false );\n };\n} else if ( docElem.detachEvent ) {\n unbind = function( obj, type, fn ) {\n obj.detachEvent( \"on\" + type, obj[ type + fn ] );\n try {\n delete obj[ type + fn ];\n } catch ( err ) {\n // can't delete window object properties\n obj[ type + fn ] = undefined;\n }\n };\n}\n\nvar eventie = {\n bind: bind,\n unbind: unbind\n};\n\n// ----- module definition ----- //\n\nif ( typeof define === 'function' && define.amd ) {\n // AMD\n define( eventie );\n} else if ( typeof exports === 'object' ) {\n // CommonJS\n module.exports = eventie;\n} else {\n // browser global\n window.eventie = eventie;\n}\n\n})( window );\n\n},{}],77:[function(require,module,exports){\n/*!\n * imagesLoaded v3.2.0\n * JavaScript is all like \"You images are done yet or what?\"\n * MIT License\n */\n\n( function( window, factory ) { 'use strict';\n // universal module definition\n\n /*global define: false, module: false, require: false */\n\n if ( typeof define == 'function' && define.amd ) {\n // AMD\n define( [\n 'eventEmitter/EventEmitter',\n 'eventie/eventie'\n ], function( EventEmitter, eventie ) {\n return factory( window, EventEmitter, eventie );\n });\n } else if ( typeof module == 'object' && module.exports ) {\n // CommonJS\n module.exports = factory(\n window,\n require('wolfy87-eventemitter'),\n require('eventie')\n );\n } else {\n // browser global\n window.imagesLoaded = factory(\n window,\n window.EventEmitter,\n window.eventie\n );\n }\n\n})( window,\n\n// -------------------------- factory -------------------------- //\n\nfunction factory( window, EventEmitter, eventie ) {\n\n'use strict';\n\nvar $ = window.jQuery;\nvar console = window.console;\n\n// -------------------------- helpers -------------------------- //\n\n// extend objects\nfunction extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}\n\nvar objToString = Object.prototype.toString;\nfunction isArray( obj ) {\n return objToString.call( obj ) == '[object Array]';\n}\n\n// turn element or nodeList into an array\nfunction makeArray( obj ) {\n var ary = [];\n if ( isArray( obj ) ) {\n // use object if already an array\n ary = obj;\n } else if ( typeof obj.length == 'number' ) {\n // convert nodeList to array\n for ( var i=0; i < obj.length; i++ ) {\n ary.push( obj[i] );\n }\n } else {\n // array of single index\n ary.push( obj );\n }\n return ary;\n}\n\n // -------------------------- imagesLoaded -------------------------- //\n\n /**\n * @param {Array, Element, NodeList, String} elem\n * @param {Object or Function} options - if function, use as callback\n * @param {Function} onAlways - callback function\n */\n function ImagesLoaded( elem, options, onAlways ) {\n // coerce ImagesLoaded() without new, to be new ImagesLoaded()\n if ( !( this instanceof ImagesLoaded ) ) {\n return new ImagesLoaded( elem, options, onAlways );\n }\n // use elem as selector string\n if ( typeof elem == 'string' ) {\n elem = document.querySelectorAll( elem );\n }\n\n this.elements = makeArray( elem );\n this.options = extend( {}, this.options );\n\n if ( typeof options == 'function' ) {\n onAlways = options;\n } else {\n extend( this.options, options );\n }\n\n if ( onAlways ) {\n this.on( 'always', onAlways );\n }\n\n this.getImages();\n\n if ( $ ) {\n // add jQuery Deferred object\n this.jqDeferred = new $.Deferred();\n }\n\n // HACK check async to allow time to bind listeners\n var _this = this;\n setTimeout( function() {\n _this.check();\n });\n }\n\n ImagesLoaded.prototype = new EventEmitter();\n\n ImagesLoaded.prototype.options = {};\n\n ImagesLoaded.prototype.getImages = function() {\n this.images = [];\n\n // filter & find items if we have an item selector\n for ( var i=0; i < this.elements.length; i++ ) {\n var elem = this.elements[i];\n this.addElementImages( elem );\n }\n };\n\n /**\n * @param {Node} element\n */\n ImagesLoaded.prototype.addElementImages = function( elem ) {\n // filter siblings\n if ( elem.nodeName == 'IMG' ) {\n this.addImage( elem );\n }\n // get background image on element\n if ( this.options.background === true ) {\n this.addElementBackgroundImages( elem );\n }\n\n // find children\n // no non-element nodes, #143\n var nodeType = elem.nodeType;\n if ( !nodeType || !elementNodeTypes[ nodeType ] ) {\n return;\n }\n var childImgs = elem.querySelectorAll('img');\n // concat childElems to filterFound array\n for ( var i=0; i < childImgs.length; i++ ) {\n var img = childImgs[i];\n this.addImage( img );\n }\n\n // get child background images\n if ( typeof this.options.background == 'string' ) {\n var children = elem.querySelectorAll( this.options.background );\n for ( i=0; i < children.length; i++ ) {\n var child = children[i];\n this.addElementBackgroundImages( child );\n }\n }\n };\n\n var elementNodeTypes = {\n 1: true,\n 9: true,\n 11: true\n };\n\n ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) {\n var style = getStyle( elem );\n // get url inside url(\"...\")\n var reURL = /url\\(['\"]*([^'\"\\)]+)['\"]*\\)/gi;\n var matches = reURL.exec( style.backgroundImage );\n while ( matches !== null ) {\n var url = matches && matches[1];\n if ( url ) {\n this.addBackground( url, elem );\n }\n matches = reURL.exec( style.backgroundImage );\n }\n };\n\n // IE8\n var getStyle = window.getComputedStyle || function( elem ) {\n return elem.currentStyle;\n };\n\n /**\n * @param {Image} img\n */\n ImagesLoaded.prototype.addImage = function( img ) {\n var loadingImage = new LoadingImage( img );\n this.images.push( loadingImage );\n };\n\n ImagesLoaded.prototype.addBackground = function( url, elem ) {\n var background = new Background( url, elem );\n this.images.push( background );\n };\n\n ImagesLoaded.prototype.check = function() {\n var _this = this;\n this.progressedCount = 0;\n this.hasAnyBroken = false;\n // complete if no images\n if ( !this.images.length ) {\n this.complete();\n return;\n }\n\n function onProgress( image, elem, message ) {\n // HACK - Chrome triggers event before object properties have changed. #83\n setTimeout( function() {\n _this.progress( image, elem, message );\n });\n }\n\n for ( var i=0; i < this.images.length; i++ ) {\n var loadingImage = this.images[i];\n loadingImage.once( 'progress', onProgress );\n loadingImage.check();\n }\n };\n\n ImagesLoaded.prototype.progress = function( image, elem, message ) {\n this.progressedCount++;\n this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;\n // progress event\n this.emit( 'progress', this, image, elem );\n if ( this.jqDeferred && this.jqDeferred.notify ) {\n this.jqDeferred.notify( this, image );\n }\n // check if completed\n if ( this.progressedCount == this.images.length ) {\n this.complete();\n }\n\n if ( this.options.debug && console ) {\n console.log( 'progress: ' + message, image, elem );\n }\n };\n\n ImagesLoaded.prototype.complete = function() {\n var eventName = this.hasAnyBroken ? 'fail' : 'done';\n this.isComplete = true;\n this.emit( eventName, this );\n this.emit( 'always', this );\n if ( this.jqDeferred ) {\n var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve';\n this.jqDeferred[ jqMethod ]( this );\n }\n };\n\n // -------------------------- -------------------------- //\n\n function LoadingImage( img ) {\n this.img = img;\n }\n\n LoadingImage.prototype = new EventEmitter();\n\n LoadingImage.prototype.check = function() {\n // If complete is true and browser supports natural sizes,\n // try to check for image status manually.\n var isComplete = this.getIsImageComplete();\n if ( isComplete ) {\n // report based on naturalWidth\n this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );\n return;\n }\n\n // If none of the checks above matched, simulate loading on detached element.\n this.proxyImage = new Image();\n eventie.bind( this.proxyImage, 'load', this );\n eventie.bind( this.proxyImage, 'error', this );\n // bind to image as well for Firefox. #191\n eventie.bind( this.img, 'load', this );\n eventie.bind( this.img, 'error', this );\n this.proxyImage.src = this.img.src;\n };\n\n LoadingImage.prototype.getIsImageComplete = function() {\n return this.img.complete && this.img.naturalWidth !== undefined;\n };\n\n LoadingImage.prototype.confirm = function( isLoaded, message ) {\n this.isLoaded = isLoaded;\n this.emit( 'progress', this, this.img, message );\n };\n\n // ----- events ----- //\n\n // trigger specified handler for event type\n LoadingImage.prototype.handleEvent = function( event ) {\n var method = 'on' + event.type;\n if ( this[ method ] ) {\n this[ method ]( event );\n }\n };\n\n LoadingImage.prototype.onload = function() {\n this.confirm( true, 'onload' );\n this.unbindEvents();\n };\n\n LoadingImage.prototype.onerror = function() {\n this.confirm( false, 'onerror' );\n this.unbindEvents();\n };\n\n LoadingImage.prototype.unbindEvents = function() {\n eventie.unbind( this.proxyImage, 'load', this );\n eventie.unbind( this.proxyImage, 'error', this );\n eventie.unbind( this.img, 'load', this );\n eventie.unbind( this.img, 'error', this );\n };\n\n // -------------------------- Background -------------------------- //\n\n function Background( url, element ) {\n this.url = url;\n this.element = element;\n this.img = new Image();\n }\n\n // inherit LoadingImage prototype\n Background.prototype = new LoadingImage();\n\n Background.prototype.check = function() {\n eventie.bind( this.img, 'load', this );\n eventie.bind( this.img, 'error', this );\n this.img.src = this.url;\n // check if image is already complete\n var isComplete = this.getIsImageComplete();\n if ( isComplete ) {\n this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );\n this.unbindEvents();\n }\n };\n\n Background.prototype.unbindEvents = function() {\n eventie.unbind( this.img, 'load', this );\n eventie.unbind( this.img, 'error', this );\n };\n\n Background.prototype.confirm = function( isLoaded, message ) {\n this.isLoaded = isLoaded;\n this.emit( 'progress', this, this.element, message );\n };\n\n // -------------------------- jQuery -------------------------- //\n\n ImagesLoaded.makeJQueryPlugin = function( jQuery ) {\n jQuery = jQuery || window.jQuery;\n if ( !jQuery ) {\n return;\n }\n // set local variable\n $ = jQuery;\n // $().imagesLoaded()\n $.fn.imagesLoaded = function( options, callback ) {\n var instance = new ImagesLoaded( this, options, callback );\n return instance.jqDeferred.promise( $(this) );\n };\n };\n // try making plugin\n ImagesLoaded.makeJQueryPlugin();\n\n // -------------------------- -------------------------- //\n\n return ImagesLoaded;\n\n});\n\n},{\"eventie\":76,\"wolfy87-eventemitter\":84}],78:[function(require,module,exports){\n(function (global){\n/**\n * @license\n * lodash 3.10.1 (Custom Build) \n * Build: `lodash modern -d -o ./index.js`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n;(function() {\n\n /** Used as a safe reference for `undefined` in pre-ES5 environments. */\n var undefined;\n\n /** Used as the semantic version number. */\n var VERSION = '3.10.1';\n\n /** Used to compose bitmasks for wrapper metadata. */\n var BIND_FLAG = 1,\n BIND_KEY_FLAG = 2,\n CURRY_BOUND_FLAG = 4,\n CURRY_FLAG = 8,\n CURRY_RIGHT_FLAG = 16,\n PARTIAL_FLAG = 32,\n PARTIAL_RIGHT_FLAG = 64,\n ARY_FLAG = 128,\n REARG_FLAG = 256;\n\n /** Used as default options for `_.trunc`. */\n var DEFAULT_TRUNC_LENGTH = 30,\n DEFAULT_TRUNC_OMISSION = '...';\n\n /** Used to detect when a function becomes hot. */\n var HOT_COUNT = 150,\n HOT_SPAN = 16;\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE = 200;\n\n /** Used to indicate the type of lazy iteratees. */\n var LAZY_FILTER_FLAG = 1,\n LAZY_MAP_FLAG = 2;\n\n /** Used as the `TypeError` message for \"Functions\" methods. */\n var FUNC_ERROR_TEXT = 'Expected a function';\n\n /** Used as the internal argument placeholder. */\n var PLACEHOLDER = '__lodash_placeholder__';\n\n /** `Object#toString` result references. */\n var argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\n var arrayBufferTag = '[object ArrayBuffer]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n /** Used to match empty string literals in compiled template source. */\n var reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n /** Used to match HTML entities and HTML characters. */\n var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,\n reUnescapedHtml = /[&<>\"'`]/g,\n reHasEscapedHtml = RegExp(reEscapedHtml.source),\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n /** Used to match template delimiters. */\n var reEscape = /<%-([\\s\\S]+?)%>/g,\n reEvaluate = /<%([\\s\\S]+?)%>/g,\n reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n /** Used to match property names within property paths. */\n var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\n\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/,\n rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g;\n\n /**\n * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns)\n * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).\n */\n var reRegExpChars = /^[:!,]|[\\\\^$.*+?()[\\]{}|\\/]|(^[0-9a-fA-Fnrtuvx])|([\\n\\r\\u2028\\u2029])/g,\n reHasRegExpChars = RegExp(reRegExpChars.source);\n\n /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */\n var reComboMark = /[\\u0300-\\u036f\\ufe20-\\ufe23]/g;\n\n /** Used to match backslashes in property paths. */\n var reEscapeChar = /\\\\(\\\\)?/g;\n\n /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */\n var reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n /** Used to match `RegExp` flags from their coerced string values. */\n var reFlags = /\\w*$/;\n\n /** Used to detect hexadecimal string values. */\n var reHasHexPrefix = /^0[xX]/;\n\n /** Used to detect host constructors (Safari > 5). */\n var reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n /** Used to detect unsigned integer values. */\n var reIsUint = /^\\d+$/;\n\n /** Used to match latin-1 supplementary letters (excluding mathematical operators). */\n var reLatin1 = /[\\xc0-\\xd6\\xd8-\\xde\\xdf-\\xf6\\xf8-\\xff]/g;\n\n /** Used to ensure capturing order of template delimiters. */\n var reNoMatch = /($^)/;\n\n /** Used to match unescaped characters in compiled string literals. */\n var reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n /** Used to match words to create compound words. */\n var reWords = (function() {\n var upper = '[A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde]',\n lower = '[a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff]+';\n\n return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');\n }());\n\n /** Used to assign default `context` object properties. */\n var contextProps = [\n 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',\n 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',\n 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite',\n 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',\n 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap'\n ];\n\n /** Used to make template sourceURLs easier to identify. */\n var templateCounter = -1;\n\n /** Used to identify `toStringTag` values of typed arrays. */\n var typedArrayTags = {};\n typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n typedArrayTags[uint32Tag] = true;\n typedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n typedArrayTags[dateTag] = typedArrayTags[errorTag] =\n typedArrayTags[funcTag] = typedArrayTags[mapTag] =\n typedArrayTags[numberTag] = typedArrayTags[objectTag] =\n typedArrayTags[regexpTag] = typedArrayTags[setTag] =\n typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\n /** Used to identify `toStringTag` values supported by `_.clone`. */\n var cloneableTags = {};\n cloneableTags[argsTag] = cloneableTags[arrayTag] =\n cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =\n cloneableTags[dateTag] = cloneableTags[float32Tag] =\n cloneableTags[float64Tag] = cloneableTags[int8Tag] =\n cloneableTags[int16Tag] = cloneableTags[int32Tag] =\n cloneableTags[numberTag] = cloneableTags[objectTag] =\n cloneableTags[regexpTag] = cloneableTags[stringTag] =\n cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\n cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\n cloneableTags[errorTag] = cloneableTags[funcTag] =\n cloneableTags[mapTag] = cloneableTags[setTag] =\n cloneableTags[weakMapTag] = false;\n\n /** Used to map latin-1 supplementary letters to basic latin letters. */\n var deburredLetters = {\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcC': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xeC': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss'\n };\n\n /** Used to map characters to HTML entities. */\n var htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '`': '`'\n };\n\n /** Used to map HTML entities to characters. */\n var htmlUnescapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\",\n '`': '`'\n };\n\n /** Used to determine if values are of the language type `Object`. */\n var objectTypes = {\n 'function': true,\n 'object': true\n };\n\n /** Used to escape characters for inclusion in compiled regexes. */\n var regexpEscapes = {\n '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34',\n '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39',\n 'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46',\n 'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66',\n 'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78'\n };\n\n /** Used to escape characters for inclusion in compiled string literals. */\n var stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n /** Detect free variable `exports`. */\n var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;\n\n /** Detect free variable `module`. */\n var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;\n\n /** Detect free variable `global` from Node.js. */\n var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;\n\n /** Detect free variable `self`. */\n var freeSelf = objectTypes[typeof self] && self && self.Object && self;\n\n /** Detect free variable `window`. */\n var freeWindow = objectTypes[typeof window] && window && window.Object && window;\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;\n\n /**\n * Used as a reference to the global object.\n *\n * The `this` value is used if it's the global object to avoid Greasemonkey's\n * restricted `window` object, otherwise the `window` object is used.\n */\n var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * The base implementation of `compareAscending` which compares values and\n * sorts them in ascending order without guaranteeing a stable sort.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\n function baseCompareAscending(value, other) {\n if (value !== other) {\n var valIsNull = value === null,\n valIsUndef = value === undefined,\n valIsReflexive = value === value;\n\n var othIsNull = other === null,\n othIsUndef = other === undefined,\n othIsReflexive = other === other;\n\n if ((value > other && !othIsNull) || !valIsReflexive ||\n (valIsNull && !othIsUndef && othIsReflexive) ||\n (valIsUndef && othIsReflexive)) {\n return 1;\n }\n if ((value < other && !valIsNull) || !othIsReflexive ||\n (othIsNull && !valIsUndef && valIsReflexive) ||\n (othIsUndef && valIsReflexive)) {\n return -1;\n }\n }\n return 0;\n }\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.indexOf` without support for binary searches.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n if (value !== value) {\n return indexOfNaN(array, fromIndex);\n }\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.isFunction` without support for environments\n * with incorrect `typeof` results.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n */\n function baseIsFunction(value) {\n // Avoid a Chakra JIT bug in compatibility modes of IE 11.\n // See https://github.com/jashkenas/underscore/issues/1621 for more details.\n return typeof value == 'function' || false;\n }\n\n /**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` or `undefined` values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\n function baseToString(value) {\n return value == null ? '' : (value + '');\n }\n\n /**\n * Used by `_.trim` and `_.trimLeft` to get the index of the first character\n * of `string` that is not found in `chars`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @param {string} chars The characters to find.\n * @returns {number} Returns the index of the first character not found in `chars`.\n */\n function charsLeftIndex(string, chars) {\n var index = -1,\n length = string.length;\n\n while (++index < length && chars.indexOf(string.charAt(index)) > -1) {}\n return index;\n }\n\n /**\n * Used by `_.trim` and `_.trimRight` to get the index of the last character\n * of `string` that is not found in `chars`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @param {string} chars The characters to find.\n * @returns {number} Returns the index of the last character not found in `chars`.\n */\n function charsRightIndex(string, chars) {\n var index = string.length;\n\n while (index-- && chars.indexOf(string.charAt(index)) > -1) {}\n return index;\n }\n\n /**\n * Used by `_.sortBy` to compare transformed elements of a collection and stable\n * sort them in ascending order.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @returns {number} Returns the sort order indicator for `object`.\n */\n function compareAscending(object, other) {\n return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);\n }\n\n /**\n * Used by `_.sortByOrder` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise,\n * a value is sorted in ascending order if its corresponding order is \"asc\", and\n * descending if \"desc\".\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\n function compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = baseCompareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * ((order === 'asc' || order === true) ? 1 : -1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://code.google.com/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n }\n\n /**\n * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\n function deburrLetter(letter) {\n return deburredLetters[letter];\n }\n\n /**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeHtmlChar(chr) {\n return htmlEscapes[chr];\n }\n\n /**\n * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @param {string} leadingChar The capture group for a leading character.\n * @param {string} whitespaceChar The capture group for a whitespace character.\n * @returns {string} Returns the escaped character.\n */\n function escapeRegExpChar(chr, leadingChar, whitespaceChar) {\n if (leadingChar) {\n chr = regexpEscapes[chr];\n } else if (whitespaceChar) {\n chr = stringEscapes[chr];\n }\n return '\\\\' + chr;\n }\n\n /**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n }\n\n /**\n * Gets the index at which the first occurrence of `NaN` is found in `array`.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched `NaN`, else `-1`.\n */\n function indexOfNaN(array, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 0 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n var other = array[index];\n if (other !== other) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\n function isObjectLike(value) {\n return !!value && typeof value == 'object';\n }\n\n /**\n * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a\n * character code is whitespace.\n *\n * @private\n * @param {number} charCode The character code to inspect.\n * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.\n */\n function isSpace(charCode) {\n return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||\n (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));\n }\n\n /**\n * Replaces all `placeholder` elements in `array` with an internal placeholder\n * and returns an array of their indexes.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {*} placeholder The placeholder to replace.\n * @returns {Array} Returns the new array of placeholder indexes.\n */\n function replaceHolders(array, placeholder) {\n var index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n if (array[index] === placeholder) {\n array[index] = PLACEHOLDER;\n result[++resIndex] = index;\n }\n }\n return result;\n }\n\n /**\n * An implementation of `_.uniq` optimized for sorted arrays without support\n * for callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The function invoked per iteration.\n * @returns {Array} Returns the new duplicate-value-free array.\n */\n function sortedUniq(array, iteratee) {\n var seen,\n index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value, index, array) : value;\n\n if (!index || seen !== computed) {\n seen = computed;\n result[++resIndex] = value;\n }\n }\n return result;\n }\n\n /**\n * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the first non-whitespace character.\n */\n function trimmedLeftIndex(string) {\n var index = -1,\n length = string.length;\n\n while (++index < length && isSpace(string.charCodeAt(index))) {}\n return index;\n }\n\n /**\n * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\n function trimmedRightIndex(string) {\n var index = string.length;\n\n while (index-- && isSpace(string.charCodeAt(index))) {}\n return index;\n }\n\n /**\n * Used by `_.unescape` to convert HTML entities to characters.\n *\n * @private\n * @param {string} chr The matched character to unescape.\n * @returns {string} Returns the unescaped character.\n */\n function unescapeHtmlChar(chr) {\n return htmlUnescapes[chr];\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Create a new pristine `lodash` function using the given `context` object.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {Object} [context=root] The context object.\n * @returns {Function} Returns a new `lodash` function.\n * @example\n *\n * _.mixin({ 'foo': _.constant('foo') });\n *\n * var lodash = _.runInContext();\n * lodash.mixin({ 'bar': lodash.constant('bar') });\n *\n * _.isFunction(_.foo);\n * // => true\n * _.isFunction(_.bar);\n * // => false\n *\n * lodash.isFunction(lodash.foo);\n * // => false\n * lodash.isFunction(lodash.bar);\n * // => true\n *\n * // using `context` to mock `Date#getTime` use in `_.now`\n * var mock = _.runInContext({\n * 'Date': function() {\n * return { 'getTime': getTimeMock };\n * }\n * });\n *\n * // or creating a suped-up `defer` in Node.js\n * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\n */\n function runInContext(context) {\n // Avoid issues with some ES3 environments that attempt to use values, named\n // after built-in constructors like `Object`, for the creation of literals.\n // ES5 clears this up by stating that literals must use built-in constructors.\n // See https://es5.github.io/#x11.1.5 for more details.\n context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;\n\n /** Native constructor references. */\n var Array = context.Array,\n Date = context.Date,\n Error = context.Error,\n Function = context.Function,\n Math = context.Math,\n Number = context.Number,\n Object = context.Object,\n RegExp = context.RegExp,\n String = context.String,\n TypeError = context.TypeError;\n\n /** Used for native method references. */\n var arrayProto = Array.prototype,\n objectProto = Object.prototype,\n stringProto = String.prototype;\n\n /** Used to resolve the decompiled source of functions. */\n var fnToString = Function.prototype.toString;\n\n /** Used to check objects for own properties. */\n var hasOwnProperty = objectProto.hasOwnProperty;\n\n /** Used to generate unique IDs. */\n var idCounter = 0;\n\n /**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\n var objToString = objectProto.toString;\n\n /** Used to restore the original `_` reference in `_.noConflict`. */\n var oldDash = root._;\n\n /** Used to detect if a method is native. */\n var reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n );\n\n /** Native method references. */\n var ArrayBuffer = context.ArrayBuffer,\n clearTimeout = context.clearTimeout,\n parseFloat = context.parseFloat,\n pow = Math.pow,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n Set = getNative(context, 'Set'),\n setTimeout = context.setTimeout,\n splice = arrayProto.splice,\n Uint8Array = context.Uint8Array,\n WeakMap = getNative(context, 'WeakMap');\n\n /* Native method references for those with the same name as other `lodash` methods. */\n var nativeCeil = Math.ceil,\n nativeCreate = getNative(Object, 'create'),\n nativeFloor = Math.floor,\n nativeIsArray = getNative(Array, 'isArray'),\n nativeIsFinite = context.isFinite,\n nativeKeys = getNative(Object, 'keys'),\n nativeMax = Math.max,\n nativeMin = Math.min,\n nativeNow = getNative(Date, 'now'),\n nativeParseInt = context.parseInt,\n nativeRandom = Math.random;\n\n /** Used as references for `-Infinity` and `Infinity`. */\n var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,\n POSITIVE_INFINITY = Number.POSITIVE_INFINITY;\n\n /** Used as references for the maximum length and index of an array. */\n var MAX_ARRAY_LENGTH = 4294967295,\n MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,\n HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\n\n /**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\n var MAX_SAFE_INTEGER = 9007199254740991;\n\n /** Used to store function metadata. */\n var metaMap = WeakMap && new WeakMap;\n\n /** Used to lookup unminified function names. */\n var realNames = {};\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object which wraps `value` to enable implicit chaining.\n * Methods that operate on and return arrays, collections, and functions can\n * be chained together. Methods that retrieve a single value or may return a\n * primitive value will automatically end the chain returning the unwrapped\n * value. Explicit chaining may be enabled using `_.chain`. The execution of\n * chained methods is lazy, that is, execution is deferred until `_#value`\n * is implicitly or explicitly called.\n *\n * Lazy evaluation allows several methods to support shortcut fusion. Shortcut\n * fusion is an optimization strategy which merge iteratee calls; this can help\n * to avoid the creation of intermediate data structures and greatly reduce the\n * number of iteratee executions.\n *\n * Chaining is supported in custom builds as long as the `_#value` method is\n * directly or indirectly included in the build.\n *\n * In addition to lodash methods, wrappers have `Array` and `String` methods.\n *\n * The wrapper `Array` methods are:\n * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,\n * `splice`, and `unshift`\n *\n * The wrapper `String` methods are:\n * `replace` and `split`\n *\n * The wrapper methods that support shortcut fusion are:\n * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,\n * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,\n * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,\n * and `where`\n *\n * The chainable wrapper methods are:\n * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,\n * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,\n * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,\n * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,\n * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,\n * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,\n * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,\n * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,\n * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,\n * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,\n * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,\n * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,\n * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,\n * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,\n * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,\n * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,\n * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`\n *\n * The wrapper methods that are **not** chainable by default are:\n * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,\n * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,\n * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,\n * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,\n * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,\n * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,\n * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,\n * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,\n * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,\n * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,\n * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,\n * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,\n * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,\n * `unescape`, `uniqueId`, `value`, and `words`\n *\n * The wrapper method `sample` will return a wrapped value when `n` is provided,\n * otherwise an unwrapped value is returned.\n *\n * @name _\n * @constructor\n * @category Chain\n * @param {*} value The value to wrap in a `lodash` instance.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var wrapped = _([1, 2, 3]);\n *\n * // returns an unwrapped value\n * wrapped.reduce(function(total, n) {\n * return total + n;\n * });\n * // => 6\n *\n * // returns a wrapped value\n * var squares = wrapped.map(function(n) {\n * return n * n;\n * });\n *\n * _.isArray(squares);\n * // => false\n *\n * _.isArray(squares.value());\n * // => true\n */\n function lodash(value) {\n if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\n if (value instanceof LodashWrapper) {\n return value;\n }\n if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {\n return wrapperClone(value);\n }\n }\n return new LodashWrapper(value);\n }\n\n /**\n * The function whose prototype all chaining wrappers inherit from.\n *\n * @private\n */\n function baseLodash() {\n // No operation performed.\n }\n\n /**\n * The base constructor for creating `lodash` wrapper objects.\n *\n * @private\n * @param {*} value The value to wrap.\n * @param {boolean} [chainAll] Enable chaining for all wrapper methods.\n * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.\n */\n function LodashWrapper(value, chainAll, actions) {\n this.__wrapped__ = value;\n this.__actions__ = actions || [];\n this.__chain__ = !!chainAll;\n }\n\n /**\n * An object environment feature flags.\n *\n * @static\n * @memberOf _\n * @type Object\n */\n var support = lodash.support = {};\n\n /**\n * By default, the template delimiters used by lodash are like those in\n * embedded Ruby (ERB). Change the following template settings to use\n * alternative delimiters.\n *\n * @static\n * @memberOf _\n * @type Object\n */\n lodash.templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type RegExp\n */\n 'escape': reEscape,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type RegExp\n */\n 'evaluate': reEvaluate,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type RegExp\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type string\n */\n 'variable': '',\n\n /**\n * Used to import variables into the compiled template.\n *\n * @memberOf _.templateSettings\n * @type Object\n */\n 'imports': {\n\n /**\n * A reference to the `lodash` function.\n *\n * @memberOf _.templateSettings.imports\n * @type Function\n */\n '_': lodash\n }\n };\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\n *\n * @private\n * @param {*} value The value to wrap.\n */\n function LazyWrapper(value) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__dir__ = 1;\n this.__filtered__ = false;\n this.__iteratees__ = [];\n this.__takeCount__ = POSITIVE_INFINITY;\n this.__views__ = [];\n }\n\n /**\n * Creates a clone of the lazy wrapper object.\n *\n * @private\n * @name clone\n * @memberOf LazyWrapper\n * @returns {Object} Returns the cloned `LazyWrapper` object.\n */\n function lazyClone() {\n var result = new LazyWrapper(this.__wrapped__);\n result.__actions__ = arrayCopy(this.__actions__);\n result.__dir__ = this.__dir__;\n result.__filtered__ = this.__filtered__;\n result.__iteratees__ = arrayCopy(this.__iteratees__);\n result.__takeCount__ = this.__takeCount__;\n result.__views__ = arrayCopy(this.__views__);\n return result;\n }\n\n /**\n * Reverses the direction of lazy iteration.\n *\n * @private\n * @name reverse\n * @memberOf LazyWrapper\n * @returns {Object} Returns the new reversed `LazyWrapper` object.\n */\n function lazyReverse() {\n if (this.__filtered__) {\n var result = new LazyWrapper(this);\n result.__dir__ = -1;\n result.__filtered__ = true;\n } else {\n result = this.clone();\n result.__dir__ *= -1;\n }\n return result;\n }\n\n /**\n * Extracts the unwrapped value from its lazy wrapper.\n *\n * @private\n * @name value\n * @memberOf LazyWrapper\n * @returns {*} Returns the unwrapped value.\n */\n function lazyValue() {\n var array = this.__wrapped__.value(),\n dir = this.__dir__,\n isArr = isArray(array),\n isRight = dir < 0,\n arrLength = isArr ? array.length : 0,\n view = getView(0, arrLength, this.__views__),\n start = view.start,\n end = view.end,\n length = end - start,\n index = isRight ? end : (start - 1),\n iteratees = this.__iteratees__,\n iterLength = iteratees.length,\n resIndex = 0,\n takeCount = nativeMin(length, this.__takeCount__);\n\n if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {\n return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);\n }\n var result = [];\n\n outer:\n while (length-- && resIndex < takeCount) {\n index += dir;\n\n var iterIndex = -1,\n value = array[index];\n\n while (++iterIndex < iterLength) {\n var data = iteratees[iterIndex],\n iteratee = data.iteratee,\n type = data.type,\n computed = iteratee(value);\n\n if (type == LAZY_MAP_FLAG) {\n value = computed;\n } else if (!computed) {\n if (type == LAZY_FILTER_FLAG) {\n continue outer;\n } else {\n break outer;\n }\n }\n }\n result[resIndex++] = value;\n }\n return result;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a cache object to store key/value pairs.\n *\n * @private\n * @static\n * @name Cache\n * @memberOf _.memoize\n */\n function MapCache() {\n this.__data__ = {};\n }\n\n /**\n * Removes `key` and its value from the cache.\n *\n * @private\n * @name delete\n * @memberOf _.memoize.Cache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`.\n */\n function mapDelete(key) {\n return this.has(key) && delete this.__data__[key];\n }\n\n /**\n * Gets the cached value for `key`.\n *\n * @private\n * @name get\n * @memberOf _.memoize.Cache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the cached value.\n */\n function mapGet(key) {\n return key == '__proto__' ? undefined : this.__data__[key];\n }\n\n /**\n * Checks if a cached value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf _.memoize.Cache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function mapHas(key) {\n return key != '__proto__' && hasOwnProperty.call(this.__data__, key);\n }\n\n /**\n * Sets `value` to `key` of the cache.\n *\n * @private\n * @name set\n * @memberOf _.memoize.Cache\n * @param {string} key The key of the value to cache.\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache object.\n */\n function mapSet(key, value) {\n if (key != '__proto__') {\n this.__data__[key] = value;\n }\n return this;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n *\n * Creates a cache object to store unique values.\n *\n * @private\n * @param {Array} [values] The values to cache.\n */\n function SetCache(values) {\n var length = values ? values.length : 0;\n\n this.data = { 'hash': nativeCreate(null), 'set': new Set };\n while (length--) {\n this.push(values[length]);\n }\n }\n\n /**\n * Checks if `value` is in `cache` mimicking the return signature of\n * `_.indexOf` by returning `0` if the value is found, else `-1`.\n *\n * @private\n * @param {Object} cache The cache to search.\n * @param {*} value The value to search for.\n * @returns {number} Returns `0` if `value` is found, else `-1`.\n */\n function cacheIndexOf(cache, value) {\n var data = cache.data,\n result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];\n\n return result ? 0 : -1;\n }\n\n /**\n * Adds `value` to the cache.\n *\n * @private\n * @name push\n * @memberOf SetCache\n * @param {*} value The value to cache.\n */\n function cachePush(value) {\n var data = this.data;\n if (typeof value == 'string' || isObject(value)) {\n data.set.add(value);\n } else {\n data.hash[value] = true;\n }\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a new array joining `array` with `other`.\n *\n * @private\n * @param {Array} array The array to join.\n * @param {Array} other The other array to join.\n * @returns {Array} Returns the new concatenated array.\n */\n function arrayConcat(array, other) {\n var index = -1,\n length = array.length,\n othIndex = -1,\n othLength = other.length,\n result = Array(length + othLength);\n\n while (++index < length) {\n result[index] = array[index];\n }\n while (++othIndex < othLength) {\n result[index++] = other[othIndex];\n }\n return result;\n }\n\n /**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\n function arrayCopy(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n }\n\n /**\n * A specialized version of `_.forEach` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEach(array, iteratee) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.forEachRight` for arrays without support for\n * callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEachRight(array, iteratee) {\n var length = array.length;\n\n while (length--) {\n if (iteratee(array[length], length, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.every` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\n function arrayEvery(array, predicate) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * A specialized version of `baseExtremum` for arrays which invokes `iteratee`\n * with one argument: (value).\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} comparator The function used to compare values.\n * @param {*} exValue The initial extremum value.\n * @returns {*} Returns the extremum value.\n */\n function arrayExtremum(array, iteratee, comparator, exValue) {\n var index = -1,\n length = array.length,\n computed = exValue,\n result = computed;\n\n while (++index < length) {\n var value = array[index],\n current = +iteratee(value);\n\n if (comparator(current, computed)) {\n computed = current;\n result = value;\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.filter` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function arrayFilter(array, predicate) {\n var index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[++resIndex] = value;\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.map` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function arrayMap(array, iteratee) {\n var index = -1,\n length = array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n }\n\n /**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\n function arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n }\n\n /**\n * A specialized version of `_.reduce` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initFromArray] Specify using the first element of `array`\n * as the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduce(array, iteratee, accumulator, initFromArray) {\n var index = -1,\n length = array.length;\n\n if (initFromArray && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.reduceRight` for arrays without support for\n * callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initFromArray] Specify using the last element of `array`\n * as the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduceRight(array, iteratee, accumulator, initFromArray) {\n var length = array.length;\n if (initFromArray && length) {\n accumulator = array[--length];\n }\n while (length--) {\n accumulator = iteratee(accumulator, array[length], length, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.some` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function arraySome(array, predicate) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `_.sum` for arrays without support for callback\n * shorthands and `this` binding..\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the sum.\n */\n function arraySum(array, iteratee) {\n var length = array.length,\n result = 0;\n\n while (length--) {\n result += +iteratee(array[length]) || 0;\n }\n return result;\n }\n\n /**\n * Used by `_.defaults` to customize its `_.assign` use.\n *\n * @private\n * @param {*} objectValue The destination object property value.\n * @param {*} sourceValue The source object property value.\n * @returns {*} Returns the value to assign to the destination object.\n */\n function assignDefaults(objectValue, sourceValue) {\n return objectValue === undefined ? sourceValue : objectValue;\n }\n\n /**\n * Used by `_.template` to customize its `_.assign` use.\n *\n * **Note:** This function is like `assignDefaults` except that it ignores\n * inherited property values when checking if a property is `undefined`.\n *\n * @private\n * @param {*} objectValue The destination object property value.\n * @param {*} sourceValue The source object property value.\n * @param {string} key The key associated with the object and source values.\n * @param {Object} object The destination object.\n * @returns {*} Returns the value to assign to the destination object.\n */\n function assignOwnDefaults(objectValue, sourceValue, key, object) {\n return (objectValue === undefined || !hasOwnProperty.call(object, key))\n ? sourceValue\n : objectValue;\n }\n\n /**\n * A specialized version of `_.assign` for customizing assigned values without\n * support for argument juggling, multiple sources, and `this` binding `customizer`\n * functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n */\n function assignWith(object, source, customizer) {\n var index = -1,\n props = keys(source),\n length = props.length;\n\n while (++index < length) {\n var key = props[index],\n value = object[key],\n result = customizer(value, source[key], key, object, source);\n\n if ((result === result ? (result !== value) : (value === value)) ||\n (value === undefined && !(key in object))) {\n object[key] = result;\n }\n }\n return object;\n }\n\n /**\n * The base implementation of `_.assign` without support for argument juggling,\n * multiple sources, and `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssign(object, source) {\n return source == null\n ? object\n : baseCopy(source, keys(source), object);\n }\n\n /**\n * The base implementation of `_.at` without support for string collections\n * and individual key arguments.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {number[]|string[]} props The property names or indexes of elements to pick.\n * @returns {Array} Returns the new array of picked elements.\n */\n function baseAt(collection, props) {\n var index = -1,\n isNil = collection == null,\n isArr = !isNil && isArrayLike(collection),\n length = isArr ? collection.length : 0,\n propsLength = props.length,\n result = Array(propsLength);\n\n while(++index < propsLength) {\n var key = props[index];\n if (isArr) {\n result[index] = isIndex(key, length) ? collection[key] : undefined;\n } else {\n result[index] = isNil ? undefined : collection[key];\n }\n }\n return result;\n }\n\n /**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\n function baseCopy(source, props, object) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n object[key] = source[key];\n }\n return object;\n }\n\n /**\n * The base implementation of `_.callback` which supports specifying the\n * number of arguments to provide to `func`.\n *\n * @private\n * @param {*} [func=_.identity] The value to convert to a callback.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\n function baseCallback(func, thisArg, argCount) {\n var type = typeof func;\n if (type == 'function') {\n return thisArg === undefined\n ? func\n : bindCallback(func, thisArg, argCount);\n }\n if (func == null) {\n return identity;\n }\n if (type == 'object') {\n return baseMatches(func);\n }\n return thisArg === undefined\n ? property(func)\n : baseMatchesProperty(func, thisArg);\n }\n\n /**\n * The base implementation of `_.clone` without support for argument juggling\n * and `this` binding `customizer` functions.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {Function} [customizer] The function to customize cloning values.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The object `value` belongs to.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates clones with source counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {\n var result;\n if (customizer) {\n result = object ? customizer(value, key, object) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return arrayCopy(value, result);\n }\n } else {\n var tag = objToString.call(value),\n isFunc = tag == funcTag;\n\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = initCloneObject(isFunc ? {} : value);\n if (!isDeep) {\n return baseAssign(result, value);\n }\n } else {\n return cloneableTags[tag]\n ? initCloneByTag(value, tag, isDeep)\n : (object ? value : {});\n }\n }\n // Check for circular references and return its corresponding clone.\n stackA || (stackA = []);\n stackB || (stackB = []);\n\n var length = stackA.length;\n while (length--) {\n if (stackA[length] == value) {\n return stackB[length];\n }\n }\n // Add the source value to the stack of traversed objects and associate it with its clone.\n stackA.push(value);\n stackB.push(result);\n\n // Recursively populate clone (susceptible to call stack limits).\n (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {\n result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);\n });\n return result;\n }\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} prototype The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n var baseCreate = (function() {\n function object() {}\n return function(prototype) {\n if (isObject(prototype)) {\n object.prototype = prototype;\n var result = new object;\n object.prototype = undefined;\n }\n return result || {};\n };\n }());\n\n /**\n * The base implementation of `_.delay` and `_.defer` which accepts an index\n * of where to slice the arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {Object} args The arguments provide to `func`.\n * @returns {number} Returns the timer id.\n */\n function baseDelay(func, wait, args) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return setTimeout(function() { func.apply(undefined, args); }, wait);\n }\n\n /**\n * The base implementation of `_.difference` which accepts a single array\n * of values to exclude.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n */\n function baseDifference(array, values) {\n var length = array ? array.length : 0,\n result = [];\n\n if (!length) {\n return result;\n }\n var index = -1,\n indexOf = getIndexOf(),\n isCommon = indexOf == baseIndexOf,\n cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,\n valuesLength = values.length;\n\n if (cache) {\n indexOf = cacheIndexOf;\n isCommon = false;\n values = cache;\n }\n outer:\n while (++index < length) {\n var value = array[index];\n\n if (isCommon && value === value) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === value) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (indexOf(values, value, 0) < 0) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.forEach` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object|string} Returns `collection`.\n */\n var baseEach = createBaseEach(baseForOwn);\n\n /**\n * The base implementation of `_.forEachRight` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object|string} Returns `collection`.\n */\n var baseEachRight = createBaseEach(baseForOwnRight, true);\n\n /**\n * The base implementation of `_.every` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\n function baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n }\n\n /**\n * Gets the extremum value of `collection` invoking `iteratee` for each value\n * in `collection` to generate the criterion by which the value is ranked.\n * The `iteratee` is invoked with three arguments: (value, index|key, collection).\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} comparator The function used to compare values.\n * @param {*} exValue The initial extremum value.\n * @returns {*} Returns the extremum value.\n */\n function baseExtremum(collection, iteratee, comparator, exValue) {\n var computed = exValue,\n result = computed;\n\n baseEach(collection, function(value, index, collection) {\n var current = +iteratee(value, index, collection);\n if (comparator(current, computed) || (current === exValue && current === result)) {\n computed = current;\n result = value;\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.fill` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n */\n function baseFill(array, value, start, end) {\n var length = array.length;\n\n start = start == null ? 0 : (+start || 0);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : (+end || 0);\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : (end >>> 0);\n start >>>= 0;\n\n while (start < length) {\n array[start++] = value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.filter` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,\n * without support for callback shorthands and `this` binding, which iterates\n * over `collection` using the provided `eachFunc`.\n *\n * @private\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function} predicate The function invoked per iteration.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @param {boolean} [retKey] Specify returning the key of the found element\n * instead of the element itself.\n * @returns {*} Returns the found element or its key, else `undefined`.\n */\n function baseFind(collection, predicate, eachFunc, retKey) {\n var result;\n eachFunc(collection, function(value, key, collection) {\n if (predicate(value, key, collection)) {\n result = retKey ? key : value;\n return false;\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.flatten` with added support for restricting\n * flattening and specifying the start index.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {boolean} [isDeep] Specify a deep flatten.\n * @param {boolean} [isStrict] Restrict flattening to arrays-like objects.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\n function baseFlatten(array, isDeep, isStrict, result) {\n result || (result = []);\n\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index];\n if (isObjectLike(value) && isArrayLike(value) &&\n (isStrict || isArray(value) || isArguments(value))) {\n if (isDeep) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, isDeep, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `baseForIn` and `baseForOwn` which iterates\n * over `object` properties returned by `keysFunc` invoking `iteratee` for\n * each property. Iteratee functions may exit iteration early by explicitly\n * returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseFor = createBaseFor();\n\n /**\n * This function is like `baseFor` except that it iterates over properties\n * in the opposite order.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseForRight = createBaseFor(true);\n\n /**\n * The base implementation of `_.forIn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForIn(object, iteratee) {\n return baseFor(object, iteratee, keysIn);\n }\n\n /**\n * The base implementation of `_.forOwn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwn(object, iteratee) {\n return baseFor(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.forOwnRight` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwnRight(object, iteratee) {\n return baseForRight(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.functions` which creates an array of\n * `object` function property names filtered from those provided.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} props The property names to filter.\n * @returns {Array} Returns the new array of filtered property names.\n */\n function baseFunctions(object, props) {\n var index = -1,\n length = props.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var key = props[index];\n if (isFunction(object[key])) {\n result[++resIndex] = key;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `get` without support for string paths\n * and default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path of the property to get.\n * @param {string} [pathKey] The key representation of path.\n * @returns {*} Returns the resolved value.\n */\n function baseGet(object, path, pathKey) {\n if (object == null) {\n return;\n }\n if (pathKey !== undefined && pathKey in toObject(object)) {\n path = [pathKey];\n }\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[path[index++]];\n }\n return (index && index == length) ? object : undefined;\n }\n\n /**\n * The base implementation of `_.isEqual` without support for `this` binding\n * `customizer` functions.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize comparing values.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);\n }\n\n /**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing objects.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA=[]] Tracks traversed `value` objects.\n * @param {Array} [stackB=[]] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = arrayTag,\n othTag = arrayTag;\n\n if (!objIsArr) {\n objTag = objToString.call(object);\n if (objTag == argsTag) {\n objTag = objectTag;\n } else if (objTag != objectTag) {\n objIsArr = isTypedArray(object);\n }\n }\n if (!othIsArr) {\n othTag = objToString.call(other);\n if (othTag == argsTag) {\n othTag = objectTag;\n } else if (othTag != objectTag) {\n othIsArr = isTypedArray(other);\n }\n }\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && !(objIsArr || objIsObj)) {\n return equalByTag(object, other, objTag);\n }\n if (!isLoose) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);\n }\n }\n if (!isSameTag) {\n return false;\n }\n // Assume cyclic values are equal.\n // For more information on detecting circular references see https://es5.github.io/#JO.\n stackA || (stackA = []);\n stackB || (stackB = []);\n\n var length = stackA.length;\n while (length--) {\n if (stackA[length] == object) {\n return stackB[length] == other;\n }\n }\n // Add `object` and `other` to the stack of traversed objects.\n stackA.push(object);\n stackB.push(other);\n\n var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);\n\n stackA.pop();\n stackB.pop();\n\n return result;\n }\n\n /**\n * The base implementation of `_.isMatch` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} matchData The propery names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparing objects.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\n function baseIsMatch(object, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = toObject(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var result = customizer ? customizer(objValue, srcValue, key) : undefined;\n if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.map` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n }\n\n /**\n * The base implementation of `_.matches` which does not clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new function.\n */\n function baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n var key = matchData[0][0],\n value = matchData[0][1];\n\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === value && (value !== undefined || (key in toObject(object)));\n };\n }\n return function(object) {\n return baseIsMatch(object, matchData);\n };\n }\n\n /**\n * The base implementation of `_.matchesProperty` which does not clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to compare.\n * @returns {Function} Returns the new function.\n */\n function baseMatchesProperty(path, srcValue) {\n var isArr = isArray(path),\n isCommon = isKey(path) && isStrictComparable(srcValue),\n pathKey = (path + '');\n\n path = toPath(path);\n return function(object) {\n if (object == null) {\n return false;\n }\n var key = pathKey;\n object = toObject(object);\n if ((isArr || !isCommon) && !(key in object)) {\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n if (object == null) {\n return false;\n }\n key = last(path);\n object = toObject(object);\n }\n return object[key] === srcValue\n ? (srcValue !== undefined || (key in object))\n : baseIsEqual(srcValue, object[key], undefined, true);\n };\n }\n\n /**\n * The base implementation of `_.merge` without support for argument juggling,\n * multiple sources, and `this` binding `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {Object} Returns `object`.\n */\n function baseMerge(object, source, customizer, stackA, stackB) {\n if (!isObject(object)) {\n return object;\n }\n var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),\n props = isSrcArr ? undefined : keys(source);\n\n arrayEach(props || source, function(srcValue, key) {\n if (props) {\n key = srcValue;\n srcValue = source[key];\n }\n if (isObjectLike(srcValue)) {\n stackA || (stackA = []);\n stackB || (stackB = []);\n baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);\n }\n else {\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n }\n if ((result !== undefined || (isSrcArr && !(key in object))) &&\n (isCommon || (result === result ? (result !== value) : (value === value)))) {\n object[key] = result;\n }\n }\n });\n return object;\n }\n\n /**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {\n var length = stackA.length,\n srcValue = source[key];\n\n while (length--) {\n if (stackA[length] == srcValue) {\n object[key] = stackB[length];\n return;\n }\n }\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {\n result = isArray(value)\n ? value\n : (isArrayLike(value) ? arrayCopy(value) : []);\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n result = isArguments(value)\n ? toPlainObject(value)\n : (isPlainObject(value) ? value : {});\n }\n else {\n isCommon = false;\n }\n }\n // Add the source value to the stack of traversed objects and associate\n // it with its merged value.\n stackA.push(srcValue);\n stackB.push(result);\n\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);\n } else if (result === result ? (result !== value) : (value === value)) {\n object[key] = result;\n }\n }\n\n /**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\n function baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new function.\n */\n function basePropertyDeep(path) {\n var pathKey = (path + '');\n path = toPath(path);\n return function(object) {\n return baseGet(object, path, pathKey);\n };\n }\n\n /**\n * The base implementation of `_.pullAt` without support for individual\n * index arguments and capturing the removed elements.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {number[]} indexes The indexes of elements to remove.\n * @returns {Array} Returns `array`.\n */\n function basePullAt(array, indexes) {\n var length = array ? indexes.length : 0;\n while (length--) {\n var index = indexes[length];\n if (index != previous && isIndex(index)) {\n var previous = index;\n splice.call(array, index, 1);\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.random` without support for argument juggling\n * and returning floating-point numbers.\n *\n * @private\n * @param {number} min The minimum possible value.\n * @param {number} max The maximum possible value.\n * @returns {number} Returns the random number.\n */\n function baseRandom(min, max) {\n return min + nativeFloor(nativeRandom() * (max - min + 1));\n }\n\n /**\n * The base implementation of `_.reduce` and `_.reduceRight` without support\n * for callback shorthands and `this` binding, which iterates over `collection`\n * using the provided `eachFunc`.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initFromCollection Specify using the first or last element\n * of `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\n function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initFromCollection\n ? (initFromCollection = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `setData` without support for hot loop detection.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var baseSetData = !metaMap ? identity : function(func, data) {\n metaMap.set(func, data);\n return func;\n };\n\n /**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n start = start == null ? 0 : (+start || 0);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : (+end || 0);\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n }\n\n /**\n * The base implementation of `_.some` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n }\n\n /**\n * The base implementation of `_.sortBy` which uses `comparer` to define\n * the sort order of `array` and replaces criteria objects with their\n * corresponding values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\n function baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.sortByOrder` without param guards.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {boolean[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\n function baseSortByOrder(collection, iteratees, orders) {\n var callback = getCallback(),\n index = -1;\n\n iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); });\n\n var result = baseMap(collection, function(value) {\n var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n }\n\n /**\n * The base implementation of `_.sum` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the sum.\n */\n function baseSum(collection, iteratee) {\n var result = 0;\n baseEach(collection, function(value, index, collection) {\n result += +iteratee(value, index, collection) || 0;\n });\n return result;\n }\n\n /**\n * The base implementation of `_.uniq` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The function invoked per iteration.\n * @returns {Array} Returns the new duplicate-value-free array.\n */\n function baseUniq(array, iteratee) {\n var index = -1,\n indexOf = getIndexOf(),\n length = array.length,\n isCommon = indexOf == baseIndexOf,\n isLarge = isCommon && length >= LARGE_ARRAY_SIZE,\n seen = isLarge ? createCache() : null,\n result = [];\n\n if (seen) {\n indexOf = cacheIndexOf;\n isCommon = false;\n } else {\n isLarge = false;\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value, index, array) : value;\n\n if (isCommon && value === value) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (indexOf(seen, computed, 0) < 0) {\n if (iteratee || isLarge) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\n function baseValues(object, props) {\n var index = -1,\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = object[props[index]];\n }\n return result;\n }\n\n /**\n * The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`,\n * and `_.takeWhile` without support for callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [isDrop] Specify dropping elements instead of taking them.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseWhile(array, predicate, isDrop, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}\n return isDrop\n ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))\n : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));\n }\n\n /**\n * The base implementation of `wrapperValue` which returns the result of\n * performing a sequence of actions on the unwrapped `value`, where each\n * successive action is supplied the return value of the previous.\n *\n * @private\n * @param {*} value The unwrapped value.\n * @param {Array} actions Actions to peform to resolve the unwrapped value.\n * @returns {*} Returns the resolved value.\n */\n function baseWrapperValue(value, actions) {\n var result = value;\n if (result instanceof LazyWrapper) {\n result = result.value();\n }\n var index = -1,\n length = actions.length;\n\n while (++index < length) {\n var action = actions[index];\n result = action.func.apply(action.thisArg, arrayPush([result], action.args));\n }\n return result;\n }\n\n /**\n * Performs a binary search of `array` to determine the index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function binaryIndex(array, value, retHighest) {\n var low = 0,\n high = array ? array.length : low;\n\n if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\n while (low < high) {\n var mid = (low + high) >>> 1,\n computed = array[mid];\n\n if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n return binaryIndexBy(array, value, identity, retHighest);\n }\n\n /**\n * This function is like `binaryIndex` except that it invokes `iteratee` for\n * `value` and each element of `array` to compute their sort ranking. The\n * iteratee is invoked with one argument; (value).\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function binaryIndexBy(array, value, iteratee, retHighest) {\n value = iteratee(value);\n\n var low = 0,\n high = array ? array.length : 0,\n valIsNaN = value !== value,\n valIsNull = value === null,\n valIsUndef = value === undefined;\n\n while (low < high) {\n var mid = nativeFloor((low + high) / 2),\n computed = iteratee(array[mid]),\n isDef = computed !== undefined,\n isReflexive = computed === computed;\n\n if (valIsNaN) {\n var setLow = isReflexive || retHighest;\n } else if (valIsNull) {\n setLow = isReflexive && isDef && (retHighest || computed != null);\n } else if (valIsUndef) {\n setLow = isReflexive && (retHighest || isDef);\n } else if (computed == null) {\n setLow = false;\n } else {\n setLow = retHighest ? (computed <= value) : (computed < value);\n }\n if (setLow) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return nativeMin(high, MAX_ARRAY_INDEX);\n }\n\n /**\n * A specialized version of `baseCallback` which only supports `this` binding\n * and specifying the number of arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\n function bindCallback(func, thisArg, argCount) {\n if (typeof func != 'function') {\n return identity;\n }\n if (thisArg === undefined) {\n return func;\n }\n switch (argCount) {\n case 1: return function(value) {\n return func.call(thisArg, value);\n };\n case 3: return function(value, index, collection) {\n return func.call(thisArg, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(thisArg, accumulator, value, index, collection);\n };\n case 5: return function(value, other, key, object, source) {\n return func.call(thisArg, value, other, key, object, source);\n };\n }\n return function() {\n return func.apply(thisArg, arguments);\n };\n }\n\n /**\n * Creates a clone of the given array buffer.\n *\n * @private\n * @param {ArrayBuffer} buffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\n function bufferClone(buffer) {\n var result = new ArrayBuffer(buffer.byteLength),\n view = new Uint8Array(result);\n\n view.set(new Uint8Array(buffer));\n return result;\n }\n\n /**\n * Creates an array that is the composition of partially applied arguments,\n * placeholders, and provided arguments into a single array of arguments.\n *\n * @private\n * @param {Array|Object} args The provided arguments.\n * @param {Array} partials The arguments to prepend to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgs(args, partials, holders) {\n var holdersLength = holders.length,\n argsIndex = -1,\n argsLength = nativeMax(args.length - holdersLength, 0),\n leftIndex = -1,\n leftLength = partials.length,\n result = Array(leftLength + argsLength);\n\n while (++leftIndex < leftLength) {\n result[leftIndex] = partials[leftIndex];\n }\n while (++argsIndex < holdersLength) {\n result[holders[argsIndex]] = args[argsIndex];\n }\n while (argsLength--) {\n result[leftIndex++] = args[argsIndex++];\n }\n return result;\n }\n\n /**\n * This function is like `composeArgs` except that the arguments composition\n * is tailored for `_.partialRight`.\n *\n * @private\n * @param {Array|Object} args The provided arguments.\n * @param {Array} partials The arguments to append to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgsRight(args, partials, holders) {\n var holdersIndex = -1,\n holdersLength = holders.length,\n argsIndex = -1,\n argsLength = nativeMax(args.length - holdersLength, 0),\n rightIndex = -1,\n rightLength = partials.length,\n result = Array(argsLength + rightLength);\n\n while (++argsIndex < argsLength) {\n result[argsIndex] = args[argsIndex];\n }\n var offset = argsIndex;\n while (++rightIndex < rightLength) {\n result[offset + rightIndex] = partials[rightIndex];\n }\n while (++holdersIndex < holdersLength) {\n result[offset + holders[holdersIndex]] = args[argsIndex++];\n }\n return result;\n }\n\n /**\n * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function.\n *\n * @private\n * @param {Function} setter The function to set keys and values of the accumulator object.\n * @param {Function} [initializer] The function to initialize the accumulator object.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter, initializer) {\n return function(collection, iteratee, thisArg) {\n var result = initializer ? initializer() : {};\n iteratee = getCallback(iteratee, thisArg, 3);\n\n if (isArray(collection)) {\n var index = -1,\n length = collection.length;\n\n while (++index < length) {\n var value = collection[index];\n setter(result, value, iteratee(value, index, collection), collection);\n }\n } else {\n baseEach(collection, function(value, key, collection) {\n setter(result, value, iteratee(value, key, collection), collection);\n });\n }\n return result;\n };\n }\n\n /**\n * Creates a `_.assign`, `_.defaults`, or `_.merge` function.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\n function createAssigner(assigner) {\n return restParam(function(object, sources) {\n var index = -1,\n length = object == null ? 0 : sources.length,\n customizer = length > 2 ? sources[length - 2] : undefined,\n guard = length > 2 ? sources[2] : undefined,\n thisArg = length > 1 ? sources[length - 1] : undefined;\n\n if (typeof customizer == 'function') {\n customizer = bindCallback(customizer, thisArg, 5);\n length -= 2;\n } else {\n customizer = typeof thisArg == 'function' ? thisArg : undefined;\n length -= (customizer ? 1 : 0);\n }\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, customizer);\n }\n }\n return object;\n });\n }\n\n /**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n var length = collection ? getLength(collection) : 0;\n if (!isLength(length)) {\n return eachFunc(collection, iteratee);\n }\n var index = fromRight ? length : -1,\n iterable = toObject(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n }\n\n /**\n * Creates a base function for `_.forIn` or `_.forInRight`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var iterable = toObject(object),\n props = keysFunc(object),\n length = props.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n var key = props[index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n }\n\n /**\n * Creates a function that wraps `func` and invokes it with the `this`\n * binding of `thisArg`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @returns {Function} Returns the new bound function.\n */\n function createBindWrapper(func, thisArg) {\n var Ctor = createCtorWrapper(func);\n\n function wrapper() {\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return fn.apply(thisArg, arguments);\n }\n return wrapper;\n }\n\n /**\n * Creates a `Set` cache object to optimize linear searches of large arrays.\n *\n * @private\n * @param {Array} [values] The values to cache.\n * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.\n */\n function createCache(values) {\n return (nativeCreate && Set) ? new SetCache(values) : null;\n }\n\n /**\n * Creates a function that produces compound words out of the words in a\n * given string.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\n function createCompounder(callback) {\n return function(string) {\n var index = -1,\n array = words(deburr(string)),\n length = array.length,\n result = '';\n\n while (++index < length) {\n result = callback(result, array[index], index);\n }\n return result;\n };\n }\n\n /**\n * Creates a function that produces an instance of `Ctor` regardless of\n * whether it was invoked as part of a `new` expression or by `call` or `apply`.\n *\n * @private\n * @param {Function} Ctor The constructor to wrap.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCtorWrapper(Ctor) {\n return function() {\n // Use a `switch` statement to work with class constructors.\n // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\n // for more details.\n var args = arguments;\n switch (args.length) {\n case 0: return new Ctor;\n case 1: return new Ctor(args[0]);\n case 2: return new Ctor(args[0], args[1]);\n case 3: return new Ctor(args[0], args[1], args[2]);\n case 4: return new Ctor(args[0], args[1], args[2], args[3]);\n case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\n case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\n case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n }\n var thisBinding = baseCreate(Ctor.prototype),\n result = Ctor.apply(thisBinding, args);\n\n // Mimic the constructor's `return` behavior.\n // See https://es5.github.io/#x13.2.2 for more details.\n return isObject(result) ? result : thisBinding;\n };\n }\n\n /**\n * Creates a `_.curry` or `_.curryRight` function.\n *\n * @private\n * @param {boolean} flag The curry bit flag.\n * @returns {Function} Returns the new curry function.\n */\n function createCurry(flag) {\n function curryFunc(func, arity, guard) {\n if (guard && isIterateeCall(func, arity, guard)) {\n arity = undefined;\n }\n var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curryFunc.placeholder;\n return result;\n }\n return curryFunc;\n }\n\n /**\n * Creates a `_.defaults` or `_.defaultsDeep` function.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Function} Returns the new defaults function.\n */\n function createDefaults(assigner, customizer) {\n return restParam(function(args) {\n var object = args[0];\n if (object == null) {\n return object;\n }\n args.push(customizer);\n return assigner.apply(undefined, args);\n });\n }\n\n /**\n * Creates a `_.max` or `_.min` function.\n *\n * @private\n * @param {Function} comparator The function used to compare values.\n * @param {*} exValue The initial extremum value.\n * @returns {Function} Returns the new extremum function.\n */\n function createExtremum(comparator, exValue) {\n return function(collection, iteratee, thisArg) {\n if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {\n iteratee = undefined;\n }\n iteratee = getCallback(iteratee, thisArg, 3);\n if (iteratee.length == 1) {\n collection = isArray(collection) ? collection : toIterable(collection);\n var result = arrayExtremum(collection, iteratee, comparator, exValue);\n if (!(collection.length && result === exValue)) {\n return result;\n }\n }\n return baseExtremum(collection, iteratee, comparator, exValue);\n };\n }\n\n /**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new find function.\n */\n function createFind(eachFunc, fromRight) {\n return function(collection, predicate, thisArg) {\n predicate = getCallback(predicate, thisArg, 3);\n if (isArray(collection)) {\n var index = baseFindIndex(collection, predicate, fromRight);\n return index > -1 ? collection[index] : undefined;\n }\n return baseFind(collection, predicate, eachFunc);\n };\n }\n\n /**\n * Creates a `_.findIndex` or `_.findLastIndex` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new find function.\n */\n function createFindIndex(fromRight) {\n return function(array, predicate, thisArg) {\n if (!(array && array.length)) {\n return -1;\n }\n predicate = getCallback(predicate, thisArg, 3);\n return baseFindIndex(array, predicate, fromRight);\n };\n }\n\n /**\n * Creates a `_.findKey` or `_.findLastKey` function.\n *\n * @private\n * @param {Function} objectFunc The function to iterate over an object.\n * @returns {Function} Returns the new find function.\n */\n function createFindKey(objectFunc) {\n return function(object, predicate, thisArg) {\n predicate = getCallback(predicate, thisArg, 3);\n return baseFind(object, predicate, objectFunc, true);\n };\n }\n\n /**\n * Creates a `_.flow` or `_.flowRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new flow function.\n */\n function createFlow(fromRight) {\n return function() {\n var wrapper,\n length = arguments.length,\n index = fromRight ? length : -1,\n leftIndex = 0,\n funcs = Array(length);\n\n while ((fromRight ? index-- : ++index < length)) {\n var func = funcs[leftIndex++] = arguments[index];\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {\n wrapper = new LodashWrapper([], true);\n }\n }\n index = wrapper ? -1 : length;\n while (++index < length) {\n func = funcs[index];\n\n var funcName = getFuncName(func),\n data = funcName == 'wrapper' ? getData(func) : undefined;\n\n if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {\n wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);\n } else {\n wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);\n }\n }\n return function() {\n var args = arguments,\n value = args[0];\n\n if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) {\n return wrapper.plant(value).value();\n }\n var index = 0,\n result = length ? funcs[index].apply(this, args) : value;\n\n while (++index < length) {\n result = funcs[index].call(this, result);\n }\n return result;\n };\n };\n }\n\n /**\n * Creates a function for `_.forEach` or `_.forEachRight`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over an array.\n * @param {Function} eachFunc The function to iterate over a collection.\n * @returns {Function} Returns the new each function.\n */\n function createForEach(arrayFunc, eachFunc) {\n return function(collection, iteratee, thisArg) {\n return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))\n ? arrayFunc(collection, iteratee)\n : eachFunc(collection, bindCallback(iteratee, thisArg, 3));\n };\n }\n\n /**\n * Creates a function for `_.forIn` or `_.forInRight`.\n *\n * @private\n * @param {Function} objectFunc The function to iterate over an object.\n * @returns {Function} Returns the new each function.\n */\n function createForIn(objectFunc) {\n return function(object, iteratee, thisArg) {\n if (typeof iteratee != 'function' || thisArg !== undefined) {\n iteratee = bindCallback(iteratee, thisArg, 3);\n }\n return objectFunc(object, iteratee, keysIn);\n };\n }\n\n /**\n * Creates a function for `_.forOwn` or `_.forOwnRight`.\n *\n * @private\n * @param {Function} objectFunc The function to iterate over an object.\n * @returns {Function} Returns the new each function.\n */\n function createForOwn(objectFunc) {\n return function(object, iteratee, thisArg) {\n if (typeof iteratee != 'function' || thisArg !== undefined) {\n iteratee = bindCallback(iteratee, thisArg, 3);\n }\n return objectFunc(object, iteratee);\n };\n }\n\n /**\n * Creates a function for `_.mapKeys` or `_.mapValues`.\n *\n * @private\n * @param {boolean} [isMapKeys] Specify mapping keys instead of values.\n * @returns {Function} Returns the new map function.\n */\n function createObjectMapper(isMapKeys) {\n return function(object, iteratee, thisArg) {\n var result = {};\n iteratee = getCallback(iteratee, thisArg, 3);\n\n baseForOwn(object, function(value, key, object) {\n var mapped = iteratee(value, key, object);\n key = isMapKeys ? mapped : key;\n value = isMapKeys ? value : mapped;\n result[key] = value;\n });\n return result;\n };\n }\n\n /**\n * Creates a function for `_.padLeft` or `_.padRight`.\n *\n * @private\n * @param {boolean} [fromRight] Specify padding from the right.\n * @returns {Function} Returns the new pad function.\n */\n function createPadDir(fromRight) {\n return function(string, length, chars) {\n string = baseToString(string);\n return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);\n };\n }\n\n /**\n * Creates a `_.partial` or `_.partialRight` function.\n *\n * @private\n * @param {boolean} flag The partial bit flag.\n * @returns {Function} Returns the new partial function.\n */\n function createPartial(flag) {\n var partialFunc = restParam(function(func, partials) {\n var holders = replaceHolders(partials, partialFunc.placeholder);\n return createWrapper(func, flag, undefined, partials, holders);\n });\n return partialFunc;\n }\n\n /**\n * Creates a function for `_.reduce` or `_.reduceRight`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over an array.\n * @param {Function} eachFunc The function to iterate over a collection.\n * @returns {Function} Returns the new each function.\n */\n function createReduce(arrayFunc, eachFunc) {\n return function(collection, iteratee, accumulator, thisArg) {\n var initFromArray = arguments.length < 3;\n return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))\n ? arrayFunc(collection, iteratee, accumulator, initFromArray)\n : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);\n };\n }\n\n /**\n * Creates a function that wraps `func` and invokes it with optional `this`\n * binding of, partial application, and currying.\n *\n * @private\n * @param {Function|string} func The function or method name to reference.\n * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [partialsRight] The arguments to append to those provided to the new function.\n * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\n var isAry = bitmask & ARY_FLAG,\n isBind = bitmask & BIND_FLAG,\n isBindKey = bitmask & BIND_KEY_FLAG,\n isCurry = bitmask & CURRY_FLAG,\n isCurryBound = bitmask & CURRY_BOUND_FLAG,\n isCurryRight = bitmask & CURRY_RIGHT_FLAG,\n Ctor = isBindKey ? undefined : createCtorWrapper(func);\n\n function wrapper() {\n // Avoid `arguments` object use disqualifying optimizations by\n // converting it to an array before providing it to other functions.\n var length = arguments.length,\n index = length,\n args = Array(length);\n\n while (index--) {\n args[index] = arguments[index];\n }\n if (partials) {\n args = composeArgs(args, partials, holders);\n }\n if (partialsRight) {\n args = composeArgsRight(args, partialsRight, holdersRight);\n }\n if (isCurry || isCurryRight) {\n var placeholder = wrapper.placeholder,\n argsHolders = replaceHolders(args, placeholder);\n\n length -= argsHolders.length;\n if (length < arity) {\n var newArgPos = argPos ? arrayCopy(argPos) : undefined,\n newArity = nativeMax(arity - length, 0),\n newsHolders = isCurry ? argsHolders : undefined,\n newHoldersRight = isCurry ? undefined : argsHolders,\n newPartials = isCurry ? args : undefined,\n newPartialsRight = isCurry ? undefined : args;\n\n bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);\n bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);\n\n if (!isCurryBound) {\n bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);\n }\n var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],\n result = createHybridWrapper.apply(undefined, newData);\n\n if (isLaziable(func)) {\n setData(result, newData);\n }\n result.placeholder = placeholder;\n return result;\n }\n }\n var thisBinding = isBind ? thisArg : this,\n fn = isBindKey ? thisBinding[func] : func;\n\n if (argPos) {\n args = reorder(args, argPos);\n }\n if (isAry && ary < args.length) {\n args.length = ary;\n }\n if (this && this !== root && this instanceof wrapper) {\n fn = Ctor || createCtorWrapper(func);\n }\n return fn.apply(thisBinding, args);\n }\n return wrapper;\n }\n\n /**\n * Creates the padding required for `string` based on the given `length`.\n * The `chars` string is truncated if the number of characters exceeds `length`.\n *\n * @private\n * @param {string} string The string to create padding for.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the pad for `string`.\n */\n function createPadding(string, length, chars) {\n var strLength = string.length;\n length = +length;\n\n if (strLength >= length || !nativeIsFinite(length)) {\n return '';\n }\n var padLength = length - strLength;\n chars = chars == null ? ' ' : (chars + '');\n return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength);\n }\n\n /**\n * Creates a function that wraps `func` and invokes it with the optional `this`\n * binding of `thisArg` and the `partials` prepended to those provided to\n * the wrapper.\n *\n * @private\n * @param {Function} func The function to partially apply arguments to.\n * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} partials The arguments to prepend to those provided to the new function.\n * @returns {Function} Returns the new bound function.\n */\n function createPartialWrapper(func, bitmask, thisArg, partials) {\n var isBind = bitmask & BIND_FLAG,\n Ctor = createCtorWrapper(func);\n\n function wrapper() {\n // Avoid `arguments` object use disqualifying optimizations by\n // converting it to an array before providing it `func`.\n var argsIndex = -1,\n argsLength = arguments.length,\n leftIndex = -1,\n leftLength = partials.length,\n args = Array(leftLength + argsLength);\n\n while (++leftIndex < leftLength) {\n args[leftIndex] = partials[leftIndex];\n }\n while (argsLength--) {\n args[leftIndex++] = arguments[++argsIndex];\n }\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return fn.apply(isBind ? thisArg : this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.ceil`, `_.floor`, or `_.round` function.\n *\n * @private\n * @param {string} methodName The name of the `Math` method to use when rounding.\n * @returns {Function} Returns the new round function.\n */\n function createRound(methodName) {\n var func = Math[methodName];\n return function(number, precision) {\n precision = precision === undefined ? 0 : (+precision || 0);\n if (precision) {\n precision = pow(10, precision);\n return func(number * precision) / precision;\n }\n return func(number);\n };\n }\n\n /**\n * Creates a `_.sortedIndex` or `_.sortedLastIndex` function.\n *\n * @private\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {Function} Returns the new index function.\n */\n function createSortedIndex(retHighest) {\n return function(array, value, iteratee, thisArg) {\n var callback = getCallback(iteratee);\n return (iteratee == null && callback === baseCallback)\n ? binaryIndex(array, value, retHighest)\n : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest);\n };\n }\n\n /**\n * Creates a function that either curries or invokes `func` with optional\n * `this` binding and partially applied arguments.\n *\n * @private\n * @param {Function|string} func The function or method name to reference.\n * @param {number} bitmask The bitmask of flags.\n * The bitmask may be composed of the following flags:\n * 1 - `_.bind`\n * 2 - `_.bindKey`\n * 4 - `_.curry` or `_.curryRight` of a bound function\n * 8 - `_.curry`\n * 16 - `_.curryRight`\n * 32 - `_.partial`\n * 64 - `_.partialRight`\n * 128 - `_.rearg`\n * 256 - `_.ary`\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to be partially applied.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\n var isBindKey = bitmask & BIND_KEY_FLAG;\n if (!isBindKey && typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = partials ? partials.length : 0;\n if (!length) {\n bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);\n partials = holders = undefined;\n }\n length -= (holders ? holders.length : 0);\n if (bitmask & PARTIAL_RIGHT_FLAG) {\n var partialsRight = partials,\n holdersRight = holders;\n\n partials = holders = undefined;\n }\n var data = isBindKey ? undefined : getData(func),\n newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];\n\n if (data) {\n mergeData(newData, data);\n bitmask = newData[1];\n arity = newData[9];\n }\n newData[9] = arity == null\n ? (isBindKey ? 0 : func.length)\n : (nativeMax(arity - length, 0) || 0);\n\n if (bitmask == BIND_FLAG) {\n var result = createBindWrapper(newData[0], newData[2]);\n } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {\n result = createPartialWrapper.apply(undefined, newData);\n } else {\n result = createHybridWrapper.apply(undefined, newData);\n }\n var setter = data ? baseSetData : setData;\n return setter(result, newData);\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing arrays.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\n function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var index = -1,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isLoose && othLength > arrLength)) {\n return false;\n }\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index],\n result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;\n\n if (result !== undefined) {\n if (result) {\n continue;\n }\n return false;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (isLoose) {\n if (!arraySome(other, function(othValue) {\n return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);\n })) {\n return false;\n }\n } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalByTag(object, other, tag) {\n switch (tag) {\n case boolTag:\n case dateTag:\n // Coerce dates and booleans to numbers, dates to milliseconds and booleans\n // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.\n return +object == +other;\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case numberTag:\n // Treat `NaN` vs. `NaN` as equal.\n return (object != +object)\n ? other != +other\n : object == +other;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings primitives and string\n // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.\n return object == (other + '');\n }\n return false;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing values.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var objProps = keys(object),\n objLength = objProps.length,\n othProps = keys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isLoose) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n var skipCtor = isLoose;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key],\n result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;\n\n // Recursively compare objects (susceptible to call stack limits).\n if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {\n return false;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (!skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Gets the appropriate \"callback\" function. If the `_.callback` method is\n * customized this function returns the custom method, otherwise it returns\n * the `baseCallback` function. If arguments are provided the chosen function\n * is invoked with them and its result is returned.\n *\n * @private\n * @returns {Function} Returns the chosen function or its result.\n */\n function getCallback(func, thisArg, argCount) {\n var result = lodash.callback || callback;\n result = result === callback ? baseCallback : result;\n return argCount ? result(func, thisArg, argCount) : result;\n }\n\n /**\n * Gets metadata for `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {*} Returns the metadata for `func`.\n */\n var getData = !metaMap ? noop : function(func) {\n return metaMap.get(func);\n };\n\n /**\n * Gets the name of `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {string} Returns the function name.\n */\n function getFuncName(func) {\n var result = func.name,\n array = realNames[result],\n length = array ? array.length : 0;\n\n while (length--) {\n var data = array[length],\n otherFunc = data.func;\n if (otherFunc == null || otherFunc == func) {\n return data.name;\n }\n }\n return result;\n }\n\n /**\n * Gets the appropriate \"indexOf\" function. If the `_.indexOf` method is\n * customized this function returns the custom method, otherwise it returns\n * the `baseIndexOf` function. If arguments are provided the chosen function\n * is invoked with them and its result is returned.\n *\n * @private\n * @returns {Function|number} Returns the chosen function or its result.\n */\n function getIndexOf(collection, target, fromIndex) {\n var result = lodash.indexOf || indexOf;\n result = result === indexOf ? baseIndexOf : result;\n return collection ? result(collection, target, fromIndex) : result;\n }\n\n /**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\n var getLength = baseProperty('length');\n\n /**\n * Gets the propery names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\n function getMatchData(object) {\n var result = pairs(object),\n length = result.length;\n\n while (length--) {\n result[length][2] = isStrictComparable(result[length][1]);\n }\n return result;\n }\n\n /**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\n function getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n }\n\n /**\n * Gets the view, applying any `transforms` to the `start` and `end` positions.\n *\n * @private\n * @param {number} start The start of the view.\n * @param {number} end The end of the view.\n * @param {Array} transforms The transformations to apply to the view.\n * @returns {Object} Returns an object containing the `start` and `end`\n * positions of the view.\n */\n function getView(start, end, transforms) {\n var index = -1,\n length = transforms.length;\n\n while (++index < length) {\n var data = transforms[index],\n size = data.size;\n\n switch (data.type) {\n case 'drop': start += size; break;\n case 'dropRight': end -= size; break;\n case 'take': end = nativeMin(end, start + size); break;\n case 'takeRight': start = nativeMax(start, end - size); break;\n }\n }\n return { 'start': start, 'end': end };\n }\n\n /**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\n function initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add array properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n }\n\n /**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneObject(object) {\n var Ctor = object.constructor;\n if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {\n Ctor = Object;\n }\n return new Ctor;\n }\n\n /**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return bufferClone(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n var buffer = object.buffer;\n return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n var result = new Ctor(object.source, reFlags.exec(object));\n result.lastIndex = object.lastIndex;\n }\n return result;\n }\n\n /**\n * Invokes the method at `path` on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {Array} args The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n */\n function invokePath(object, path, args) {\n if (object != null && !isKey(path, object)) {\n path = toPath(path);\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n path = last(path);\n }\n var func = object == null ? object : object[path];\n return func == null ? undefined : func.apply(object, args);\n }\n\n /**\n * Checks if `value` is array-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n */\n function isArrayLike(value) {\n return value != null && isLength(getLength(value));\n }\n\n /**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\n function isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n }\n\n /**\n * Checks if the provided arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n */\n function isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)) {\n var other = object[index];\n return value === value ? (value === other) : (other !== other);\n }\n return false;\n }\n\n /**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\n function isKey(value, object) {\n var type = typeof value;\n if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {\n return true;\n }\n if (isArray(value)) {\n return false;\n }\n var result = !reIsDeepProp.test(value);\n return result || (object != null && value in toObject(object));\n }\n\n /**\n * Checks if `func` has a lazy counterpart.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.\n */\n function isLaziable(func) {\n var funcName = getFuncName(func);\n if (!(funcName in LazyWrapper.prototype)) {\n return false;\n }\n var other = lodash[funcName];\n if (func === other) {\n return true;\n }\n var data = getData(other);\n return !!data && func === data[0];\n }\n\n /**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\n function isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\n function isStrictComparable(value) {\n return value === value && !isObject(value);\n }\n\n /**\n * Merges the function metadata of `source` into `data`.\n *\n * Merging metadata reduces the number of wrappers required to invoke a function.\n * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\n * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`\n * augment function arguments, making the order in which they are executed important,\n * preventing the merging of metadata. However, we make an exception for a safe\n * common case where curried functions have `_.ary` and or `_.rearg` applied.\n *\n * @private\n * @param {Array} data The destination metadata.\n * @param {Array} source The source metadata.\n * @returns {Array} Returns `data`.\n */\n function mergeData(data, source) {\n var bitmask = data[1],\n srcBitmask = source[1],\n newBitmask = bitmask | srcBitmask,\n isCommon = newBitmask < ARY_FLAG;\n\n var isCombo =\n (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||\n (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||\n (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);\n\n // Exit early if metadata can't be merged.\n if (!(isCommon || isCombo)) {\n return data;\n }\n // Use source `thisArg` if available.\n if (srcBitmask & BIND_FLAG) {\n data[2] = source[2];\n // Set when currying a bound function.\n newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;\n }\n // Compose partial arguments.\n var value = source[3];\n if (value) {\n var partials = data[3];\n data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);\n data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);\n }\n // Compose partial right arguments.\n value = source[5];\n if (value) {\n partials = data[5];\n data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);\n data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);\n }\n // Use source `argPos` if available.\n value = source[7];\n if (value) {\n data[7] = arrayCopy(value);\n }\n // Use source `ary` if it's smaller.\n if (srcBitmask & ARY_FLAG) {\n data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\n }\n // Use source `arity` if one is not provided.\n if (data[9] == null) {\n data[9] = source[9];\n }\n // Use source `func` and merge bitmasks.\n data[0] = source[0];\n data[1] = newBitmask;\n\n return data;\n }\n\n /**\n * Used by `_.defaultsDeep` to customize its `_.merge` use.\n *\n * @private\n * @param {*} objectValue The destination object property value.\n * @param {*} sourceValue The source object property value.\n * @returns {*} Returns the value to assign to the destination object.\n */\n function mergeDefaults(objectValue, sourceValue) {\n return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults);\n }\n\n /**\n * A specialized version of `_.pick` which picks `object` properties specified\n * by `props`.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} props The property names to pick.\n * @returns {Object} Returns the new object.\n */\n function pickByArray(object, props) {\n object = toObject(object);\n\n var index = -1,\n length = props.length,\n result = {};\n\n while (++index < length) {\n var key = props[index];\n if (key in object) {\n result[key] = object[key];\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.pick` which picks `object` properties `predicate`\n * returns truthy for.\n *\n * @private\n * @param {Object} object The source object.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Object} Returns the new object.\n */\n function pickByCallback(object, predicate) {\n var result = {};\n baseForIn(object, function(value, key, object) {\n if (predicate(value, key, object)) {\n result[key] = value;\n }\n });\n return result;\n }\n\n /**\n * Reorder `array` according to the specified indexes where the element at\n * the first index is assigned as the first element, the element at\n * the second index is assigned as the second element, and so on.\n *\n * @private\n * @param {Array} array The array to reorder.\n * @param {Array} indexes The arranged array indexes.\n * @returns {Array} Returns `array`.\n */\n function reorder(array, indexes) {\n var arrLength = array.length,\n length = nativeMin(indexes.length, arrLength),\n oldArray = arrayCopy(array);\n\n while (length--) {\n var index = indexes[length];\n array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;\n }\n return array;\n }\n\n /**\n * Sets metadata for `func`.\n *\n * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\n * period of time, it will trip its breaker and transition to an identity function\n * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)\n * for more details.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var setData = (function() {\n var count = 0,\n lastCalled = 0;\n\n return function(key, value) {\n var stamp = now(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return key;\n }\n } else {\n count = 0;\n }\n return baseSetData(key, value);\n };\n }());\n\n /**\n * A fallback implementation of `Object.keys` which creates an array of the\n * own enumerable property names of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function shimKeys(object) {\n var props = keysIn(object),\n propsLength = props.length,\n length = propsLength && object.length;\n\n var allowIndexes = !!length && isLength(length) &&\n (isArray(object) || isArguments(object));\n\n var index = -1,\n result = [];\n\n while (++index < propsLength) {\n var key = props[index];\n if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * Converts `value` to an array-like object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Array|Object} Returns the array-like object.\n */\n function toIterable(value) {\n if (value == null) {\n return [];\n }\n if (!isArrayLike(value)) {\n return values(value);\n }\n return isObject(value) ? value : Object(value);\n }\n\n /**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\n function toObject(value) {\n return isObject(value) ? value : Object(value);\n }\n\n /**\n * Converts `value` to property path array if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Array} Returns the property path array.\n */\n function toPath(value) {\n if (isArray(value)) {\n return value;\n }\n var result = [];\n baseToString(value).replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n }\n\n /**\n * Creates a clone of `wrapper`.\n *\n * @private\n * @param {Object} wrapper The wrapper to clone.\n * @returns {Object} Returns the cloned wrapper.\n */\n function wrapperClone(wrapper) {\n return wrapper instanceof LazyWrapper\n ? wrapper.clone()\n : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of elements split into groups the length of `size`.\n * If `collection` can't be split evenly, the final chunk will be the remaining\n * elements.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to process.\n * @param {number} [size=1] The length of each chunk.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the new array containing chunks.\n * @example\n *\n * _.chunk(['a', 'b', 'c', 'd'], 2);\n * // => [['a', 'b'], ['c', 'd']]\n *\n * _.chunk(['a', 'b', 'c', 'd'], 3);\n * // => [['a', 'b', 'c'], ['d']]\n */\n function chunk(array, size, guard) {\n if (guard ? isIterateeCall(array, size, guard) : size == null) {\n size = 1;\n } else {\n size = nativeMax(nativeFloor(size) || 1, 1);\n }\n var index = 0,\n length = array ? array.length : 0,\n resIndex = -1,\n result = Array(nativeCeil(length / size));\n\n while (index < length) {\n result[++resIndex] = baseSlice(array, index, (index += size));\n }\n return result;\n }\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array ? array.length : 0,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[++resIndex] = value;\n }\n }\n return result;\n }\n\n /**\n * Creates an array of unique `array` values not included in the other\n * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The arrays of values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.difference([1, 2, 3], [4, 2]);\n * // => [1, 3]\n */\n var difference = restParam(function(array, values) {\n return (isObjectLike(array) && isArrayLike(array))\n ? baseDifference(array, baseFlatten(values, false, true))\n : [];\n });\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function drop(array, n, guard) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (guard ? isIterateeCall(array, n, guard) : n == null) {\n n = 1;\n }\n return baseSlice(array, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function dropRight(array, n, guard) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (guard ? isIterateeCall(array, n, guard) : n == null) {\n n = 1;\n }\n n = length - (+n || 0);\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the end.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * bound to `thisArg` and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that match the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRightWhile([1, 2, 3], function(n) {\n * return n > 1;\n * });\n * // => [1]\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');\n * // => ['barney', 'fred']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.dropRightWhile(users, 'active', false), 'user');\n * // => ['barney']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.dropRightWhile(users, 'active'), 'user');\n * // => ['barney', 'fred', 'pebbles']\n */\n function dropRightWhile(array, predicate, thisArg) {\n return (array && array.length)\n ? baseWhile(array, getCallback(predicate, thisArg, 3), true, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the beginning.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * bound to `thisArg` and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropWhile([1, 2, 3], function(n) {\n * return n < 3;\n * });\n * // => [3]\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');\n * // => ['fred', 'pebbles']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.dropWhile(users, 'active', false), 'user');\n * // => ['pebbles']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.dropWhile(users, 'active'), 'user');\n * // => ['barney', 'fred', 'pebbles']\n */\n function dropWhile(array, predicate, thisArg) {\n return (array && array.length)\n ? baseWhile(array, getCallback(predicate, thisArg, 3), true)\n : [];\n }\n\n /**\n * Fills elements of `array` with `value` from `start` up to, but not\n * including, `end`.\n *\n * **Note:** This method mutates `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.fill(array, 'a');\n * console.log(array);\n * // => ['a', 'a', 'a']\n *\n * _.fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * _.fill([4, 6, 8], '*', 1, 2);\n * // => [4, '*', 8]\n */\n function fill(array, value, start, end) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n start = 0;\n end = length;\n }\n return baseFill(array, value, start, end);\n }\n\n /**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(chr) {\n * return chr.user == 'barney';\n * });\n * // => 0\n *\n * // using the `_.matches` callback shorthand\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.findIndex(users, 'active', false);\n * // => 0\n *\n * // using the `_.property` callback shorthand\n * _.findIndex(users, 'active');\n * // => 2\n */\n var findIndex = createFindIndex();\n\n /**\n * This method is like `_.findIndex` except that it iterates over elements\n * of `collection` from right to left.\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.findLastIndex(users, function(chr) {\n * return chr.user == 'pebbles';\n * });\n * // => 2\n *\n * // using the `_.matches` callback shorthand\n * _.findLastIndex(users, { 'user': 'barney', 'active': true });\n * // => 0\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.findLastIndex(users, 'active', false);\n * // => 2\n *\n * // using the `_.property` callback shorthand\n * _.findLastIndex(users, 'active');\n * // => 0\n */\n var findLastIndex = createFindIndex(true);\n\n /**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @alias head\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.first([1, 2, 3]);\n * // => 1\n *\n * _.first([]);\n * // => undefined\n */\n function first(array) {\n return array ? array[0] : undefined;\n }\n\n /**\n * Flattens a nested array. If `isDeep` is `true` the array is recursively\n * flattened, otherwise it is only flattened a single level.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to flatten.\n * @param {boolean} [isDeep] Specify a deep flatten.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, 3, [4]]]);\n * // => [1, 2, 3, [4]]\n *\n * // using `isDeep`\n * _.flatten([1, [2, 3, [4]]], true);\n * // => [1, 2, 3, 4]\n */\n function flatten(array, isDeep, guard) {\n var length = array ? array.length : 0;\n if (guard && isIterateeCall(array, isDeep, guard)) {\n isDeep = false;\n }\n return length ? baseFlatten(array, isDeep) : [];\n }\n\n /**\n * Recursively flattens a nested array.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to recursively flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flattenDeep([1, [2, 3, [4]]]);\n * // => [1, 2, 3, 4]\n */\n function flattenDeep(array) {\n var length = array ? array.length : 0;\n return length ? baseFlatten(array, true) : [];\n }\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it is used as the offset\n * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`\n * performs a faster binary search.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {boolean|number} [fromIndex=0] The index to search from or `true`\n * to perform a binary search on a sorted array.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // using `fromIndex`\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n *\n * // performing a binary search\n * _.indexOf([1, 1, 2, 2], 2, true);\n * // => 2\n */\n function indexOf(array, value, fromIndex) {\n var length = array ? array.length : 0;\n if (!length) {\n return -1;\n }\n if (typeof fromIndex == 'number') {\n fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;\n } else if (fromIndex) {\n var index = binaryIndex(array, value);\n if (index < length &&\n (value === value ? (value === array[index]) : (array[index] !== array[index]))) {\n return index;\n }\n return -1;\n }\n return baseIndexOf(array, value, fromIndex || 0);\n }\n\n /**\n * Gets all but the last element of `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.initial([1, 2, 3]);\n * // => [1, 2]\n */\n function initial(array) {\n return dropRight(array, 1);\n }\n\n /**\n * Creates an array of unique values that are included in all of the provided\n * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of shared values.\n * @example\n * _.intersection([1, 2], [4, 2], [2, 1]);\n * // => [2]\n */\n var intersection = restParam(function(arrays) {\n var othLength = arrays.length,\n othIndex = othLength,\n caches = Array(length),\n indexOf = getIndexOf(),\n isCommon = indexOf == baseIndexOf,\n result = [];\n\n while (othIndex--) {\n var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];\n caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;\n }\n var array = arrays[0],\n index = -1,\n length = array ? array.length : 0,\n seen = caches[0];\n\n outer:\n while (++index < length) {\n value = array[index];\n if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {\n var othIndex = othLength;\n while (--othIndex) {\n var cache = caches[othIndex];\n if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {\n continue outer;\n }\n }\n if (seen) {\n seen.push(value);\n }\n result.push(value);\n }\n }\n return result;\n });\n\n /**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\n function last(array) {\n var length = array ? array.length : 0;\n return length ? array[length - 1] : undefined;\n }\n\n /**\n * This method is like `_.indexOf` except that it iterates over elements of\n * `array` from right to left.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {boolean|number} [fromIndex=array.length-1] The index to search from\n * or `true` to perform a binary search on a sorted array.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.lastIndexOf([1, 2, 1, 2], 2);\n * // => 3\n *\n * // using `fromIndex`\n * _.lastIndexOf([1, 2, 1, 2], 2, 2);\n * // => 1\n *\n * // performing a binary search\n * _.lastIndexOf([1, 1, 2, 2], 2, true);\n * // => 3\n */\n function lastIndexOf(array, value, fromIndex) {\n var length = array ? array.length : 0;\n if (!length) {\n return -1;\n }\n var index = length;\n if (typeof fromIndex == 'number') {\n index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1;\n } else if (fromIndex) {\n index = binaryIndex(array, value, true) - 1;\n var other = array[index];\n if (value === value ? (value === other) : (other !== other)) {\n return index;\n }\n return -1;\n }\n if (value !== value) {\n return indexOfNaN(array, index, true);\n }\n while (index--) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * Removes all provided values from `array` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.without`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...*} [values] The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3, 1, 2, 3];\n *\n * _.pull(array, 2, 3);\n * console.log(array);\n * // => [1, 1]\n */\n function pull() {\n var args = arguments,\n array = args[0];\n\n if (!(array && array.length)) {\n return array;\n }\n var index = 0,\n indexOf = getIndexOf(),\n length = args.length;\n\n while (++index < length) {\n var fromIndex = 0,\n value = args[index];\n\n while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {\n splice.call(array, fromIndex, 1);\n }\n }\n return array;\n }\n\n /**\n * Removes elements from `array` corresponding to the given indexes and returns\n * an array of the removed elements. Indexes may be specified as an array of\n * indexes or as individual arguments.\n *\n * **Note:** Unlike `_.at`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...(number|number[])} [indexes] The indexes of elements to remove,\n * specified as individual indexes or arrays of indexes.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = [5, 10, 15, 20];\n * var evens = _.pullAt(array, 1, 3);\n *\n * console.log(array);\n * // => [5, 15]\n *\n * console.log(evens);\n * // => [10, 20]\n */\n var pullAt = restParam(function(array, indexes) {\n indexes = baseFlatten(indexes);\n\n var result = baseAt(array, indexes);\n basePullAt(array, indexes.sort(baseCompareAscending));\n return result;\n });\n\n /**\n * Removes all elements from `array` that `predicate` returns truthy for\n * and returns an array of the removed elements. The predicate is bound to\n * `thisArg` and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * **Note:** Unlike `_.filter`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = [1, 2, 3, 4];\n * var evens = _.remove(array, function(n) {\n * return n % 2 == 0;\n * });\n *\n * console.log(array);\n * // => [1, 3]\n *\n * console.log(evens);\n * // => [2, 4]\n */\n function remove(array, predicate, thisArg) {\n var result = [];\n if (!(array && array.length)) {\n return result;\n }\n var index = -1,\n indexes = [],\n length = array.length;\n\n predicate = getCallback(predicate, thisArg, 3);\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result.push(value);\n indexes.push(index);\n }\n }\n basePullAt(array, indexes);\n return result;\n }\n\n /**\n * Gets all but the first element of `array`.\n *\n * @static\n * @memberOf _\n * @alias tail\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.rest([1, 2, 3]);\n * // => [2, 3]\n */\n function rest(array) {\n return drop(array, 1);\n }\n\n /**\n * Creates a slice of `array` from `start` up to, but not including, `end`.\n *\n * **Note:** This method is used instead of `Array#slice` to support node\n * lists in IE < 9 and to ensure dense arrays are returned.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function slice(array, start, end) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\n start = 0;\n end = length;\n }\n return baseSlice(array, start, end);\n }\n\n /**\n * Uses a binary search to determine the lowest index at which `value` should\n * be inserted into `array` in order to maintain its sort order. If an iteratee\n * function is provided it is invoked for `value` and each element of `array`\n * to compute their sort ranking. The iteratee is bound to `thisArg` and\n * invoked with one argument; (value).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedIndex([30, 50], 40);\n * // => 1\n *\n * _.sortedIndex([4, 4, 5, 5], 5);\n * // => 2\n *\n * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };\n *\n * // using an iteratee function\n * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {\n * return this.data[word];\n * }, dict);\n * // => 1\n *\n * // using the `_.property` callback shorthand\n * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');\n * // => 1\n */\n var sortedIndex = createSortedIndex();\n\n /**\n * This method is like `_.sortedIndex` except that it returns the highest\n * index at which `value` should be inserted into `array` in order to\n * maintain its sort order.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedLastIndex([4, 4, 5, 5], 5);\n * // => 4\n */\n var sortedLastIndex = createSortedIndex(true);\n\n /**\n * Creates a slice of `array` with `n` elements taken from the beginning.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.take([1, 2, 3]);\n * // => [1]\n *\n * _.take([1, 2, 3], 2);\n * // => [1, 2]\n *\n * _.take([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.take([1, 2, 3], 0);\n * // => []\n */\n function take(array, n, guard) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (guard ? isIterateeCall(array, n, guard) : n == null) {\n n = 1;\n }\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the end.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeRight([1, 2, 3]);\n * // => [3]\n *\n * _.takeRight([1, 2, 3], 2);\n * // => [2, 3]\n *\n * _.takeRight([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.takeRight([1, 2, 3], 0);\n * // => []\n */\n function takeRight(array, n, guard) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (guard ? isIterateeCall(array, n, guard) : n == null) {\n n = 1;\n }\n n = length - (+n || 0);\n return baseSlice(array, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with elements taken from the end. Elements are\n * taken until `predicate` returns falsey. The predicate is bound to `thisArg`\n * and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeRightWhile([1, 2, 3], function(n) {\n * return n > 1;\n * });\n * // => [2, 3]\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');\n * // => ['pebbles']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.takeRightWhile(users, 'active', false), 'user');\n * // => ['fred', 'pebbles']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.takeRightWhile(users, 'active'), 'user');\n * // => []\n */\n function takeRightWhile(array, predicate, thisArg) {\n return (array && array.length)\n ? baseWhile(array, getCallback(predicate, thisArg, 3), false, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` with elements taken from the beginning. Elements\n * are taken until `predicate` returns falsey. The predicate is bound to\n * `thisArg` and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeWhile([1, 2, 3], function(n) {\n * return n < 3;\n * });\n * // => [1, 2]\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false},\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');\n * // => ['barney']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.takeWhile(users, 'active', false), 'user');\n * // => ['barney', 'fred']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.takeWhile(users, 'active'), 'user');\n * // => []\n */\n function takeWhile(array, predicate, thisArg) {\n return (array && array.length)\n ? baseWhile(array, getCallback(predicate, thisArg, 3))\n : [];\n }\n\n /**\n * Creates an array of unique values, in order, from all of the provided arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([1, 2], [4, 2], [2, 1]);\n * // => [1, 2, 4]\n */\n var union = restParam(function(arrays) {\n return baseUniq(baseFlatten(arrays, false, true));\n });\n\n /**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurence of each element\n * is kept. Providing `true` for `isSorted` performs a faster search algorithm\n * for sorted arrays. If an iteratee function is provided it is invoked for\n * each element in the array to generate the criterion by which uniqueness\n * is computed. The `iteratee` is bound to `thisArg` and invoked with three\n * arguments: (value, index, array).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias unique\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {boolean} [isSorted] Specify the array is sorted.\n * @param {Function|Object|string} [iteratee] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new duplicate-value-free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n *\n * // using `isSorted`\n * _.uniq([1, 1, 2], true);\n * // => [1, 2]\n *\n * // using an iteratee function\n * _.uniq([1, 2.5, 1.5, 2], function(n) {\n * return this.floor(n);\n * }, Math);\n * // => [1, 2.5]\n *\n * // using the `_.property` callback shorthand\n * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n function uniq(array, isSorted, iteratee, thisArg) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (isSorted != null && typeof isSorted != 'boolean') {\n thisArg = iteratee;\n iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;\n isSorted = false;\n }\n var callback = getCallback();\n if (!(iteratee == null && callback === baseCallback)) {\n iteratee = callback(iteratee, thisArg, 3);\n }\n return (isSorted && getIndexOf() == baseIndexOf)\n ? sortedUniq(array, iteratee)\n : baseUniq(array, iteratee);\n }\n\n /**\n * This method is like `_.zip` except that it accepts an array of grouped\n * elements and creates an array regrouping the elements to their pre-zip\n * configuration.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);\n * // => [['fred', 30, true], ['barney', 40, false]]\n *\n * _.unzip(zipped);\n * // => [['fred', 'barney'], [30, 40], [true, false]]\n */\n function unzip(array) {\n if (!(array && array.length)) {\n return [];\n }\n var index = -1,\n length = 0;\n\n array = arrayFilter(array, function(group) {\n if (isArrayLike(group)) {\n length = nativeMax(group.length, length);\n return true;\n }\n });\n var result = Array(length);\n while (++index < length) {\n result[index] = arrayMap(array, baseProperty(index));\n }\n return result;\n }\n\n /**\n * This method is like `_.unzip` except that it accepts an iteratee to specify\n * how regrouped values should be combined. The `iteratee` is bound to `thisArg`\n * and invoked with four arguments: (accumulator, value, index, group).\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @param {Function} [iteratee] The function to combine regrouped values.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip([1, 2], [10, 20], [100, 200]);\n * // => [[1, 10, 100], [2, 20, 200]]\n *\n * _.unzipWith(zipped, _.add);\n * // => [3, 30, 300]\n */\n function unzipWith(array, iteratee, thisArg) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n var result = unzip(array);\n if (iteratee == null) {\n return result;\n }\n iteratee = bindCallback(iteratee, thisArg, 4);\n return arrayMap(result, function(group) {\n return arrayReduce(group, iteratee, undefined, true);\n });\n }\n\n /**\n * Creates an array excluding all provided values using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to filter.\n * @param {...*} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.without([1, 2, 1, 3], 1, 2);\n * // => [3]\n */\n var without = restParam(function(array, values) {\n return isArrayLike(array)\n ? baseDifference(array, values)\n : [];\n });\n\n /**\n * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)\n * of the provided arrays.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of values.\n * @example\n *\n * _.xor([1, 2], [4, 2]);\n * // => [1, 4]\n */\n function xor() {\n var index = -1,\n length = arguments.length;\n\n while (++index < length) {\n var array = arguments[index];\n if (isArrayLike(array)) {\n var result = result\n ? arrayPush(baseDifference(result, array), baseDifference(array, result))\n : array;\n }\n }\n return result ? baseUniq(result) : [];\n }\n\n /**\n * Creates an array of grouped elements, the first of which contains the first\n * elements of the given arrays, the second of which contains the second elements\n * of the given arrays, and so on.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zip(['fred', 'barney'], [30, 40], [true, false]);\n * // => [['fred', 30, true], ['barney', 40, false]]\n */\n var zip = restParam(unzip);\n\n /**\n * The inverse of `_.pairs`; this method returns an object composed from arrays\n * of property names and values. Provide either a single two dimensional array,\n * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names\n * and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @alias object\n * @category Array\n * @param {Array} props The property names.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject([['fred', 30], ['barney', 40]]);\n * // => { 'fred': 30, 'barney': 40 }\n *\n * _.zipObject(['fred', 'barney'], [30, 40]);\n * // => { 'fred': 30, 'barney': 40 }\n */\n function zipObject(props, values) {\n var index = -1,\n length = props ? props.length : 0,\n result = {};\n\n if (length && !values && !isArray(props[0])) {\n values = [];\n }\n while (++index < length) {\n var key = props[index];\n if (values) {\n result[key] = values[index];\n } else if (key) {\n result[key[0]] = key[1];\n }\n }\n return result;\n }\n\n /**\n * This method is like `_.zip` except that it accepts an iteratee to specify\n * how grouped values should be combined. The `iteratee` is bound to `thisArg`\n * and invoked with four arguments: (accumulator, value, index, group).\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @param {Function} [iteratee] The function to combine grouped values.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zipWith([1, 2], [10, 20], [100, 200], _.add);\n * // => [111, 222]\n */\n var zipWith = restParam(function(arrays) {\n var length = arrays.length,\n iteratee = length > 2 ? arrays[length - 2] : undefined,\n thisArg = length > 1 ? arrays[length - 1] : undefined;\n\n if (length > 2 && typeof iteratee == 'function') {\n length -= 2;\n } else {\n iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;\n thisArg = undefined;\n }\n arrays.length = length;\n return unzipWith(arrays, iteratee, thisArg);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object that wraps `value` with explicit method\n * chaining enabled.\n *\n * @static\n * @memberOf _\n * @category Chain\n * @param {*} value The value to wrap.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'pebbles', 'age': 1 }\n * ];\n *\n * var youngest = _.chain(users)\n * .sortBy('age')\n * .map(function(chr) {\n * return chr.user + ' is ' + chr.age;\n * })\n * .first()\n * .value();\n * // => 'pebbles is 1'\n */\n function chain(value) {\n var result = lodash(value);\n result.__chain__ = true;\n return result;\n }\n\n /**\n * This method invokes `interceptor` and returns `value`. The interceptor is\n * bound to `thisArg` and invoked with one argument; (value). The purpose of\n * this method is to \"tap into\" a method chain in order to perform operations\n * on intermediate results within the chain.\n *\n * @static\n * @memberOf _\n * @category Chain\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @param {*} [thisArg] The `this` binding of `interceptor`.\n * @returns {*} Returns `value`.\n * @example\n *\n * _([1, 2, 3])\n * .tap(function(array) {\n * array.pop();\n * })\n * .reverse()\n * .value();\n * // => [2, 1]\n */\n function tap(value, interceptor, thisArg) {\n interceptor.call(thisArg, value);\n return value;\n }\n\n /**\n * This method is like `_.tap` except that it returns the result of `interceptor`.\n *\n * @static\n * @memberOf _\n * @category Chain\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @param {*} [thisArg] The `this` binding of `interceptor`.\n * @returns {*} Returns the result of `interceptor`.\n * @example\n *\n * _(' abc ')\n * .chain()\n * .trim()\n * .thru(function(value) {\n * return [value];\n * })\n * .value();\n * // => ['abc']\n */\n function thru(value, interceptor, thisArg) {\n return interceptor.call(thisArg, value);\n }\n\n /**\n * Enables explicit method chaining on the wrapper object.\n *\n * @name chain\n * @memberOf _\n * @category Chain\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 }\n * ];\n *\n * // without explicit chaining\n * _(users).first();\n * // => { 'user': 'barney', 'age': 36 }\n *\n * // with explicit chaining\n * _(users).chain()\n * .first()\n * .pick('user')\n * .value();\n * // => { 'user': 'barney' }\n */\n function wrapperChain() {\n return chain(this);\n }\n\n /**\n * Executes the chained sequence and returns the wrapped result.\n *\n * @name commit\n * @memberOf _\n * @category Chain\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2];\n * var wrapped = _(array).push(3);\n *\n * console.log(array);\n * // => [1, 2]\n *\n * wrapped = wrapped.commit();\n * console.log(array);\n * // => [1, 2, 3]\n *\n * wrapped.last();\n * // => 3\n *\n * console.log(array);\n * // => [1, 2, 3]\n */\n function wrapperCommit() {\n return new LodashWrapper(this.value(), this.__chain__);\n }\n\n /**\n * Creates a new array joining a wrapped array with any additional arrays\n * and/or values.\n *\n * @name concat\n * @memberOf _\n * @category Chain\n * @param {...*} [values] The values to concatenate.\n * @returns {Array} Returns the new concatenated array.\n * @example\n *\n * var array = [1];\n * var wrapped = _(array).concat(2, [3], [[4]]);\n *\n * console.log(wrapped.value());\n * // => [1, 2, 3, [4]]\n *\n * console.log(array);\n * // => [1]\n */\n var wrapperConcat = restParam(function(values) {\n values = baseFlatten(values);\n return this.thru(function(array) {\n return arrayConcat(isArray(array) ? array : [toObject(array)], values);\n });\n });\n\n /**\n * Creates a clone of the chained sequence planting `value` as the wrapped value.\n *\n * @name plant\n * @memberOf _\n * @category Chain\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2];\n * var wrapped = _(array).map(function(value) {\n * return Math.pow(value, 2);\n * });\n *\n * var other = [3, 4];\n * var otherWrapped = wrapped.plant(other);\n *\n * otherWrapped.value();\n * // => [9, 16]\n *\n * wrapped.value();\n * // => [1, 4]\n */\n function wrapperPlant(value) {\n var result,\n parent = this;\n\n while (parent instanceof baseLodash) {\n var clone = wrapperClone(parent);\n if (result) {\n previous.__wrapped__ = clone;\n } else {\n result = clone;\n }\n var previous = clone;\n parent = parent.__wrapped__;\n }\n previous.__wrapped__ = value;\n return result;\n }\n\n /**\n * Reverses the wrapped array so the first element becomes the last, the\n * second element becomes the second to last, and so on.\n *\n * **Note:** This method mutates the wrapped array.\n *\n * @name reverse\n * @memberOf _\n * @category Chain\n * @returns {Object} Returns the new reversed `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _(array).reverse().value()\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function wrapperReverse() {\n var value = this.__wrapped__;\n\n var interceptor = function(value) {\n return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();\n };\n if (value instanceof LazyWrapper) {\n var wrapped = value;\n if (this.__actions__.length) {\n wrapped = new LazyWrapper(this);\n }\n wrapped = wrapped.reverse();\n wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });\n return new LodashWrapper(wrapped, this.__chain__);\n }\n return this.thru(interceptor);\n }\n\n /**\n * Produces the result of coercing the unwrapped value to a string.\n *\n * @name toString\n * @memberOf _\n * @category Chain\n * @returns {string} Returns the coerced string value.\n * @example\n *\n * _([1, 2, 3]).toString();\n * // => '1,2,3'\n */\n function wrapperToString() {\n return (this.value() + '');\n }\n\n /**\n * Executes the chained sequence to extract the unwrapped value.\n *\n * @name value\n * @memberOf _\n * @alias run, toJSON, valueOf\n * @category Chain\n * @returns {*} Returns the resolved unwrapped value.\n * @example\n *\n * _([1, 2, 3]).value();\n * // => [1, 2, 3]\n */\n function wrapperValue() {\n return baseWrapperValue(this.__wrapped__, this.__actions__);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of elements corresponding to the given keys, or indexes,\n * of `collection`. Keys may be specified as individual arguments or as arrays\n * of keys.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {...(number|number[]|string|string[])} [props] The property names\n * or indexes of elements to pick, specified individually or in arrays.\n * @returns {Array} Returns the new array of picked elements.\n * @example\n *\n * _.at(['a', 'b', 'c'], [0, 2]);\n * // => ['a', 'c']\n *\n * _.at(['barney', 'fred', 'pebbles'], 0, 2);\n * // => ['barney', 'pebbles']\n */\n var at = restParam(function(collection, props) {\n return baseAt(collection, baseFlatten(props));\n });\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` through `iteratee`. The corresponding value\n * of each key is the number of times the key was returned by `iteratee`.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.countBy([4.3, 6.1, 6.4], function(n) {\n * return Math.floor(n);\n * });\n * // => { '4': 1, '6': 2 }\n *\n * _.countBy([4.3, 6.1, 6.4], function(n) {\n * return this.floor(n);\n * }, Math);\n * // => { '4': 1, '6': 2 }\n *\n * _.countBy(['one', 'two', 'three'], 'length');\n * // => { '3': 2, '5': 1 }\n */\n var countBy = createAggregator(function(result, value, key) {\n hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);\n });\n\n /**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * The predicate is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias all\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.every(users, 'active', false);\n * // => true\n *\n * // using the `_.property` callback shorthand\n * _.every(users, 'active');\n * // => false\n */\n function every(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (thisArg && isIterateeCall(collection, predicate, thisArg)) {\n predicate = undefined;\n }\n if (typeof predicate != 'function' || thisArg !== undefined) {\n predicate = getCallback(predicate, thisArg, 3);\n }\n return func(collection, predicate);\n }\n\n /**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is bound to `thisArg` and\n * invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias select\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the new filtered array.\n * @example\n *\n * _.filter([4, 5, 6], function(n) {\n * return n % 2 == 0;\n * });\n * // => [4, 6]\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');\n * // => ['barney']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.filter(users, 'active', false), 'user');\n * // => ['fred']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.filter(users, 'active'), 'user');\n * // => ['barney']\n */\n function filter(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n predicate = getCallback(predicate, thisArg, 3);\n return func(collection, predicate);\n }\n\n /**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is bound to `thisArg` and\n * invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias detect\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.result(_.find(users, function(chr) {\n * return chr.age < 40;\n * }), 'user');\n * // => 'barney'\n *\n * // using the `_.matches` callback shorthand\n * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');\n * // => 'pebbles'\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.result(_.find(users, 'active', false), 'user');\n * // => 'fred'\n *\n * // using the `_.property` callback shorthand\n * _.result(_.find(users, 'active'), 'user');\n * // => 'barney'\n */\n var find = createFind(baseEach);\n\n /**\n * This method is like `_.find` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * _.findLast([1, 2, 3, 4], function(n) {\n * return n % 2 == 1;\n * });\n * // => 3\n */\n var findLast = createFind(baseEachRight, true);\n\n /**\n * Performs a deep comparison between each element in `collection` and the\n * source object, returning the first element that has equivalent property\n * values.\n *\n * **Note:** This method supports comparing arrays, booleans, `Date` objects,\n * numbers, `Object` objects, regexes, and strings. Objects are compared by\n * their own, not inherited, enumerable properties. For comparing a single\n * own or inherited property value see `_.matchesProperty`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Object} source The object of property values to match.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user');\n * // => 'barney'\n *\n * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user');\n * // => 'fred'\n */\n function findWhere(collection, source) {\n return find(collection, baseMatches(source));\n }\n\n /**\n * Iterates over elements of `collection` invoking `iteratee` for each element.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection). Iteratee functions may exit iteration early\n * by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\" property\n * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`\n * may be used for object iteration.\n *\n * @static\n * @memberOf _\n * @alias each\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array|Object|string} Returns `collection`.\n * @example\n *\n * _([1, 2]).forEach(function(n) {\n * console.log(n);\n * }).value();\n * // => logs each value from left to right and returns the array\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {\n * console.log(n, key);\n * });\n * // => logs each value-key pair and returns the object (iteration order is not guaranteed)\n */\n var forEach = createForEach(arrayEach, baseEach);\n\n /**\n * This method is like `_.forEach` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @alias eachRight\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array|Object|string} Returns `collection`.\n * @example\n *\n * _([1, 2]).forEachRight(function(n) {\n * console.log(n);\n * }).value();\n * // => logs each value from right to left and returns the array\n */\n var forEachRight = createForEach(arrayEachRight, baseEachRight);\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` through `iteratee`. The corresponding value\n * of each key is an array of the elements responsible for generating the key.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([4.2, 6.1, 6.4], function(n) {\n * return Math.floor(n);\n * });\n * // => { '4': [4.2], '6': [6.1, 6.4] }\n *\n * _.groupBy([4.2, 6.1, 6.4], function(n) {\n * return this.floor(n);\n * }, Math);\n * // => { '4': [4.2], '6': [6.1, 6.4] }\n *\n * // using the `_.property` callback shorthand\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n result[key] = [value];\n }\n });\n\n /**\n * Checks if `value` is in `collection` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it is used as the offset\n * from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @alias contains, include\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {*} target The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.\n * @returns {boolean} Returns `true` if a matching element is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');\n * // => true\n *\n * _.includes('pebbles', 'eb');\n * // => true\n */\n function includes(collection, target, fromIndex, guard) {\n var length = collection ? getLength(collection) : 0;\n if (!isLength(length)) {\n collection = values(collection);\n length = collection.length;\n }\n if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {\n fromIndex = 0;\n } else {\n fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);\n }\n return (typeof collection == 'string' || !isArray(collection) && isString(collection))\n ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)\n : (!!length && getIndexOf(collection, target, fromIndex) > -1);\n }\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` through `iteratee`. The corresponding value\n * of each key is the last element responsible for generating the key. The\n * iteratee function is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * var keyData = [\n * { 'dir': 'left', 'code': 97 },\n * { 'dir': 'right', 'code': 100 }\n * ];\n *\n * _.indexBy(keyData, 'dir');\n * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n *\n * _.indexBy(keyData, function(object) {\n * return String.fromCharCode(object.code);\n * });\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n *\n * _.indexBy(keyData, function(object) {\n * return this.fromCharCode(object.code);\n * }, String);\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n */\n var indexBy = createAggregator(function(result, value, key) {\n result[key] = value;\n });\n\n /**\n * Invokes the method at `path` of each element in `collection`, returning\n * an array of the results of each invoked method. Any additional arguments\n * are provided to each invoked method. If `methodName` is a function it is\n * invoked for, and `this` bound to, each element in `collection`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Array|Function|string} path The path of the method to invoke or\n * the function invoked per iteration.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {Array} Returns the array of results.\n * @example\n *\n * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');\n * // => [[1, 5, 7], [1, 2, 3]]\n *\n * _.invoke([123, 456], String.prototype.split, '');\n * // => [['1', '2', '3'], ['4', '5', '6']]\n */\n var invoke = restParam(function(collection, path, args) {\n var index = -1,\n isFunc = typeof path == 'function',\n isProp = isKey(path),\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value) {\n var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);\n result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);\n });\n return result;\n });\n\n /**\n * Creates an array of values by running each element in `collection` through\n * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three\n * arguments: (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,\n * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,\n * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,\n * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,\n * `sum`, `uniq`, and `words`\n *\n * @static\n * @memberOf _\n * @alias collect\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function timesThree(n) {\n * return n * 3;\n * }\n *\n * _.map([1, 2], timesThree);\n * // => [3, 6]\n *\n * _.map({ 'a': 1, 'b': 2 }, timesThree);\n * // => [3, 6] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // using the `_.property` callback shorthand\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\n function map(collection, iteratee, thisArg) {\n var func = isArray(collection) ? arrayMap : baseMap;\n iteratee = getCallback(iteratee, thisArg, 3);\n return func(collection, iteratee);\n }\n\n /**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, while the second of which\n * contains elements `predicate` returns falsey for. The predicate is bound\n * to `thisArg` and invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * _.partition([1, 2, 3], function(n) {\n * return n % 2;\n * });\n * // => [[1, 3], [2]]\n *\n * _.partition([1.2, 2.3, 3.4], function(n) {\n * return this.floor(n) % 2;\n * }, Math);\n * // => [[1.2, 3.4], [2.3]]\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * var mapper = function(array) {\n * return _.pluck(array, 'user');\n * };\n *\n * // using the `_.matches` callback shorthand\n * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper);\n * // => [['pebbles'], ['barney', 'fred']]\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.map(_.partition(users, 'active', false), mapper);\n * // => [['barney', 'pebbles'], ['fred']]\n *\n * // using the `_.property` callback shorthand\n * _.map(_.partition(users, 'active'), mapper);\n * // => [['fred'], ['barney', 'pebbles']]\n */\n var partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n }, function() { return [[], []]; });\n\n /**\n * Gets the property value of `path` from all elements in `collection`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Array|string} path The path of the property to pluck.\n * @returns {Array} Returns the property values.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 }\n * ];\n *\n * _.pluck(users, 'user');\n * // => ['barney', 'fred']\n *\n * var userIndex = _.indexBy(users, 'user');\n * _.pluck(userIndex, 'age');\n * // => [36, 40] (iteration order is not guaranteed)\n */\n function pluck(collection, path) {\n return map(collection, property(path));\n }\n\n /**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` through `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not provided the first element of `collection` is used as the initial\n * value. The `iteratee` is bound to `thisArg` and invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`,\n * and `sortByOrder`\n *\n * @static\n * @memberOf _\n * @alias foldl, inject\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.reduce([1, 2], function(total, n) {\n * return total + n;\n * });\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {\n * result[key] = n * 3;\n * return result;\n * }, {});\n * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed)\n */\n var reduce = createReduce(arrayReduce, baseEach);\n\n /**\n * This method is like `_.reduce` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @alias foldr\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * var array = [[0, 1], [2, 3], [4, 5]];\n *\n * _.reduceRight(array, function(flattened, other) {\n * return flattened.concat(other);\n * }, []);\n * // => [4, 5, 2, 3, 0, 1]\n */\n var reduceRight = createReduce(arrayReduceRight, baseEachRight);\n\n /**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the new filtered array.\n * @example\n *\n * _.reject([1, 2, 3, 4], function(n) {\n * return n % 2 == 0;\n * });\n * // => [1, 3]\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');\n * // => ['barney']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.reject(users, 'active', false), 'user');\n * // => ['fred']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.reject(users, 'active'), 'user');\n * // => ['barney']\n */\n function reject(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n predicate = getCallback(predicate, thisArg, 3);\n return func(collection, function(value, index, collection) {\n return !predicate(value, index, collection);\n });\n }\n\n /**\n * Gets a random element or `n` random elements from a collection.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to sample.\n * @param {number} [n] The number of elements to sample.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {*} Returns the random sample(s).\n * @example\n *\n * _.sample([1, 2, 3, 4]);\n * // => 2\n *\n * _.sample([1, 2, 3, 4], 2);\n * // => [3, 1]\n */\n function sample(collection, n, guard) {\n if (guard ? isIterateeCall(collection, n, guard) : n == null) {\n collection = toIterable(collection);\n var length = collection.length;\n return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;\n }\n var index = -1,\n result = toArray(collection),\n length = result.length,\n lastIndex = length - 1;\n\n n = nativeMin(n < 0 ? 0 : (+n || 0), length);\n while (++index < n) {\n var rand = baseRandom(index, lastIndex),\n value = result[rand];\n\n result[rand] = result[index];\n result[index] = value;\n }\n result.length = n;\n return result;\n }\n\n /**\n * Creates an array of shuffled values, using a version of the\n * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n * @example\n *\n * _.shuffle([1, 2, 3, 4]);\n * // => [4, 1, 3, 2]\n */\n function shuffle(collection) {\n return sample(collection, POSITIVE_INFINITY);\n }\n\n /**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable properties for objects.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the size of `collection`.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\n function size(collection) {\n var length = collection ? getLength(collection) : 0;\n return isLength(length) ? length : keys(collection).length;\n }\n\n /**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * The function returns as soon as it finds a passing value and does not iterate\n * over the entire collection. The predicate is bound to `thisArg` and invoked\n * with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias any\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.some(users, 'active', false);\n * // => true\n *\n * // using the `_.property` callback shorthand\n * _.some(users, 'active');\n * // => true\n */\n function some(collection, predicate, thisArg) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (thisArg && isIterateeCall(collection, predicate, thisArg)) {\n predicate = undefined;\n }\n if (typeof predicate != 'function' || thisArg !== undefined) {\n predicate = getCallback(predicate, thisArg, 3);\n }\n return func(collection, predicate);\n }\n\n /**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection through `iteratee`. This method performs\n * a stable sort, that is, it preserves the original sort order of equal elements.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * _.sortBy([1, 2, 3], function(n) {\n * return Math.sin(n);\n * });\n * // => [3, 1, 2]\n *\n * _.sortBy([1, 2, 3], function(n) {\n * return this.sin(n);\n * }, Math);\n * // => [3, 1, 2]\n *\n * var users = [\n * { 'user': 'fred' },\n * { 'user': 'pebbles' },\n * { 'user': 'barney' }\n * ];\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.sortBy(users, 'user'), 'user');\n * // => ['barney', 'fred', 'pebbles']\n */\n function sortBy(collection, iteratee, thisArg) {\n if (collection == null) {\n return [];\n }\n if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {\n iteratee = undefined;\n }\n var index = -1;\n iteratee = getCallback(iteratee, thisArg, 3);\n\n var result = baseMap(collection, function(value, key, collection) {\n return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };\n });\n return baseSortBy(result, compareAscending);\n }\n\n /**\n * This method is like `_.sortBy` except that it can sort by multiple iteratees\n * or property names.\n *\n * If a property name is provided for an iteratee the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If an object is provided for an iteratee the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees\n * The iteratees to sort by, specified as individual values or arrays of values.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 42 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.map(_.sortByAll(users, ['user', 'age']), _.values);\n * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]\n *\n * _.map(_.sortByAll(users, 'user', function(chr) {\n * return Math.floor(chr.age / 10);\n * }), _.values);\n * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n */\n var sortByAll = restParam(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var guard = iteratees[2];\n if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) {\n iteratees.length = 1;\n }\n return baseSortByOrder(collection, baseFlatten(iteratees), []);\n });\n\n /**\n * This method is like `_.sortByAll` except that it allows specifying the\n * sort orders of the iteratees to sort by. If `orders` is unspecified, all\n * values are sorted in ascending order. Otherwise, a value is sorted in\n * ascending order if its corresponding order is \"asc\", and descending if \"desc\".\n *\n * If a property name is provided for an iteratee the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If an object is provided for an iteratee the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {boolean[]} [orders] The sort orders of `iteratees`.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 34 },\n * { 'user': 'fred', 'age': 42 },\n * { 'user': 'barney', 'age': 36 }\n * ];\n *\n * // sort by `user` in ascending order and by `age` in descending order\n * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values);\n * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n */\n function sortByOrder(collection, iteratees, orders, guard) {\n if (collection == null) {\n return [];\n }\n if (guard && isIterateeCall(iteratees, orders, guard)) {\n orders = undefined;\n }\n if (!isArray(iteratees)) {\n iteratees = iteratees == null ? [] : [iteratees];\n }\n if (!isArray(orders)) {\n orders = orders == null ? [] : [orders];\n }\n return baseSortByOrder(collection, iteratees, orders);\n }\n\n /**\n * Performs a deep comparison between each element in `collection` and the\n * source object, returning an array of all elements that have equivalent\n * property values.\n *\n * **Note:** This method supports comparing arrays, booleans, `Date` objects,\n * numbers, `Object` objects, regexes, and strings. Objects are compared by\n * their own, not inherited, enumerable properties. For comparing a single\n * own or inherited property value see `_.matchesProperty`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Object} source The object of property values to match.\n * @returns {Array} Returns the new filtered array.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] },\n * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] }\n * ];\n *\n * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user');\n * // => ['barney']\n *\n * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user');\n * // => ['fred']\n */\n function where(collection, source) {\n return filter(collection, baseMatches(source));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Gets the number of milliseconds that have elapsed since the Unix epoch\n * (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @category Date\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => logs the number of milliseconds it took for the deferred function to be invoked\n */\n var now = nativeNow || function() {\n return new Date().getTime();\n };\n\n /*------------------------------------------------------------------------*/\n\n /**\n * The opposite of `_.before`; this method creates a function that invokes\n * `func` once it is called `n` or more times.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {number} n The number of calls before `func` is invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var saves = ['profile', 'settings'];\n *\n * var done = _.after(saves.length, function() {\n * console.log('done saving!');\n * });\n *\n * _.forEach(saves, function(type) {\n * asyncSave({ 'type': type, 'complete': done });\n * });\n * // => logs 'done saving!' after the two async saves have completed\n */\n function after(n, func) {\n if (typeof func != 'function') {\n if (typeof n == 'function') {\n var temp = n;\n n = func;\n func = temp;\n } else {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n }\n n = nativeIsFinite(n = +n) ? n : 0;\n return function() {\n if (--n < 1) {\n return func.apply(this, arguments);\n }\n };\n }\n\n /**\n * Creates a function that accepts up to `n` arguments ignoring any\n * additional arguments.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @param {number} [n=func.length] The arity cap.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Function} Returns the new function.\n * @example\n *\n * _.map(['6', '8', '10'], _.ary(parseInt, 1));\n * // => [6, 8, 10]\n */\n function ary(func, n, guard) {\n if (guard && isIterateeCall(func, n, guard)) {\n n = undefined;\n }\n n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);\n return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);\n }\n\n /**\n * Creates a function that invokes `func`, with the `this` binding and arguments\n * of the created function, while it is called less than `n` times. Subsequent\n * calls to the created function return the result of the last `func` invocation.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {number} n The number of calls at which `func` is no longer invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * jQuery('#add').on('click', _.before(5, addContactToList));\n * // => allows adding up to 4 contacts to the list\n */\n function before(n, func) {\n var result;\n if (typeof func != 'function') {\n if (typeof n == 'function') {\n var temp = n;\n n = func;\n func = temp;\n } else {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n }\n return function() {\n if (--n > 0) {\n result = func.apply(this, arguments);\n }\n if (n <= 1) {\n func = undefined;\n }\n return result;\n };\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of `thisArg`\n * and prepends any additional `_.bind` arguments to those provided to the\n * bound function.\n *\n * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for partially applied arguments.\n *\n * **Note:** Unlike native `Function#bind` this method does not set the \"length\"\n * property of bound functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var greet = function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * };\n *\n * var object = { 'user': 'fred' };\n *\n * var bound = _.bind(greet, object, 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * // using placeholders\n * var bound = _.bind(greet, object, _, '!');\n * bound('hi');\n * // => 'hi fred!'\n */\n var bind = restParam(function(func, thisArg, partials) {\n var bitmask = BIND_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, bind.placeholder);\n bitmask |= PARTIAL_FLAG;\n }\n return createWrapper(func, bitmask, thisArg, partials, holders);\n });\n\n /**\n * Binds methods of an object to the object itself, overwriting the existing\n * method. Method names may be specified as individual arguments or as arrays\n * of method names. If no method names are provided all enumerable function\n * properties, own and inherited, of `object` are bound.\n *\n * **Note:** This method does not set the \"length\" property of bound functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Object} object The object to bind and assign the bound methods to.\n * @param {...(string|string[])} [methodNames] The object method names to bind,\n * specified as individual method names or arrays of method names.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var view = {\n * 'label': 'docs',\n * 'onClick': function() {\n * console.log('clicked ' + this.label);\n * }\n * };\n *\n * _.bindAll(view);\n * jQuery('#docs').on('click', view.onClick);\n * // => logs 'clicked docs' when the element is clicked\n */\n var bindAll = restParam(function(object, methodNames) {\n methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object);\n\n var index = -1,\n length = methodNames.length;\n\n while (++index < length) {\n var key = methodNames[index];\n object[key] = createWrapper(object[key], BIND_FLAG, object);\n }\n return object;\n });\n\n /**\n * Creates a function that invokes the method at `object[key]` and prepends\n * any additional `_.bindKey` arguments to those provided to the bound function.\n *\n * This method differs from `_.bind` by allowing bound functions to reference\n * methods that may be redefined or don't yet exist.\n * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)\n * for more details.\n *\n * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Object} object The object the method belongs to.\n * @param {string} key The key of the method.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var object = {\n * 'user': 'fred',\n * 'greet': function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n * };\n *\n * var bound = _.bindKey(object, 'greet', 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * object.greet = function(greeting, punctuation) {\n * return greeting + 'ya ' + this.user + punctuation;\n * };\n *\n * bound('!');\n * // => 'hiya fred!'\n *\n * // using placeholders\n * var bound = _.bindKey(object, 'greet', _, '!');\n * bound('hi');\n * // => 'hiya fred!'\n */\n var bindKey = restParam(function(object, key, partials) {\n var bitmask = BIND_FLAG | BIND_KEY_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, bindKey.placeholder);\n bitmask |= PARTIAL_FLAG;\n }\n return createWrapper(key, bitmask, object, partials, holders);\n });\n\n /**\n * Creates a function that accepts one or more arguments of `func` that when\n * called either invokes `func` returning its result, if all `func` arguments\n * have been provided, or returns a function that accepts one or more of the\n * remaining `func` arguments, and so on. The arity of `func` may be specified\n * if `func.length` is not sufficient.\n *\n * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for provided arguments.\n *\n * **Note:** This method does not set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curry(abc);\n *\n * curried(1)(2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // using placeholders\n * curried(1)(_, 3)(2);\n * // => [1, 2, 3]\n */\n var curry = createCurry(CURRY_FLAG);\n\n /**\n * This method is like `_.curry` except that arguments are applied to `func`\n * in the manner of `_.partialRight` instead of `_.partial`.\n *\n * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for provided arguments.\n *\n * **Note:** This method does not set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curryRight(abc);\n *\n * curried(3)(2)(1);\n * // => [1, 2, 3]\n *\n * curried(2, 3)(1);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // using placeholders\n * curried(3)(1, _)(2);\n * // => [1, 2, 3]\n */\n var curryRight = createCurry(CURRY_RIGHT_FLAG);\n\n /**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed invocations. Provide an options object to indicate that `func`\n * should be invoked on the leading and/or trailing edge of the `wait` timeout.\n * Subsequent calls to the debounced function return the result of the last\n * `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the debounced function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=false] Specify invoking on the leading\n * edge of the timeout.\n * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n * delayed before it is invoked.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // avoid costly calculations while the window size is in flux\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // invoke `sendMail` when the click event is fired, debouncing subsequent calls\n * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // ensure `batchLog` is invoked once after 1 second of debounced calls\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', _.debounce(batchLog, 250, {\n * 'maxWait': 1000\n * }));\n *\n * // cancel a debounced call\n * var todoChanges = _.debounce(batchLog, 1000);\n * Object.observe(models.todo, todoChanges);\n *\n * Object.observe(models, function(changes) {\n * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {\n * todoChanges.cancel();\n * }\n * }, ['delete']);\n *\n * // ...at some point `models.todo` is changed\n * models.todo.completed = true;\n *\n * // ...before 1 second has passed `models.todo` is deleted\n * // which cancels the debounced `todoChanges` call\n * delete models.todo;\n */\n function debounce(func, wait, options) {\n var args,\n maxTimeoutId,\n result,\n stamp,\n thisArg,\n timeoutId,\n trailingCall,\n lastCalled = 0,\n maxWait = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = wait < 0 ? 0 : (+wait || 0);\n if (options === true) {\n var leading = true;\n trailing = false;\n } else if (isObject(options)) {\n leading = !!options.leading;\n maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (maxTimeoutId) {\n clearTimeout(maxTimeoutId);\n }\n lastCalled = 0;\n maxTimeoutId = timeoutId = trailingCall = undefined;\n }\n\n function complete(isCalled, id) {\n if (id) {\n clearTimeout(id);\n }\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (isCalled) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n }\n }\n\n function delayed() {\n var remaining = wait - (now() - stamp);\n if (remaining <= 0 || remaining > wait) {\n complete(trailingCall, maxTimeoutId);\n } else {\n timeoutId = setTimeout(delayed, remaining);\n }\n }\n\n function maxDelayed() {\n complete(trailing, timeoutId);\n }\n\n function debounced() {\n args = arguments;\n stamp = now();\n thisArg = this;\n trailingCall = trailing && (timeoutId || !leading);\n\n if (maxWait === false) {\n var leadingCall = leading && !timeoutId;\n } else {\n if (!maxTimeoutId && !leading) {\n lastCalled = stamp;\n }\n var remaining = maxWait - (stamp - lastCalled),\n isCalled = remaining <= 0 || remaining > maxWait;\n\n if (isCalled) {\n if (maxTimeoutId) {\n maxTimeoutId = clearTimeout(maxTimeoutId);\n }\n lastCalled = stamp;\n result = func.apply(thisArg, args);\n }\n else if (!maxTimeoutId) {\n maxTimeoutId = setTimeout(maxDelayed, remaining);\n }\n }\n if (isCalled && timeoutId) {\n timeoutId = clearTimeout(timeoutId);\n }\n else if (!timeoutId && wait !== maxWait) {\n timeoutId = setTimeout(delayed, wait);\n }\n if (leadingCall) {\n isCalled = true;\n result = func.apply(thisArg, args);\n }\n if (isCalled && !timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n return result;\n }\n debounced.cancel = cancel;\n return debounced;\n }\n\n /**\n * Defers invoking the `func` until the current call stack has cleared. Any\n * additional arguments are provided to `func` when it is invoked.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to defer.\n * @param {...*} [args] The arguments to invoke the function with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.defer(function(text) {\n * console.log(text);\n * }, 'deferred');\n * // logs 'deferred' after one or more milliseconds\n */\n var defer = restParam(function(func, args) {\n return baseDelay(func, 1, args);\n });\n\n /**\n * Invokes `func` after `wait` milliseconds. Any additional arguments are\n * provided to `func` when it is invoked.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {...*} [args] The arguments to invoke the function with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.delay(function(text) {\n * console.log(text);\n * }, 1000, 'later');\n * // => logs 'later' after one second\n */\n var delay = restParam(function(func, wait, args) {\n return baseDelay(func, wait, args);\n });\n\n /**\n * Creates a function that returns the result of invoking the provided\n * functions with the `this` binding of the created function, where each\n * successive invocation is supplied the return value of the previous.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {...Function} [funcs] Functions to invoke.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var addSquare = _.flow(_.add, square);\n * addSquare(1, 2);\n * // => 9\n */\n var flow = createFlow();\n\n /**\n * This method is like `_.flow` except that it creates a function that\n * invokes the provided functions from right to left.\n *\n * @static\n * @memberOf _\n * @alias backflow, compose\n * @category Function\n * @param {...Function} [funcs] Functions to invoke.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var addSquare = _.flowRight(square, _.add);\n * addSquare(1, 2);\n * // => 9\n */\n var flowRight = createFlow(true);\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is coerced to a string and used as the\n * cache key. The `func` is invoked with the `this` binding of the memoized\n * function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoizing function.\n * @example\n *\n * var upperCase = _.memoize(function(string) {\n * return string.toUpperCase();\n * });\n *\n * upperCase('fred');\n * // => 'FRED'\n *\n * // modifying the result cache\n * upperCase.cache.set('fred', 'BARNEY');\n * upperCase('fred');\n * // => 'BARNEY'\n *\n * // replacing `_.memoize.Cache`\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'barney' };\n * var identity = _.memoize(_.identity);\n *\n * identity(object);\n * // => { 'user': 'fred' }\n * identity(other);\n * // => { 'user': 'fred' }\n *\n * _.memoize.Cache = WeakMap;\n * var identity = _.memoize(_.identity);\n *\n * identity(object);\n * // => { 'user': 'fred' }\n * identity(other);\n * // => { 'user': 'barney' }\n */\n function memoize(func, resolver) {\n if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result);\n return result;\n };\n memoized.cache = new memoize.Cache;\n return memoized;\n }\n\n /**\n * Creates a function that runs each argument through a corresponding\n * transform function.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to wrap.\n * @param {...(Function|Function[])} [transforms] The functions to transform\n * arguments, specified as individual functions or arrays of functions.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function doubled(n) {\n * return n * 2;\n * }\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var modded = _.modArgs(function(x, y) {\n * return [x, y];\n * }, square, doubled);\n *\n * modded(1, 2);\n * // => [1, 4]\n *\n * modded(5, 10);\n * // => [25, 20]\n */\n var modArgs = restParam(function(func, transforms) {\n transforms = baseFlatten(transforms);\n if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = transforms.length;\n return restParam(function(args) {\n var index = nativeMin(args.length, length);\n while (index--) {\n args[index] = transforms[index](args[index]);\n }\n return func.apply(this, args);\n });\n });\n\n /**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\n function negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function() {\n return !predicate.apply(this, arguments);\n };\n }\n\n /**\n * Creates a function that is restricted to invoking `func` once. Repeat calls\n * to the function return the value of the first call. The `func` is invoked\n * with the `this` binding and arguments of the created function.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var initialize = _.once(createApplication);\n * initialize();\n * initialize();\n * // `initialize` invokes `createApplication` once\n */\n function once(func) {\n return before(2, func);\n }\n\n /**\n * Creates a function that invokes `func` with `partial` arguments prepended\n * to those provided to the new function. This method is like `_.bind` except\n * it does **not** alter the `this` binding.\n *\n * The `_.partial.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method does not set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * var greet = function(greeting, name) {\n * return greeting + ' ' + name;\n * };\n *\n * var sayHelloTo = _.partial(greet, 'hello');\n * sayHelloTo('fred');\n * // => 'hello fred'\n *\n * // using placeholders\n * var greetFred = _.partial(greet, _, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n */\n var partial = createPartial(PARTIAL_FLAG);\n\n /**\n * This method is like `_.partial` except that partially applied arguments\n * are appended to those provided to the new function.\n *\n * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method does not set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * var greet = function(greeting, name) {\n * return greeting + ' ' + name;\n * };\n *\n * var greetFred = _.partialRight(greet, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n *\n * // using placeholders\n * var sayHelloTo = _.partialRight(greet, 'hello', _);\n * sayHelloTo('fred');\n * // => 'hello fred'\n */\n var partialRight = createPartial(PARTIAL_RIGHT_FLAG);\n\n /**\n * Creates a function that invokes `func` with arguments arranged according\n * to the specified indexes where the argument value at the first index is\n * provided as the first argument, the argument value at the second index is\n * provided as the second argument, and so on.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to rearrange arguments for.\n * @param {...(number|number[])} indexes The arranged argument indexes,\n * specified as individual indexes or arrays of indexes.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var rearged = _.rearg(function(a, b, c) {\n * return [a, b, c];\n * }, 2, 0, 1);\n *\n * rearged('b', 'c', 'a')\n * // => ['a', 'b', 'c']\n *\n * var map = _.rearg(_.map, [1, 0]);\n * map(function(n) {\n * return n * 3;\n * }, [1, 2, 3]);\n * // => [3, 6, 9]\n */\n var rearg = restParam(function(func, indexes) {\n return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));\n });\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.restParam(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\n function restParam(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n rest = Array(length);\n\n while (++index < length) {\n rest[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, args[0], rest);\n case 2: return func.call(this, args[0], args[1], rest);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = rest;\n return func.apply(this, otherArgs);\n };\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the created\n * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).\n *\n * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to spread arguments over.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.spread(function(who, what) {\n * return who + ' says ' + what;\n * });\n *\n * say(['fred', 'hello']);\n * // => 'fred says hello'\n *\n * // with a Promise\n * var numbers = Promise.all([\n * Promise.resolve(40),\n * Promise.resolve(36)\n * ]);\n *\n * numbers.then(_.spread(function(x, y) {\n * return x + y;\n * }));\n * // => a Promise of 76\n */\n function spread(func) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function(array) {\n return func.apply(this, array);\n };\n }\n\n /**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed invocations. Provide an options object to indicate\n * that `func` should be invoked on the leading and/or trailing edge of the\n * `wait` timeout. Subsequent calls to the throttled function return the\n * result of the last `func` call.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the throttled function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=true] Specify invoking on the leading\n * edge of the timeout.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // avoid excessively updating the position while scrolling\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {\n * 'trailing': false\n * }));\n *\n * // cancel a trailing throttled call\n * jQuery(window).on('popstate', throttled.cancel);\n */\n function throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (options === false) {\n leading = false;\n } else if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing });\n }\n\n /**\n * Creates a function that provides `value` to the wrapper function as its\n * first argument. Any additional arguments provided to the function are\n * appended to those provided to the wrapper function. The wrapper is invoked\n * with the `this` binding of the created function.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {*} value The value to wrap.\n * @param {Function} wrapper The wrapper function.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var p = _.wrap(_.escape, function(func, text) {\n * return '

        ' + func(text) + '

        ';\n * });\n *\n * p('fred, barney, & pebbles');\n * // => '

        fred, barney, & pebbles

        '\n */\n function wrap(value, wrapper) {\n wrapper = wrapper == null ? identity : wrapper;\n return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,\n * otherwise they are assigned by reference. If `customizer` is provided it is\n * invoked to produce the cloned values. If `customizer` returns `undefined`\n * cloning is handled by the method instead. The `customizer` is bound to\n * `thisArg` and invoked with two argument; (value [, index|key, object]).\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).\n * The enumerable properties of `arguments` objects and objects created by\n * constructors other than `Object` are cloned to plain `Object` objects. An\n * empty object is returned for uncloneable values such as functions, DOM nodes,\n * Maps, Sets, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {Function} [customizer] The function to customize cloning values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {*} Returns the cloned value.\n * @example\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * var shallow = _.clone(users);\n * shallow[0] === users[0];\n * // => true\n *\n * var deep = _.clone(users, true);\n * deep[0] === users[0];\n * // => false\n *\n * // using a customizer callback\n * var el = _.clone(document.body, function(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(false);\n * }\n * });\n *\n * el === document.body\n * // => false\n * el.nodeName\n * // => BODY\n * el.childNodes.length;\n * // => 0\n */\n function clone(value, isDeep, customizer, thisArg) {\n if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {\n isDeep = false;\n }\n else if (typeof isDeep == 'function') {\n thisArg = customizer;\n customizer = isDeep;\n isDeep = false;\n }\n return typeof customizer == 'function'\n ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1))\n : baseClone(value, isDeep);\n }\n\n /**\n * Creates a deep clone of `value`. If `customizer` is provided it is invoked\n * to produce the cloned values. If `customizer` returns `undefined` cloning\n * is handled by the method instead. The `customizer` is bound to `thisArg`\n * and invoked with two argument; (value [, index|key, object]).\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).\n * The enumerable properties of `arguments` objects and objects created by\n * constructors other than `Object` are cloned to plain `Object` objects. An\n * empty object is returned for uncloneable values such as functions, DOM nodes,\n * Maps, Sets, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to deep clone.\n * @param {Function} [customizer] The function to customize cloning values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {*} Returns the deep cloned value.\n * @example\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * var deep = _.cloneDeep(users);\n * deep[0] === users[0];\n * // => false\n *\n * // using a customizer callback\n * var el = _.cloneDeep(document.body, function(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(true);\n * }\n * });\n *\n * el === document.body\n * // => false\n * el.nodeName\n * // => BODY\n * el.childNodes.length;\n * // => 20\n */\n function cloneDeep(value, customizer, thisArg) {\n return typeof customizer == 'function'\n ? baseClone(value, true, bindCallback(customizer, thisArg, 1))\n : baseClone(value, true);\n }\n\n /**\n * Checks if `value` is greater than `other`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.\n * @example\n *\n * _.gt(3, 1);\n * // => true\n *\n * _.gt(3, 3);\n * // => false\n *\n * _.gt(1, 3);\n * // => false\n */\n function gt(value, other) {\n return value > other;\n }\n\n /**\n * Checks if `value` is greater than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.\n * @example\n *\n * _.gte(3, 1);\n * // => true\n *\n * _.gte(3, 3);\n * // => true\n *\n * _.gte(1, 3);\n * // => false\n */\n function gte(value, other) {\n return value >= other;\n }\n\n /**\n * Checks if `value` is classified as an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n function isArguments(value) {\n return isObjectLike(value) && isArrayLike(value) &&\n hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');\n }\n\n /**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\n var isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n };\n\n /**\n * Checks if `value` is classified as a boolean primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isBoolean(false);\n * // => true\n *\n * _.isBoolean(null);\n * // => false\n */\n function isBoolean(value) {\n return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);\n }\n\n /**\n * Checks if `value` is classified as a `Date` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isDate(new Date);\n * // => true\n *\n * _.isDate('Mon April 23 2012');\n * // => false\n */\n function isDate(value) {\n return isObjectLike(value) && objToString.call(value) == dateTag;\n }\n\n /**\n * Checks if `value` is a DOM element.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.\n * @example\n *\n * _.isElement(document.body);\n * // => true\n *\n * _.isElement('');\n * // => false\n */\n function isElement(value) {\n return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);\n }\n\n /**\n * Checks if `value` is empty. A value is considered empty unless it is an\n * `arguments` object, array, string, or jQuery-like collection with a length\n * greater than `0` or an object with own enumerable properties.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {Array|Object|string} value The value to inspect.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\n function isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||\n (isObjectLike(value) && isFunction(value.splice)))) {\n return !value.length;\n }\n return !keys(value).length;\n }\n\n /**\n * Performs a deep comparison between two values to determine if they are\n * equivalent. If `customizer` is provided it is invoked to compare values.\n * If `customizer` returns `undefined` comparisons are handled by the method\n * instead. The `customizer` is bound to `thisArg` and invoked with three\n * arguments: (value, other [, index|key]).\n *\n * **Note:** This method supports comparing arrays, booleans, `Date` objects,\n * numbers, `Object` objects, regexes, and strings. Objects are compared by\n * their own, not inherited, enumerable properties. Functions and DOM nodes\n * are **not** supported. Provide a customizer function to extend support\n * for comparing other values.\n *\n * @static\n * @memberOf _\n * @alias eq\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize value comparisons.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'fred' };\n *\n * object == other;\n * // => false\n *\n * _.isEqual(object, other);\n * // => true\n *\n * // using a customizer callback\n * var array = ['hello', 'goodbye'];\n * var other = ['hi', 'goodbye'];\n *\n * _.isEqual(array, other, function(value, other) {\n * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {\n * return true;\n * }\n * });\n * // => true\n */\n function isEqual(value, other, customizer, thisArg) {\n customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;\n var result = customizer ? customizer(value, other) : undefined;\n return result === undefined ? baseIsEqual(value, other, customizer) : !!result;\n }\n\n /**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\n function isError(value) {\n return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;\n }\n\n /**\n * Checks if `value` is a finite primitive number.\n *\n * **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.\n * @example\n *\n * _.isFinite(10);\n * // => true\n *\n * _.isFinite('10');\n * // => false\n *\n * _.isFinite(true);\n * // => false\n *\n * _.isFinite(Object(10));\n * // => false\n *\n * _.isFinite(Infinity);\n * // => false\n */\n function isFinite(value) {\n return typeof value == 'number' && nativeIsFinite(value);\n }\n\n /**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\n function isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 equivalents which return 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n }\n\n /**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\n function isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n }\n\n /**\n * Performs a deep comparison between `object` and `source` to determine if\n * `object` contains equivalent property values. If `customizer` is provided\n * it is invoked to compare values. If `customizer` returns `undefined`\n * comparisons are handled by the method instead. The `customizer` is bound\n * to `thisArg` and invoked with three arguments: (value, other, index|key).\n *\n * **Note:** This method supports comparing properties of arrays, booleans,\n * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions\n * and DOM nodes are **not** supported. Provide a customizer function to extend\n * support for comparing other values.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Function} [customizer] The function to customize value comparisons.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * var object = { 'user': 'fred', 'age': 40 };\n *\n * _.isMatch(object, { 'age': 40 });\n * // => true\n *\n * _.isMatch(object, { 'age': 36 });\n * // => false\n *\n * // using a customizer callback\n * var object = { 'greeting': 'hello' };\n * var source = { 'greeting': 'hi' };\n *\n * _.isMatch(object, source, function(value, other) {\n * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;\n * });\n * // => true\n */\n function isMatch(object, source, customizer, thisArg) {\n customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;\n return baseIsMatch(object, getMatchData(source), customizer);\n }\n\n /**\n * Checks if `value` is `NaN`.\n *\n * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4)\n * which returns `true` for `undefined` and other non-numeric values.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n * @example\n *\n * _.isNaN(NaN);\n * // => true\n *\n * _.isNaN(new Number(NaN));\n * // => true\n *\n * isNaN(undefined);\n * // => true\n *\n * _.isNaN(undefined);\n * // => false\n */\n function isNaN(value) {\n // An `NaN` primitive is the only value that is not equal to itself.\n // Perform the `toStringTag` check first to avoid errors with some host objects in IE.\n return isNumber(value) && value != +value;\n }\n\n /**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\n function isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n }\n\n /**\n * Checks if `value` is `null`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `null`, else `false`.\n * @example\n *\n * _.isNull(null);\n * // => true\n *\n * _.isNull(void 0);\n * // => false\n */\n function isNull(value) {\n return value === null;\n }\n\n /**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified\n * as numbers, use the `_.isFinite` method.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isNumber(8.4);\n * // => true\n *\n * _.isNumber(NaN);\n * // => true\n *\n * _.isNumber('8.4');\n * // => false\n */\n function isNumber(value) {\n return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);\n }\n\n /**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * **Note:** This method assumes objects created by the `Object` constructor\n * have no inherited enumerable properties.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\n function isPlainObject(value) {\n var Ctor;\n\n // Exit early for non `Object` objects.\n if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||\n (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {\n return false;\n }\n // IE < 9 iterates inherited properties before own properties. If the first\n // iterated property is an object's own property then there are no inherited\n // enumerable properties.\n var result;\n // In most environments an object's own properties are iterated before\n // its inherited properties. If the last iterated property is an object's\n // own property then there are no inherited enumerable properties.\n baseForIn(value, function(subValue, key) {\n result = key;\n });\n return result === undefined || hasOwnProperty.call(value, result);\n }\n\n /**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\n function isRegExp(value) {\n return isObject(value) && objToString.call(value) == regexpTag;\n }\n\n /**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n function isString(value) {\n return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);\n }\n\n /**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\n function isTypedArray(value) {\n return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n }\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\n function isUndefined(value) {\n return value === undefined;\n }\n\n /**\n * Checks if `value` is less than `other`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.\n * @example\n *\n * _.lt(1, 3);\n * // => true\n *\n * _.lt(3, 3);\n * // => false\n *\n * _.lt(3, 1);\n * // => false\n */\n function lt(value, other) {\n return value < other;\n }\n\n /**\n * Checks if `value` is less than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.\n * @example\n *\n * _.lte(1, 3);\n * // => true\n *\n * _.lte(3, 3);\n * // => true\n *\n * _.lte(3, 1);\n * // => false\n */\n function lte(value, other) {\n return value <= other;\n }\n\n /**\n * Converts `value` to an array.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Array} Returns the converted array.\n * @example\n *\n * (function() {\n * return _.toArray(arguments).slice(1);\n * }(1, 2, 3));\n * // => [2, 3]\n */\n function toArray(value) {\n var length = value ? getLength(value) : 0;\n if (!isLength(length)) {\n return values(value);\n }\n if (!length) {\n return [];\n }\n return arrayCopy(value);\n }\n\n /**\n * Converts `value` to a plain object flattening inherited enumerable\n * properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\n function toPlainObject(value) {\n return baseCopy(value, keysIn(value));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Recursively merges own enumerable properties of the source object(s), that\n * don't resolve to `undefined` into the destination object. Subsequent sources\n * overwrite property assignments of previous sources. If `customizer` is\n * provided it is invoked to produce the merged values of the destination and\n * source properties. If `customizer` returns `undefined` merging is handled\n * by the method instead. The `customizer` is bound to `thisArg` and invoked\n * with five arguments: (objectValue, sourceValue, key, object, source).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var users = {\n * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n * };\n *\n * var ages = {\n * 'data': [{ 'age': 36 }, { 'age': 40 }]\n * };\n *\n * _.merge(users, ages);\n * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n *\n * // using a customizer callback\n * var object = {\n * 'fruits': ['apple'],\n * 'vegetables': ['beet']\n * };\n *\n * var other = {\n * 'fruits': ['banana'],\n * 'vegetables': ['carrot']\n * };\n *\n * _.merge(object, other, function(a, b) {\n * if (_.isArray(a)) {\n * return a.concat(b);\n * }\n * });\n * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n */\n var merge = createAssigner(baseMerge);\n\n /**\n * Assigns own enumerable properties of source object(s) to the destination\n * object. Subsequent sources overwrite property assignments of previous sources.\n * If `customizer` is provided it is invoked to produce the assigned values.\n * The `customizer` is bound to `thisArg` and invoked with five arguments:\n * (objectValue, sourceValue, key, object, source).\n *\n * **Note:** This method mutates `object` and is based on\n * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).\n *\n * @static\n * @memberOf _\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });\n * // => { 'user': 'fred', 'age': 40 }\n *\n * // using a customizer callback\n * var defaults = _.partialRight(_.assign, function(value, other) {\n * return _.isUndefined(value) ? other : value;\n * });\n *\n * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\n * // => { 'user': 'barney', 'age': 36 }\n */\n var assign = createAssigner(function(object, source, customizer) {\n return customizer\n ? assignWith(object, source, customizer)\n : baseAssign(object, source);\n });\n\n /**\n * Creates an object that inherits from the given `prototype` object. If a\n * `properties` object is provided its own enumerable properties are assigned\n * to the created object.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} prototype The object to inherit from.\n * @param {Object} [properties] The properties to assign to the object.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Object} Returns the new object.\n * @example\n *\n * function Shape() {\n * this.x = 0;\n * this.y = 0;\n * }\n *\n * function Circle() {\n * Shape.call(this);\n * }\n *\n * Circle.prototype = _.create(Shape.prototype, {\n * 'constructor': Circle\n * });\n *\n * var circle = new Circle;\n * circle instanceof Circle;\n * // => true\n *\n * circle instanceof Shape;\n * // => true\n */\n function create(prototype, properties, guard) {\n var result = baseCreate(prototype);\n if (guard && isIterateeCall(prototype, properties, guard)) {\n properties = undefined;\n }\n return properties ? baseAssign(result, properties) : result;\n }\n\n /**\n * Assigns own enumerable properties of source object(s) to the destination\n * object for all destination properties that resolve to `undefined`. Once a\n * property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\n * // => { 'user': 'barney', 'age': 36 }\n */\n var defaults = createDefaults(assign, assignDefaults);\n\n /**\n * This method is like `_.defaults` except that it recursively assigns\n * default properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });\n * // => { 'user': { 'name': 'barney', 'age': 36 } }\n *\n */\n var defaultsDeep = createDefaults(merge, mergeDefaults);\n\n /**\n * This method is like `_.find` except that it returns the key of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {string|undefined} Returns the key of the matched element, else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findKey(users, function(chr) {\n * return chr.age < 40;\n * });\n * // => 'barney' (iteration order is not guaranteed)\n *\n * // using the `_.matches` callback shorthand\n * _.findKey(users, { 'age': 1, 'active': true });\n * // => 'pebbles'\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.findKey(users, 'active', false);\n * // => 'fred'\n *\n * // using the `_.property` callback shorthand\n * _.findKey(users, 'active');\n * // => 'barney'\n */\n var findKey = createFindKey(baseForOwn);\n\n /**\n * This method is like `_.findKey` except that it iterates over elements of\n * a collection in the opposite order.\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {string|undefined} Returns the key of the matched element, else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findLastKey(users, function(chr) {\n * return chr.age < 40;\n * });\n * // => returns `pebbles` assuming `_.findKey` returns `barney`\n *\n * // using the `_.matches` callback shorthand\n * _.findLastKey(users, { 'age': 36, 'active': true });\n * // => 'barney'\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.findLastKey(users, 'active', false);\n * // => 'fred'\n *\n * // using the `_.property` callback shorthand\n * _.findLastKey(users, 'active');\n * // => 'pebbles'\n */\n var findLastKey = createFindKey(baseForOwnRight);\n\n /**\n * Iterates over own and inherited enumerable properties of an object invoking\n * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked\n * with three arguments: (value, key, object). Iteratee functions may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forIn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)\n */\n var forIn = createForIn(baseFor);\n\n /**\n * This method is like `_.forIn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forInRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'\n */\n var forInRight = createForIn(baseForRight);\n\n /**\n * Iterates over own enumerable properties of an object invoking `iteratee`\n * for each property. The `iteratee` is bound to `thisArg` and invoked with\n * three arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'a' and 'b' (iteration order is not guaranteed)\n */\n var forOwn = createForOwn(baseForOwn);\n\n /**\n * This method is like `_.forOwn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwnRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'\n */\n var forOwnRight = createForOwn(baseForOwnRight);\n\n /**\n * Creates an array of function property names from all enumerable properties,\n * own and inherited, of `object`.\n *\n * @static\n * @memberOf _\n * @alias methods\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the new array of property names.\n * @example\n *\n * _.functions(_);\n * // => ['after', 'ary', 'assign', ...]\n */\n function functions(object) {\n return baseFunctions(object, keysIn(object));\n }\n\n /**\n * Gets the property value at `path` of `object`. If the resolved value is\n * `undefined` the `defaultValue` is used in its place.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\n function get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, toPath(path), path + '');\n return result === undefined ? defaultValue : result;\n }\n\n /**\n * Checks if `path` is a direct property.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` is a direct property, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': { 'c': 3 } } };\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b.c');\n * // => true\n *\n * _.has(object, ['a', 'b', 'c']);\n * // => true\n */\n function has(object, path) {\n if (object == null) {\n return false;\n }\n var result = hasOwnProperty.call(object, path);\n if (!result && !isKey(path)) {\n path = toPath(path);\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n if (object == null) {\n return false;\n }\n path = last(path);\n result = hasOwnProperty.call(object, path);\n }\n return result || (isLength(object.length) && isIndex(path, object.length) &&\n (isArray(object) || isArguments(object)));\n }\n\n /**\n * Creates an object composed of the inverted keys and values of `object`.\n * If `object` contains duplicate values, subsequent values overwrite property\n * assignments of previous values unless `multiValue` is `true`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to invert.\n * @param {boolean} [multiValue] Allow multiple values per key.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invert(object);\n * // => { '1': 'c', '2': 'b' }\n *\n * // with `multiValue`\n * _.invert(object, true);\n * // => { '1': ['a', 'c'], '2': ['b'] }\n */\n function invert(object, multiValue, guard) {\n if (guard && isIterateeCall(object, multiValue, guard)) {\n multiValue = undefined;\n }\n var index = -1,\n props = keys(object),\n length = props.length,\n result = {};\n\n while (++index < length) {\n var key = props[index],\n value = object[key];\n\n if (multiValue) {\n if (hasOwnProperty.call(result, value)) {\n result[value].push(key);\n } else {\n result[value] = [key];\n }\n }\n else {\n result[value] = key;\n }\n }\n return result;\n }\n\n /**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\n var keys = !nativeKeys ? shimKeys : function(object) {\n var Ctor = object == null ? undefined : object.constructor;\n if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n (typeof object != 'function' && isArrayLike(object))) {\n return shimKeys(object);\n }\n return isObject(object) ? nativeKeys(object) : [];\n };\n\n /**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\n function keysIn(object) {\n if (object == null) {\n return [];\n }\n if (!isObject(object)) {\n object = Object(object);\n }\n var length = object.length;\n length = (length && isLength(length) &&\n (isArray(object) || isArguments(object)) && length) || 0;\n\n var Ctor = object.constructor,\n index = -1,\n isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n result = Array(length),\n skipIndexes = length > 0;\n\n while (++index < length) {\n result[index] = (index + '');\n }\n for (var key in object) {\n if (!(skipIndexes && isIndex(key, length)) &&\n !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The opposite of `_.mapValues`; this method creates an object with the\n * same values as `object` and keys generated by running each own enumerable\n * property of `object` through `iteratee`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the new mapped object.\n * @example\n *\n * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n * return key + value;\n * });\n * // => { 'a1': 1, 'b2': 2 }\n */\n var mapKeys = createObjectMapper(true);\n\n /**\n * Creates an object with the same keys as `object` and values generated by\n * running each own enumerable property of `object` through `iteratee`. The\n * iteratee function is bound to `thisArg` and invoked with three arguments:\n * (value, key, object).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the new mapped object.\n * @example\n *\n * _.mapValues({ 'a': 1, 'b': 2 }, function(n) {\n * return n * 3;\n * });\n * // => { 'a': 3, 'b': 6 }\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * // using the `_.property` callback shorthand\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\n var mapValues = createObjectMapper();\n\n /**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable properties of `object` that are not omitted.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {Function|...(string|string[])} [predicate] The function invoked per\n * iteration or property names to omit, specified as individual property\n * names or arrays of property names.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'user': 'fred', 'age': 40 };\n *\n * _.omit(object, 'age');\n * // => { 'user': 'fred' }\n *\n * _.omit(object, _.isNumber);\n * // => { 'user': 'fred' }\n */\n var omit = restParam(function(object, props) {\n if (object == null) {\n return {};\n }\n if (typeof props[0] != 'function') {\n var props = arrayMap(baseFlatten(props), String);\n return pickByArray(object, baseDifference(keysIn(object), props));\n }\n var predicate = bindCallback(props[0], props[1], 3);\n return pickByCallback(object, function(value, key, object) {\n return !predicate(value, key, object);\n });\n });\n\n /**\n * Creates a two dimensional array of the key-value pairs for `object`,\n * e.g. `[[key1, value1], [key2, value2]]`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the new array of key-value pairs.\n * @example\n *\n * _.pairs({ 'barney': 36, 'fred': 40 });\n * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)\n */\n function pairs(object) {\n object = toObject(object);\n\n var index = -1,\n props = keys(object),\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n var key = props[index];\n result[index] = [key, object[key]];\n }\n return result;\n }\n\n /**\n * Creates an object composed of the picked `object` properties. Property\n * names may be specified as individual arguments or as arrays of property\n * names. If `predicate` is provided it is invoked for each property of `object`\n * picking the properties `predicate` returns truthy for. The predicate is\n * bound to `thisArg` and invoked with three arguments: (value, key, object).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {Function|...(string|string[])} [predicate] The function invoked per\n * iteration or property names to pick, specified as individual property\n * names or arrays of property names.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'user': 'fred', 'age': 40 };\n *\n * _.pick(object, 'user');\n * // => { 'user': 'fred' }\n *\n * _.pick(object, _.isString);\n * // => { 'user': 'fred' }\n */\n var pick = restParam(function(object, props) {\n if (object == null) {\n return {};\n }\n return typeof props[0] == 'function'\n ? pickByCallback(object, bindCallback(props[0], props[1], 3))\n : pickByArray(object, baseFlatten(props));\n });\n\n /**\n * This method is like `_.get` except that if the resolved value is a function\n * it is invoked with the `this` binding of its parent object and its result\n * is returned.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to resolve.\n * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n *\n * _.result(object, 'a[0].b.c1');\n * // => 3\n *\n * _.result(object, 'a[0].b.c2');\n * // => 4\n *\n * _.result(object, 'a.b.c', 'default');\n * // => 'default'\n *\n * _.result(object, 'a.b.c', _.constant('default'));\n * // => 'default'\n */\n function result(object, path, defaultValue) {\n var result = object == null ? undefined : object[path];\n if (result === undefined) {\n if (object != null && !isKey(path, object)) {\n path = toPath(path);\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n result = object == null ? undefined : object[last(path)];\n }\n result = result === undefined ? defaultValue : result;\n }\n return isFunction(result) ? result.call(object) : result;\n }\n\n /**\n * Sets the property value of `path` on `object`. If a portion of `path`\n * does not exist it is created.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to augment.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, 'x[0].y.z', 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\n function set(object, path, value) {\n if (object == null) {\n return object;\n }\n var pathKey = (path + '');\n path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = path[index];\n if (isObject(nested)) {\n if (index == lastIndex) {\n nested[key] = value;\n } else if (nested[key] == null) {\n nested[key] = isIndex(path[index + 1]) ? [] : {};\n }\n }\n nested = nested[key];\n }\n return object;\n }\n\n /**\n * An alternative to `_.reduce`; this method transforms `object` to a new\n * `accumulator` object which is the result of running each of its own enumerable\n * properties through `iteratee`, with each invocation potentially mutating\n * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked\n * with four arguments: (accumulator, value, key, object). Iteratee functions\n * may exit iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Array|Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The custom accumulator value.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.transform([2, 3, 4], function(result, n) {\n * result.push(n *= n);\n * return n % 2 == 0;\n * });\n * // => [4, 9]\n *\n * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {\n * result[key] = n * 3;\n * });\n * // => { 'a': 3, 'b': 6 }\n */\n function transform(object, iteratee, accumulator, thisArg) {\n var isArr = isArray(object) || isTypedArray(object);\n iteratee = getCallback(iteratee, thisArg, 4);\n\n if (accumulator == null) {\n if (isArr || isObject(object)) {\n var Ctor = object.constructor;\n if (isArr) {\n accumulator = isArray(object) ? new Ctor : [];\n } else {\n accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);\n }\n } else {\n accumulator = {};\n }\n }\n (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {\n return iteratee(accumulator, value, index, object);\n });\n return accumulator;\n }\n\n /**\n * Creates an array of the own enumerable property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\n function values(object) {\n return baseValues(object, keys(object));\n }\n\n /**\n * Creates an array of the own and inherited enumerable property values\n * of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.valuesIn(new Foo);\n * // => [1, 2, 3] (iteration order is not guaranteed)\n */\n function valuesIn(object) {\n return baseValues(object, keysIn(object));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Checks if `n` is between `start` and up to but not including, `end`. If\n * `end` is not specified it is set to `start` with `start` then set to `0`.\n *\n * @static\n * @memberOf _\n * @category Number\n * @param {number} n The number to check.\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `n` is in the range, else `false`.\n * @example\n *\n * _.inRange(3, 2, 4);\n * // => true\n *\n * _.inRange(4, 8);\n * // => true\n *\n * _.inRange(4, 2);\n * // => false\n *\n * _.inRange(2, 2);\n * // => false\n *\n * _.inRange(1.2, 2);\n * // => true\n *\n * _.inRange(5.2, 4);\n * // => false\n */\n function inRange(value, start, end) {\n start = +start || 0;\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = +end || 0;\n }\n return value >= nativeMin(start, end) && value < nativeMax(start, end);\n }\n\n /**\n * Produces a random number between `min` and `max` (inclusive). If only one\n * argument is provided a number between `0` and the given number is returned.\n * If `floating` is `true`, or either `min` or `max` are floats, a floating-point\n * number is returned instead of an integer.\n *\n * @static\n * @memberOf _\n * @category Number\n * @param {number} [min=0] The minimum possible value.\n * @param {number} [max=1] The maximum possible value.\n * @param {boolean} [floating] Specify returning a floating-point number.\n * @returns {number} Returns the random number.\n * @example\n *\n * _.random(0, 5);\n * // => an integer between 0 and 5\n *\n * _.random(5);\n * // => also an integer between 0 and 5\n *\n * _.random(5, true);\n * // => a floating-point number between 0 and 5\n *\n * _.random(1.2, 5.2);\n * // => a floating-point number between 1.2 and 5.2\n */\n function random(min, max, floating) {\n if (floating && isIterateeCall(min, max, floating)) {\n max = floating = undefined;\n }\n var noMin = min == null,\n noMax = max == null;\n\n if (floating == null) {\n if (noMax && typeof min == 'boolean') {\n floating = min;\n min = 1;\n }\n else if (typeof max == 'boolean') {\n floating = max;\n noMax = true;\n }\n }\n if (noMin && noMax) {\n max = 1;\n noMax = false;\n }\n min = +min || 0;\n if (noMax) {\n max = min;\n min = 0;\n } else {\n max = +max || 0;\n }\n if (floating || min % 1 || max % 1) {\n var rand = nativeRandom();\n return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max);\n }\n return baseRandom(min, max);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the camel cased string.\n * @example\n *\n * _.camelCase('Foo Bar');\n * // => 'fooBar'\n *\n * _.camelCase('--foo-bar');\n * // => 'fooBar'\n *\n * _.camelCase('__foo_bar__');\n * // => 'fooBar'\n */\n var camelCase = createCompounder(function(result, word, index) {\n word = word.toLowerCase();\n return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);\n });\n\n /**\n * Capitalizes the first character of `string`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('fred');\n * // => 'Fred'\n */\n function capitalize(string) {\n string = baseToString(string);\n return string && (string.charAt(0).toUpperCase() + string.slice(1));\n }\n\n /**\n * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\n function deburr(string) {\n string = baseToString(string);\n return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');\n }\n\n /**\n * Checks if `string` ends with the given target string.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to search.\n * @param {string} [target] The string to search for.\n * @param {number} [position=string.length] The position to search from.\n * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`.\n * @example\n *\n * _.endsWith('abc', 'c');\n * // => true\n *\n * _.endsWith('abc', 'b');\n * // => false\n *\n * _.endsWith('abc', 'b', 2);\n * // => true\n */\n function endsWith(string, target, position) {\n string = baseToString(string);\n target = (target + '');\n\n var length = string.length;\n position = position === undefined\n ? length\n : nativeMin(position < 0 ? 0 : (+position || 0), length);\n\n position -= target.length;\n return position >= 0 && string.indexOf(target, position) == position;\n }\n\n /**\n * Converts the characters \"&\", \"<\", \">\", '\"', \"'\", and \"\\`\", in `string` to\n * their corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional characters\n * use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value.\n * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * Backticks are escaped because in Internet Explorer < 9, they can break out\n * of attribute values or HTML comments. See [#59](https://html5sec.org/#59),\n * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and\n * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)\n * for more details.\n *\n * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)\n * to reduce XSS vectors.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, & pebbles'\n */\n function escape(string) {\n // Reset `lastIndex` because in IE < 9 `String#replace` does not.\n string = baseToString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n }\n\n /**\n * Escapes the `RegExp` special characters \"\\\", \"/\", \"^\", \"$\", \".\", \"|\", \"?\",\n * \"*\", \"+\", \"(\", \")\", \"[\", \"]\", \"{\" and \"}\" in `string`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escapeRegExp('[lodash](https://lodash.com/)');\n * // => '\\[lodash\\]\\(https:\\/\\/lodash\\.com\\/\\)'\n */\n function escapeRegExp(string) {\n string = baseToString(string);\n return (string && reHasRegExpChars.test(string))\n ? string.replace(reRegExpChars, escapeRegExpChar)\n : (string || '(?:)');\n }\n\n /**\n * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the kebab cased string.\n * @example\n *\n * _.kebabCase('Foo Bar');\n * // => 'foo-bar'\n *\n * _.kebabCase('fooBar');\n * // => 'foo-bar'\n *\n * _.kebabCase('__foo_bar__');\n * // => 'foo-bar'\n */\n var kebabCase = createCompounder(function(result, word, index) {\n return result + (index ? '-' : '') + word.toLowerCase();\n });\n\n /**\n * Pads `string` on the left and right sides if it's shorter than `length`.\n * Padding characters are truncated if they can't be evenly divided by `length`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.pad('abc', 8);\n * // => ' abc '\n *\n * _.pad('abc', 8, '_-');\n * // => '_-abc_-_'\n *\n * _.pad('abc', 3);\n * // => 'abc'\n */\n function pad(string, length, chars) {\n string = baseToString(string);\n length = +length;\n\n var strLength = string.length;\n if (strLength >= length || !nativeIsFinite(length)) {\n return string;\n }\n var mid = (length - strLength) / 2,\n leftLength = nativeFloor(mid),\n rightLength = nativeCeil(mid);\n\n chars = createPadding('', rightLength, chars);\n return chars.slice(0, leftLength) + string + chars;\n }\n\n /**\n * Pads `string` on the left side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padLeft('abc', 6);\n * // => ' abc'\n *\n * _.padLeft('abc', 6, '_-');\n * // => '_-_abc'\n *\n * _.padLeft('abc', 3);\n * // => 'abc'\n */\n var padLeft = createPadDir();\n\n /**\n * Pads `string` on the right side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padRight('abc', 6);\n * // => 'abc '\n *\n * _.padRight('abc', 6, '_-');\n * // => 'abc_-_'\n *\n * _.padRight('abc', 3);\n * // => 'abc'\n */\n var padRight = createPadDir(true);\n\n /**\n * Converts `string` to an integer of the specified radix. If `radix` is\n * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,\n * in which case a `radix` of `16` is used.\n *\n * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E)\n * of `parseInt`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} string The string to convert.\n * @param {number} [radix] The radix to interpret `value` by.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.parseInt('08');\n * // => 8\n *\n * _.map(['6', '08', '10'], _.parseInt);\n * // => [6, 8, 10]\n */\n function parseInt(string, radix, guard) {\n // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.\n // Chrome fails to trim leading whitespace characters.\n // See https://code.google.com/p/v8/issues/detail?id=3109 for more details.\n if (guard ? isIterateeCall(string, radix, guard) : radix == null) {\n radix = 0;\n } else if (radix) {\n radix = +radix;\n }\n string = trim(string);\n return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));\n }\n\n /**\n * Repeats the given string `n` times.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to repeat.\n * @param {number} [n=0] The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n * @example\n *\n * _.repeat('*', 3);\n * // => '***'\n *\n * _.repeat('abc', 2);\n * // => 'abcabc'\n *\n * _.repeat('abc', 0);\n * // => ''\n */\n function repeat(string, n) {\n var result = '';\n string = baseToString(string);\n n = +n;\n if (n < 1 || !string || !nativeIsFinite(n)) {\n return result;\n }\n // Leverage the exponentiation by squaring algorithm for a faster repeat.\n // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n do {\n if (n % 2) {\n result += string;\n }\n n = nativeFloor(n / 2);\n string += string;\n } while (n);\n\n return result;\n }\n\n /**\n * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the snake cased string.\n * @example\n *\n * _.snakeCase('Foo Bar');\n * // => 'foo_bar'\n *\n * _.snakeCase('fooBar');\n * // => 'foo_bar'\n *\n * _.snakeCase('--foo-bar');\n * // => 'foo_bar'\n */\n var snakeCase = createCompounder(function(result, word, index) {\n return result + (index ? '_' : '') + word.toLowerCase();\n });\n\n /**\n * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the start cased string.\n * @example\n *\n * _.startCase('--foo-bar');\n * // => 'Foo Bar'\n *\n * _.startCase('fooBar');\n * // => 'Foo Bar'\n *\n * _.startCase('__foo_bar__');\n * // => 'Foo Bar'\n */\n var startCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));\n });\n\n /**\n * Checks if `string` starts with the given target string.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to search.\n * @param {string} [target] The string to search for.\n * @param {number} [position=0] The position to search from.\n * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`.\n * @example\n *\n * _.startsWith('abc', 'a');\n * // => true\n *\n * _.startsWith('abc', 'b');\n * // => false\n *\n * _.startsWith('abc', 'b', 1);\n * // => true\n */\n function startsWith(string, target, position) {\n string = baseToString(string);\n position = position == null\n ? 0\n : nativeMin(position < 0 ? 0 : (+position || 0), string.length);\n\n return string.lastIndexOf(target, position) == position;\n }\n\n /**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is provided it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options] The options object.\n * @param {RegExp} [options.escape] The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate] The \"evaluate\" delimiter.\n * @param {Object} [options.imports] An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate] The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL] The sourceURL of the template's compiled source.\n * @param {string} [options.variable] The data object variable name.\n * @param- {Object} [otherOptions] Enables the legacy `options` param signature.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // using the \"interpolate\" delimiter to create a compiled template\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // using the HTML \"escape\" delimiter to escape data property values\n * var compiled = _.template('<%- value %>');\n * compiled({ 'value': '