function setDivMode(n){n==1?($(".dz-preview.dz-file-preview.dz-processing.dz-success.dz-complete").hide(),$(".dz-message.needsclick").show()):($(".dz-preview.dz-file-preview.dz-processing.dz-success.dz-complete").show(),$(".dz-message.needsclick").hide())}function validateUploadedFile(){var n=$("#hfMaxFileSize").val(),t,i,r;setDivMode(2);showFileSizeExceedErrorMessage(!1,n);t=tempFile;submitButtonState(tempFile);t.length!=0?(i=t[0].size,$(".dz-filename span").html(t[0].name),r=(i/1024).toFixed(2),$(".dz-size span strong").html(r+" KB"),i>n*1e6?showFileSizeExceedErrorMessage(!0,n):showFileSizeExceedErrorMessage(!1,n)):setDivMode(2)}function showFileSizeExceedErrorMessage(n){if(n){$(".field-validation-error").show();$(".field-validation-error").html($("#hfFileSizeExceedMessage").val());cnt.find('button[type="submit"]').addClass("btn-disabled");return}$("#CartUploadContentBlockValidator").val("1");cnt.find('button[type="submit"]').hasClass("btn-disabled")||cnt.find('button[type="submit"]').removeClass("btn-disabled")}function ManageUploadResponse(n,t,i){$("#partial-withredirect").hide();$("#partial-noredirect").hide();$("#success-complete").hide();$("#upload-error").hide();$("#upload-alert").hide();$("#no-file-msg").hide();$("#formdata-msg").hide();$("#"+n).show();$("#"+t).html(i)}function Init(){cnt=$(".form-holder-cart-upload");cnt.find("form").on("submit",onSubmit);submitButtonState(tempFile);$("#separator").change(function(){hideValidation()})}function UploadToCart(){if(window.FormData!==undefined)if(showImportingIndicator(),tempFile!=null){var n=new FormData;n.append(tempFile[0].name,tempFile[0]);n.append("separator",$("#separator").val());n.append("redirecttocart",$("#hfRedirectToCart").val());n.append("checkitemsonline",$("#hfCheckAvailabilityOnline").val());n.append("emptycart",$("#hfEmptyCart").val());n.append("__RequestVerificationToken",Sana.Utils.getAntiForgeryToken());$.ajax({url:"/CartUploadContentBlock/UploadToCart",type:"POST",contentType:!1,processData:!1,data:n,async:!0,success:function(n){if(n.redirectToCart){BasketSummary.onChanged(3);window.location=n.basketUrl}else if(n.success){BasketSummary.onChanged(3);n.partial?n.showBasketButton?ManageUploadResponse("partial-withredirect","partial-withredirect-message",n.msg):ManageUploadResponse("partial-noredirect","partial-noredirect-message",n.msg):ManageUploadResponse("success-complete","success-complete-message",n.msg);Popup.open(".cartSuccessPopup")}else showErrorMsg(n.msg);hideImportingIndicator()},error:function(n){showErrorMsg(n.msg);hideImportingIndicator()}})}else showErrorMsg($("#hfNoFileMessage").val()),hideImportingIndicator();else showErrorMsg($("#hfFormDataMessage").val())}function Navigation(n){var t=this;this.options=$.extend({activeClass:"selected"},n);this.getCurrentUrl=function(){return location.pathname};this.markCurrentNode=function(){var n=this.getIndex();typeof n=="number"&&$(t.options.root).eq(n).addClass(t.options.activeClass)};this.isCurrentNode=function(n){var t=n.find("> a");return t.length||(t=n.find("> div > a")),t.attr("href")===location.pathname};this.getIndex=function(){for(var f,i=function(n){var r,f,u,e;if(t.isCurrentNode(n))return!0;if(r=n.find(t.options.child),!r.length)return!1;for(f=!1,u=0;u<r.length;u++)if(e=i(r.eq(u)),e){f=!0;break}return f},r,u=$(t.options.root),n=0;n<u.length;n++)if(f=i(u.eq(n)),f){r=n;break}return r}}function QuickOrderViewModel(){var n=this,f=function(){$("#quickOrder .ddlb select").selectmenu("refresh")},e=function(n){this.id=n.Id;this.title=n.Title;this.url=n.DetailsUrl;this.unitsOfMeasure=$.map(n.UnitsOfMeasure,function(n){return{id:n.Id,title:n.Title,step:n.Step}});this.trackingData=n.ProductTrackingDataModel},i,t,u;n.componentGroups=[];n.quickOrderForm=ko.observable();n.request=ko.observable();n.isInputActivated=ko.observable(!1);n.productNotFound=ko.observable(!1);n.product=ko.observable();n.components=ko.observable();n.quantity=ko.observable();n.selectedUom=ko.observable();n.defaultUomTitle=ko.observable();n.quantityStep=ko.observable(1);n.unitOfMeasureAvailable=ko.computed(function(){var t=n.product();return t&&t.unitsOfMeasure&&t.unitsOfMeasure.length});n.request.subscribe(function(){n.productNotFound(!1)});n.typing=function(t,i){i.keyCode==13&&n.searchProduct()};n.validationMessagePattern=ko.observable();n.validationMessage=ko.computed(function(){var t=n.validationMessagePattern()||"";return t.replace(/\{0\}/g,n.quantityStep())});t=function(t){return n.unitOfMeasureAvailable()?(t=t.toUpperCase(),$.grep(n.product().unitsOfMeasure,function(n){return n.id.toUpperCase()==t})[0]):{id:t,title:"",step:1}};n.selectedUom.subscribe(function(i){if(i){var r=t(i).step;n.quantityStep(r);n.quantity(r);n.quickOrderForm().setQuantityStep(r)}});var o=function(t){var i=t.VariantComponents,r=t.Variants,u;n.componentGroups=i.length?$.map(i,function(n,t){return{options:$.map(i[t].Components,function(n){return{id:n.Id,title:n.Title}}),selected:n.Components[0].Id}}):r.length?[{options:$.map(r,function(n){return{id:n.Id,title:n.Title}}),selected:r[0].Id}]:[];u=$.map(n.componentGroups,function(n){return{options:ko.observableArray(n.options),selected:ko.observable(n.selected)}});n.components(u)},s=function(n){i=$.map(n.Variants,function(n){return{id:n.Id,components:n.Components}})},h=function(){for(var i=n.components(),t=0;t<i.length-1;t++)i[t].selected.subscribe(function(){r();f()},this)},r=function(){var s=function(n,t){for(var u,r,e,s,o=[],f=0;f<t.options.length;f++){for(u=i,r=0;r<n.length;r++)u=$.grep(u,function(t){return t.components[r].Value==n[r]});e=t.options[f];s=$.grep(u,function(t){return t.components[n.length].Value==e.id})[0];s&&o.push(e)}return o},r,t,u,f,e,o;if(n.componentGroups.length<=1)return!0;for(r=[],t=1;t<n.componentGroups.length;t++)u=n.components(),f=u[t-1].selected(),r.push(f),e=s(r,n.componentGroups[t]),o=u[t],o.options(e)},c=function(i){var f=new e(i),u;n.product(f);o(i);s(i);u=t(i.DefaultUnitOfMeasureId);n.selectedUom(u.id);n.quantity(u.step);n.defaultUomTitle(u.title);r();h()};n.searchProduct=function(){(n.product(null),n.request())&&(Sana.UI.LoadingIndicator.show(),$.post($("#quickOrder").attr("data-src"),{term:n.request()},function(t){if(Sana.UI.LoadingIndicator.hide(),!t){n.productNotFound(!0);return}c(t);Sana.UI.Selects.init("#quickOrder .ddlb select");$("#quickOrder .ui-autocomplete-input")._autocomplete("close");n.quickOrderForm().refreshValidation()}))};u=function(){var r={},f,o,e,t,u;for(r.productId=n.product().id,r.quantity=parseFloat(n.quantity()),r.unitOfMeasureId=n.selectedUom(),r.isPrepack=!1,f=n.components(),o=i,e=0;e<o.length;e++){if(t=o[e],t.components.length){for(u=0;u<f.length;u++)if(t.components[u].Value!==f[u].selected()){t=null;break}}else t.id!==f[0].selected()&&(t=null);if(t){r.variantId=t.id;break}}return r};n.addQuickOrderLine=function(n){if($(n).valid()){var t=u();$(QuickOrder).trigger("addQuickOrderLine",[t])}};n.afterLineAdded=function(){n.isInputActivated(!0);n.quantity(t(n.selectedUom()).step)}}function BasketViewModel(){var n=this;this.linesCount=ko.observable();this.linesCount.subscribe(function(){n.isEmpty(n.linesCount()==0)});this.isEmpty=ko.observable();this.isEmpty.subscribe(function(){$(".btn-quote").toggleClass("btn-disabled",n.isEmpty());$(".btn-checkout").toggleClass("btn-disabled",n.isEmpty());$(".hyp-update, .hyp-wishlist, .hyp-save, .hyp-clear").toggleClass("hyp-btn-disabled",n.isEmpty());$("#basketPage").toggleClass("basket-empty",n.isEmpty())});this.checkLines=function(){n.linesCount($(".gvi-basket tr.upper-row").length)};this.quickOrderLine=ko.observable(null);this.getDataToSent=function(t){var r=dataToSend=$.param(n.quickOrderLine()||[]),i=t.serialize();return i&&(dataToSend=r+"&"+i),dataToSend}}function OrderOverviewViewModel(){var n=this,t=$("#chbAgreeTerms").prop("checked");n.isChecked=ko.observable(t);n.showValidation=ko.observable(!1);n.isChecked.subscribe(function(){n.isChecked()&&n.showValidation(!1)});n.pay=function(t){return n.isChecked()?$(t).valid()?(Sana.UI.LoadingIndicator.show(),!0):!1:(n.showValidation(!0),!1)};n.openTerms=function(){Popup.open("#termsPopup")}}var tempFile,onSubmit,BasketSummary,Sana,Matrix,Menu,Popup,QuickOrder,NumericInput,VariantMatrixPopup,Zoom,OrderDetails,OrderOverview,ProductDetails,MyAccount,SubAccount,SubAccountList,StoreLocator;(function(){$.widget("ui._autocomplete",$.extend({},$.ui.autocomplete.prototype,{_renderItem:function(n,t){return $("<li>").append($("<a>").html(t.label)).appendTo(n)},_resizeMenu:function(){var n=this.menu.element;n.closest(".content").length>0&&$.ui.autocomplete.prototype._resizeMenu.call(this)}}))})();FontObject=function(){var n={custom:{families:["Pathway Gothic One","Open Sans:400,700,400italic"]},active:function(){$(document).trigger("webfontactive")},inactive:function(){$(document).trigger("webfontinactive")}},t=$(".custom-font").attr("href");return t&&(fontName=t.replace("//fonts.googleapis.com/css?family=",""),n.google={families:[fontName]}),n}();WebFont.load(FontObject);Sana=Sana||{};Sana.GoogleTagManager=function(){var n={},u,t;n.isAvaliable=function(){return!!window.dataLayer&&!!window.google_tag_manager};n.initCheckoutForm=function(t,i){var r=$("#checkoutForm");r.on("submit.track",function(u){if(!n.isAvaliable()){r.off("submit.track");return}var f=i(r);u.preventDefault();Sana.UI.LoadingIndicator.show();n.trackCheckoutOption(f,t,function(){r.off("submit.track");r.submit()})})};n.initMethodCheckoutForm=function(t){n.initCheckoutForm(t,function(n){return n.find('input[name="MethodId"]:checked').data("name")})};n.trackCheckoutOption=function(t,i,r){if(!n.isAvaliable()){r&&r();return}var u={event:"checkoutOption",ecommerce:{checkout_option:{actionField:{step:i,option:t}}}};r&&(u.eventCallback=r);dataLayer.push(u)};n.trackViewedPromotions=function(t){n.isAvaliable()&&($.isArray(t)||(t=[t]),t.length!==0)&&dataLayer.push({event:"promoViewed",ecommerce:{promoView:{promotions:t}}})};n.trackPromotionClick=function(t,i){if(n.isAvaliable()){var r={event:"promotionClick",ecommerce:{promoClick:{promotions:[t]}}};i&&(r.eventCallback=function(){document.location=i});dataLayer.push(r)}};var f=function(n){var t=n.parents(".touchcarousel"),f=t.find(".tc-paging-container").is(":visible");if(!f)return n;var i=t.data("touchCarousel"),r=i._itemsPerMove,e=i._currPageId,u=e*r,o=u+r;return n.slice(u,o)},i=function(n,i){var u=$(".product-tile:visible",n),e,r;u=f(u);e=$.map(u,function(n){return $(n).data("tracking-data")});r=[];$.each(e,function(n,t){if(t!=null){var i=$.grep(r,function(n){return n.id===t.id}).length===0;i&&r.push(t)}});t(r,i)},r=!1;return n.initProductImpressionTracking=function(t){n.isAvaliable()&&(r||($(function(){i($(document),t);u(t)}),r=!0))},u=function(n){var r=$(document),f=Paging.getTargetSelector(),u;r.on("pagingChange",f,function(t,r){var u=$(r.newHtml);i(u,n)});u="#lastViewedProductsTab > .touchcarousel";r.on("onAnimComplete",u,function(i,r){var u=r._currPageId,f=r.items[u],e=f.item.find(".product-tile").data("tracking-data");t([e],n)})},t=function(n,t){var i=$.grep(dataLayer,function(n){return n.event==="impression"}),r;(i.length>0&&(r=$.map(i,function(n){return n.ecommerce.impressions}),n=$.grep(n,function(n){return $.grep(r,function(t){return t.id===n.id}).length===0})),n.length!==0)&&dataLayer.push({event:"impression",ecommerce:{currencyCode:t,impressions:n}})},n.trackProductDetailsView=function(t){n.isAvaliable()&&dataLayer.push({event:"detail",ecommerce:{detail:{products:[t]}}})},n.trackProductClick=function(t){n.isAvaliable()&&t&&dataLayer.push({event:"productClick",ecommerce:{click:{products:[t]}}})},n.initProductClicks=function(){$(document).on("mouseup","[data-product-url]",function(t){var r=$(this),u=t.which,f=2,i,e;(u===1||u===f)&&(u!==f||r.attr("href"))&&(i=r.data("tracking-data"),i||(e=r.parents("[data-tracking-data]"),i=e.data("tracking-data")),n.trackProductClick(i))})},n.trackCheckoutProcess=function(t,i,r){n.isAvaliable()&&dataLayer.push({event:"checkout",ecommerce:{checkout:{actionField:i,products:t}},customerType:r})},n.trackPurchase=function(t,i,r){n.isAvaliable()&&dataLayer.push({event:"purchase",ecommerce:{purchase:{actionField:i,products:t}},customerType:r})},n.trackProductAddition=function(t,i,r,u){if(!n.isAvaliable()){u&&u();return}if($.isArray(t)||(t=[t]),t.length===0){u&&u();return}var f={event:"addToCart",ecommerce:{currencyCode:i?i:"EUR",add:{products:t}},customerType:r};u&&(f.eventCallback=u);dataLayer.push(f)},n.trackProductRemovals=function(t,i,r){if(!n.isAvaliable()){r&&r();return}if($.isArray(t)||(t=[t]),t.length===0){r&&r();return}var u={event:"removeFromCart",ecommerce:{remove:{products:t}},customerType:i};r&&(u.eventCallback=r);dataLayer.push(u)},n.updateAdditionAndRemovals=function(t,i){var f,e,u,o,r;if(!n.isAvaliable()||!t||!t.Items||!t.Items.length){i&&i();return}for(f=[],e=[],u=0,o=t.Items.length;u<o;u++)r=t.Items[u],r.quantity>0?f.push(r):r.quantity<0&&(r.quantity=-r.quantity,e.push(r));n.trackProductAddition(f,t.ActionField,t.CustomerType);n.trackProductRemovals(e,t.CustomerType,i)},n}();Sana=Sana||{};Sana.History=function(){return{setUrlParam:function(n,t){var i={},r,u;i[n]=t;r=$.extend(history.state,i);u=Sana.Utils.getQueryParam(n,t);history.replaceState(r,document.title,u)},pushUrlParamFromString:function(n,t,i){var r=Sana.Utils.getQueryVariable("page",t)||"",u=Sana.Utils.getQueryParam(n,r)||document.location.pathname;history.pushState(i,document.title,u)},backButton:function(n,t){$(document).on("click",n,function(){if(location.search.indexOf(t)!=-1)return history.back(),!1})},saveCurrentState:function(n){history.replaceState(n,document.title)},onPopstate:function(n){window.addEventListener("popstate",n)}}}();ko.bindingHandlers.attributeToObservable={init:function(n,t,i,r){var arguments=t(),u,f,e;for(u in arguments)f=arguments[u],e=$(n).attr(u),r[f](e)}};ko.bindingHandlers.form={init:function(n,t,i,r){var u=$(n),f;u.refreshValidation=function(){Sana.UI.refreshValidationFor(u)};u.setQuantityStep=function(n){!u.data("validator")||u.valid();u.find("input[data-step]")._spinner({step:n})};f=t();r[f](u)}};Print=function(){var n={};n.init=function(){$(document).on("click",".hyp-print-preview",i);var n=document.location.href;n.indexOf("print=1")!=-1&&($(".btn-print").on("click",function(){window.print();window.location.reload()}).prependTo(".site").show(),setTimeout(function(){u()}),r(),Zoom.init=$.noop,ProductDetails.lightboxImageSlider.init=$.noop,ProductDetails.imageControls.initSmallCarousel=$.noop,Sana.UI.StickyHeader=$.noop)};var t=function(){var n="",r=$(".ddlb-component select").map(function(){return $(this).val()}).get().join(),t,i;return r.length>0&&(n+="&v="+encodeURIComponent(r)),t=$(".ddlb-uom select"),t.length>0&&(n+="&unitOfMeasureId="+encodeURIComponent(t.val())),i=$(".ddlb-prepack-selector select"),i.length>0&&(n+="&pack="+encodeURIComponent(i.val())),n},i=function(){var n=document.location.href;n+=n.indexOf("?")!=-1?"&print=1":"?print=1";n+=t();window.open(n,"_blank")},r=function(){var n=document.getElementById("productPage");n!=null&&$("#variants, #prepacks").each(function(){var n=$(this).attr("id"),t=$('[href="#'+n+'"]').text();$("<h2/>",{text:t}).prependTo($(this))})},u=function(){var n=$(".ddlb-component, .ddlb-prepack-selector, .ddlb-uom");n.length?n.each(function(){var n=$(this);$("<label/>",{text:n.find("option:selected").text()}).appendTo(n.parent())}):$(".order-box").hide()};return n}();$(function(){Print.init()});window.matchMedia||(window.matchMedia=function(){"use strict";var t=window.styleMedia||window.media;if(!t){var n=document.createElement("style"),i=document.getElementsByTagName("script")[0],r=null;n.type="text/css";n.id="matchmediajs-test";i.parentNode.insertBefore(n,i);r="getComputedStyle"in window&&window.getComputedStyle(n,null)||n.currentStyle;t={matchMedium:function(t){var i="@media "+t+"{ #matchmediajs-test { width: 1px; } }";return n.styleSheet?n.styleSheet.cssText=i:n.textContent=i,r.width==="1px"}}}return function(n){return{matches:t.matchMedium(n||"all"),media:n||"all"}}}());Sana=Sana||{};Sana.Layout=function(){var n={touch:!1,retinaDisplay:!1,layout:!1,rules:{ALL:"",DESKTOP:"only screen and (min-width: 1024px)",TABLET:"only screen and (min-width: 640px) and (max-width: 1023px)",MOBILE:"only screen and (max-width: 639px)"},functions:{ALL:[],DESKTOP:[],TABLET:[],MOBILE:[]},isIE:!1,init:function(){var t=this,i=navigator.userAgent.toLowerCase();t.touch=this.isTouchDevice();"devicePixelRatio"in window&&window.devicePixelRatio>=1.9&&(t.retinaDisplay=!0);i.indexOf("msie")!=-1&&(t.isIE=!0);jQuery(document).ready(function(){t.callFuctions()});jQuery(window).resize(function(){n.isRule(t.layout)||t.callFuctions()})},addFunction:function(n,t){this.functions[t].push(n)},isRule:function(n){return window.matchMedia(this.rules[n]).matches?!0:!1},callFuctions:function(){for(var n=0,t=this.functions.ALL.length;n<t;n++)this.functions.ALL[n]();this.widthMedia()},widthMedia:function(){var i="",n,t,r;for(n in this.rules)i+=" ui-"+n.toLowerCase();jQuery("body").removeClass(i);for(n in this.rules)if(n!="ALL"&&window.matchMedia(this.rules[n]).matches)for(jQuery("body").addClass("ui-"+n.toLowerCase()),this.layout=n,t=0,r=this.functions[n].length;t<r;t++)this.functions[n][t]()},isTouchDevice:function(){return this.isIE?!1:("ontouchstart"in window)?(jQuery("body").addClass("ui-touch-device"),!0):!1}};return n}();Sana=Sana||{};Sana.UI=function(){var n={};return n.init=function(){Menu.init();n.StickyHeader();n.Search();Sana.Layout.addFunction(function(){n.footerPosition();setTimeout(function(){n.fixHeightOverflow();n.adaptLanguageAndLoginToMobile()})},"ALL");n.Inputs.init();n.Datepickers.init();n.Selects.init();n.Newsletter.init();n.ActionLinks.Login.init();n.Toggler.init(".accordion-header");Tabs.init();n.ActionLinks.LastViewed.init();n.NumberTextBox.init();n.responsiveImages.init();Sana.Layout.init();n.openZopim();n.switchRetailPrices()},n.switchRetailPrices=function(){$(".hyp-retail-price").on("click",function(){var t=$(this).attr("data-src"),i=$(this).attr("data-retail-status"),n=!1;$("#toggleRetail").text()==i&&(n=!0);$.ajax({url:t,type:"POST",dataType:"json",cache:!1,data:{status:n},success:function(){window.location.reload()}})})},n.responsiveImages={_instance:null,init:function(){var i=function(){var t=$("img[data-src], [data-bg-src]");t.resImages({attribute:"data-original"});n.responsiveImages._instance=t.lazy({attribute:"data-original",threshold:1,bind:"event",effect:"fadeIn",effectTime:300,chainable:!1,autoDestroy:!1,afterLoad:function(n){$(n).trigger("lazy_afterLoad")},onError:function(n){n.off(".lazy");n.attr("src",n.attr("data-original"))}})},r=function(t){var i=$("img[data-src], [data-bg-src]",t);i.resImages({attribute:"data-original"});n.responsiveImages._instance&&(n.responsiveImages._instance.addItems(i),n.responsiveImages._instance.update())},u=function(){var r=$("img[data-src], [data-bg-src]"),i=r.filter(function(){return $(this).data("handled")==!0}),t;i.length&&(i.data("resImage").settings.attribute="src",i.resImages("refresh"));t=$(n.responsiveImages._instance.getItems());t.length&&(t.data("resImage").settings.attribute="data-original",t.resImages("refresh"))},t=!0;Sana.Layout.addFunction(Sana.Utils.debounce(function(){if(t){t=!1;return}u()},300),"ALL");$(document).on("htmlUpdated",function(n){r(n.target)});i()},refresh:function(){n.responsiveImages._instance&&n.responsiveImages._instance.update()}},n.footerPosition=function(){var n=$(window).height()-$(".content").offset().top-$("footer").outerHeight();$(".content").css({"min-height":n})},n.LoadingIndicator={_selector:"#loadingIndicator",_timeout:null,show:function(){$(this._selector).show()},hide:function(){clearTimeout(this._timeout);this._timeout=null;$(this._selector).hide()},showAfter:function(n){var t=this;t._timeout=setTimeout(function(){t._timeout!=null&&(t._timeout=null,t.show())},n)}},n.Tooltips={init:function(n){$(n).tooltip({position:{my:"left-25% bottom-25"},content:function(){var n=[],r=$(this).attr("title")||"",t,i;return n=r.split("::"),t=n[0]?"<h4>"+n[0]+"<\/h4>":"",i=n[1]||"",$("<a>").html(t+i).html()}})}},n.Inputs={init:function(){Sana.Utils.noPlaceholder()&&$("#newsletterEmail, #searchbox").each(function(){var n=$(this);n.watermark(n.attr("placeholder"),{className:"water-mark",useNative:!1})});$(document).on("focus blur",".tbx input, .tar textarea",function(n){$(this).parent().toggleClass("focused",n.type=="focusin")})}},n.Autocomplete={_extended:!1,init:function(t){n.Autocomplete._extended||n.Autocomplete._extend();var i=$(t.options.selector);i.each(function(n,i){var r=$(i);r._autocomplete({source:function(n,i){$.ajax({url:r.attr("data-src")+"?term="+r.val(),type:"GET",success:function(n){i($.map(n,function(n){return t.mapping(n,r.val())}))}})},select:function(n,i){t.onItemSelect(n,i)},minLength:t.options.minLength||1,delay:t.options.delay||300})})},_extend:function(){$.widget("ui._autocomplete",$.extend({},$.ui.autocomplete.prototype,{_renderItem:function(n,t){return $("<li>").append($("<a>").html(t.label)).appendTo(n)}}));$.ui._autocomplete.defaults=$.extend({},$.ui.autocomplete.defaults);n.Autocomplete._extended=!0}},n.Search=function(){n.Autocomplete.init({options:{selector:".tbx-main-search input",minLength:2,delay:100},mapping:function(n,t){var r=$("<span>",{"class":"suggest-img"}).append($("<img>",{src:n.ImageUrl,alt:n.Title})),u=$("<span>",{"class":"suggest-text"}).append($("<span>",{"class":"suggest-title-id"}).html(Sana.Utils.highlightWords(n.Title+" - "+n.Id,t))).append($("<span>",{"class":"font-lighter font-smaller"}).text(n.Category||"")),i=$("<span>",{"class":"suggest-item","data-url":n.Url,"data-tracking-data":JSON.stringify(n.ProductTrackingDataModel)});return i.append(r),i.append(u),{label:i,value:n.Title}},onItemSelect:function(n,t){var i,r;n.preventDefault();Sana.UI.LoadingIndicator.show();i=t.item.label.attr("data-tracking-data");i&&(r=JSON.parse(i),Sana.GoogleTagManager.trackProductClick(r));document.location.href=t.item.label.attr("data-url")}})},n.Datepickers={init:function(){$(document).on("click",".tbx-date",function(){$("input",this).focus()});$(".datepicker").each(function(){var n=$(this),t=$.extend({showOn:"both"},n.data("datepicker-options"),n.data("datepicker-extend"));n.datepicker(t);n.next().attr("tabindex","-1")})}},n.Selects={cssSelector:".ddlb select",init:function(t){var i;i=t?typeof t=="string"?$(t):$(t).find(n.Selects.cssSelector):$(n.Selects.cssSelector);i.each(function(n,t){var i=$(t);i.selectmenu({width:"100%",appendTo:i.parent(".ddlb"),change:function(){i.change()},select:function(){i.click()}})})}},n.StickyHeader=function(){var n=$("header"),t=!1,i=n.height(),r=function(n){n!=0&&(n=i);$(".site").css("padding-top",n)},u=function(){i=n.height()},e=function(i){t||(i&&r(),$(".middle-header .basket").appendTo(".top-header .top-action"),n.addClass("sticky-mode animate"),t=!0)},f=function(){t&&(r(0),$(".top-header .basket").appendTo(".middle-header"),n.removeClass("sticky-mode animate"),t=!1)},o=function(){var n=$(window).scrollTop()>i;n?e(!0):f()};Sana.Layout.addFunction(function(){$(window).on("scroll.ribbon",Sana.Utils.throttle(o,300));f();u();$(".middle-header .nav-opener-wrapper").prependTo(".bottom-header > .center")},"DESKTOP");Sana.Layout.addFunction(function(){$(window).off("scroll.ribbon");e();u();r();$(".middle-header .nav-opener-wrapper").prependTo(".bottom-header > .center")},"TABLET");Sana.Layout.addFunction(function(){$(window).off("scroll.ribbon");f();$(".bottom-header > .center .nav-opener-wrapper").prependTo(".middle-header")},"MOBILE");$(document).on("webfontactive webfontinactive",function(){u()})},n.fixHeightOverflow=function(){var n=$(window).height()-75;Sana.Layout.layout=="MOBILE"&&(n="");$(".basket-summary").css("max-height",n);$(".ui-autocomplete").css("max-height",n);$(".language.top-dropdown .summary").css("max-height",n)},n.adaptLanguageAndLoginToMobile=function(){var n=".top-header .language .opener, .top-header .login .opener";if($(document).off("._toggler",n),Sana.Layout.layout==="MOBILE")$(document).on("click._toggler",n,function(){var n=$(this);n.next().stop(!0,!0).slideToggle(200,function(){$(this).removeAttr("style");n.toggleClass("collapsed expanded")})})},n.scrollToNode=function(n,t){var i=$(n);if(i.length){var r=i.offset().top,u=t||0,f="WebkitAppearance"in document.documentElement.style;$(f?"body":"html").animate({scrollTop:r-60-u},500)}},n.priceStyle=function(n){var i=function(n){var t=$(n).text().substr(-3,1);return t.indexOf(",")!=-1||t.indexOf(".")!=-1},t=$(n).find(".lbl-price");t.length&&i(t[0])&&t.each(function(n,t){var i=$(t).text(),r=i.substring(0,i.length-2)+i.substr(-2).sup();$(t).html(r)})},n.tabsSliderHorizontal={selector:".tabs-horizontal",init:function(){var t=$(this.selector).find("li").length;if(t<2){$(".opacity-left, .opacity-right").hide();return}$(".btn-prev").on("click",function(){var t=n.tabsSliderHorizontal.getCurrent();n.tabsSliderHorizontal.selectTab(t.index-1)});$(".btn-next").on("click",function(){var i=n.tabsSliderHorizontal.getCurrent(),r=0;t-i.index>1&&(r=i.index+1);n.tabsSliderHorizontal.selectTab(r)});$(this.selector).find("li a").on("click",function(){var t=$(this).parent();n.tabsSliderHorizontal.scrollTo({width:t.width(),left:t.offset().left})})},getCurrent:function(){var n=$(this.selector).find(".ui-tabs-active");return{width:n.width(),index:n.index(),left:n.offset().left}},scrollTo:function(n){var t=$(this.selector).find(".ui-tabs-nav"),i,r;t.stop(!0);i=($(".related-info").width()-n.width)/2;r=n.left-$(this.selector).find(".ui-tabs-nav").offset().left-i;t.animate({left:-r+"px"},500)},selectTab:function(t){$lnk=$(this.selector).find("li").eq(t).find("a");Tabs.select($lnk);var i=n.tabsSliderHorizontal.getCurrent();n.tabsSliderHorizontal.scrollTo(i)}},n.Sorting={selector:".ddlb-sorting select",originalValue:null,newValue:null,init:function(){n.Sorting.originalValue=$(this.selector).val();$(this.selector).change(function(){n.Sorting.newValue=$(this).val();$.isFunction(n.Sorting.onBeforeChange)?(Sana.UI.Sorting.undo(),$.when(n.Sorting.onBeforeChange()).then(function(){n.Sorting.resolve()})):n.Sorting.resolve()})},resolve:function(){document.location.href=n.Sorting.newValue},undo:function(){$(n.Sorting.selector).val(n.Sorting.originalValue);$(n.Sorting.selector).selectmenu("refresh")}},n.SelectionLost={selector:"#selectionLostPopup",open:function(n){var t=$.Deferred();Popup.open("#selectionLostPopup");$(this.selector).find(".btn-yes").focus();$(this.selector).find(".btn-yes").off("click.selectionLost").on("click.selectionLost",function(){$.when(n.successCallback()).then(function(){t.resolve()});Popup.close("#selectionLostPopup")});$(this.selector).find(".btn-no").off("click.selectionLost").on("click.selectionLost",function(){t.resolve()});return t}},n.Facets={selector:".facets",url:null,init:function(){var t=$(this.selector);if(t.length){$(".list-facets",t).each(function(){var n=$(this),t=n.next(".hyp-toggle");if(n.find("li").length<=5)return t.hide(),!0;t.on("click",function(){n.toggleClass("limited unlimited")})});n.Toggler.init(".facet .hdr");$(this.selector).find("ul li a").on("click",function(){n.Facets.url=$(this).attr("href");var t=$(this).find("[type=checkbox]");return t&&t.prop("checked")&&(n.Facets.url=t.attr("data-uncheck")),$.isFunction(n.Facets.onBeforeChange)?$.when(n.Facets.onBeforeChange()).then(function(){n.Facets.resolve()}):n.Facets.resolve(),!1})}},resolve:function(){window.location.href=n.Facets.url}},n.Newsletter={selector:".newsletter",init:function(){$(this.selector).find("form").submit(function(t){var i=$(n.Newsletter.selector).find("#newsletterEmail").val();i==""&&(t.preventDefault(),window.location.href=$(this).attr("action"))})}},n.ActionLinks={AddToWishlist:{selector:"#addToWishlist",init:function(){$(document).on("click",n.ActionLinks.AddToWishlist.selector,function(){var t=$(this),i=t.attr("data-url"),r={productId:t.attr("data-product"),unitOfMeasureId:t.attr("data-uom"),variantId:$("#product-form [name=variantId]").val(),__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()};n.LoadingIndicator.show();$.post(i,r,function(t){n.LoadingIndicator.hide();var i=$("#addToWishlistPopup").html(t),u=i.find("button"),r=null;u.click(function(){Popup.close(i)});Popup.open(i,{afterClose:function(){i.html("");r!=null&&r.focus()}});setTimeout(function(){r=document.activeElement;u.focus()},10)})})}},AddToMediaDatabase:{selector:"#addToMediaDatabase",init:function(){$(document).on("click",n.ActionLinks.AddToMediaDatabase.selector,function(){var t=$(this),i=t.attr("data-url"),r={productId:t.attr("data-product"),variantId:$("#product-form [name=variantId]").val(),__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()};n.LoadingIndicator.show();$.post(i,r,function(t){n.LoadingIndicator.hide();var i=$("#addToMediaDatabasePopup").html(t),u=i.find("button"),r=null;u.click(function(){Popup.close(i)});Popup.open(i,{afterClose:function(){i.html("");r!=null&&r.focus()}});setTimeout(function(){r=document.activeElement;u.focus()},10)})})}},Login:{init:function(){$(document).on("click","#unimpersonateLink, #logoutLink, #orderResultLogoutLink",function(t){t.preventDefault();n.LoadingIndicator.show();var i=$(this).attr("href");$.post(i,null,function(){location.reload()})})}},LastViewed:{init:function(){$(document).on("click","#clearLastViewedProducts",function(n){n.preventDefault();var t=$(this),i=t.attr("href");$.post(i,function(){var n=t.attr("data-src");n!=null?location=n:t.parents(".last-viewed:first").remove()})})}}},n.Toggler={init:function(n){$(document).off(".toggler",n);$(document).on("click.toggler",n,function(){var n=$(this);n.next().stop(!0,!0).slideToggle(200,function(){n.toggleClass("collapsed expanded")})});$(document).on("mouseenter.toggler mouseleave.toggler",n,function(){$(this).find(".btn").toggleClass("hover")})}},n.NumberTextBox={init:function(){$(document).on("keypress","input.integer",Sana.InputFilter.integer);$(document).on("keypress","input.positive-integer",Sana.InputFilter.positiveInteger);$(document).on("keypress","input.decimal",Sana.InputFilter.decimal);$(document).on("keypress","input.positive-decimal",Sana.InputFilter.positiveDecimal)}},n.ActionButtons={init:function(){Sana.Layout.addFunction(n.ActionButtons.moveActionsBottom,"MOBILE");Sana.Layout.addFunction(n.ActionButtons.moveActionsTop,"TABLET");Sana.Layout.addFunction(n.ActionButtons.moveActionsTop,"DESKTOP")},moveActionsBottom:function(){var n=$(".col-info .action-links");n.each(function(n,t){var i=$(t).parents("tr").find(".col-total");$(t).prependTo(i)})},moveActionsTop:function(){var n=$(".col-total .action-links");n.each(function(n,t){var i=$(t).parents("tr"),r=i.hasClass("upper-row")?".col-info":".vertical-line",u=i.find(r);$(t).appendTo(u)})},refresh:function(){Sana.Layout.layout=="MOBILE"&&n.ActionButtons.moveActionsBottom()}},n.initActionButtonsPosition=function(){function t(){var n=$(".col-info .action-links");n.each(function(n,t){var i=$(t).parents("tr").find(".col-total");$(t).prependTo(i)})}function n(){var n=$(".col-total .action-links");n.each(function(n,t){var i=$(t).parents("tr"),r=i.hasClass("upper-row")?".col-info":".vertical-line",u=i.find(r);$(t).appendTo(u)})}Sana.Layout.addFunction(t,"MOBILE");Sana.Layout.addFunction(n,"TABLET");Sana.Layout.addFunction(n,"DESKTOP")},n.validateForms=function(n){var t=!0;return n.each(function(n,i){if(!$(i).valid())return t=!1,!1}),t},n.setValidationFor=function(n){$.validator.unobtrusive.parse(n)},n.refreshValidationFor=function(n){n&&($(n).removeData("validator"),$(n).removeData("unobtrusiveValidation"),$.validator.unobtrusive.parse(n))},n.openZopim=function(){var t=n.getSelectedLanguage();window.$zopim||function(n,t){var i=$zopim=function(n){i._.push(n)},r=i.s=n.createElement(t),u=n.getElementsByTagName(t)[0];i.set=function(n){i.set._.push(n)};i._=[];i.set._=[];r.async=!0;r.setAttribute("charset","utf-8");r.src="//v2.zopim.com/?3w4kGEAhef9mTXO7dDMwCQGeGkOtdGty";i.t=+new Date;r.type="text/javascript";u.parentNode.insertBefore(r,u)}(document,"script");$zopim(function(){$zopim.livechat.setLanguage(t)})},n.getSelectedLanguage=function(){var n;return $.ajax({cache:!1,type:"Post",url:"/Content/GetCurrentLanguageId",data:{},async:!1,success:function(t){n=t},error:function(){n="en-Us"}}),n},n}();$(function(){$("html").removeClass("no-js");Sana.UI.init()});Sana=Sana||{};Sana.Urls=function(){var n=null,t=function(){if(n==null){var t=document.getElementsByTagName("body")[0];n={Root:t.getAttribute("data-url-root"),Home:t.getAttribute("data-url-home")}}return n},i={Root:function(){return t().Root},Home:function(){return t().Home},RedirectBack:function(){var n=Sana.Utils.getQueryVariable("returnurl");n&&n.length!=0||(n=i.Home());window.location.href=n}};return i}();Sana=Sana||{};Sana.Utils=function(){var n={};return n.replaceElements=function(n){if(typeof n=="string"){var t=document.createElement("div");t.innerHTML=n;n=$(t.childNodes)}n.each(function(){var n,t;if(this.tagName!=undefined){if(n="#"+this.id,n=="#"){if(this.className=="")return;n=this.tagName+"."+this.className.split(" ").join(".")}t=$(n).html(this.innerHTML);$.validator.unobtrusive.parse(t)}})},n.isMultiple=function(n,t){if(n===0)return!1;var i=Math.pow(10,10),r=Math.round(n/t*i)/i;return r%1==0},n.roundQuantity=function(n){return Math.round(n*1e4)/1e4},n.getQueryVariable=function(n,t){var r,u,i,f;if(t=t||window.location.search,r=t.split("?")[1],r)for(u=r.split("&"),i=0;i<u.length;i++)if(f=u[i].split("="),f[0]==n)return decodeURIComponent(f[1])},n.removeQueryParam=function(n,t){if(!t)return"";var i=new RegExp("[?&]"+n+"=[^&#]+");return t=t.replace(i,""),t.length&&(t="?"+t.substring(1)),t},n.getQueryParam=function(t,i){var f=new RegExp(t+"=[^&#]+"),r=location.search,u=t+"="+i;return i?(r?r.search(f)==-1?r+="&"+u:r=r.replace(f,u):r="?"+u,r):n.removeQueryParam(t,r)},n.debounce=function(n,t,i){var r;return function(){var u=this,f=arguments;clearTimeout(r);r=setTimeout(function(){r=null;i||n.apply(u,f)},t);i&&!r&&n.apply(u,f)}},n.throttle=function(n,t,i){var r,f,u;return function(){f=arguments;u=!0;i=i||this;r||function(){u?(n.apply(i,f),u=!1,r=setTimeout(arguments.callee,t)):r=null}()}},n.noPlaceholder=function(){return document.createElement("input").placeholder==undefined},RegExp.escape=function(n){return n.replace(/[.*+?|()\[\]{}\\$^]/g,"\\$&")},n.highlightWords=function(n,t){var i=new RegExp("("+RegExp.escape(t)+")","gi");return n.replace(i,function(n){var t=$('<span class="highlight"><\/span>');return t.text(n),t[0].outerHTML})},n.getScrollbarSize=function(){var t=0,n=document.createElement("div");return n.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(n),t=n.offsetWidth-n.clientWidth,document.body.removeChild(n),t},n.guid=function(){function n(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()},n.getAntiForgeryToken=function(){return $('input[name="__RequestVerificationToken"]:first').val()},n.intersect=function(n,t){return n.filter(function(n){return t.indexOf(n)!==-1})},n.toLowerCaseArray=function(n){return n.map(function(n){return n.toLowerCase()})},n.indexOfMax=function(n){var i,r,t;if(n.length===0)return-1;for(i=n[0],r=0,t=1;t<n.length;t++)n[t]>i&&(r=t,i=n[t]);return r},n.indecesOfMax=function(n){var i,r,t;if(n.length===0)return-1;for(i=n[0],r=[0],t=1;t<n.length;t++)n[t]>i?(r=[t],i=n[t]):n[t]===i&&r.push(t);return r},n.groupBy=function(n,t){for(var f,u,i={},r=0;r<n.length;r++)i[t(n[r])]||(i[t(n[r])]=[]),i[t(n[r])].push(n[r]);f=[];for(u in i)i.hasOwnProperty(u)&&f.push({key:u,value:i[u]});return f},n}();tempFile=null;onSubmit=function(n){n.preventDefault();UploadToCart()};var submitButtonState=function(n){var t=cnt.find('button[type="submit"]');if(t.addClass("btn-disabled"),t.prop("disabled",!0),n!=null&&n.length>0){if(n[0].name.toLowerCase().split(".").pop()=="csv"){t.removeClass("btn-disabled");t.prop("disabled",!1);return}showErrorMsg($("#hfInvalidFileType").val())}},showErrorMsg=function(n){$(".field-validation-error").show();$(".field-validation-error").html(n)},showImportingIndicator=function(){$("#importingIndicator").show()},hideImportingIndicator=function(){$("#importingIndicator").hide()},hideValidation=function(){$(".field-validation-error").html("");$(".field-validation-error").hide()},dropzoneInit=function(){$(".dropzone").click(function(){$(this).find('input[type="file"]').click()});$(".dropzone input").click(function(n){n.stopPropagation()});$(".dropzone").on("dragenter",function(n){n.preventDefault();$(this).css("background","#BBD5B8")});$(".dropzone").on("dragover",function(n){n.preventDefault();n.stopPropagation()});$(".dropzone").on("drop",function(n){try{n.preventDefault();$(this).css("background","#daeeff");var t=n.dataTransfer||n.originalEvent&&n.originalEvent.dataTransfer,i=n.target.files||t&&t.files;console.log(t.files[0]);tempFile=i;$("input[type='file']").attr("files",i);console.log($("input[type='file']").prop("files"));validateUploadedFile()}catch(n){console.log(n.message)}});$('input[type="file"]').change(function(){var t,i,n;hideValidation();t=$("#hfMaxFileSize").val();setDivMode(2);showFileSizeExceedErrorMessage(!1,t);i=$(this).get(0);n=i.files;n.length!=0?(tempFile=n,validateUploadedFile()):setDivMode(2)})};$(document).ready(function(){Init();dropzoneInit();setDivMode(1)}),function(n){"use strict";var t={item:3,height:0,autoWidth:!1,slideMove:1,slideMargin:10,addClass:"",mode:"slide",useCSS:!0,cssEasing:"ease",easing:"linear",speed:400,auto:!1,pauseOnHover:!1,loop:!1,slideEndAnimation:!0,pause:2e3,keyPress:!1,controls:!0,prevHtml:"",nextHtml:"",rtl:!1,adaptiveHeight:!1,vertical:!1,verticalHeight:500,vThumbWidth:100,thumbItem:10,pager:!0,galleryMargin:5,gallery:!1,thumbMargin:5,currentPagerPosition:"middle",enableTouch:!0,enableDrag:!0,freeMove:!0,swipeThreshold:40,pagerClass:"",responsive:[],onBeforeStart:function(){},onSliderLoad:function(){},onBeforeSlide:function(){},onAfterSlide:function(){},onBeforeNextSlide:function(){},onBeforePrevSlide:function(){},onRefresh:function(){}};n.fn.lightSlider=function(i){if(this.length===0)return this;if(this.length>1)return this.each(function(){n(this).lightSlider(i)}),this;var a={},r=n.extend(!0,{},t,i),p={},u=this;a.$el=this;r.mode==="fade"&&(r.vertical=!1);var h=u.children(),g=n(window).width(),ut=null,b=null,w=0,c=0,nt=!1,o=0,f="",e=0,tt=r.vertical===!0?"height":"width",it=r.vertical===!0?"margin-bottom":"margin-right",l=0,d=0,y=0,k=0,v=null,rt="ontouchstart"in document.documentElement,s={};s.chbreakpoint=function(){var f,i,t,u;if(g=n(window).width(),r.responsive.length){if(r.autoWidth===!1&&(f=r.item),g<r.responsive[0].breakpoint)for(i=0;i<r.responsive.length;i++)g<r.responsive[i].breakpoint&&(ut=r.responsive[i].breakpoint,b=r.responsive[i]);if(typeof b!="undefined"&&b!==null)for(t in b.settings)b.settings.hasOwnProperty(t)&&((typeof p[t]=="undefined"||p[t]===null)&&(p[t]=r[t]),r[t]=b.settings[t]);if(!n.isEmptyObject(p)&&g>r.responsive[0].breakpoint)for(u in p)p.hasOwnProperty(u)&&(r[u]=p[u]);r.autoWidth===!1&&l>0&&y>0&&f!==r.item&&(e=Math.round(l/((y+r.slideMargin)*r.slideMove)))}};s.calSW=function(){r.autoWidth===!1&&(y=(o-(r.item*r.slideMargin-r.slideMargin))/r.item)};s.calWidth=function(n){var i=n===!0?f.find(".lslide").length:h.length,t;if(r.autoWidth===!1)c=i*(y+r.slideMargin);else for(c=0,t=0;t<i;t++)c+=parseInt(h.eq(t).width())+r.slideMargin;return c};a={doCss:function(){var n=function(){for(var t=["transition","MozTransition","WebkitTransition","OTransition","msTransition","KhtmlTransition"],i=document.documentElement,n=0;n<t.length;n++)if(t[n]in i.style)return!0};return r.useCSS&&n()?!0:!1},keyPress:function(){if(r.keyPress)n(document).on("keyup.lightslider",function(t){n(":focus").is("input, textarea")||(t.preventDefault?t.preventDefault():t.returnValue=!1,t.keyCode===37?u.goToPrevSlide():t.keyCode===39&&u.goToNextSlide())})},controls:function(){if(r.controls){u.after('<div class="lSAction"><a class="lSPrev">'+r.prevHtml+'<\/a><a class="lSNext">'+r.nextHtml+"<\/a><\/div>");r.autoWidth?s.calWidth(!1)<o&&f.find(".lSAction").hide():w<=r.item&&f.find(".lSAction").hide();f.find(".lSAction a").on("click",function(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,n(this).attr("class")==="lSPrev"?u.goToPrevSlide():u.goToNextSlide(),!1})}},initialStyle:function(){var n=this;r.mode==="fade"&&(r.autoWidth=!1,r.slideEndAnimation=!1);r.auto&&(r.slideEndAnimation=!1);r.autoWidth&&(r.slideMove=1,r.item=1);r.loop&&(r.slideMove=1,r.freeMove=!1);r.onBeforeStart.call(this,u);s.chbreakpoint();u.addClass("lightSlider").wrap('<div class="lSSlideOuter '+r.addClass+'"><div class="lSSlideWrapper"><\/div><\/div>');f=u.parent(".lSSlideWrapper");r.rtl===!0&&f.parent().addClass("lSrtl");r.vertical?(f.parent().addClass("vertical"),o=r.verticalHeight,f.css("height",o+"px")):(o=u.outerWidth(),r.height>0&&f.find("img").not(".nav").css("height",r.height+"px"));h.addClass("lslide");r.loop===!0&&r.mode==="slide"&&(s.calSW(),s.clone=function(){var v,y,i,t,f,c,l,a;if(s.calWidth(!0)>o){for(v=0,y=0,i=0;i<h.length;i++)if(v+=parseInt(u.find(".lslide").eq(i).width())+r.slideMargin,y++,v>=o+r.slideMargin)break;if(t=r.autoWidth===!0?y:r.item,t<u.find(".clone.left").length)for(f=0;f<u.find(".clone.left").length-t;f++)h.eq(f).remove();if(t<u.find(".clone.right").length)for(c=h.length-1;c>h.length-1-u.find(".clone.right").length;c--)e--,h.eq(c).remove();for(l=u.find(".clone.right").length;l<t;l++)u.find(".lslide").eq(l).clone().removeClass("lslide").addClass("clone right").appendTo(u),e++;for(a=u.find(".lslide").length-u.find(".clone.left").length;a>u.find(".lslide").length-t;a--)u.find(".lslide").eq(a-1).clone().removeClass("lslide").addClass("clone left").prependTo(u);h=u.children()}else h.hasClass("clone")&&(u.find(".clone").remove(),n.move(u,0))},s.clone());s.sSW=function(){w=h.length;r.rtl===!0&&r.vertical===!1&&(it="margin-left");r.autoWidth===!1&&h.css(tt,y+"px");h.css(it,r.slideMargin+"px");c=s.calWidth(!1);u.css(tt,c+"px");r.loop===!0&&r.mode==="slide"&&nt===!1&&(e=u.find(".clone.left").length)};s.calL=function(){h=u.children();w=h.length};this.doCss()&&f.addClass("usingCss");s.calL();r.mode==="slide"?(s.calSW(),s.sSW(),r.loop===!0&&(l=n.slideValue(),this.move(u,l)),r.vertical===!1&&this.setHeight(u,!1)):(this.setHeight(u,!0),u.addClass("lSFade"),this.doCss()||(h.fadeOut(0),h.eq(e).fadeIn(0)));r.loop===!0&&r.mode==="slide"?h.eq(e).addClass("active"):h.first().addClass("active")},pager:function(){var i=this,n,t;s.createPager=function(){var p,a,t,s;k=(o-(r.thumbItem*r.thumbMargin-r.thumbMargin))/r.thumbItem;for(var v=f.find(".lslide"),w=f.find(".lslide").length,n=0,h="",l=0,n=0;n<w;n++)if(r.mode==="slide"&&(r.autoWidth?l+=(parseInt(v.eq(n).width())+r.slideMargin)*r.slideMove:l=n*(y+r.slideMargin)*r.slideMove),p=v.eq(n*r.slideMove).attr("data-thumb"),h+=r.gallery===!0?'<li style="width:100%;'+tt+":"+k+"px;"+it+":"+r.thumbMargin+'px"><a href="#"><img src="'+p+'" /><\/a><\/li>':'<li><a href="#">'+(n+1)+"<\/a><\/li>",r.mode==="slide"&&l>=c-o-r.slideMargin){n=n+1;a=2;r.autoWidth&&(h+='<li><a href="#">'+(n+1)+"<\/a><\/li>",a=1);n<a?(h=null,f.parent().addClass("noPager")):f.parent().removeClass("noPager");break}t=f.parent();t.find(".lSPager"+r.pagerClass).html(h);r.gallery===!0&&(r.vertical===!0&&t.find(".lSPager"+r.pagerClass).css("width",r.vThumbWidth+"px"),d=n*(r.thumbMargin+k)+.5,t.find(".lSPager"+r.pagerClass).css({property:d+"px","transition-duration":r.speed+"ms"}),r.vertical===!0&&f.parent().css("padding-right",r.vThumbWidth+r.galleryMargin+"px"),t.find(".lSPager"+r.pagerClass).css(tt,d+"px"));s=t.find(".lSPager"+r.pagerClass).find("li");s.first().addClass("active");s.on("click",function(){return e=r.loop===!0&&r.mode==="slide"?e+(s.index(this)-t.find(".lSPager"+r.pagerClass).find("li.active").index()):s.index(this),u.mode(!1),r.gallery===!0&&i.slideThumb(),!1})};r.pager&&(n="lSpg",r.gallery&&(n="lSGallery"),f.after('<ul class="lSPager'+r.pagerClass+" "+n+'"><\/ul>'),t=r.vertical?"margin-left":"margin-top",f.parent().find(".lSPager"+r.pagerClass).css(t,r.galleryMargin+"px"),s.createPager());setTimeout(function(){s.init()},0)},setHeight:function(n,t){var i=null,f=this,u;i=r.loop?n.children(".lslide ").first():n.children().first();u=function(){var r=i.outerHeight(),u=0,f=r;t&&(r=0,u=f*100/o);n.css({height:r+"px","padding-bottom":u+"%"})};u();i.find("img").length?i.find("img")[0].complete?(u(),v||f.auto()):i.find("img").load(function(){setTimeout(function(){u();v||f.auto()},100)}):v||f.auto()},active:function(n,t){var i,o,s;this.doCss()&&r.mode==="fade"&&f.addClass("on");i=0;e*r.slideMove<w?(n.removeClass("active"),this.doCss()||r.mode!=="fade"||t!==!1||n.fadeOut(r.speed),i=t===!0?e:e*r.slideMove,t===!0&&(o=n.length,s=o-1,i+1>=o&&(i=s)),r.loop===!0&&r.mode==="slide"&&(i=t===!0?e-u.find(".clone.left").length:e*r.slideMove,t===!0&&(o=n.length,s=o-1,i+1===o?i=s:i+1>o&&(i=0))),this.doCss()||r.mode!=="fade"||t!==!1||n.eq(i).fadeIn(r.speed),n.eq(i).addClass("active")):(n.removeClass("active"),n.eq(n.length-1).addClass("active"),this.doCss()||r.mode!=="fade"||t!==!1||(n.fadeOut(r.speed),n.eq(i).fadeIn(r.speed)))},move:function(n,t){r.rtl===!0&&(t=-t);this.doCss()?r.vertical===!0?n.css({transform:"translate3d(0px, "+-t+"px, 0px)","-webkit-transform":"translate3d(0px, "+-t+"px, 0px)"}):n.css({transform:"translate3d("+-t+"px, 0px, 0px)","-webkit-transform":"translate3d("+-t+"px, 0px, 0px)"}):r.vertical===!0?n.css("position","relative").animate({top:-t+"px"},r.speed,r.easing):n.css("position","relative").animate({left:-t+"px"},r.speed,r.easing);var i=f.parent().find(".lSPager"+r.pagerClass).find("li");this.active(i,!0)},fade:function(){this.active(h,!1);var n=f.parent().find(".lSPager"+r.pagerClass).find("li");this.active(n,!0)},slide:function(){var n=this;s.calSlide=function(){c>o&&(l=n.slideValue(),n.active(h,!1),l>c-o-r.slideMargin?l=c-o-r.slideMargin:l<0&&(l=0),n.move(u,l),r.loop===!0&&r.mode==="slide"&&(e>=w-u.find(".clone.left").length/r.slideMove&&n.resetSlide(u.find(".clone.left").length),e===0&&n.resetSlide(f.find(".lslide").length)))};s.calSlide()},resetSlide:function(n){var t=this;f.find(".lSAction a").addClass("disabled");setTimeout(function(){e=n;f.css("transition-duration","0ms");l=t.slideValue();t.active(h,!1);a.move(u,l);setTimeout(function(){f.css("transition-duration",r.speed+"ms");f.find(".lSAction a").removeClass("disabled")},50)},r.speed+100)},slideValue:function(){var n=0,t;if(r.autoWidth===!1)n=e*(y+r.slideMargin)*r.slideMove;else for(n=0,t=0;t<e;t++)n+=parseInt(h.eq(t).width())+r.slideMargin;return n},slideThumb:function(){var i,n,s,t;switch(r.currentPagerPosition){case"left":i=0;break;case"middle":i=o/2-k/2;break;case"right":i=o-k}n=e-u.find(".clone.left").length;s=f.parent().find(".lSPager"+r.pagerClass);r.mode==="slide"&&r.loop===!0&&(n>=s.children().length?n=0:n<0&&(n=s.children().length));t=n*(k+r.thumbMargin)-i;t+o>d&&(t=d-o-r.thumbMargin);t<0&&(t=0);this.move(s,t)},auto:function(){r.auto&&(clearInterval(v),v=setInterval(function(){u.goToNextSlide()},r.pause))},pauseOnHover:function(){var t=this;if(r.auto&&r.pauseOnHover){f.on("mouseenter",function(){n(this).addClass("ls-hover");u.pause();r.auto=!0});f.on("mouseleave",function(){n(this).removeClass("ls-hover");f.find(".lightSlider").hasClass("lsGrabbing")||t.auto()})}},touchMove:function(n,t){var s,i,e;f.css("transition-duration","0ms");r.mode==="slide"&&(s=n-t,i=l-s,i>=c-o-r.slideMargin?r.freeMove===!1?i=c-o-r.slideMargin:(e=c-o-r.slideMargin,i=e+(i-e)/5):i<0&&(i=r.freeMove===!1?0:i/5),this.move(u,i))},touchEnd:function(n){var i,t,s;f.css("transition-duration",r.speed+"ms");r.mode==="slide"?(i=!1,t=!0,l=l-n,l>c-o-r.slideMargin?(l=c-o-r.slideMargin,r.autoWidth===!1&&(i=!0)):l<0&&(l=0),s=function(n){var u=0,f,s,t;if(i||n&&(u=1),r.autoWidth){for(s=0,t=0;t<h.length;t++)if(s+=parseInt(h.eq(t).width())+r.slideMargin,e=t+u,s>=l)break}else f=l/((y+r.slideMargin)*r.slideMove),e=parseInt(f)+u,l>=c-o-r.slideMargin&&f%1!=0&&e++},n>=r.swipeThreshold?(s(!1),t=!1):n<=-r.swipeThreshold&&(s(!0),t=!1),u.mode(t),this.slideThumb()):n>=r.swipeThreshold?u.goToPrevSlide():n<=-r.swipeThreshold&&u.goToNextSlide()},enableDrag:function(){var e=this;if(!rt){var u=0,t=0,i=!1;f.find(".lightSlider").addClass("lsGrab");f.on("mousedown",function(t){if(c<o&&c!==0)return!1;n(t.target).attr("class")!=="lSPrev"&&n(t.target).attr("class")!=="lSNext"&&(u=r.vertical===!0?t.pageY:t.pageX,i=!0,t.preventDefault?t.preventDefault():t.returnValue=!1,f.scrollLeft+=1,f.scrollLeft-=1,f.find(".lightSlider").removeClass("lsGrab").addClass("lsGrabbing"),clearInterval(v))});n(window).on("mousemove",function(n){i&&(t=r.vertical===!0?n.pageY:n.pageX,e.touchMove(t,u))});n(window).on("mouseup",function(o){if(i){f.find(".lightSlider").removeClass("lsGrabbing").addClass("lsGrab");i=!1;t=r.vertical===!0?o.pageY:o.pageX;var s=t-u;if(Math.abs(s)>=r.swipeThreshold)n(window).on("click.ls",function(t){t.preventDefault?t.preventDefault():t.returnValue=!1;t.stopImmediatePropagation();t.stopPropagation();n(window).off("click.ls")});e.touchEnd(s)}})}},enableTouch:function(){var i=this,n,t;if(rt){n={};t={};f.on("touchstart",function(i){t=i.originalEvent.targetTouches[0];n.pageX=i.originalEvent.targetTouches[0].pageX;n.pageY=i.originalEvent.targetTouches[0].pageY;clearInterval(v)});f.on("touchmove",function(u){var s,f,e;if(c<o&&c!==0)return!1;s=u.originalEvent;t=s.targetTouches[0];f=Math.abs(t.pageX-n.pageX);e=Math.abs(t.pageY-n.pageY);r.vertical===!0?(e*3>f&&u.preventDefault(),i.touchMove(t.pageY,n.pageY)):(f*3>e&&u.preventDefault(),i.touchMove(t.pageX,n.pageX))});f.on("touchend",function(){if(c<o&&c!==0)return!1;var u;u=r.vertical===!0?t.pageY-n.pageY:t.pageX-n.pageX;i.touchEnd(u)})}},build:function(){var t=this;t.initialStyle();this.doCss()&&(r.enableTouch===!0&&t.enableTouch(),r.enableDrag===!0&&t.enableDrag());n(window).on("focus",function(){t.auto()});n(window).on("blur",function(){clearInterval(v)});t.pager();t.pauseOnHover();t.controls();t.keyPress()}};a.build();s.init=function(){s.chbreakpoint();r.vertical===!0?(o=r.item>1?r.verticalHeight:h.outerHeight(),f.css("height",o+"px")):(r.height>0&&f.find("img").not(".nav").css("height",r.height+"px"),o=f.outerWidth(),s.calSW());r.loop===!0&&r.mode==="slide"&&s.clone();s.calL();r.mode==="slide"&&u.removeClass("lSSlide");r.mode==="slide"&&(s.calSW(),s.sSW());setTimeout(function(){r.mode==="slide"&&u.addClass("lSSlide")},1e3);r.pager&&s.createPager();r.adaptiveHeight===!0&&r.vertical===!1&&u.css("height",h.eq(e).outerHeight(!0));r.adaptiveHeight===!1&&(r.mode==="slide"?r.vertical===!1?a.setHeight(u,!1):a.auto():a.setHeight(u,!0));r.gallery===!0&&a.slideThumb();r.mode==="slide"&&a.slide();r.autoWidth===!1?h.length<=r.item?f.find(".lSAction").hide():f.find(".lSAction").show():s.calWidth(!1)<o&&c!==0?f.find(".lSAction").hide():f.find(".lSAction").show();r.onRefresh.call(this,u)};u.goToPrevSlide=function(){if(e>0)r.onBeforePrevSlide.call(this,u,e),e--,u.mode(!1),r.gallery===!0&&a.slideThumb();else if(r.loop===!0){if(r.onBeforePrevSlide.call(this,u,e),r.mode==="fade"){var n=w-1;e=parseInt(n/r.slideMove)}u.mode(!1);r.gallery===!0&&a.slideThumb()}else r.slideEndAnimation===!0&&(u.addClass("leftEnd"),setTimeout(function(){u.removeClass("leftEnd")},400))};u.goToNextSlide=function(){var n=!0,t;r.mode==="slide"&&(t=a.slideValue(),n=t<c-o-r.slideMargin);e*r.slideMove<w-r.slideMove&&n?(r.onBeforeNextSlide.call(this,u,e),e++,u.mode(!1),r.gallery===!0&&a.slideThumb()):r.loop===!0?(r.onBeforeNextSlide.call(this,u,e),e=0,u.mode(!1),r.gallery===!0&&a.slideThumb()):r.slideEndAnimation===!0&&(u.addClass("rightEnd"),setTimeout(function(){u.removeClass("rightEnd")},400))};u.mode=function(n){r.adaptiveHeight===!0&&r.vertical===!1&&u.css("height",h.eq(e).outerHeight(!0));nt===!1&&(r.mode==="slide"?a.doCss()&&(u.addClass("lSSlide"),r.speed!==""&&f.css("transition-duration",r.speed+"ms"),r.cssEasing!==""&&f.css("transition-timing-function",r.cssEasing)):a.doCss()&&(r.speed!==""&&u.css("transition-duration",r.speed+"ms"),r.cssEasing!==""&&u.css("transition-timing-function",r.cssEasing)));n||r.onBeforeSlide.call(this,u,e);r.mode==="slide"?a.slide():a.fade();f.hasClass("ls-hover")||a.auto();setTimeout(function(){n||r.onAfterSlide.call(this,u,e)},r.speed);nt=!0};u.play=function(){u.goToNextSlide();r.auto=!0;a.auto()};u.pause=function(){r.auto=!1;clearInterval(v)};u.refresh=function(){s.init()};u.getCurrentSlideCount=function(){var i=e,t,n;return r.loop&&(t=f.find(".lslide").length,n=u.find(".clone.left").length,i=e<=n-1?t+(e-n):e>=t+n?e-t-n:e-n),i+1};u.getTotalSlideCount=function(){return f.find(".lslide").length};u.goToSlide=function(n){e=r.loop?n+u.find(".clone.left").length-1:n;u.mode(!1);r.gallery===!0&&a.slideThumb()};u.destroy=function(){u.lightSlider&&(u.goToPrevSlide=function(){},u.goToNextSlide=function(){},u.mode=function(){},u.play=function(){},u.pause=function(){},u.refresh=function(){},u.getCurrentSlideCount=function(){},u.getTotalSlideCount=function(){},u.goToSlide=function(){},u.lightSlider=null,s={init:function(){}},u.parent().parent().find(".lSAction, .lSPager"+r.pagerClass).remove(),u.removeClass("lightSlider lSFade lSSlide lsGrab lsGrabbing leftEnd right").removeAttr("style").unwrap().unwrap(),u.children().removeAttr("style"),h.removeClass("lslide active"),u.find(".clone").remove(),h=null,v=null,nt=!1,e=0)};setTimeout(function(){r.onSliderLoad.call(this,u)},10);n(window).on("resize orientationchange",function(n){setTimeout(function(){n.preventDefault?n.preventDefault():n.returnValue=!1;s.init()},200)});return this}}(jQuery);var AppendCustomizeStyles=function(n,t){$("<style>").prop("type","text/css").html("."+t+"{background-image: url('"+n.SectionForDotNavigator.NavigatorIcon+"'); background-size: contain;border-radius:0px !important;background-color:transparent !important; background-repeat: no-repeat;width:"+n.SectionForDotNavigator.IconWidth+"px !important;height:"+n.SectionForDotNavigator.IconHeight+"px !important;}."+t+":hover {background-image: url('"+n.SectionForDotNavigator.NavigatorIconOnHover+"'); }.lSSlideOuter .lSpg.lSPager"+n.Id+" > li:hover a, .lSSlideOuter .lSpg.lSPager"+n.Id+" > li.active a {background-image: url('"+n.SectionForDotNavigator.NavigatorIconOnHover+"'); }.lSSlideOuter .lSPager"+n.Id+".lSGallery li.active, .lSSlideOuter .lSPager"+n.Id+".lSGallery li:hover{background-image: url('"+n.SectionForDotNavigator.NavigatorIcon+"'); }.lSSlideOuter .lSPager"+n.Id+".lSpg {margin: 10px 0 0;padding: 0;text-align: center;}.lSSlideOuter .lSPager"+n.Id+".lSpg > li {cursor: pointer;display: inline-block;padding: 0 5px;}.lSSlideOuter .lSPager"+n.Id+".lSpg > li a {display: inline-block;height: 8px;overflow: hidden;text-indent: -999em;width: 8px;position: relative;z-index: 99;}").appendTo("head")},SetSliderSize=function(n,t){t.SectionForHeight.FixedHeight&&$(n).find("img").not(".nav").css("height",t.SectionForHeight.DesktopHeight+"px");t.SectionForMiscellaneousSetting.FullWidth&&($(n).find(".item").addClass("content-full-width"),$(n).append('<div id="placeHolder" style="height:'+t.SectionForHeight.Height+'px;"><\/div>'));t.SectionForMiscellaneousSetting.FitImageWidth&&$(n).find("img").css("width","100%")},ChangeSliderHeight=function(n,t){var i=+$(n).find(".content-slider").outerHeight(!0);t.SectionForDotNavigator.IncludeInside||(i+=$(n).find(".lSPager"+t.Id).outerHeight(!0));$(n).find("#placeHolder").css("height",i)};$("body").find(".image-slider").each(function(n,t){var i=JSON.parse($(t).attr("properties")),u=i.SectionForMiscellaneousSetting.TransformAs==0?"slide":"fade",e="active"+i.Id,r="pager"+i.Id,f;AppendCustomizeStyles(i,r);SetSliderSize(t,i);f=$(t).find("#content-slider").lightSlider({item:i.SectionForMiscellaneousSetting.NumbersOfImages,height:i.SectionForHeight.FixedHeight===!0?i.SectionForHeight.DesktopHeight:0,loop:!0,pager:i.SectionForDotNavigator.DotNavigator,speed:500,pause:i.SectionForAutoPlay.RotationDelay*1e3,mode:u,adaptiveHeight:i.SectionForHeight.FixedHeight,auto:i.SectionForAutoPlay.AutoPlay,autoWidth:!1,controls:i.SectionForNavigationButtons.ShowNavigation,nextHtml:'<img class="nav" src="'+i.SectionForNavigationButtons.NextIcon+'" />',prevHtml:'<img class="nav" src="'+i.SectionForNavigationButtons.PreviousIcon+'" />',pagerClass:i.Id,slideMargin:i.SectionForMiscellaneousSetting.SpaceBetweenImages,items:i.SectionForMiscellaneousSetting.NumbersOfImages,responsive:[{breakpoint:800,settings:{item:1,slideMove:1,slideMargin:6,height:i.SectionForHeight.FixedHeight===!0?i.SectionForHeight.TabletHeight:0}},{breakpoint:480,settings:{item:1,slideMove:1,height:i.SectionForHeight.FixedHeight===!0?i.SectionForHeight.MobileHeight:0}}],onRefresh:function(){$(t).find(".lSpg > *").find("a").addClass(r);ChangeSliderHeight(t,i)},onBeforeSlide:function(){var n=+$(t).find(".content-slider").outerHeight(!0);ChangeSliderHeight(t,i)},onAfterSlide:function(){var n=+$(t).find(".content-slider").outerHeight(!0);ChangeSliderHeight(t,i)},onSliderLoad:function(){$("#autoWidth").removeClass("cS-hidden");i.SectionForDotNavigator.DotNavigator&&i.SectionForDotNavigator.IncludeInside&&$(t).find(".lSpg").addClass("navigator-inPage");$(t).find(".lSpg > *").find("a").addClass(r)}})});Sana=Sana||{};Sana.Addon=Sana.Addon||{};Sana.Addon.Parallax=Sana.Addon.Parallax||{};Sana.Addon.Parallax.Init=function(){$(".parallax-scroller").each(function(){var t=$(this).find("#Parallax_IsFixedWidth").val(),n=$(this).find("#Parallax_ImageHeight").val();t=="True"?($(this).find("> div:first-of-type").removeClass("full-width"),$(this).find("> div:first-of-type").addClass("fixed-width")):($(this).find("> div:first-of-type").removeClass("fixed-width"),$(this).find("> div:first-of-type").addClass("full-width"));$(this).css("height",n+"px");$(this).find(".parallax-window").css("min-height",n+"px");$(this).find(".parallax-window .parallax-content").css("height",n+"px")});$("header").on("cssClassChanged",function(){$(window).trigger("load.px.parallax")});var n=$("img[data-src], [data-bg-src]").not(".custom-lazy, .custom-lazy img");n.on("load",function(){$(window).trigger("load.px.parallax")})};$(document).ready(function(){Sana.Addon.Parallax.Init()}),function(){var n=jQuery.fn.addClass,t=jQuery.fn.removeClass;jQuery.fn.addClass=function(){var t=n.apply(this,arguments);return jQuery(this).trigger("cssClassChanged"),t};jQuery.fn.removeClass=function(){var n=t.apply(this,arguments);return jQuery(this).trigger("cssClassChanged"),n}}(),function(n,t,i,r){function u(t,i){var e=this,f,o,s;if(typeof i=="object"&&(delete i.refresh,delete i.render,n.extend(this,i)),this.$element=n(t),!this.imageSrc&&this.$element.is("img")&&(this.imageSrc=this.$element.attr("src")),f=(this.position+"").toLowerCase().match(/\S+/g)||[],f.length<1&&f.push("center"),f.length==1&&f.push(f[0]),(f[0]=="top"||f[0]=="bottom"||f[1]=="left"||f[1]=="right")&&(f=[f[1],f[0]]),this.positionX!=r&&(f[0]=this.positionX.toLowerCase()),this.positionY!=r&&(f[1]=this.positionY.toLowerCase()),e.positionX=f[0],e.positionY=f[1],this.positionX!="left"&&this.positionX!="right"&&(this.positionX=isNaN(parseInt(this.positionX))?"center":parseInt(this.positionX)),this.positionY!="top"&&this.positionY!="bottom"&&(this.positionY=isNaN(parseInt(this.positionY))?"center":parseInt(this.positionY)),this.position=this.positionX+(isNaN(this.positionX)?"":"px")+" "+this.positionY+(isNaN(this.positionY)?"":"px"),navigator.userAgent.match(/(iPod|iPhone|iPad)/))return this.imageSrc&&this.iosFix&&!this.$element.is("img")&&this.$element.css({backgroundImage:"url("+this.imageSrc+")",backgroundSize:"cover",backgroundPosition:this.position}),this;if(navigator.userAgent.match(/(Android)/))return this.imageSrc&&this.androidFix&&!this.$element.is("img")&&this.$element.css({backgroundImage:"url("+this.imageSrc+")",backgroundSize:"cover",backgroundPosition:this.position}),this;this.$mirror=n("<div />").prependTo("body div.site");o=this.$element.find(">.parallax-slider");s=!1;o.length==0?this.$slider=n("<img />").prependTo(this.$mirror):(this.$slider=o.prependTo(this.$mirror),s=!0);this.$mirror.addClass("parallax-mirror").css({visibility:"hidden",zIndex:this.zIndex,position:"fixed",top:0,left:0,overflow:"hidden"});this.$slider.addClass("parallax-slider").one("load",function(){e.naturalHeight&&e.naturalWidth||(e.naturalHeight=this.naturalHeight||this.height||1,e.naturalWidth=this.naturalWidth||this.width||1);e.aspectRatio=e.naturalWidth/e.naturalHeight;u.isSetup||u.setup();u.sliders.push(e);u.isFresh=!1;u.requestRender()});s||(this.$slider[0].src=this.imageSrc);(this.naturalHeight&&this.naturalWidth||this.$slider[0].complete||o.length>0)&&this.$slider.trigger("load")}function f(r){return this.each(function(){var f=n(this),e=typeof r=="object"&&r;this==t||this==i||f.is("body div.site")?u.configure(e):f.data("px.parallax")?typeof r=="object"&&n.extend(f.data("px.parallax"),e):(e=n.extend({},f.data(),e),f.data("px.parallax",new u(this,e)));typeof r=="string"&&(r=="destroy"?u.destroy(this):u[r]())})}(function(){for(var r=0,i=["ms","moz","webkit","o"],n=0;n<i.length&&!t.requestAnimationFrame;++n)t.requestAnimationFrame=t[i[n]+"RequestAnimationFrame"],t.cancelAnimationFrame=t[i[n]+"CancelAnimationFrame"]||t[i[n]+"CancelRequestAnimationFrame"];t.requestAnimationFrame||(t.requestAnimationFrame=function(n){var i=(new Date).getTime(),u=Math.max(0,16-(i-r)),f=t.setTimeout(function(){n(i+u)},u);return r=i+u,f});t.cancelAnimationFrame||(t.cancelAnimationFrame=function(n){clearTimeout(n)})})();n.extend(u.prototype,{speed:.2,bleed:0,zIndex:-100,iosFix:!0,androidFix:!0,position:"center",overScrollFix:!1,refresh:function(){var n;this.boxWidth=this.$element.outerWidth();this.boxHeight=this.$element.outerHeight()+this.bleed*2;this.boxOffsetTop=this.$element.offset().top-this.bleed;this.boxOffsetLeft=this.$element.offset().left;this.boxOffsetBottom=this.boxOffsetTop+this.boxHeight;var r=u.winHeight,e=u.docHeight,f=Math.min(this.boxOffsetTop,e-r),o=Math.max(this.boxOffsetTop+this.boxHeight-r,0),i=this.boxHeight+(f-o)*(1-this.speed)|0,t=(this.boxOffsetTop-f)*(1-this.speed)|0;i*this.aspectRatio>=this.boxWidth?(this.imageWidth=i*this.aspectRatio|0,this.imageHeight=i,this.offsetBaseTop=t,n=this.imageWidth-this.boxWidth,this.offsetLeft=this.positionX=="left"?0:this.positionX=="right"?-n:isNaN(this.positionX)?-n/2|0:Math.max(this.positionX,-n)):(this.imageWidth=this.boxWidth,this.imageHeight=this.boxWidth/this.aspectRatio|0,this.offsetLeft=0,n=this.imageHeight-i,this.offsetBaseTop=this.positionY=="top"?t:this.positionY=="bottom"?t-n:isNaN(this.positionY)?t-n/2|0:t+Math.max(this.positionY,-n))},render:function(){var n=u.scrollTop,t=u.scrollLeft,i=this.overScrollFix?u.overScroll:0,r=n+u.winHeight;this.boxOffsetBottom>n&&this.boxOffsetTop<=r?(this.visibility="visible",this.mirrorTop=this.boxOffsetTop-n,this.mirrorLeft=this.boxOffsetLeft-t,this.offsetTop=this.offsetBaseTop-this.mirrorTop*(1-this.speed)):this.visibility="hidden";this.$mirror.css({transform:"translate3d(0px, 0px, 0px)",visibility:this.visibility,top:this.mirrorTop-i,left:this.mirrorLeft,height:this.boxHeight,width:this.boxWidth});this.$slider.css({transform:"translate3d(0px, 0px, 0px)",position:"absolute",top:this.offsetTop,left:this.offsetLeft,height:this.imageHeight,width:this.imageWidth,maxWidth:"none"})}});n.extend(u,{scrollTop:0,scrollLeft:0,winHeight:0,winWidth:0,docHeight:1073741824,docWidth:1073741824,sliders:[],isReady:!1,isFresh:!1,isBusy:!1,setup:function(){if(!this.isReady){var f=n(i),r=n(t),e=function(){u.winHeight=r.height();u.winWidth=r.width();u.docHeight=f.height();u.docWidth=f.width()},o=function(){var n=r.scrollTop(),t=u.docHeight-u.winHeight,i=u.docWidth-u.winWidth;u.scrollTop=Math.max(0,Math.min(t,n));u.scrollLeft=Math.max(0,Math.min(i,r.scrollLeft()));u.overScroll=Math.max(n-t,Math.min(n,0))};r.on("resize.px.parallax load.px.parallax",function(){e();u.isFresh=!1;u.requestRender()}).on("scroll.px.parallax load.px.parallax",function(){o();u.requestRender()});e();o();this.isReady=!0}},configure:function(t){typeof t=="object"&&(delete t.refresh,delete t.render,n.extend(this.prototype,t))},refresh:function(){n.each(this.sliders,function(){this.refresh()});this.isFresh=!0},render:function(){this.isFresh||this.refresh();n.each(this.sliders,function(){this.render()})},requestRender:function(){var n=this;this.isBusy||(this.isBusy=!0,t.requestAnimationFrame(function(){n.render();n.isBusy=!1}))},destroy:function(i){var r,f=n(i).data("px.parallax");for(f.$mirror.remove(),r=0;r<this.sliders.length;r+=1)this.sliders[r]==f&&this.sliders.splice(r,1);n(i).data("px.parallax",!1);this.sliders.length===0&&(n(t).off("scroll.px.parallax resize.px.parallax load.px.parallax"),this.isReady=!1,u.isSetup=!1)}});var e=n.fn.parallax;n.fn.parallax=f;n.fn.parallax.Constructor=u;n.fn.parallax.noConflict=function(){return n.fn.parallax=e,this};n(function(){n('[data-parallax="scroll"]').parallax()})}(jQuery,window,document);$(function(){var n=$("[class$=-state] select");n.each(function(){var n=$(this),i=n.attr("name"),r,t;(i=i.slice(0,i.lastIndexOf(".")-1),r=$('[class$=-countryid] select[name^="'+i+'"]'),r.length!=0)&&(t=n.parents("[class$=-state]:first").find("input[type=text]"),n.dependent_on(r),n.change(function(){var i=n.find("option").length>0;n.toggleClass("hide",!i).prop("disabled",!i);n.parents(".ddlb:first").toggleClass("hide",!i);t.length>0?(t.toggleClass("hide",i).prop("disabled",i),t.parents(".tbx:first").toggleClass("hide",i),i&&t.val("")):n.parents(".form-row:first").toggleClass("hide",!i)}),n.trigger("change"))})});BasketSummary={selector:"#basketModalPopup",get$Obj:function(){return $(".basket")},onBeforeChange:function(){$(".basket-loading").show()},onAfterChange:function(){$(".basket-loading").hide()},showFullSummary:function(){setTimeout(function(){$(BasketSummary.selector).fadeOut(1e3,function(){$(BasketSummary.selector).removeClass("just-added").removeAttr("style").find(".added-product").show()});$(".ui-mobile .basket .over-summary-number").fadeOut(1e3)},2e3)},onChanged:function(n){var t=parseFloat(n);if(isNaN(t)||t<=0){BasketSummary.onAfterChange();return}$.post(BasketSummary.get$Obj().attr("data-src"),function(n){BasketSummary.get$Obj().html(n);BasketSummary.onAfterChange();$(BasketSummary.selector).addClass("just-added").show().fadeIn(500).find(".added-product").slice(t).hide();BasketSummary.showFullSummary();$(".ui-mobile .basket .over-summary-number").fadeIn(500);$(BasketSummary.selector).trigger("htmlUpdated")})}};Sana=Sana||{};Sana.FileUploder=function(){var t=$(".uploader"),n,i;if(t.length)return n={},i=function(t){var i=$(t),r=i.find('input[type="file"]'),u=r.attr("name"),f=i.find("label"),o=i.find(".uploader-cancel"),e=function(n){f.find(".uploader-selected-files").text(n.length>1?(r.attr("data-val-multiple-caption")||"").replace("{0}",n.length):n[0].name);i.addClass("is-files-selected")};n[u]=!1;r.on("change",function(t){var i=t.target.files;i.length&&(n[u]=i,e(i))});o.on("click",function(){n[u]=!1;f.find(".uploader-selected-files").text("");i.removeClass("is-files-selected");r.val("");r.removeData("files")});i.on("drag dragstart dragend dragover dragenter dragleave drop",function(n){n.preventDefault();n.stopPropagation()}).on("dragover dragenter",function(){i.addClass("is-dragover")}).on("dragleave dragend drop",function(){i.removeClass("is-dragover")}).on("drop",function(t){var i=t.originalEvent.dataTransfer.files;i.length&&(n[u]=i,e(n[u]),r.val(""),r.data("files",i))})},t.each(function(n,t){i(t)}),{getFiles:function(t){return n[t]}}}();Matrix={staticMode:{inputsSelector:'.gvi-variants .tbx-quantity input[type="text"]',popupElementId:null,init:function(n){Matrix.staticMode.popupElementId=n||"matricesPopup";Matrix.staticMode.bindUomChange();Matrix.staticMode.updateTotal();$(document).on("spinstop",Matrix.staticMode.inputsSelector,function(){$(this).valid()&&Matrix.staticMode.updateTotal()})},updateTotal:function(){Matrix.staticMode.setValidationVisible(!1);var n=Matrix.staticMode.countTotal();$(".variants-count .value").text(n)},countTotal:function(){var n=0;return $(Matrix.staticMode.inputsSelector).each(function(){var t=parseFloat($(this).val());isNaN(t)||(n+=t)}),Sana.Utils.roundQuantity(n)},setValidationVisible:function(n){$("#variantsValidationMsg").toggleClass("hide",!n)},onBeforeAddToBasket:function(){var n=Matrix.staticMode.countTotal();if(isNaN(n)||n<=0)return Matrix.staticMode.setValidationVisible(!0),!1;BasketSummary.onBeforeChange();Popup.close("#"+Matrix.staticMode.popupElementId)},onVariantsAdded:function(n){if($(Matrix.staticMode.inputsSelector).val(""),Matrix.staticMode.updateTotal(),n&&n.Count){var t=n.Url?function(){location.href=n.Url}:undefined;Sana.GoogleTagManager.trackProductAddition(n.Items,n.ActionField,n.CustomerType,t)}BasketSummary.onChanged(n.Count)},bindUomChange:function(){var n=".variants select[name=unitOfMeasureId]";$(document).on("change",n,function(){var t={unitOfMeasureId:$(n).val(),__RequestVerificationToken:Sana.Utils.getAntiForgeryToken()};Sana.UI.LoadingIndicator.show();$.ajax(window.location.href,{type:"POST",data:t,dataFilter:function(n){return $($.parseHTML(n.trim()))}}).done(function(t){var i=t.find(".variants");Sana.Utils.replaceElements(i);Sana.UI.Selects.init(n);Matrix.makeHeadersSticky();Sana.UI.LoadingIndicator.hide()})})}},dynamicMode:{currentProductId:null,popupElementId:null,uomSelector:".variants select[name=unitOfMeasureId]",init:function(n,t){Matrix.dynamicMode.popupElementId=t||"variantMatrixPopup";Matrix.dynamicMode.currentProductId=n;Matrix.dynamicMode.loadVariants();Sana.UI.setValidationFor("#variantMatrixPopup");Matrix.dynamicMode.bindUomChange();Sana.UI.Selects.init(Matrix.dynamicMode.uomSelector)},onBeforeAdd:function(){var i=Matrix.dynamicMode.getProductLine().find("input[name=variants]"),f=$('#variantMatrixPopup input[name$=".Key"]'),r=$(Matrix.dynamicMode.uomSelector).val(),n=$.map(f,function(n){var t=$(n),u=t.val(),f=t.attr("step"),i=Number(t.next().val());if(i>0)return{productId:Matrix.dynamicMode.currentProductId,variantId:u,quantity:i,unitOfMeasureId:r,step:f}}),t=Matrix.dynamicMode.getVariants(i);for(var u in t)t[u].unitOfMeasureId!=r&&n.push(t[u]);i.val($.toJSON(n));Matrix.dynamicMode.updateVariantsTotal(n);Popup.close("#"+Matrix.dynamicMode.popupElementId)},getProductLine:function(){return $('[data-id="'+Matrix.dynamicMode.currentProductId+'"]')},getVariants:function(n){var t=n.val();return t!=""&&typeof t!="undefined"?$.evalJSON(t):null},updateVariantsTotal:function(n){var r=function(){var i=0,r,t;for(r in n)t=n[r],i+=t.step%1>0?1:t.quantity;return i},t=r(),i=Matrix.dynamicMode.getProductLine(),u=i.find(".selected-quantity"),f=u.find(".value");f.text(t);i.toggleClass("variants-selected",t>0)},loadVariants:function(){var u=Matrix.dynamicMode.getProductLine().find("input[name=variants]"),t=Matrix.dynamicMode.getVariants(u),f=$(Matrix.dynamicMode.uomSelector).val(),i,n,r;for(i in t)n=t[i],n.quantity>0&&n.unitOfMeasureId==f&&(r=$("#"+Matrix.dynamicMode.popupElementId+' input[name$=".Key"][value="'+n.variantId+'"]').next(),r.val(n.quantity))},bindUomChange:function(){var n=".variants form";$(document).off("change.matrixUom");$(document).on("change.matrixUom",Matrix.dynamicMode.uomSelector,function(){var t=$(n).serialize();Sana.UI.LoadingIndicator.show();$.ajax($(n).attr("action"),{type:"POST",data:t,dataFilter:function(n){return $($.parseHTML(n.trim()))}}).done(function(n){Sana.Utils.replaceElements(n);Sana.UI.Selects.init(Matrix.dynamicMode.uomSelector);Matrix.makeHeadersSticky();Matrix.dynamicMode.loadVariants();Sana.UI.LoadingIndicator.hide()})})}},makeHeadersSticky:function(){var t=450,n=$(".gvi-variants");n.height()>t&&n.closest(".grid-inside").height(t);n.data("plugin_stickyTable")||n.stickyTable({overflowy:!0})}};Menu={cssNavRoot:".nav-list-root",cssNavIsHovered:"nav-is-hovered",cssNavItemIsHovered:"hover",showItem:function(n){n.addClass(Menu.cssNavItemIsHovered).parent().addClass(Menu.cssNavIsHovered)},hideItem:function(n){n.removeClass(Menu.cssNavItemIsHovered)},unhoverMenu:function(n){n.removeClass(Menu.cssNavIsHovered)},markCurrentItem:function(){var n={selector:".nav-main .nav-list-root",root:".nav-main .nav-item-root",child:".nav-list > .nav-item"},i=$(n.selector),t;i.length&&(t=new Navigation(n),t.markCurrentNode())},initLaziness:function(){var n=function(n){return $.extend({activate:function(n){Menu.showItem($(n))},deactivate:function(n){Menu.hideItem($(n))},exitMenu:function(n){return Menu.unhoverMenu($(n)),!0}},n)};$(".nav-list-root").menuAim(n({submenuDirection:function(){return $("header").hasClass("sticky-mode")?"right":"below"}}));$(".nav-type-simple .nav-list-sub").menuAim(n())},makeTouchFriendly:function(){$(document).on("touchstart",".nav-item > a",function(){if(Sana.Layout.layout!="MOBILE"){var n=$(this),t=n.next(".nav-list, .nav-wrapper");if(!n.parent().hasClass(Menu.cssNavItemIsHovered)&&t.length){n.parent().parents(".nav-item").length||Menu.hideItem($(".nav-item"));Menu.showItem(n.parent());$(document).off("touchstart.leaveNav");$(document).on("touchstart.leaveNav",function(n){$(n.target).closest(".nav-item").length||($(document).off("touchstart.leaveNav"),Menu.hideItem($(".nav-item")),Menu.unhoverMenu($(Menu.cssNavRoot)))});return!1}}})},bindClickOnToggleButton:function(){$(document).on("click",".nav-opener",function(){var n,t,i;Sana.Layout.layout!=="MOBILE"?$("header").toggleClass("nav-is-closed nav-is-opened"):(n=$(".header-blocks-wrapper"),$("header").hasClass("nav-is-closed")?(n.css("height",n.height()),$("header").toggleClass("nav-is-closed nav-is-opened"),t=$(".top-header").innerHeight()+$(".middle-header").innerHeight()+$(".bottom-header").innerHeight(),n.stop(!0,!0).animate({height:t},200,function(){n.css("height","")})):(i=62,n.stop(!0,!0).animate({height:i},200,function(){n.css("height","");$("header").toggleClass("nav-is-closed nav-is-opened")})))})},bindClickOnNavItems:function(){$(document).on("click",".nav-item > a",function(n){if(Sana.Layout.layout==="MOBILE"&&(!$(n.target).is("span")||!$(this).attr("href")||$(this).attr("href")==="#")){var t=$(this).next(".nav-wrapper, .nav-list-sub");t.length&&(n.preventDefault(),t.stop(!0,!0).slideToggle(200,function(){$(n.target).parent(".nav-item").toggleClass("submenu-expanded")}))}})},clearStates:function(){Sana.Layout.addFunction(function(){$(".nav-wrapper, .nav-list-sub").css("display","");$(".nav-item").removeClass("submenu-expanded")},"ALL")},init:function(){var n=!0;$(Menu.cssNavRoot).length&&(Menu.markCurrentItem(),Menu.bindClickOnToggleButton(),Menu.bindClickOnNavItems(),Menu.clearStates(),Sana.Layout.addFunction(function(){n&&(n=!1,Menu.makeTouchFriendly(),Menu.initLaziness())},"ALL"))}},function(){function t(){return typeof EditorContext!="undefined"}function i(i){var u=this,f,e,o;for(this.orderAuthorizationRules=$.map(i,function(n){return new r(n)}),this.lines=ko.observableArray([]),f=0;f<u.orderAuthorizationRules.length;f++)e=u.orderAuthorizationRules[f],e.selected&&u.lines.push(new n(e));this.availableApproveAccounts=function(n){var t=u.orderAuthorizationRules.slice(0);return $.grep(t,function(t){for(var f,r,i=0;i<u.lines().length;i++){if(f=u.lines()[i],r=f.authorizerId(),t.authorizerId==r&&r!=n)return!1;t.amount=0}return!0})};this.canAdd=function(){var n=u.availableApproveAccounts();return n.length>0};this.add=function(){var i=u.availableApproveAccounts();u.lines.push(new n(i[0]));Sana.UI.refreshValidationFor(".sub-account-holder form");t()&&GenerateEditButtons(".row-orderauthorizationrules")};this.removeLine=function(n){u.lines.remove(n)};o=function(){for(var t,n=0;n<u.lines().length;n++)t=$(".gvi-limits select").eq(n).selectmenu("instance"),t?t.refresh():Sana.UI.Selects.init(t)};this.lines.subscribe(function(){setTimeout(function(){o()})})}function r(n){this.id=Sana.Utils.guid();this.authorizerId=n.AuthorizerId;this.amount=n.Amount;this.name=n.Name;this.currencyId=n.CurrencyId;this.selected=n.Selected;this.amountNameAttr="OrderAuthorizationRules["+this.id+"].Amount";this.amountIdAttr="OrderAuthorizationRules_"+this.id+"__Amount";this.authorizerId_NameAttr="OrderAuthorizationRules["+this.id+"].AuthorizerId";this.authorizerId_IdAttr="OrderAuthorizationRules_"+this.id+"__AuthorizerId";this.ariaDescribedBy="OrderAuthorizationRules_"+this.id+"__Amount-error"}function n(n){this.id=Sana.Utils.guid();this.authorizerId=ko.observable(n.authorizerId);this.amount=n.amount;this.currencyId=n.currencyId;this.name=ko.observable(n.Name);this.amountNameAttr="OrderAuthorizationRules["+this.id+"].Amount";this.amountIdAttr="OrderAuthorizationRules_"+this.id+"__Amount";this.authorizerId_NameAttr="OrderAuthorizationRules["+this.id+"].AuthorizerId";this.authorizerId_IdAttr="OrderAuthorizationRules_"+this.id+"__AuthorizerId";this.ariaDescribedBy="OrderAuthorizationRules_"+this.id+"__Amount-error"}$(function(){var n=$("#orderAuthorizationRules").text();n.length>0&&(ko.applyBindings(new i(JSON.parse(n)),document.getElementById("orderAuthorizationRulesContainer")),Sana.UI.Selects.init(".gvi-limits select"),Sana.UI.refreshValidationFor(".sub-account-holder form"))})}();Paging=function(){var n={},c=".paging-control",f=".btn-load-more",e=".lazy-load-more",o=".paging-links",i,t,r;n.init=function(){var t=$(c);i="#"+t.attr("data-target-id");t.find(o).length?n._linksMode():t.find(f).length?n._loadMoreMode():t.find(e).length&&n._lazyMode()};n.getTargetSelector=function(){return i};var s=function(n){_url=n.attr("href").replace(/(&|\?)?\bpage=\d+/i,"");r=parseInt(n.data("last-page"))},h=function(n){return t=parseInt(n.attr("data-page"))+1,t||(t=1),{page:t+1}},u=function(n,t){var r=$(n.data.trim()),u;t?(u=r.filter(i),u.length&&(r=u.children()),$(i).html(r)):(u=r.find(i),u.length&&(r=u.children()),$(i).append(r));$(i).trigger("pagingChange",{newHtml:r,url:n.url,setCount:n.setCount})};return n._loadMoreMode=function(){var n=$(f);s(n);n.click(function(){Sana.UI.LoadingIndicator.show();n.addClass("loading");var i=h(n);return $.get(_url,i,function(i){u({data:i,setCount:!0});n.removeClass("loading");t!=r?n.attr("data-page",t):n.hide();Sana.UI.LoadingIndicator.hide()}),!1})},n._lazyMode=function(){var n=$(e),i;s(n);i=n.lazy({threshold:1,chainable:!1,autoDestroy:!1,productsLoader:function(f){var e=h(n);$.get(_url,e,function(e){u({data:e,setCount:!0});f.load();t!=r?(n.data("handled",!1).attr("data-loader","productsLoader"),i.addItems(n),n.attr("data-page",t)):n.hide()})}})},n._linksMode=function(){var t=function(n,t){Sana.UI.LoadingIndicator.show();$.ajax({url:n,cache:!1}).success(function(i){u({data:i,url:n},!0);Sana.UI.LoadingIndicator.hide();t||Sana.History.pushUrlParamFromString("page",n,{action:n})})};$(document).on("click",o+" a",function(i){i.preventDefault();var r=$(this).attr("href");r&&($.isFunction(n.onBeforeChange)?$.when(n.onBeforeChange()).then(function(){t(r)}):t(r))});Sana.History.saveCurrentState({action:document.location.href});Sana.History.onPopstate(function(n){var i=n.state;i&&t(i.action,!0)})},n}();$(function(){Paging.init()});Popup={open:function(n,t){var i=$(n),r=$.extend({},{draggable:!1,resizable:!1,width:"100%",minHeight:"inherit",modal:!0,appendTo:".site"},t);i.dialog(r);i.dialog({close:function(){$(".ui-dialog").hasClass("ui-dialog-scroll")&&($("ui-dialog-scroll").removeClass("ui-dialog-scroll"),$("html").removeClass("fix-dialog-scroll-helper").css("margin-right","initial"));i.dialog("destroy");r.afterClose&&r.afterClose()}});Popup.fixScroll(n);i.off("click.dialog");i.on("click.dialog",".btn-close-dialog",function(){i.dialog("instance").close()})},close:function(n){var t=$(n).dialog("instance");t&&t.close()},center:function(n){var t=$(n).dialog("instance");t&&t.option("position",{my:"center",at:"center",of:window})},fixScroll:function(n){$(window).height()<$(n).parents(".ui-dialog").outerHeight()&&($(n).parents(".ui-dialog").addClass("ui-dialog-scroll"),$("html").addClass("fix-dialog-scroll-helper").css("margin-right",Sana.Utils.getScrollbarSize()))}};QuickOrder={viewModel:new QuickOrderViewModel,init:function(){Sana.UI.Autocomplete.init({options:{selector:'input[name="productInput"]'},mapping:function(n,t){var i=n.Id+" - "+n.Title,r=Sana.Utils.highlightWords(i,t);return{label:r,originalLabel:i,value:n.Id}},onItemSelect:function(n,t){QuickOrder.viewModel.request(t.item.originalLabel);QuickOrder.viewModel.searchProduct();n.preventDefault()}});$(document).on("spinstop",'input[name="quantity"]',function(n){$(n.target).change()})},clearSelection:function(){QuickOrder.viewModel.product(null);QuickOrder.viewModel.request("")},setFocus:function(){$("#quickOrder .tbx-search input").select();QuickOrder.viewModel.afterLineAdded()}},function(){var n=document.getElementById("quickOrder");n&&ko.applyBindings(QuickOrder.viewModel,n)}();NumericInput=NumericInput||{};NumericInput.init=function(){$("input[type=text].numeric").each(function(){var n=$(this);Sana.Layout.touch==!0&&n.attr("readonly","true");var t=Number(n.attr("min-value")||n.data("min")||n.data("min-no-validation"))||0,i=Number(n.attr("max-value")||n.data("max")||n.data("max-no-validation"))||99999,r=n.attr("data-step")||n.data("step-no-validate")||1;n._spinner({min:t,max:i,step:r,icons:{down:"icon-down",up:"icon-up"}});n.keypress(function(n){if(n.which!=46&&n.which!=8&&n.which!=0&&n.which!=13&&(n.which<48||n.which>57))return!1});n.on("spinchange",function(){n.change()});n.on("spin",function(){n.change()})})};$(function(){if($.widget("ui._spinner",$.extend({},$.ui.spinner.prototype,{_uiSpinnerHtml:function(){return""},_buttonHtml:function(){return"<a class='btn no-caption ui-spinner-button ui-spinner-up'><\/a><a class='btn no-caption ui-spinner-button ui-spinner-down'><\/a>"}})),$.ui._spinner.defaults=$.extend({},$.ui.spinner.defaults),NumericInput.init(),$(document).ajaxSuccess(function(){NumericInput.init()}),Sana.Layout.touch==!0){$(document).on("click",".tbx-quantity",function(n){$(n.target).is(".btn")||($(this).find("input[type=text].numeric").css("pointer-events","auto"),$(this).find("input[type=text].numeric").attr("readonly",!1),$(this).find("input[type=text].numeric").focus())});$(document).on("blur","input[type=text].numeric",function(){$(this).attr("readonly",!0);$(this).css("pointer-events","none")})}});Tabs={container:".tab-control",init:function(){var n=this;$(this.container).tabs();this.refresh();$(".hyp-read-description, .hyp-read-reviews").click(function(){var n="a[href='#"+$(this).attr("data-scroll-to")+"']";Sana.Layout.layout=="MOBILE"&&(n="[data-tab-header="+$(this).attr("data-scroll-to")+"]");Sana.UI.scrollToNode(n,90);Tabs.select(n)});Tabs.initMobile(".last-viewed");Tabs.initMobile(".accessory-products");Tabs.initMobile(".checkout-offers");Sana.UI.priceStyle(".last-viewed");Sana.UI.priceStyle(".accessory-products");Sana.UI.priceStyle(".checkout-offers")},refresh:function(){$(this.container).each(function(){var n=$(this).find("ul li").length;n==0&&$(this).css("visibility","hidden")})},select:function(n){$(n).click()},remove:function(n){var i=n.closest(this.container),t=n.closest("li"),r=t.parent().children().index(t);i.tabs("remove",r);this.refresh()},initMobile:function(n){var t=$(".products-group",n),i;t.length&&(i=function(n){n.touchCarousel({pagingNav:!0,scrollbar:!1,directionNavAutoHide:!1,itemsPerMove:1,loopItems:!0,directionNav:!1,autoplay:!1,autoplayDelay:2e3,transitionSpeed:400,onBeforeDragStart:function(n){Sana.Layout.layout!=="MOBILE"&&(this._successfullyDragged=!1,n.carouselDisabled=!0)},onAnimComplete:function(){Sana.UI.responsiveImages.refresh();$(this.carouselRoot).trigger("onAnimComplete",this.carouselRoot.data("touchCarousel"))}})},t.addClass("touchcarousel").children().addClass("touchcarousel-container").children(":not(.empty-column)").addClass("touchcarousel-item"),i(t))}},function(){function n(n){return n.substr(0,n.lastIndexOf(".")+1)}function t(n,t){return n.indexOf("*.")===0&&(n=n.replace("*.",t)),n}jQuery.validator.unobtrusive.options={errorPlacement:function(n){n.parent(".compact-sign-error").attr("title",n.text())}};jQuery.validator.defaults.ignore=":disabled";jQuery.validator.addMethod("multipleof",function(n,t,i){var r,u;return!n||n==""?i.empty:(r=parseFloat(n),isNaN(r))?!1:n==0?i.zero:(u=$(t).attr("data-val-multipleof-value"),Sana.Utils.isMultiple(r,u))});jQuery.validator.addMethod("data-min",function(n,t,i){return this.optional(t)||n>=Number(i)});jQuery.validator.addMethod("data-max",function(n,t,i){return this.optional(t)||n<=Number(i)});jQuery.validator.addMethod("data-step",function(n,t,i){return this.optional(t)||Sana.Utils.isMultiple(n,i)});jQuery.validator.unobtrusive.adapters.addSingleVal("min",null,"data-min");jQuery.validator.unobtrusive.adapters.addSingleVal("max",null,"data-max");jQuery.validator.unobtrusive.adapters.add("multipleof",["value","empty","zero"],function(n){var t={value:parseFloat(n.params.value),zero:n.params.zero=="true",empty:n.params.empty=="true"};n.rules.multipleof=t;n.message&&(n.messages.multipleof=n.message)});jQuery.validator.addMethod("mustnotmatch",function(n,t,i){var r=jQuery("#"+i.otherpropertyid).val();return n==r?!1:!0});jQuery.validator.unobtrusive.adapters.add("mustnotmatch",["otherproperty"],function(i){var r=n(i.element.name),u=t(i.params.otherproperty,r),f=$(i.form).find(":input[name="+u+"]")[0],e={otherpropertyid:f.id};i.rules.mustnotmatch=e;i.message&&(i.messages.mustnotmatch=i.message)});jQuery.validator.addMethod("mustbetrue",function(n){return n?!0:!1});jQuery.validator.unobtrusive.adapters.add("mustbetrue",[],function(n){n.rules.mustbetrue={};n.message&&(n.messages.mustbetrue=n.message)});jQuery.validator.addMethod("greaterthantoday",function(n,t){var i,r,u;if(!n)return!0;i=$(t).data("datepicker-options").dateFormat;try{return r=$.datepicker.parseDate(i,n),u=(new Date).setHours(0,0,0,0),r>=u}catch(f){return!1}});jQuery.validator.unobtrusive.adapters.add("greaterthantoday",[],function(n){n.rules.greaterthantoday={};n.message&&(n.messages.greaterthantoday=n.message)});jQuery.validator.addMethod("validdateformat",function(n,t){if(!n)return!0;var i=$(t).data("datepicker-options").dateFormat;try{return $.datepicker.parseDate(i,n),!0}catch(r){return!1}});jQuery.validator.unobtrusive.adapters.add("validdateformat",[],function(n){n.rules.validdateformat={};n.message&&(n.messages.validdateformat=n.message)});jQuery.validator.unobtrusive.adapters.add("zipcode",["messages","patterns"],function(i){var e=JSON.parse(i.params.messages),o=JSON.parse(i.params.patterns),s=t("*.CountryId",n(i.element.name)),u=$(i.form).find(':input[name="'+s+'"]'),r,f=function(){var t=u.find("option:selected"),n=t.attr("value");r=n&&n.length?t.attr("data-zipplus4")==="true"?"plus4":n.toLowerCase():null};u.on("change",function(){f();var n=$(i.element);(n.hasClass("valid")||n.hasClass("input-validation-error"))&&n.valid()});f();i.rules.regex=function(){return r?o[r]:undefined};i.messages.regex=function(){return r?e[r]:undefined}})}();jQuery.validator.defaults.highlight=function(){var n=$.validator.defaults.highlight;return function(t,i,r){n.call(this,t,i,r);$(t).parents(".form-row").removeClass("row-passed").addClass("row-error")}}();jQuery.validator.defaults.unhighlight=function(){var n=$.validator.defaults.unhighlight;return function(t,i,r){n.call(this,t,i,r);$(t).parents(".form-row").removeClass("row-error").addClass("row-passed")}}();VariantMatrixPopup={open:function(n,t,i){$("#variantMatrixPopup").off("dialogopen.stickyhead");$("#variantMatrixPopup").on("dialogopen.stickyhead",function(){Matrix.makeHeadersSticky()});Popup.open("#"+i);Sana.UI.LoadingIndicator.hide();t?Matrix.staticMode.init(i):Matrix.dynamicMode.init(n)}};Zoom={cssRoot:null,cssItem:null,stopEvents:!0,getPlaceholderSize:function(n,t){var u=t.naturalWidth,f=t.naturalHeight,o=$(n).parents(".main").width()-$(n).parents(".details-img").width(),s=$(n).parents(".main").height(),e=1,i,r,h,c;return u>o&&(e=o/u),i=1,f>s&&(i=s/f),r=1,r=e<i?e:i,h=r*u,c=r*f,{width:h,height:c}},elevateCurrent:function(){var i=$(Zoom.cssRoot).data("touchCarousel")?$(Zoom.cssRoot).data("touchCarousel")._currPageId:0,n=$(Zoom.cssItem).eq(i).find("img"),r=!!$(n).attr("data-zoom-image"),t;if(r){if(t=$(n).data("elevateZoom"),t){t.changeState("enable");t.zoomContainer.show();return}if(!$(n).attr("data-original"))Zoom.showZoomedImage(n);else $(n).on("lazy_afterLoad",function(){Zoom.showZoomedImage(n);$(n).off("lazy_afterLoad")})}},showZoomedImage:function(n){$("<img>").attr("src",$(n).attr("data-zoom-image")).on("load",function(){var t=Zoom.getPlaceholderSize(n,this);$(n).elevateZoom({zoomLevel:.5,easing:!0,scrollZoom:!0,zoomWindowFadeIn:500,zoomWindowFadeOut:500,borderSize:2,borderColour:"#e6e6e6",zoomWindowPosition:"zoomPlaceHolder",zoomWindowWidth:t.width,zoomWindowHeight:t.height});Zoom.stopEvents=!1})},bindEvents:function(){$(".details-img").on("scCarousel.onBeforeAnimation",function(){Zoom.stopEvents||Zoom.disableAll()});$(".details-img").on("scCarousel.onAfterAnimation",function(){Zoom.stopEvents||Zoom.elevateCurrent()});$(window).resize($.debounce(250,function(){Zoom.destroyAll();Sana.Layout.layout!=="MOBILE"&&Zoom.elevateCurrent()}));Sana.Layout.addFunction($.debounce(100,function(){Zoom.destroyAll()}),"MOBILE")},disableAll:function(){for(var n,i=$(Zoom.cssItem),t=0;t<=i.length;t++)n=i.eq(t).find("img").data("elevateZoom"),n&&(n.changeState("disable"),n.zoomContainer.hide())},destroyAll:function(){for(var t=$(Zoom.cssItem),n=0;n<=t.length;n++)t.eq(n).find("img").removeData("elevateZoom");$(".zoomContainer").remove();$(".zoomWindowContainer").remove();Zoom.stopEvents=!0},init:function(n,t){$(n).find(t).length&&(Zoom.cssRoot=n,Zoom.cssItem=t,$('<div id="zoomPlaceHolder" style="position: absolute; top: 0;"><\/div>').prependTo(".details-info"),Zoom.bindEvents(),Zoom.elevateCurrent())}};var BasketDetails={lastUpdateUrl:null,viewModel:new BasketViewModel,init:function(){var u=Paging.getTargetSelector();Paging.onBeforeChange=BasketDetails.updateBasket;$(document).on("pagingChange",u,function(n,t){BasketDetails.lastUpdateUrl=t.url;BasketDetails.onBasketContentUpdate()});$(document).on("click","#btnClearBasket",function(n){n.preventDefault();BasketDetails.clearBasket()});$(document).on("click","#btnCancelBasket",function(n){n.preventDefault();BasketDetails.cancelBasket()});$(document).on("click",".hyp-update, .hyp-recalculate",function(n){n.preventDefault();BasketDetails.recalculateBasket()});$(document).on("click","#btnAddToWishlist",function(n){n.preventDefault();BasketDetails.addToWishlist($(this))});$(document).on("submit","#promotionForm",function(n){n.preventDefault();BasketDetails.submitPromotion($(this))});$(document).on("click",".hyp-discount",function(){$(this).hide().next("#promotionForm").show().find("input").focus()});$(document).on("keypress","#basketContent .tbx-quantity",function(n){n.which==13&&(n.preventDefault(),BasketDetails.recalculateBasket())});$(document).on("click","#basket .hyp-remove",function(n){n.preventDefault();var t={},i=$(this).closest("tr");t.src=$(this).attr("data-src");t.product=i.attr("data-productid");t.variant=i.attr("data-variantid");t.prepack;i.attr("data-prepackvariantid")&&(t.variant=i.attr("data-prepackvariantid"),t.prepack=i.attr("data-variantid"));t.uom=i.attr("data-unitofmeasureid");BasketDetails.removeLines(t)});$(document).on("click",".enter-discount .hyp-remove",function(n){n.preventDefault();var t={},i=$(this);t.src=i.attr("data-src");t.product=i.attr("data-product");BasketDetails.removeLines(t)});$(document).on("click",".btn-checkout, .btn-quote",function(n){n.preventDefault();BasketDetails.goToCheckout($(this));$(window).off("unload.updateBasket")});this.initCheckoutOffers();this.initQuickOrder();BasketDetails.rowStyling();Sana.UI.Tooltips.init(".shipping-cost");$(window).on("unload.updateBasket",function(){BasketDetails.viewModel.isEmpty()||BasketDetails.updateBasket()});$(document).on("click",".btn-show-hide",function(){var n=$(this).parents(".upper-row");n.hasClass("row-expanded")?n.nextUntil(".upper-row").stop(!0,!0).animate({opacity:0},200,function(){$(this).addClass("row-state")}):n.nextUntil(".upper-row").removeClass("hide").stop(!0,!0).css("opacity",0).animate({opacity:1},200,function(){$(this).removeClass("row-state")});n.toggleClass("row-expanded row-collapsed");$(this).toggleClass("expanded collapsed")});var n=function(n){return n.data("tracked",!0),promoObj={id:n.find(".product-id .value").text(),name:n.find(".product-title").text(),creative:"basket_offers"}},t=$("#checkoutofferings .flow-products"),r=t.find(".tc-paging-container").is(":visible"),i=[];if(t.each(function(t){var f=$(this),u;f.find("a").click(function(i){var r=$(this).parents(".product-tile"),u;r.length&&(u=n(r),u.position=t+"_"+r.parent().index(),i.preventDefault(),Sana.GoogleTagManager.trackPromotionClick(u,this.href))});products=f.find("div.column.touchcarousel-item");r?(u=n($(products[0])),u.position=t+"_0",i.push(u)):products.each(function(r){var f=$(this),u=n(f);u.position=t+"_"+r;i.push(u)})}),Sana.GoogleTagManager.trackViewedPromotions(i),r)t.on("onAnimComplete",function(t,i){var r=i._currPageId,u=i.carouselRoot.data("prevIndex"),f,e;(u===undefined&&(u=0),u!=r)&&((i.carouselRoot.data("prevIndex",r),f=i.items[r],f.item.data("tracked"))||(e=n(f.item),e.position=$(this).index()+"_"+r,Sana.GoogleTagManager.trackViewedPromotions(e)))});Sana.UI.ActionButtons.init()},recalculateBasket:function(){BasketDetails.viewModel.isEmpty()||BasketDetails.updateBasket({callback:function(n){BasketDetails.onBasketLinesUpdated(n)}})},onBasketLinesUpdated:function(n){n&&n.Count&&(BasketDetails.refreshBasket(),Sana.GoogleTagManager.updateAdditionAndRemovals(n))},addToWishlist:function(n){if(!BasketDetails.viewModel.isEmpty()){var t=n.attr("data-src");BasketDetails.updateBasket({callback:function(n){n&&n.Items&&n.Count&&(BasketDetails.refreshBasket(),Sana.GoogleTagManager.trackProductAdditions(n.Items,n.ActionField,n.CustomerType));$.post(t,{__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()},function(){Sana.UI.LoadingIndicator.hide();Popup.open("#addToWishlistFeedbackPopup")})}})}},submitPromotion:function(n){if(!BasketDetails.viewModel.isEmpty()){var t=n.attr("data-src");BasketDetails.updateBasket({callback:function(){var n=$("#txtPromotionCode").val();Sana.UI.LoadingIndicator.show();$.post(t,{code:n,__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()},function(){BasketDetails.refreshBasket()})}})}},removeLines:function(n){BasketDetails.updateBasket({callback:function(){$.post(n.src,{productId:n.product,variationId:n.variant,prepackId:n.prepack,unitOfMeasureId:n.uom,__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()},function(n){BasketDetails.refreshBasket();n.Items&&Sana.GoogleTagManager.trackProductRemovals(n.Items,n.CustomerType)})}})},clearBasket:function(){if(!BasketDetails.viewModel.isEmpty()){BasketDetails.lastUpdateUrl=null;var n=$("#btnClearBasket").attr("href");Sana.UI.LoadingIndicator.show();$.post(n,{__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()},function(n){QuickOrder.clearSelection();BasketDetails.refreshBasket();n.Items&&Sana.GoogleTagManager.trackProductRemovals(n.Items,n.CustomerType)})}},cancelBasket:function(){BasketDetails.lastUpdateUrl=null;var n=$("#btnCancelBasket").attr("href");Sana.UI.LoadingIndicator.show();$.post(n,{__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()},function(){BasketDetails.refreshBasket()})},goToCheckout:function(n){BasketDetails.updateBasket({callback:function(t){Sana.GoogleTagManager.updateAdditionAndRemovals(t.data,function(){window.location.href=n.attr("href")})}})},updateBasket:function(n){var t=$("#basket"),i;if(t.valid()){if(i=t.serialize(),!i){n&&n.callback&&n.callback();return}return Sana.UI.LoadingIndicator.showAfter(400),$.ajax({url:t.attr("action"),data:i+"&save=true",type:"POST",success:function(t){Sana.UI.LoadingIndicator.hide();n&&n.callback&&n.callback(t);$(".msg-basket-recalculate").slideUp();$(".msg-block-error").remove()}})}},refreshBasket:function(){var n=$("#basketContent");url=BasketDetails.lastUpdateUrl||n.attr("data-src");Sana.UI.LoadingIndicator.show();$.post(url,function(t){var i=$(t.trim()).filter("#basketContent");n.replaceWith(i);BasketDetails.onBasketContentUpdate();$(".msg-basket-updated").slideToggle().delay(2500).slideToggle();Sana.UI.LoadingIndicator.hide()})},initCheckoutOffers:function(){$("#checkoutofferings").find("form").each(function(){$(this).attr("data-ajax-begin","Sana.UI.LoadingIndicator.show();");$(this).attr("data-ajax-success","BasketDetails.onBasketLinesUpdated")})},initQuickOrder:function(){var n=document.getElementById("quickOrder");n&&QuickOrder.init(n);$(QuickOrder).on("addQuickOrderLine",function(n,t){var i=$("#basket"),r,u,f,e,o;if(!i.valid()){$(".input-validation-error").focus();return}r=i.find('[name^="lines["]').map(function(n,t){return/lines\[(\d+)\]/g.exec(t.name)[1]});u=0;r.length>0&&(u=Math.max.apply(Math,r)+1);f=[];for(e in t)f.push({name:"lines["+u+"]."+e,value:t[e]});o=$("#basket tbody:first");BasketDetails.viewModel.quickOrderLine(f);Sana.UI.LoadingIndicator.show();$.ajax({url:i.attr("action"),data:BasketDetails.viewModel.getDataToSent(i)+"&save=false",type:"POST",success:function(n){o.html(n);BasketDetails.onBasketTableUpdate();$(".msg-basket-recalculate").slideDown();$(".list-totals .total-value, .gvi-basket .cell-total-value, .gvi-basket .cell-price-value").text("-");QuickOrder.setFocus();$(".msg-block-error").remove();Sana.UI.LoadingIndicator.hide()}})})},rowStyling:function(){$(".row-header").each(function(n,t){$(t).nextUntil(".upper-row").last().addClass("last-in-group")});$(".inner-row.row-service").each(function(n,t){$(t).prev().hasClass("upper-row")&&$(t).removeClass("row-state").find(".vertical-line").removeClass()});BasketDetails.viewModel.checkLines()},onBasketContentUpdate:function(){BasketDetails.rowStyling();Sana.UI.ActionButtons.refresh();Sana.UI.setValidationFor("#basket");Sana.UI.Tooltips.init(".shipping-cost");$("#basketContent").trigger("htmlUpdated")},onBasketTableUpdate:function(){BasketDetails.rowStyling();Sana.UI.ActionButtons.refresh();Sana.UI.refreshValidationFor("#basket");$("#basket").trigger("htmlUpdated")}},OrderTemplatePopup={id:"#saveOrderTemplatePopup",init:function(){$(document).on("click","#btnSaveOrderTemplate",function(n){if(n.preventDefault(),!BasketDetails.viewModel.isEmpty()){var t=$(this).attr("data-src");BasketDetails.updateBasket({callback:function(n){n&&BasketDetails.refreshBasket();OrderTemplatePopup.open(t)}})}})},open:function(n){Sana.UI.LoadingIndicator.hide();var t=$("#saveOrderTemplateBody");$.get(n,function(n){t.html(n);Popup.open(OrderTemplatePopup.id);t.find("input[type=text]:first-child").focus();Sana.UI.refreshValidationFor("#saveOrderTemplatePopup")})},close:function(){$(OrderTemplatePopup.id).dialog("close")}},OrderTemplateFeedBackPopup={open:function(n){Sana.UI.LoadingIndicator.hide();parseInt(n)==1&&(OrderTemplatePopup.close(),Popup.open("#saveOrderTemplateFeedbackPopup"))},beginSave:function(){Sana.UI.LoadingIndicator.show()}};$(function(){var t=document.getElementById("basketPage"),n;t&&(BasketDetails.init(),OrderTemplatePopup.init(),n=document.getElementById("basketContent"),n)&&ko.applyBindings(BasketDetails.viewModel,n)}),function(){function i(){var t=this;t.confirmDeletePopup="#deleteProductPopup";t.confirmDeleteAllPopup="#deleteAllProductsPopup";t.selectResolutionPopup="#selectImageResolutionPopup";t.imageDetailsDialog="#detailsProductPopup";t.errorPopup="#errorPopup";t.productId="";t.variantId="";t.searchTerm="";t.resolution="";t.subfolderPath="";t.images=new Set;t.nonProductImages=new Set;t.reset=function(){t.productId="";t.variantId="";t.resolution="";t.subfolderPath="";t.images=new Set;t.nonProductImages=new Set};t.downloadFile=function(n,t){window.location.assign(Sana.Urls.Home()+"media-database/download-file?filename="+n+"&source="+t)};t.download=function(){Sana.UI.LoadingIndicator.show();$.post(Sana.Urls.Home()+"media-database/download",{productId:t.productId,resolution:t.resolution,images:Array.from(t.images.values()).join(",")},function(i){t.downloadFile(i,"productMediaDatabase");Popup.close(n.selectResolutionPopup);Popup.close(n.imageDetailsDialog)}).fail(function(t){$("#errorTitle").html(t.responseJSON.title);t.responseJSON.message&&$("#errorMsg").html(t.responseJSON.message);Popup.open(n.errorPopup);Popup.close(n.selectResolutionPopup);Popup.close(n.imageDetailsDialog)}).always(function(){t.reset();Sana.UI.LoadingIndicator.hide()})};t.downloadNonProductImages=function(){Sana.UI.LoadingIndicator.show();$.post(Sana.Urls.Home()+"media-database/generate-non-product-images-archive",{selectedFolder:t.subfolderPath,images:Array.from(t.nonProductImages.values()).join(",")},function(n){t.downloadFile(n,"nonProductMediaDatabase")}).fail(function(t){$("#errorTitle").html(t.responseJSON.title);t.responseJSON.message&&$("#errorMsg").html(t.responseJSON.message);Popup.open(n.errorPopup)}).always(function(){Sana.UI.LoadingIndicator.hide()})};t.downloadNonProductFolder=function(){Sana.UI.LoadingIndicator.show();$.post(Sana.Urls.Home()+"media-database/generate-non-product-images-archive",{selectedFolder:t.subfolderPath},function(n){t.downloadFile(n,"nonProductMediaDatabase")}).fail(function(t){$("#errorTitle").html(t.responseJSON.title);t.responseJSON.message&&$("#errorMsg").html(t.responseJSON.message);Popup.open(n.errorPopup)}).always(function(){Sana.UI.LoadingIndicator.hide()})};t.openFolder=function(){if(Sana.UI.LoadingIndicator.show(),t.nonProductImages=new Set,!t.subfolderPath&&t.subfolderPath!==""){Sana.UI.LoadingIndicator.hide();return}$.get(Sana.Urls.Home()+"media-database/non-product-media-database",{selectedFolder:t.subfolderPath},function(n){$("#mediaDatabaseNonProductList").replaceWith(n);Sana.UI.LoadingIndicator.hide()})};t.downloadAll=function(){Sana.UI.LoadingIndicator.show();$.post(Sana.Urls.Home()+"media-database/download-all",{term:t.searchTerm,resolution:t.resolution},function(i){Popup.close(n.selectResolutionPopup);t.downloadFile(i,"productMediaDatabase")}).fail(function(t){$("#errorTitle").html(t.responseJSON.title);t.responseJSON.message&&$("#errorMsg").html(t.responseJSON.message);Popup.open(n.errorPopup);Popup.close(n.selectResolutionPopup)}).always(function(){t.reset();Sana.UI.LoadingIndicator.hide()})};t.deleteAll=function(){Sana.UI.LoadingIndicator.show();$.post(Sana.Urls.Home()+"media-database/delete-all",{},function(i){Popup.close(n.confirmDeleteAllPopup);t.replaceList(i);t.search("");document.getElementById("media-database-searchbox").value=""}).fail(function(t){$("#errorTitle").html(t.responseJSON.title);t.responseJSON.message&&$("#errorMsg").html(t.responseJSON.message);Popup.open(n.errorPopup);Popup.close(n.confirmDeleteAllPopup)}).always(function(){t.reset();Sana.UI.LoadingIndicator.hide()})};t.remove=function(){Sana.UI.LoadingIndicator.show();$.post(Sana.Urls.Home()+"media-database/delete",{term:t.searchTerm,productId:t.productId},function(i){Popup.close(n.confirmDeletePopup);t.replaceList(i)}).fail(function(t){$("#errorTitle").html(t.responseJSON.title);t.responseJSON.message&&$("#errorMsg").html(t.responseJSON.message);Popup.open(n.errorPopup)}).always(function(){t.reset();Sana.UI.LoadingIndicator.hide()})};t.search=function(i){Sana.UI.LoadingIndicator.show();t.searchTerm=i;$.get(Sana.Urls.Home()+"media-database/search",{term:i},function(n){t.replaceList(n);Sana.UI.LoadingIndicator.hide()}).fail(function(t){$("#errorTitle").html(t.responseJSON.title);t.responseJSON.message&&$("#errorMsg").html(t.responseJSON.message);Popup.open(n.errorPopup);Sana.UI.LoadingIndicator.hide()})};t.replaceList=function(n){$("#mediaDatabaseList").replaceWith(n);Sana.UI.responsiveImages.init()};t.showDetails=function(){Sana.UI.LoadingIndicator.show();$.get(Sana.Urls.Home()+"media-database/product-images",{productId:n.productId},function(t){$(n.imageDetailsDialog).html(t);Sana.UI.LoadingIndicator.hide();Popup.open(n.imageDetailsDialog,{afterClose:function(){n.images=new Set}})}).fail(function(t){$("#errorTitle").html(t.responseJSON.title);t.responseJSON.message&&$("#errorMsg").html(t.responseJSON.message);Popup.open(n.errorPopup);Sana.UI.LoadingIndicator.hide()})}}var t=document.getElementById("mediaDatabasePage"),n;t&&($(function(){function u(t){var i=t?t.tab:"productMediaDatabaseLink";Tabs.select("#"+i);i=="nonProductMediaDatabaseLink"&&(n.subfolderPath=t.folderPath,n.openFolder())}function i(){var t=location.href,n=new URL(t).searchParams;return{tab:n.has("tab")?n.get("tab"):"",folderPath:n.has("folderPath")?n.get("folderPath"):""}}function f(n){var t=new URLSearchParams("");n.tab&&t.append("tab",n.tab);n.folderPath&&t.append("folderPath",n.folderPath);history.pushState(n,(new Date).getTime(),"?"+t)}function e(n,t,i,r){t.has(i)?($(n.currentTarget).removeClass("selected"),t.delete(i)):($(n.currentTarget).addClass("selected"),t.add(i));t.size>0?$(r).removeClass("disabled"):$(r).addClass("disabled")}var t,o=1e3,r;$(document).on("keyup","#media-database-searchbox",function(){var i=$("#media-database-searchbox")[0].value;clearTimeout(t);t=setTimeout(n.search,o,i)});$(document).on("keydown","#media-database-searchbox",function(){clearTimeout(t)});$(document).on("click","#mediaDatabaseDownloadAll",function(t){t.preventDefault();$(".mediaDatabaseProductImagesDownload .btn").removeClass("disabled");Popup.open(n.selectResolutionPopup)});$(document).on("click","#mediaDatabaseProductImagesDownloadHigh",function(t){t.preventDefault();n.resolution="high";n.productId?n.download():n.downloadAll()});$(document).on("click","#mediaDatabaseProductImagesDownloadMedium",function(t){t.preventDefault();n.resolution="medium";n.productId?n.download():n.downloadAll()});$(document).on("click","#mediaDatabaseProductImagesDownloadLow",function(t){t.preventDefault();n.resolution="low";n.productId?n.download():n.downloadAll()});$(document).on("click",".media-database-download-btn",function(t){t.stopPropagation();$(".mediaDatabaseProductImagesDownload .btn").removeClass("disabled");n.productId=t.target.dataset.productId;var i=t.target.dataset.imagesCount;if(i>0){Popup.open(n.selectResolutionPopup);return}n.resolution="";n.download()});$(document).on("click",".mediaDatabaseNonProductImagesDownload",function(t){t.stopPropagation();n.downloadNonProductImages()});$(document).on("click",".media-database-non-product-download-btn",function(t){t.stopPropagation();n.subfolderPath=t.target.dataset.folderPath;n.downloadNonProductFolder()});$(document).on("click",".media-database-non-product-tile, .media-database-breadcrumb",function(t){t.stopPropagation();n.subfolderPath=t.target.dataset.folderPath;n.openFolder();var r=i();r.folderPath=n.subfolderPath;f(r)});$(document).on("click",".media-database-delete-btn",function(t){t.stopPropagation();n.productId=t.target.dataset.productId;Popup.open(n.confirmDeletePopup)});$(document).on("click","#mediaDatabaseDeleteAll",function(t){t.stopPropagation();Popup.open(n.confirmDeleteAllPopup)});$(document).on("click",".btn-confirm.btn-delete-confirm",function(){n.remove()});$(document).on("click",".btn-confirm.btn-delete-all-confirm",function(){n.deleteAll()});$(document).on("click",".media-database-tile",function(t){n.productId=t.currentTarget.dataset.productId;n.variantId=t.currentTarget.dataset.variantId;n.showDetails()});$(document).on("click",".mediaDatabaseProductImageTile",function(t){t.preventDefault();var i=t.currentTarget.dataset.productImageId;e(t,n.images,i,".mediaDatabaseProductImagesDownload .btn")});$(document).on("click",".media-database-img-selection",function(t){t.preventDefault();var i=t.currentTarget.dataset.imagePath;e(t,n.nonProductImages,i,".mediaDatabaseNonProductImagesDownload")});$(document).on("mouseup","#productMediaDatabaseLink, #nonProductMediaDatabaseLink",function(n){var t=i();t.tab=n.currentTarget.id;f(t)});$(window).on("popstate",function(n){var t=n.originalEvent.state;setTimeout(function(){u(t)},0)});r=i();u(r)}),n=new i,ko.applyBindings(n,t))}();NewsListPage=function(){var n={},t;return n.init=function(){var t=Paging.getTargetSelector();$(document).on("pagingChange",t,function(t,i){if(i.setCount){var r=$(".news-list [data-id]").length;Sana.History.setUrlParam("count",r)}n.refreshLines(i.newHtml)})},n.refreshLines=function(n){$(n).trigger("htmlUpdated")},t=function(){if(n._getLines().length>0)return Sana.UI.SelectionLost.open({})},n._getLines=function(){var n=$(".news-list > li");return $.map(n,function(){console.log(n)})},Sana.UI.Facets.onBeforeChange=t,Paging.onBeforeChange=t,n}();$(function(){var n=document.getElementById("news-list-panel");n&&NewsListPage.init()}),function(){function r(){var n=this,i=t();n.shippingChoice=ko.observable(i);n.goToNextStep=function(t){var c=$(".shipping-selection").find('select[name="ShippingAddressId"]').val(),e=$(t).validate(),s,h,f,i,r,o;if((e.form(),s=e.errorList.filter(function(n){return n.element.id.startsWith("ShippingAddress_")}).length,h=e.errorList.filter(function(n){return n.element.id.startsWith("ShippingAddressId")}).length,n.shippingChoice()!="custom"||!s)&&(n.shippingChoice()!=="selected"||!h)){f=$(t).serializeArray();i={__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()};switch(n.shippingChoice()){case"default":i.ShipToCustomAddress=!1;i.ShippingAddressId=$(".shipping-default").find('input[name="shippingValueDefault"]').val();break;case"selected":i.ShipToCustomAddress=!1;i.ShippingAddressId=c;break;case"custom":for(i.ShipToCustomAddress=!0,r=0;r<f.length;r++)f[r].name.indexOf("ShippingAddress.")>-1&&(i[f[r].name]=f[r].value)}return Sana.UI.LoadingIndicator.show(),o=function(){var n=$(t).attr("action");$.post(n,i)},Sana.GoogleTagManager.isAvaliable()?u(n.shippingChoice(),o):o(),!1}}}function u(n,t){for(var r=0,i=0,u=dataLayer.length;i<u;i++)if(dataLayer[i].event==="checkout"){r=dataLayer[i].ecommerce.checkout.actionField.step;break}Sana.GoogleTagManager.trackCheckoutOption(n,r,t)}var n=document.getElementById("orderAdressPage"),t,i;n&&(t=function(){var n="default",t=$(".shipping-selection").attr("data-initial"),i=$(".shipping-custom").attr("data-initial");return t&&(n="selected"),i&&(n="custom"),n},i=new r,ko.applyBindings(i,n))}(),function(){function i(n){this.OrderId=n.OrderId;this.PlacedBy=n.PlacedBy;this.OrderDate=n.OrderDate;this.OrderAmount=n.OrderAmount;this.AuthorizationStatus=n.AuthorizationStatus;this.cssAuthorizationStatus=n.AuthorizationStatus?"status-"+n.AuthorizationStatus.toLowerCase():"";this.AuthorizationStatusTitle=n.AuthorizationStatusTitle;this.Url=n.Url}function r(){var n=this,t;n.loaded=ko.observable(!1);n.loading=ko.observable(!1);t=function(t){n.loading(!0);Sana.UI.LoadingIndicator.show();var r=n.filter.toJSON();r.__RequestVerificationToken=Sana.Utils.getAntiForgeryToken();$.post(document.location.href,r,function(r){var u=ko.utils.arrayMap(r.Items,function(n){return new i(n)});t(u);n.loaded(!0);n.hasMore(n.orders().length<r.TotalCount);n.loading(!1);Sana.UI.LoadingIndicator.hide()});n.filter.page++};n.orders=ko.observableArray([]);n.empty=ko.computed(function(){return n.orders().length==0});n.filter={page:0,OrderId:ko.observable(),AuthorizationStatus:ko.observable(),StartDate:ko.observable(),EndDate:ko.observable(),toJSON:function(){return{page:this.page,OrderId:this.OrderId(),AuthorizationStatus:this.AuthorizationStatus(),StartDate:this.StartDate(),EndDate:this.EndDate()}}};n.hasMore=ko.observable(!1);n.search=function(){n.filter.page=0;t(function(t){n.orders(t)})};n.loadMore=function(){t(function(t){ko.utils.arrayPushAll(n.orders,t)})}}var t=document.getElementById("authorizationHistoryPage"),n;t&&(n=new r,$(function(){var i=$("#"+t.id);n.filter.OrderId(i.find('input[name="filter.OrderId"]').val());n.filter.StartDate(i.find('input[name="filter.StartDate"]').val());n.filter.EndDate(i.find('input[name="filter.EndDate"]').val());n.filter.AuthorizationStatus(i.find('select[name="filter.AuthorizationStatus"]').val());ko.applyBindings(n,t);n.search();$(".gvi-orders").resTables()}))}();OrderDetails={init:function(){OrderDetails.convertUtcDatesToLocal();$(document).on("click",".authorization-cancel-link",function(){Popup.open("#authorizationCancelPopup")});$(document).on("click",".orders-details-page .btn-continue-promote",function(){Popup.close("#productsInsufficientQuantity");Sana.UI.LoadingIndicator.show();document.getElementById("quotePromotionForm").submit()});$(document).on("click","#orderHistoryDetailPage .btn-decline-order",function(){Popup.open("#orderBeforeDeclinedPopup")});var n=$(".gvi-order-lines"),t=$(".show-hide-mode");if(!t.length){n.resTables();return}t.show();n.toggleClass("expanded collapsed");$(document).on("click",".toggle-hyp-inside .hyp",function(){n.toggleClass("expanded collapsed")});$(document).on("click","#btnLoadOrderLines",function(t){t.preventDefault();var i=$(this).attr("href");i&&(Sana.UI.LoadingIndicator.show(),$.ajax({url:i,cache:!1,success:function(t){n.html(t).resTables().toggleClass("expanded collapsed").find("tfoot").show();$("#btnLoadOrderLines").hide();$(".toggle-hyp-inside").show();Sana.UI.LoadingIndicator.hide()}}))})},beforePromote:function(n){var r=n.getAttribute("data-only-confirmation"),t,i;return r?(Popup.open("#quotePromotionConfirmationPopup"),!1):(t=n.getAttribute("data-instock"),t)?(Sana.UI.LoadingIndicator.show(),!0):(i=n.getAttribute("data-checkstock"),i)?(Popup.open("#quoteCannotBePromoted"),!1):(Popup.open("#productsInsufficientQuantity"),!1)},onAuthorizationApproved:function(n){$("#orderAuthorizationFormWrapper").html(n);OrderDetails.convertUtcDatesToLocal();var t=$("#orderAlreadyApproved").length;if(t){Popup.open("#orderAlreadyApproved");$(document).on("click",".authorization-cancel-link",function(){Popup.close("#orderAlreadyApproved")})}else Popup.open("#orderAfterApprovedPopup")},onAuthorizationDeclined:function(n){Popup.close("#orderBeforeDeclinedPopup");$("#orderAuthorizationFormWrapper").html(n);OrderDetails.convertUtcDatesToLocal();var t=$("#orderAlreadyDeclined").length;if(t){Popup.open("#orderAlreadyDeclined");$(document).on("click",".authorization-cancel-link",function(){Popup.close("#orderAlreadyDeclined")})}else Popup.open("#orderAfterDeclinedPopup")},onAuthorizationCancelled:function(n){Popup.close("#authorizationCancelPopup");$("#orderAuthorizationFormWrapper").html(n);OrderDetails.convertUtcDatesToLocal()},convertUtcDatesToLocal:function(){$(".date-utc").each(function(n,t){var i=$(t),r=new Date(i.text());i.text(r.toLocaleDateString())});$(".time-utc").each(function(n,t){var r=$(t),u=new Date(r.text()),i=u.toLocaleTimeString();i=i.replace(/\u200E/g,"");i=i.replace(/^([^\d]*\d{1,2}:\d{1,2}):\d{1,2}([^\d]*)$/,"$1$2");r.text(i)})},onReorder:function(n){if(n&&n.Count){var t=n.Url?function(){location.href=n.Url}:undefined;Sana.GoogleTagManager.trackProductAddition(n.Items,n.ActionField,n.CustomerType,t)}Sana.UI.LoadingIndicator.hide()}};$(function(){var n=document.getElementById("orderHistoryDetailPage");n&&OrderDetails.init()}),function(){function u(n){this.OrderId=n.OrderId;this.DocumentId=n.DocumentId;this.DocumentDate=n.DocumentDate;this.BillToName=n.BillToName;this.ShipToName=n.ShipToName;this.OrderType=n.OrderType;this.TotalAmount=n.TotalAmount;this.OutstandingAmount=n.OutstandingAmount;this.OrderStatus=n.OrderStatus;this.OrderStatusTitle=n.OrderStatusTitle;this.Url=n.Url;this.ShippingTrackingText=n.ShippingTrackingText;this.ShippingTrackingUrl=n.ShippingTrackingUrl;this.DueDate=n.DueDate;this.QuoteStatus=n.QuoteStatus;this.QuoteStatusTitle=n.QuoteStatusTitle;this.ReferenceNumber=n.ReferenceNumber;this.trackingText=n.ShippingTrackingText;this.isSelected=ko.observable();this.actionState=function(n){return this.OutstandingAmountValue<=0?{icon:"status-paid",title:t.actionTitlePaid,template:"action-static-template"}:this.IsOverdue?{icon:"status-overdue",title:t.actionTitleOverdue,template:"action-static-template"}:this.PaymentStatus==="inprogress"?{icon:"status-progress",title:t.actionTitleProgress,template:"action-static-template"}:n&&n!==this.CurrencyId?{isEnabled:!1,title:t.actionTitleCurrencyMismatch,template:"action-dynamic-template"}:{isEnabled:!0,template:"action-dynamic-template"}}}function f(){var t=this,i;t.loaded=ko.observable(!1);t.loading=ko.observable(!1);i=function(n){t.loading(!0);Sana.UI.LoadingIndicator.show();var i=t.filter.toJSON();i.__RequestVerificationToken=Sana.Utils.getAntiForgeryToken();$.post(document.location.href,i,function(f){var e=ko.utils.arrayMap(f.Items,function(n){return new u(n)});n(e);t.loaded(!0);t.hasMore(t.orders().length<f.TotalCount);t.hiddenColumns(r[i.OrderType]||[]);t.loading(!1);Sana.UI.LoadingIndicator.hide()});t.filter.page++};t.orders=ko.observableArray([]);t.empty=ko.computed(function(){return t.orders().length==0});t.filter={page:0,OrderType:$(n).find('input[name="filter.OrderType"]').val(),OrderId:ko.observable($(n).find('input[name="filter.OrderId"]').val()),DocumentId:ko.observable($(n).find('input[name="filter.DocumentId"]').val()),StartDate:ko.observable($(n).find('input[name="Filter.StartDate"]').val()),EndDate:ko.observable($(n).find('input[name="Filter.EndDate"]').val()),toJSON:function(){return{page:this.page,OrderId:this.OrderId,DocumentId:this.DocumentId,OrderType:this.OrderType,StartDate:this.StartDate,EndDate:this.EndDate}}};t.isChildOrderType=ko.computed(function(){var n=t.filter.OrderType;return n!="Order"&&n!="Quote"});t.hiddenColumns=ko.observableArray([]);t.hasMore=ko.observable(!1);t.search=function(){$(n).find("form").valid()&&(t.filter.page=0,i(function(n){t.orders(n)}))};t.loadMore=function(){i(function(n){$.each(n,function(){t.orders.push(this)})})};t.columnVisible=function(n){return t.hiddenColumns.indexOf(n)<0};t.selectedDocuments=ko.computed(function(){return _.filter(t.orders(),function(n){return n.isSelected()})});t.isPaymentAvailable=ko.computed(function(){return t.selectedDocuments().length>0});t.outstandingAmountTotal=ko.computed(function(){return t.selectedDocuments().map(function(n){return n.OutstandingAmountValue}).reduce(function(n,t){return Number(n)+Number(t)},0)});t.currencyOfSelectedOrders=ko.computed(function(){var n=t.selectedDocuments();return n.length?n[0].CurrencyId:null});t.pay=function(n){var i=t.selectedDocuments().map(function(n){return{OrderId:n.Id,OriginalOrderId:n.OriginalOrderId}});Sana.UI.LoadingIndicator.show();$.post(n,{documents:i,__RequestVerificationToken:Sana.Utils.getAntiForgeryToken()}).done(function(n){n.redirectUrl&&(document.location.href=n.redirectUrl)}).fail(function(){Sana.UI.LoadingIndicator.hide();var n=$(".msg-pay-invoices-error");n.removeClass("hide");setTimeout(function(){n.addClass("hide")},1e4)})};t.afterApply=function(){t.search();$(".gvi-orders").resTables();$(document).on("change",".tbx-date input",function(){$(this).valid()})}}var n=document.getElementById("orderHistoryPage")||document.getElementById("quoteHistoryPage")||document.getElementById("invoicesHistoryPage")||document.getElementById("rmaHistoryPage")||document.getElementById("returnReceiptsHistoryPage")||document.getElementById("creditNotesHistoryPage")||document.getElementById("shipmentsHistoryPage"),r,t,i;n&&(r={Order:["DocumentId","ShipToName","OutstandingAmount","QuoteStatus"],Quote:["DocumentId","ShipToName","OutstandingAmount","OrderStatus","ReferenceNumber"],Invoice:["ShipToName","OrderStatus","QuoteStatus","ReferenceNumber"],Shipment:["TotalAmount","OutstandingAmount","OrderStatus","QuoteStatus","ReferenceNumber"],ReturnReceipt:["TotalAmount","OutstandingAmount","OrderStatus","QuoteStatus","ReferenceNumber"],CreditNote:["ShipToName","OrderStatus","QuoteStatus","ReferenceNumber"]},t=JSON.parse($("#data-texts").text()||"{}"),i=new f,ko.applyBindings(i,n),$(i.afterApply))}();OrderOverview={init:function(){var n=document.getElementById("submitOrderPage")||document.getElementById("submitQuotePage"),t;if(n){$(document).on("click",".btn.add-promotion",function(n){var t,i;n.preventDefault();t=$("#txtPromotionCode").val();Sana.UI.LoadingIndicator.show();i=$("#promotionForm").data("src");$.post(i,{code:t,__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()},function(n){var i=n,t=$("#leftUntilFreeShippingMessage"),r=$("#noFreeShipping"),u=$("#freeShipping"),f;t.data("should-generally-display")==="True"&&(t.empty(),i.isBelowFreeShippingPrice?(t.append(i.message),t.css("display","block"),r.css("display","block"),u.css("display","none")):(t.css("display","none"),r.css("display","none"),u.css("display","block")));f=$("#promotionForm").data("get-basket-url");$.post(f,function(n){var i=$(n.trim()),t=$("#basketContent");t.empty();t.append(i);$(".msg-basket-updated").slideToggle().delay(2500).slideToggle();$("#promotionForm").hide().find("input").val("");$(".hyp-discount").show();Sana.UI.LoadingIndicator.hide();t.trigger("htmlUpdated")})})});$(document).on("click",".hyp-discount",function(){$(this).hide().next("#promotionForm").show().find("input").focus()});$(document).on("click",".toggle-hyp-inside .hyp",function(){var n=$(".gvi-big-basket"),t=n.find("tbody:first"),i;if(t.children("tr").length==0){Sana.UI.LoadingIndicator.show();i=n.attr("data-src");$.post(i,function(i){t.html(i);Sana.UI.LoadingIndicator.hide();n.toggleClass("expanded collapsed")});return}n.toggleClass("expanded collapsed")});$(document).on("change",".additional-info input, .additional-info textarea",function(){$(this).valid()});$(".shipping-cost").removeAttr("title").find(".tooltip-sign").remove();$(".gvi-basket-overview").resTables();t=new OrderOverviewViewModel;ko.applyBindings(t,n)}}};OrderOverview.init(),function(){function i(){var n=this,i=$(".gvi-order-templates").data("open-action"),t;n.checkedValues=ko.observableArray([]);n.showValidation=ko.observable(!1);n.anyIsChecked=ko.computed(function(){return n.checkedValues().length>0});n.checkedValues.subscribe(function(){n.showValidation(!1)});t=function(t,i){if(!n.anyIsChecked()){n.showValidation(!0);return}var r=$("#orderTemplatesPage form"),u=r.serializeArray();u.push({name:"__RequestVerificationToken",value:$('input[name="__RequestVerificationToken"]:first').val()});t||(t=r.attr("action"));Sana.UI.LoadingIndicator.show();$.ajax({url:t,type:"post",data:u,success:function(n){Sana.UI.LoadingIndicator.hide();var t=$("#messagesPopup").html(n).find(".btn-close-dialog");i&&i();Popup.open("#messagesPopup",{afterClose:function(){window.location.href=t.attr("href")}})}})};n.submit=function(){t(undefined,function(){var t=$("#messagesPopup [data-tracking-data]"),n=t.data("tracking-data");n&&n.Count&&Sana.GoogleTagManager.trackProductAddition(n.Items,n.ActionField,n.AccountType)})};n.remove=function(n,i){t($(i.target).attr("data-action"))};n.openTemplate=function(n,t){Sana.UI.LoadingIndicator.show();var u=$(t.target),r=$("#detailsPopup");r.load(i,{templateId:u.attr("data-id")},function(){Sana.UI.LoadingIndicator.hide();Popup.open(r)})}}var n=document.getElementById("orderTemplatesPage"),t;n&&(t=new i,ko.applyBindings(t,n))}(),function(){var n=$("#paymentPage"),t;n.length!=0&&(t=$("#totalPrice",n),$('input[name="MethodId"]',n).change(function(){var n=$(this).data("total-amount");t.text(n)}))}();$(function(){var n=document.getElementById("orderPaymentPage");n&&Sana.UI.Tooltips.init(".checkout-text")});ProductDetails={init:function(){function t(n,t){var i=t.pageX-n.width()/2;i<0&&(i=0);n.css("left",i);n.css("top",t.pageY-n.height()-50)}function n(n){var t=n.data("popup-id");return $("#"+t)}Sana.UI.priceStyle(".order-box");this.imageControls.init();this.dropdowns.init();this.matrix.init();this.prepacks.init();Sana.UI.tabsSliderHorizontal.init();Sana.UI.ActionLinks.AddToWishlist.init();Sana.UI.ActionLinks.AddToMediaDatabase.init();this.initUom();this.lightboxImageSlider.init();this.elementsRelocation();$(document).on("click",".hyp-volume-prices",function(n){n.preventDefault();Sana.UI.LoadingIndicator.show();var t=$(this),i=t.attr("href"),r=t.attr("data-productid");$.post(i,{productId:r},function(n){$("#volumePricesPopup").html(n);Popup.open("#volumePricesPopup");$(".gvi-volume-prices").resTables();Sana.UI.LoadingIndicator.hide()})});$(document).on("click",".hyp-bom",function(){$(".gvi-bom").resTables();Popup.open("#bomPopup")});var i=Paging.getTargetSelector();$(document).on("pagingChange",i,function(n,t){$(t.newHtml).find("input.star").rating()});Sana.History.backButton(".hyp-back","returnurl");$(".drpvariants")!=undefined&&$(".drpvariants").trigger("change");$(document.body).append($(".perfion-technology-popup"));$(document).on("mouseenter",".perfion-technology",function(i){var r=n($(this));r.show();t(r,i)});$(document).on("mousemove",".perfion-technology",function(i){var r=n($(this));t(r,i)});$(document).on("mouseleave",".perfion-technology",function(){var t=n($(this));t.hide()})},initUom:function(){var i=window.location.href,n=".order-box",t;if($(n).length){t=function(){ProductDetails.dropdowns.init();Sana.UI.Selects.init();Sana.UI.priceStyle(n)};$(document).on("change","select[name=unitOfMeasureId]",function(){var n=$(this);ProductDetails.dropdowns.rememberSelection();Sana.UI.LoadingIndicator.show();$.ajax(i,{type:"POST",data:{unitOfMeasureId:n.val()}}).done(function(i){Sana.Utils.replaceElements(i);t();$("aside #addToWishlist").attr("data-uom",n.val());Sana.UI.LoadingIndicator.hide()})})}},imageControls:{cssMediumRoot:".carousel-image-m-wrapper",cssSmallRoot:".carousel-image-s-wrapper",instanceMedium:null,isSingleImage:function(){return!$(ProductDetails.imageControls.cssSmallRoot).length},checkLegendFor:function(){var n=$(ProductDetails.imageControls.cssMediumRoot).data("touchCarousel"),t=n?n._currPageId:0,i=!!$(ProductDetails.imageControls.cssMediumRoot).find(".carousel-image-m-item").eq(t).find("img").attr("data-zoom-image");$(".carousel-legend").toggleClass("invisible",!i)},init:function(){var n=!0;Sana.Layout.addFunction(function(){n&&(n=!1,ProductDetails.imageControls.initMediumCarousel(),ProductDetails.imageControls.initSmallCarousel(),Sana.Layout.touch||Zoom.init(ProductDetails.imageControls.cssMediumRoot,".carousel-image-m-item"))},"ALL");ProductDetails.imageControls.checkLegendFor();$(ProductDetails.imageControls.cssMediumRoot).on("onAnimComplete",function(){ProductDetails.imageControls.checkLegendFor()});window.setTimeout(function(){Sana.UI.responsiveImages.refresh()},100)},initMediumCarousel:function(){if(!ProductDetails.imageControls.isSingleImage()){var n=$(ProductDetails.imageControls.cssMediumRoot);n.addClass("touchcarousel").children().addClass("touchcarousel-container").children().addClass("touchcarousel-item");ProductDetails.imageControls.instanceMedium=n.touchCarousel({pagingNav:!0,scrollbar:!1,directionNavAutoHide:!1,itemsPerMove:1,loopItems:!0,directionNav:!1,autoplay:!1,autoplayDelay:2e3,transitionSpeed:400,onBeforeDragStart:function(n){Sana.Layout.layout==="MOBILE"||Sana.Layout.touch||(this._successfullyDragged=!1,n.carouselDisabled=!0)},onAnimComplete:function(){Sana.UI.responsiveImages.refresh();$(this.carouselRoot).trigger("onAnimComplete")}}).data("touchCarousel");$(ProductDetails.imageControls.cssSmallRoot).on("scCarousel.onBeforeAnimation",function(){var t=ProductDetails.imageControls.instanceMedium._currPageId,n=$(this).scCarousel("getCurrentId");t!==n&&(ProductDetails.imageControls.instanceMedium.goTo(n),ProductDetails.imageControls.update(t,n))})}},initSmallCarousel:function(){if(!ProductDetails.imageControls.isSingleImage()){$(ProductDetails.imageControls.cssSmallRoot).scCarousel();$(ProductDetails.imageControls.cssMediumRoot).on("onAnimComplete",function(){var t=$(ProductDetails.imageControls.cssSmallRoot).scCarousel("getCurrentId"),n=$(this).data("touchCarousel")._currPageId;t!==n&&($(ProductDetails.imageControls.cssSmallRoot).scCarousel("goTo",n),ProductDetails.imageControls.update(t,n))})}},selectImageByTags:function(n){var i,t,r,u,f;ProductDetails.imageControls.instanceMedium&&(i=$(".carousel-image-m-item").map(function(t){return{index:t,matchingTags:Sana.Utils.intersect(n,ProductDetails.getImageTags($(this))).length}}).filter(function(n,t){return t.matchingTags>0}),t=Sana.Utils.groupBy(i,function(n){return n.matchingTags}).sort(function(n,t){return t.key-n.key}).map(function(n){return n.value})[0],t&&t.length>0&&(r=ProductDetails.imageControls.instanceMedium._currPageId,u=t.filter(function(n){return n.index===r})[0],u||(f=t[0].index,ProductDetails.imageControls.instanceMedium.goTo(f))))},update:function(n,t){if(n!==t){var i=$(ProductDetails.imageControls.cssMediumRoot).find("li.carousel-image-m-item")[t];ProductDetails.dropdowns.selectVariantByTags(ProductDetails.getImageTags($(i)))}}},lightboxImageSlider:{instance:null,init:function(){var t=document.getElementById("lightboxSlider"),n;t&&(ProductDetails.lightboxImageSlider.setContainerDimension(),n={$SlideSpacing:25,$ArrowNavigatorOptions:{$Class:$JssorArrowNavigator$,$ChanceToShow:2,$AutoCenter:2,$Scale:!1},$BulletNavigatorOptions:{$Class:$JssorBulletNavigator$,$ChanceToShow:2,$AutoCenter:1,$SpacingX:20,$SpacingY:20,$Scale:!1}},ProductDetails.lightboxImageSlider.instance=new $JssorSlider$("lightboxSlider",n),ProductDetails.lightboxImageSlider._bindEvents())},setContainerDimension:function(){var n=$(window).width()+Sana.Utils.getScrollbarSize(),t=$(window).height();$(".slider-wrapper, .slider-list").width(n).height(t)},_bindEvents:function(){var n=ProductDetails.lightboxImageSlider.instance,t=function(){var i=$(n.$Elmt).parent(),t={w:i.width(),h:i.height()},r={w:n.$ScaleWidth(),h:n.$ScaleHeight()},u=t.w-r.w<=t.h-r.h;t.w&&t.w>0&&(u?n.$ScaleWidth(t.w):n.$ScaleHeight(t.h))},i=function(t){var r=$(ProductDetails.imageControls.cssSmallRoot).scCarousel("getCurrentId"),u=$(".carousel-image-m-item").eq(r).find("img").attr("data-zoom-image"),i=$('[u="slides"]:last',n.$Elmt).find('[src="'+u+'"]').parent().index();i!=-1&&(n.$GoTo(i-1),t())};$(".carousel-image-m-wrapper").on("click.lightbox",function(){Sana.Layout.layout!="MOBILE"&&i(function(){$(".hyp-lightbox").magnificPopup("open")})});$(".hyp-lightbox").magnificPopup({preloader:!1,alignTop:!0,overflowY:"hidden",callbacks:{open:function(){i(t)}}});$(window).bind("load",$.debounce(50,t));$(window).bind("resize",$.debounce(50,t));$(window).bind("orientationchange",$.debounce(50,t))}},dropdowns:{_selectedComponents:null,_selectedSize:null,_rootSelector:".product",_getComponentDropdowns:function(){return $(".order-box .ddlb-component select",this._rootSelector)},init:function(){function e(n,t){var r=n.selectmenu("instance"),i=r.button.find("span.ui-icon");t?i.hide():i.show();n.selectmenu("option","disabled",t);n.prop("disabled",!1)}var u=this._getComponentDropdowns(),t,f,n,i,r;if(u.size()==0){ProductDetails.filterRetailOffers(null);return}t=this._selectedComponents;t==null&&(f=Sana.Utils.getQueryVariable("v"),f&&(t=f.split(",")));n=null;i=$(u[0]);u.each(function(i){var r=$(this);n!=null&&r.dependent_on(n);t&&r.val(t[i]);n=r});ProductDetails.dropdowns.update(n);r=this;n.change(function(){ProductDetails.dropdowns.update($(this));r._selectedSize=$(this).find("option:selected").text().trim()});e(i,i.find("option").length<2);e(n,n.find("option").length<2);i.change(function(){var t,i;r._selectedSize&&(t=n.find("option"),e(n,t.length<2),i=t.filter(function(n){return $(n).text().trim()===r._selectedSize})[0],i&&n.val(i.val()))})},rememberSelection:function(){this._selectedComponents=this._getComponentDropdowns().map(function(){return $(this).val()})},selectVariantByTags:function(n){var t=this._getComponentDropdowns();t.size()!==0&&ProductDetails.dropdowns.selectOptionByImageTags($(t[0]),n)&&ProductDetails.dropdowns.selectOptionByImageTags($(t[1]),n)},selectOptionByImageTags:function(n,t){var u=n.find("option"),f=u.map(function(){return Sana.Utils.intersect(t,ProductDetails.getImageTags($(this))).length}),e=Sana.Utils.indecesOfMax(f),r,i;return e.indexOf(n.prop("selectedIndex"))!==-1?!0:(r=e[0],f[r]>0&&(i=$(u[r]).val()),i&&i!==n.val()&&(n.val(i),n.selectmenu("refresh"),n.trigger("change")),i)?!0:!1},update:function(n){var t=n.find("option:selected");ProductDetails.dropdowns.updatePrice(t.attr("data-price"),t.attr("data-listprice"));ProductDetails.dropdowns.updateDiscount(t.attr("data-discount"));ProductDetails.dropdowns.updateInventory(t.attr("data-inventory"),t.attr("data-availabledate"));ProductDetails.imageControls.selectImageByTags(ProductDetails.getImageTags(t));ProductDetails.filterRetailOffers(t.attr("value"));ProductDetails.dropdowns.updateOrderability(t.is("[data-not-orderable]"))},updateInventory:function(n){var t=parseFloat(n);$(".stock-row",this._rootSelector).each(function(){var n=$(this),r=parseFloat(n.attr("data-min")),u=parseFloat(n.attr("data-max")),i=t<=r||t>u;n.toggleClass("hide",i);i||n.find(".stock-amount").text(t)})},updatePrice:function(n,t){$(".main .prices-action-inner .lbl-price",this._rootSelector).text(n);var i=t&&n!=t;$(".main .list-price",this._rootSelector).toggleClass("hide",!i).html(i?t:"&nbsp;");Sana.UI.priceStyle(".order-box")},updateDiscount:function(n){n&&n!=""?($("#productDiscountText2").css("display","table-cell"),$("#productDiscountText2 .label").text(n),$("#productDiscountText").length>0&&$("#productDiscountText").css("display","none")):$("#productDiscountText2").css("display","none")},updateOrderability:function(n){$(".order-box").toggleClass("state-variant-not-available",n)},onBeforeAddToBasket:function(){var t=$('.tbx-quantity input[name="quantity"]',this._rootSelector),n=parseFloat(t.val());return!n||isNaN(n)?!1:BasketSummary.onBeforeChange()}},filterRetailOffers:function(n){var t=$("#retailOffers");$("div[data-variant]",t).each(function(){var t=$(this),i=t.attr("data-variant");i==""||i==n?t.show():t.hide()});t.show();t.find("div:visible").length==0&&t.hide()},matrix:{init:function(){$(document).on("click",".btn-matrix",function(){$("#matricesPopup").off("dialogopen.stickyhead");$("#matricesPopup").on("dialogopen.stickyhead",function(){Matrix.makeHeadersSticky()});Popup.open("#matricesPopup",{dialogClass:"matrices"})});Matrix.staticMode.init()}},prepacks:{formSelector:"#prepacksForm",init:function(){var n=Sana.Utils.getQueryVariable("pack");n&&$(".ddlb-prepack-selector select").val(n);$("#verticalCode").change(function(){ProductDetails.prepacks.onVariantChange()});$(this.formSelector+" input.numeric").change(function(){ProductDetails.prepacks.onQuantityChange()});$(this.formSelector+" button[type='submit']").click(function(n){ProductDetails.prepacks.onSubmit(n)});this.updatePrices()},validators:{selector:"#prepacksValidationMsg",check:function(n){return n>0},showMessage:function(n){$(this.selector).toggleClass("hide",!n)}},onVariantChange:function(){this.updatePrices()},onQuantityChange:function(){this.updateTotalQuantity();this.validators.showMessage(!$("#prepacksForm").valid())},onSubmit:function(n){var t=this.calcTotalQuantity();this.validators.check(t)?Popup.close("#matricesPopup"):(this.validators.showMessage(!0),n.preventDefault())},onBasketChanged:function(n){BasketSummary.onChanged($("#prepackTotalCnt").html());if($(ProductDetails.prepacks.formSelector+" input.numeric").val(""),ProductDetails.prepacks.updateTotalQuantity(),n&&n.Count){var t=n.Url?function(){location.href=n.Url}:undefined;Sana.GoogleTagManager.trackProductAddition(n.Items,n.ActionField,n.CustomerType,t)}},updatePrices:function(){var r=$("#verticalCode").val(),t=$(this.formSelector).find("table.gvi-prepacks tbody"),i=t.find("tr"),n;i.hide();i.find(":input").prop("disabled",!0);n=t.find("tr[data-src='"+r+"']");n.show();n.find(":input").prop("disabled",!1);$(this.formSelector).find(".numeric").val("").change()},updateTotalQuantity:function(){var n=$("#prepackTotalCnt"),t=n.parents(".prepacks-count"),i=this.calcTotalQuantity();if(isNaN(i)){t.hide();return}n.html(i);t.show()},calcTotalQuantity:function(){if(!$("#prepacksForm").valid())return NaN;var n=0;return $(this.formSelector+" input.numeric").each(function(){n+=Number(this.value)}),n=Sana.Utils.roundQuantity(n)}},elementsRelocation:function(){var t=$(".details-info").find("h1, .product-id"),i=$(".details-img").find(".add-this"),r=$(".details-img").find(".new-item"),u=$(".details-img").find("#productDiscountText"),n="";$(".details-img").find("#productDiscountText2").length>0&&(n=$(".details-img").find("#productDiscountText2"));Sana.Layout.addFunction(function(){t.prependTo(".details-img");i.insertAfter(".product .main");r.prependTo(".carousel-image-m-wrapper");u.prependTo(".carousel-image-m-wrapper");n!=""&&n.prependTo(".carousel-image-m-wrapper")},"MOBILE");Sana.Layout.addFunction(function(){t.prependTo(".details-info");r.insertBefore(".carousel-image-m-wrapper");u.insertBefore(".carousel-image-m-wrapper");n!=""&&n.insertBefore(".carousel-image-m-wrapper");i.appendTo(".details-img")},"TABLET");Sana.Layout.addFunction(function(){t.prependTo(".details-info");r.insertBefore(".carousel-image-m-wrapper");u.insertBefore(".carousel-image-m-wrapper");n!=""&&n.insertBefore(".carousel-image-m-wrapper");i.appendTo(".details-img")},"DESKTOP")},onBasketChanged:function(n){BasketSummary.onChanged(n.Count);var t=n.Url?function(){location.href=n.Url}:undefined;Sana.GoogleTagManager.trackProductAddition(n.Items,n.ActionField,n.CustomerType,t)},getImageTags:function(n){return Sana.Utils.toLowerCaseArray((n.data("image-tags")||"").split(" "))}};$(function(){var n=document.getElementById("productPage");n&&ProductDetails.init()});ProductListPage=function(){var n={};return n.init=function(){Sana.UI.priceStyle(".product-list");Sana.UI.Sorting.init();Sana.UI.Facets.init();var t=Paging.getTargetSelector();$(document).on("pagingChange",t,function(t,i){if(i.setCount){var r=$(".product-list [data-id]").length;Sana.History.setUrlParam("count",r)}n.refreshLines(i.newHtml);Sana.UI.Sorting.init()});n.initOrderMode();Sana.Layout.addFunction(function(){n.mobileLayout()},"MOBILE");Sana.Layout.addFunction(function(){$(".filters-wrapper").prependTo(".column-facets");$(".facets").show()},"TABLET");Sana.Layout.addFunction(function(){$(".filters-wrapper").prependTo(".column-facets");$(".facets").show()},"DESKTOP")},n.refreshLines=function(n){Sana.UI.Selects.init(n);Sana.UI.priceStyle(n);Sana.UI.setValidationFor(n);$(n).trigger("htmlUpdated")},n.initOrderMode=function(){var i="#btnQuickOrderTop, #btnQuickOrderBottom",t;if($(i).length!=0){$(document).on("click",i,function(){n._addToBasket()});n.changeAddButtonVisibility();$(document).on("keydown",".form-quantity",function(t){if(t.which==13)return n._addToBasket(),!1});t=function(){if(n._getLines().length>0)return Sana.UI.SelectionLost.open({successCallback:n._addToBasket})};Sana.UI.Sorting.onBeforeChange=t;Sana.UI.Facets.onBeforeChange=t;Paging.onBeforeChange=t;$(document).on("change",".product-list > li select[name=unitOfMeasureId]",function(){n._onUnitOfMeasureChanged($(this))});$(document).off("click",".edit-selected").on("click",".edit-selected",function(){$(this).closest("form").submit()})}},n.changeAddButtonVisibility=function(){var n=function(){var n=$(".product-list > li"),t=$(".btn-add-inside"),i=n.find(".tbx-quantity, .select-variants .btn");t.toggle(!!i.length)};$(document).on("htmlUpdated",".product-list",n);n()},n.getVariants=function(n){var t=n.val();return t!=""&&typeof t!="undefined"?$.evalJSON(t):null},n._addToBasket=function(){var t,i;if(Sana.UI.validateForms($(".form-quantity")))return t=n._getLines(),t.length>0?(i=$("#btnQuickOrderTop").attr("data-src"),$.ajax({url:i,type:"post",data:$.toJSON(t),contentType:"application/json",beforeSend:function(){BasketSummary.onBeforeChange()},success:function(t){n._clearSelection();BasketSummary.onChanged(t.Count);if(t.Count){var i=t.Url?function(){location.href=t.Url}:undefined;Sana.GoogleTagManager.trackProductAddition(t.Items,t.ActionField,t.CustomerType,i)}}})):void 0},n.onAddedToBasket=function(n){if(n&&n.Count){BasketSummary.onChanged(n.Count);var t=n.Url?function(){location.href=n.Url}:undefined;Sana.GoogleTagManager.trackProductAddition(n.Items,n.ActionField,n.CustomerType,t)}},n._getLines=function(){var t=$(".product-list > li");return $.map(t,function(t){var r=$(t).attr("data-id"),u=$(t).find("input[name^=product_quantity]").val(),f=$(t).find("select[name=unitOfMeasureId]").val(),i=Number(u);return i>0?{productId:r,variantId:"",quantity:i,unitOfMeasureId:f}:n.getVariants($(t).find("input[name=variants]"))})},n._clearSelection=function(){var n=$(".product-list");n.find("input[name=variants]").val("");n.find("input[name=product_quantity]").val("");n.children().removeClass("variants-selected")},n._onUnitOfMeasureChanged=function(t){var i=t.parents(".product-list > li"),r=t.val(),u=i.attr("data-id");Sana.UI.LoadingIndicator.show();$.ajax({url:window.location.href,type:"post",data:{unitOfMeasureId:r,productId:u},success:function(t){$newRow=$(t.trim());i.replaceWith($newRow);n.refreshLines($newRow);Sana.UI.LoadingIndicator.hide()}})},n.mobileLayout=function(){$(".filters-wrapper").insertAfter("header");Sana.UI.Toggler.init(".filter-title")},n.loadPrices=function(n,t){ProductListPage._loadDynamicData(n,ProductListPage._loadPricesUrl,t)},n.loadStockInfos=function(n,t){ProductListPage._loadDynamicData(n,ProductListPage._loadStockInfosUrl,t)},n._loadDynamicData=function(n,t,i){$.ajax({url:t,type:"POST",dataType:"json",cache:!1,async:!0,data:{productIds:n},success:i,error:function(n){console.log(n)}})},n._loadPricesUrl="/de-ch/productList/GetPrices",n._loadStockInfosUrl="/de-ch/productList/GetStockInfos",n.initializeDynamicDataUrls=function(n){typeof n.loadPricesUrl!="undefined"&&(ProductListPage._loadPricesUrl=n.loadPricesUrl);typeof n.loadStockInfosUrl!="undefined"&&(ProductListPage._loadStockInfosUrl=n.loadStockInfosUrl)},n}();$(function(){var n=document.getElementById("productListPage"),t=document.getElementById("searchPage");(n||t)&&ProductListPage.init()});MyAccount={init:function(){$(".gvi-orders").resTables()}};$(function(){$(".banner-pane > div > div > div").length>1&&$(".banner-pane > div > div").owlCarousel({items:1,loop:!0,dots:!0,navigation:!0,autoplay:!0});var n=document.getElementById("myAccountPage");n&&MyAccount.init()}),function(){function u(n,t,i){this.uid=++r;this.isEditorsEnabled=ko.observable(!0);this.selectedReason=ko.observable();this.reasons=ko.observable(t);this.comment=ko.observable();this.quantity=ko.observable(n.Quantity.Current);this.quantityStep=n.Quantity.Step;this.minimumQuantity=n.Quantity.Minimum;this.maximumQuantity=n.Quantity.Maximum;this.unitOfMeasureTitle=n.UnitOfMeasureTitle;this.validationMessage=i["data-val-regex-pattern"];this.maximumValidationMessage=i["data-max-msg-pattern"].replace(/\{0\}/g,n.Quantity.Maximum)}function f(n,t,r,f){var e=this,o;this.VariantDescription="";for(o in n)this[o]=n[o];this.isReturnable=n.Quantity.Maximum>0;this.isSplitLinesSupported=f;this.isSelected=ko.observable(!1);this.isSelected.subscribe(function(n){var t=e.items();n&&!t.length&&e.add();_.each(t,function(t){t.isEditorsEnabled(n);NumericInput.init()})});this.items=ko.observableArray([]);this.sum=ko.computed(function(){var n=0;return _.each(e.items(),function(t){n+=parseFloat(t.quantity())}),n});this.canAdd=ko.computed(function(){return e.isSplitLinesSupported?e.sum()<n.Quantity.Maximum:!1});this.add=function(){e.items.push(new u(n,t,r));i.returnForm().refreshValidation();i.returnForm().trigger("afterHtmlChanged")};this.delete=function(){e.items.remove(this);e.items().length||e.isSelected(!1)};this.maximumValidationMessage=r["data-max-msg-pattern"].replace(/\{0\}/g,n.Quantity.Maximum)}function e(i,r){var u=this,e,o,s,h,c;u.isEditorsEnabled=ko.observable(!0);u.isReturnable=!0;u.salesAgreementUrl=i.SalesAgreementUrl;u.returnForm=ko.observable();u.selectedReason=ko.observable();u.isAllSelected=ko.observable(!1);u.id=i.Id;u.originalOrderId=i.OriginalOrderId;this.commentConditionsMet=ko.observable();this.commentConditionsNotMet=ko.observable();u.feedbackTitle=ko.observable();u.feedbackBody=ko.observable();e=function(n){var t=[];for(var i in n)t.push({id:i,name:n[i]});return t};u.reasons=ko.observable(e(i.OrderReasons));o=e(i.OrderLineReasons);s=$.map(i.Lines,function(n){return new f(n,o,r,i.IsSplitLinesSupported)});u.lines=ko.observable(s);u.isEmpty=ko.computed(function(){return!_.some(u.lines(),function(n){return n.isSelected()})});u.isAllSelected.subscribe(function(n){_.each(u.lines(),function(t){t.isReturnable&&t.isSelected(n)})});h=function(){var r=[],f=_.filter(u.lines(),function(n){return n.isSelected()}),n,i;return _.each(f,function(n){_.each(n.items(),function(t){r.push({LineNo:n.LineNo,Quantity:{Current:t.quantity()},SelectedReasonId:t.selectedReason(),Comment:t.comment()})})}),n=new FormData,n.append("jsonModel",JSON.stringify({Id:u.id,OriginalOrderId:u.originalOrderId,SelectedReasonId:u.selectedReason(),Comment:u.conditionsFulfilled()==="true"?u.commentConditionsMet():u.commentConditionsNotMet(),Lines:r,ConditionsFulfilled:u.conditionsFulfilled()})),i=$(t).find("#languageId").val(),i&&n.append("languageId",i),n.append("isInvoiceBased","true"),n.append("__RequestVerificationToken",Sana.Utils.getAntiForgeryToken()),n};u.completeReturn=function(i,r){if(u.returnForm().valid()&&r){u.showValidation(!1);var f=$(t).find("form").attr("data-action"),e=h();Sana.UI.LoadingIndicator.show();$.ajax({url:f,data:e,type:"POST",contentType:!1,processData:!1}).done(function(t){Sana.UI.LoadingIndicator.hide();t.Created?(u.feedbackTitle(n.feedbackOkTitle),u.conditionsFulfilled()==="true"?u.feedbackBody(n.feedbackOkBodyConditionsMet):u.feedbackBody(n.feedbackOkBodyConditionsNotMet)):(u.feedbackTitle(n.feedbackErrorTitle),u.feedbackBody(n.feedbackErrorBody));Popup.open("#complete",{afterClose:function(){window.location.href=t.Url}})}).fail(function(){Sana.UI.LoadingIndicator.hide();u.feedbackTitle(n.feedbackErrorTitle);u.feedbackBody(n.feedbackErrorBody);Popup.open("#complete",{afterClose:function(){window.location.reload()}})})}};u.afterApply=function(){$(".gvi-return").resTables();u.returnForm().refreshValidation()};u.openConditions=function(){Popup.open("#conditionsPopup")};c=$("#conditionsFulfilled").prop("checked");u.conditionsFulfilled=ko.observable(c);u.showValidation=ko.observable(!1);u.conditionsFulfilled.subscribe(function(){u.conditionsFulfilled()&&u.showValidation(!1)})}var t=document.getElementById("docBasedReturnOrderPage"),r;if(t){r=0;var o=JSON.parse($("#data-return").text()),s=JSON.parse($("#data-validation-patterns").text()),n=JSON.parse($("#data-messages").text()),i=new e(o,s);ko.applyBindings(i,t);i.afterApply()}}(),function(){function f(n){this.productId=n.id;this.productTitle=n.title;var t=n.getSelectedVariant();this.variant={id:t.id,title:t.title};this.quantity=n.quantity.current();this.unitOfMeasure={id:n.selectedUom().Id,title:n.selectedUom().Title};this.reasons=_.map(r.OrderLineReasons,function(n,t){return{id:t,name:n}});this.selectedReason=ko.observable();this.comment=ko.observable()}function e(n,t){var i=this,r,o,f,s;this.id=n.Id;this.title=n.Title;this.url=n.DetailsUrl;this.componentGroups=[];this.components=ko.observable();var h=function(){var t=n.VariantComponents,r=n.Variants,u;i.componentGroups=t.length?$.map(t,function(n,i){return{options:$.map(t[i].Components,function(n){return{id:n.Id,title:n.Title}}),selected:n.Components[0].Id}}):r.length?[{options:$.map(r,function(n){return{id:n.Id,title:n.Title}}),selected:r[0].Id}]:[];u=$.map(i.componentGroups,function(n){return{options:ko.observableArray(n.options),selected:ko.observable(n.selected)}});i.components(u)},c=function(){r=$.map(n.Variants,function(n){var t=n.Title,i,r;return n.Components&&(i=n.Components.filter(function(n){return n.Key==="colorId"})[0],r=n.Components.filter(function(n){return n.Key==="sizeId"})[0],i&&(t=i.Value),r&&(i?t+=", "+r.Value:t=r.Value)),{id:n.Id,title:t,components:n.Components}})},e=function(){var s=function(n,t){for(var u,i,e,s,o=[],f=0;f<t.options.length;f++){for(u=r,i=0;i<n.length;i++)u=$.grep(u,function(t){return t.components[i].Value===n[i]});e=t.options[f];s=$.grep(u,function(t){return t.components[n.length].Value===e.id})[0];s&&o.push(e)}return o},t,n,u,f,e,o;if(i.componentGroups.length<=1)return!0;for(t=[],n=1;n<i.componentGroups.length;n++)u=i.components(),f=u[n-1].selected(),t.push(f),e=s(t,i.componentGroups[n]),o=u[n],o.options(e)},l=function(){for(var t=i.components(),n=0;n<t.length-1;n++)t[n].selected.subscribe(function(){e();$(".quicksearch-result .ddlb select").trigger("change")},this)};this.getSelectedVariant=function(){for(var n,t,e={},u=i.components(),o=r,f=0;f<o.length;f++){if(n=o[f],n.components.length){for(t=0;t<u.length;t++)if(n.components[t].Value!==u[t].selected()){n=null;break}}else n.id!==u[0].selected()&&(n=null);if(n){e=n;break}}return e};h();c(n);e();l();this.unitsOfMeasure=n.UnitsOfMeasure;o=function(n){return $.grep(i.unitsOfMeasure,function(t){return t.Id.toUpperCase()===n.toUpperCase()})[0]};f=o(n.DefaultUnitOfMeasureId);this.selectedUom=ko.observable(f);this.uomTemplate=function(){return u.allowUnitOfMeasureSelection&&i.unitsOfMeasure.length>1?"uom-dynamic-template":"uom-static-template"};this.quantity={minimum:ko.observable(1),maximum:ko.observable(100),step:ko.observable(f.Step),current:ko.observable(1)};this.validationMessagePattern=ko.observable();this.minimumValidationMessagePattern=ko.observable();this.maximumValidationMessagePattern=ko.observable();this.validationMessage=ko.computed(function(){var n=i.validationMessagePattern()||"";return n.replace(/\{0\}/g,i.quantity.step())});this.minimumValidationMessage=ko.computed(function(){var n=i.minimumValidationMessagePattern()||"";return n.replace(/\{0\}/g,i.quantity.minimum())});this.maximumValidationMessage=ko.computed(function(){var n=i.maximumValidationMessagePattern()||"";return n.replace(/\{0\}/g,i.quantity.maximum())});this.quantityEditorChange=ko.observable();s=function(n){i.quantity.minimum(n.Quantity.Minimum);i.quantity.maximum(n.Quantity.Maximum);i.quantity.step(n.Quantity.Step);i.quantity.current(n.Quantity.Current);i.quantityEditorChange(n);t.refreshValidation()};this.selectedUom.subscribe(function(n){s(n)})}function o(){var u=this,s=$(i).find(".quicksearch-search"),o=s.find('input[name="productInput"]'),h,c;this.request=ko.observable();this.selectedProduct=ko.observable();this.quickSearchResultForm=ko.observable();this.isProductNotFound=ko.observable(!1);o._autocomplete({classes:{"ui-autocomplete":"quicksearch-autocomplete"},source:function(n,t){$.ajax({url:o.attr("data-src")+"?term="+o.val(),type:"GET",success:function(n){t($.map(n,function(n){var t=n.Id+" - "+n.Title,i=Sana.Utils.highlightWords(t,o.val());return{label:i,originalLabel:t,value:n.Id}}))}})},select:function(n,i){n.preventDefault();t.request(i.item.originalLabel);t.searchProduct()}});this.searchProduct=function(){u.selectedProduct(null);Sana.UI.LoadingIndicator.show();$.post(s.attr("action"),{term:u.request()}).done(function(n){if(Sana.UI.LoadingIndicator.hide(),!n){u.isProductNotFound(!0);_.delay(function(){u.isProductNotFound(!1)},2500);return}u.selectedProduct(new e(n,u.quickSearchResultForm()));o._autocomplete("close");u.quickSearchResultForm().refreshValidation()})};this.onSearchSubmit=function(){return u.request()&&u.searchProduct(),!1};this.addToReturn=function(){if(u.quickSearchResultForm().valid()){var n=new f(u.selectedProduct());u.lines.unshift(n);u.returnRequestForm().refreshValidation();u.returnRequestForm().trigger("afterHtmlChanged")}};this.lines=ko.observableArray([]);this.reasons=_.map(r.OrderReasons,function(n,t){return{id:t,name:n}});this.selectedReason=ko.observable();this.commentConditionsMet=ko.observable();this.commentConditionsNotMet=ko.observable();this.returnRequestForm=ko.observable();this.deleteLine=function(){u.lines.remove(this)};this.isEmpty=ko.computed(function(){return!u.lines().length});h=function(){var r=[],n,t;return _.each(u.lines(),function(n){r.push({ProductId:n.productId,VariantId:n.variant.id,UnitOfMeasureId:n.unitOfMeasure.id,Quantity:{Current:n.quantity},SelectedReasonId:n.selectedReason(),Comment:n.comment()})}),n=new FormData,n.append("jsonModel",JSON.stringify({SelectedReasonId:u.selectedReason(),Comment:u.conditionsFulfilled()==="true"?u.commentConditionsMet():u.commentConditionsNotMet(),Lines:r,ConditionsFulfilled:u.conditionsFulfilled()})),t=$(i).find("#languageId").val(),t&&n.append("languageId",t),n.append("isInvoiceBased","false"),n.append("__RequestVerificationToken",Sana.Utils.getAntiForgeryToken()),n};this.completeReturn=function(){if(u.returnRequestForm().valid()){u.showValidation(!1);var t=u.returnRequestForm().attr("data-action"),i=h();Sana.UI.LoadingIndicator.show();$.ajax({url:t,data:i,type:"POST",contentType:!1,processData:!1}).done(function(t){Sana.UI.LoadingIndicator.hide();t&&t.Created?(u.feedbackTitle(n.feedbackOkTitle),u.conditionsFulfilled()==="true"?u.feedbackBody(n.feedbackOkBodyConditionsMet):u.feedbackBody(n.feedbackOkBodyConditionsNotMet)):(u.feedbackTitle(n.feedbackErrorTitle),u.feedbackBody(n.feedbackErrorBody));Popup.open("#complete",{afterClose:function(){window.location.href=t.Url||""}})}).fail(function(){Sana.UI.LoadingIndicator.hide();u.feedbackTitle(n.feedbackErrorTitle);u.feedbackBody(n.feedbackErrorBody);Popup.open("#complete",{afterClose:function(){window.location.reload()}})})}};this.feedbackTitle=ko.observable();this.feedbackBody=ko.observable();this.afterApply=function(){$(".gvi-return").resTables();u.returnRequestForm().refreshValidation()};u.openConditions=function(){Popup.open("#conditionsPopup")};c=$("#conditionsFulfilled").prop("checked");u.conditionsFulfilled=ko.observable(c);u.showValidation=ko.observable(!1);u.conditionsFulfilled.subscribe(function(){u.conditionsFulfilled()&&u.showValidation(!1)})}var i=document.getElementById("docFreeReturnOrderPage"),t;if(i){var r=JSON.parse($("#data-return").text()),u=JSON.parse($("#data-settings").text()),n=JSON.parse($("#data-messages").text());t=new o;ko.applyBindings(t,i);t.afterApply()}}(),function(){function i(n){this.Id=n.Id;this.Name=n.Name;this.Address=n.Address}function r(){var n=this,t=0,r;n.loading=ko.observable(!1);r=function(r){Sana.UI.LoadingIndicator.showAfter(1e3);n.loading(!0);$.post(Sana.Urls.Home()+"profile/representablecustomers",{keywords:n.keywords(),page:t,__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()},function(t){var u=ko.utils.arrayMap(t.Items,function(n){return new i(n)});r(u);n.hasMore(n.customers().length<t.TotalCount);n.loading(!1);Sana.UI.LoadingIndicator.hide()});t++};n.customers=ko.observableArray([]);n.empty=ko.computed(function(){return n.customers().length==0});n.keywords=ko.observable();n.hasMore=ko.observable(!1);n.search=function(){t=0;r(function(t){n.customers(t)})};n.onkeydown=function(t,i){return i.which===27?(n.keywords(null),!1):!0};n.loadMore=function(){r(function(t){$.each(t,function(){n.customers.push(this)})})};n.represent=function(n){Sana.UI.LoadingIndicator.show();$.post(Sana.Urls.Home()+"profile/impersonate",{accountId:n.Id,__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()},function(){Sana.Urls.RedirectBack()})};n.keywords.subscribe(Sana.Utils.debounce(function(){n.search()},300))}var t=document.getElementById("representCustomerPage"),n;t&&(n=new r,ko.applyBindings(n,t),n.search(),$(".gvi-represent").resTables())}();SubAccount={init:function(){var o=$(".row-canorderproducts"),s=$(".row-canseeprices"),h=$(".row-canseestock"),n=$(".sub-account-holder"),u=n.attr("data-enable-canorderproducts").toLowerCase()=="true",f=n.attr("data-enable-canseeprices").toLowerCase()=="true",e=n.attr("data-enable-canseestock").toLowerCase()=="true",t,i,r;n.find(':input[name$="CanSeePrices"]').prop("disabled",!f);s.toggleClass("hide",!f);n.find(':input[name$="CanSeeStock"]').prop("disabled",!e);h.toggleClass("hide",!e);n.find(':input[name$="CanOrderProducts"]').prop("disabled",!u);o.toggleClass("hide",!u);t=$(".row-orderauthorizationrules");i=n.find(':input[name$="HasLimitedBudget"]');i.change(function(){r()});r=function(){var n=i.is(":checked"),r=t.find("tr options");t.find(":input").prop("disabled",!n);t.toggleClass("hide",!n)};r()}};$(function(){var n=document.getElementById("createNewSubAccountPage")||document.getElementById("editSubAccountPage");n&&SubAccount.init()});SubAccountList={init:function(){var n=$("#sub-accountsPage");n.on("click",".btn-delete-sub-account",function(n){n.preventDefault();var i=$(this),t="#deleteSubAccountConfirmationPopup";Popup.open(t);$(t).on("click",".btn-confirm",function(){var n=i.attr("href");i.parents("tr:first").remove();$.post(n,{__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()});Popup.close(t)})});$(".gvi-sub-accounts").resTables()}};$(function(){var n=document.getElementById("sub-accountsPage");n&&SubAccountList.init()});StoreLocator={init:function(){var n=[];$("#txtSearchStore").keyup(function(n){n.keyCode==13&&StoreLocator.callMe()});$("#txtSearchStore").focusin(function(){$(".store-locator-wrapper").hide();$(".brand-dropdown").hide()});$("#txtSearchStore").focusout(function(){$(".store-locator-wrapper").show();$(".brand-dropdown").show()});$(".brand-dropdown dt > a").on("click",function(){$(".brand-dropdown dd ul").slideToggle("fast",function(){});$(".store-locator-wrapper").height()==70?$(".store-locator-wrapper").animate({height:"200px"}):$(".store-locator-wrapper").height()==200&&$(".store-locator-wrapper").animate({height:"70px"})});$(".brand-dropdown dd ul li a").on("click",function(){$(".store-locator-wrapper").css("height","70px");$(".brand-dropdown dd ul").hide()});$('.mutliSelect input[type="checkbox"]').on("click",function(){var i=$(this).closest(".mutliSelect").find('input[type="checkbox"]').val(),i=$(this).val(),t;$(this).is(":checked")?(n.push(i),StoreLocator.refreshMap(n)):(t=n.indexOf(i),t>-1&&n.splice(t,1),StoreLocator.refreshMap(n));clientSelectedBrands=n})},refreshMap:function(n){var t=$(".brand-dropdown").attr("data-url");$.ajax({url:t,type:"POST",cache:!1,data:{selectedBrands:n},success:function(n){buildMarkers(n,!0)}})}};$(function(){var n=document.getElementById("storeLocatorContainer");n&&StoreLocator.init()});$(function(){var i=document.getElementById("tellafriendPreviewPage");if(i){var r=$("#previewContent").val(),t=document.getElementById("previewFrame"),n=t.document;t.contentDocument?n=t.contentDocument:t.contentWindow&&(n=t.contentWindow.document);n.open();n.writeln(r);n.close();$(n.body).find("a").each(function(){$(this).attr("target","_blank")});$("#tellAFriendForm").submit(function(n){n.preventDefault();Sana.UI.LoadingIndicator.show();$.ajax({type:"POST",url:$(this).attr("action"),data:$(this).serialize(),success:function(n){Sana.UI.LoadingIndicator.hide();var t=$("#tellAFriendPopup").html(n).find(".btn-close-dialog");Popup.open(".successPopup",{afterClose:function(){window.location.href=t.attr("href")}})},error:function(){$("#tellAFriendPopup").html(data);Sana.UI.LoadingIndicator.hide()}})})}}),function(){function i(){var n=this,t=".wishlist-details";n.sendData=function(i,r){var u=i.attr("data-src");r||(r={id:i.attr("data-product"),uom:i.attr("data-uom"),variant:i.attr("data-variant"),prepack:i.attr("data-prepack")});Sana.UI.LoadingIndicator.show();$.post(u,{productId:r.id,unitOfMeasureId:r.uom,variantId:r.variant,prepackId:r.prepack,__RequestVerificationToken:$('input[name="__RequestVerificationToken"]:first').val()},function(i){if(i!=""){if(i.Count){var r=i.Url?function(){location.href=i.Url}:undefined;Sana.GoogleTagManager.trackProductAddition(i.Items,i.ActionField,i.CustomerType,r)}Sana.UI.LoadingIndicator.hide();return}$(t).load(window.location.href,function(){var i=$(t)[0];ko.cleanNode(i);ko.applyBindings(n,i);Sana.UI.ActionButtons.refresh();Sana.UI.LoadingIndicator.hide();$(t).trigger("htmlUpdated")})})};n.addToBasket=function(t,i){var r=$(i.target).closest("button");n.sendData(r)};n.remove=function(t,i){var r=$(i.target);n.sendData(r)}}var t=document.getElementById("wishListPage"),n;t&&($(function(){$(document).on("click",".gvi-wish-list .hyp-remove",function(t){t.preventDefault();var i=$(this).closest("tr"),r={id:i.attr("data-product"),variant:i.attr("data-variant"),prepack:i.attr("data-prepack"),uom:i.attr("data-uom")};n.sendData($(this),r)});$(document).on("click","#btnOk",function(t){if($(".gvi-edit-wishlist").length>0){t.preventDefault();$.ajax({url:"/retailprice/setretailpricestatus",type:"POST",dataType:"json",cache:!1,data:{status:!1},success:function(){}});var i={id:$(this).attr("data-product"),variant:$(this).attr("data-variant"),prepack:$(this).attr("data-prepack"),uom:$(this).attr("data-uom")};n.sendData($(this),i)}})}),Sana.UI.ActionButtons.init(),n=new i,ko.applyBindings(n,t))}();$(function(){var t=document.getElementById("addreviewPage"),n;t&&(n=$("#addReviewForm"),n.submit(function(t){if(t.preventDefault(),!n.valid())return!1;Sana.UI.LoadingIndicator.show();$.ajax({type:"POST",url:n.attr("action"),data:n.serialize(),success:function(n){var t=$("#reviewAddedPopup").html(n).find(".btn-close-dialog");Sana.UI.LoadingIndicator.hide();Popup.open(".successPopup",{afterClose:function(){window.location.href=t.attr("href")}})}})}))}),function(n){function o(n){return typeof n=="function"}function t(n,t,i){var r={value:i,writable:!0,enumerable:!1,configurable:!0};Object.defineProperty(n,t,r)}function s(t){if(t===null||t===n)throw TypeError();return Object(t)}function ht(n,t){var i=s(n);return i[t]}function tt(t,i){var r=ht(t,i);if(r===null||r===n)return n;if(o(r)===!1)throw new TypeError("Method not callable: "+i);return r}function i(n){switch(typeof n){case"undefined":return"undefined";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";default:return n===null?"null":"Symbol"in this&&n instanceof this.Symbol?"symbol":"object"}}function w(n){return i(n)!=="object"?!1:typeof n=="function"&&!!n.prototype}function r(n,t){return n[t]}function at(n,t){var u=r(n,"prototype");return i(u)!=="object"&&(u=t),u}function b(n,t){var i=arguments[2]||{},f=at(n,t),u=Object.create(f);for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&Object.defineProperty(u,r,{configurable:!0,enumerable:!1,writable:!0,value:i[r]});return u}function rt(n){var t=arguments.length>2?arguments[2]:n,i=arguments.length>1?arguments[1]:[],r;if(!w(n))throw new TypeError("F must be a constructor.");if(!w(t))throw new TypeError("newTarget must be a constructor.");return t===n?new(Function.prototype.bind.apply(n,[null].concat(i))):(r=b(t,Object.prototype),f(n,r,i))}function ut(n){if(1/n==-Infinity&&(n=0),n>Math.pow(2,32)-1)throw new RangeError("Invalid array length");var t=[];return t.length=n,t}function f(n,t){var i=arguments.length>2?arguments[2]:[];if(o(n)===!1)throw new TypeError(Object.prototype.toString.call(n)+"is not a function.");return n.apply(t,i)}function k(n){var e=arguments.length>1?arguments[1]:tt(n,Symbol.iterator),r=f(e,n),u,t;if(i(r)!=="object")throw new TypeError("bad iterator");return u=ht(r,"next"),t=Object.create(null),t["[[Iterator]]"]=r,t["[[NextMethod]]"]=u,t["[[Done]]"]=!1,t}function c(t,r){var u,e,s,o;if(i(t["[[Iterator]]"])!=="object")throw new Error(Object.prototype.toString.call(t["[[Iterator]]"])+"is not an Object.");if(u=t["[[Iterator]]"],e=tt(u,"return"),e===n)return r;try{s=f(e,u)}catch(h){o=h}if(r)return r;if(o)throw o;if(i(s)!=="object")throw new TypeError("Iterator's return method returned a non-object.");return r}function vt(n,t){for(var c,s,h,e=t==="string"?["toString","valueOf"]:["valueOf","toString"],u=0;u<e.length;++u)if(c=e[u],s=r(n,c),o(s)&&(h=f(s,n),i(h)!=="object"))return h;throw new TypeError("Cannot convert to primitive.");}function yt(t){var o=arguments.length>1?arguments[1]:n,r,u,e;if(i(t)==="object"){if(arguments.length<2?r="default":o===String?r="string":o===Number&&(r="number"),u=typeof this.Symbol=="function"&&typeof this.Symbol.toPrimitive=="symbol"?tt(t,this.Symbol.toPrimitive):n,u!==n){if(e=f(u,t,[r]),i(e)!=="object")return e;throw new TypeError("Cannot convert exotic object to primitive.");}return r==="default"&&(r="number"),vt(t,r)}return t}function u(n){switch(i(n)){case"symbol":throw new TypeError("Cannot convert a Symbol value to a string");case"object":var t=yt(n,"string");return u(t);default:return String(n)}}function pt(n){if(arguments.length<2)var t=f(n["[[NextMethod]]"],n["[[Iterator]]"]);else t=f(n["[[NextMethod]]"],n["[[Iterator]]"],[arguments[1]]);if(i(t)!=="object")throw new TypeError("bad iterator");return t}function l(n){return Boolean(n)}function wt(n){if(i(n)!=="object")throw new Error(Object.prototype.toString.call(n)+"is not an Object.");return l(r(n,"done"))}function d(n){var t=pt(n),i=wt(t);return i===!0?!1:t}function g(n){if(i(n)!=="object")throw new Error(Object.prototype.toString.call(n)+"is not an Object.");return r(n,"value")}function ft(n,t,i){var r={value:i,writable:!0,enumerable:!0,configurable:!0};try{return Object.defineProperty(n,t,r),!0}catch(u){return!1}}function et(n,t,i){var r=ft(n,t,i);if(!r)throw new TypeError("Cannot assign value `"+Object.prototype.toString.call(i)+"` to property `"+Object.prototype.toString.call(t)+"` on object `"+Object.prototype.toString.call(n)+"`");return r}function e(n){var t=Number(n);return isNaN(t)?0:1/t==Infinity||1/t==-Infinity||t===Infinity||t===-Infinity?t:(t<0?-1:1)*Math.floor(Math.abs(t))}function v(n){var t=e(n);return t<=0?0:Math.min(t,Math.pow(2,53)-1)}function y(n,t){if(i(t)!=="boolean")throw new Error;var r={};return ft(r,"value",n),ft(r,"done",t),r}function ct(n,t){return n===t}function h(n,t){return i(n)!==i(t)?!1:i(n)==="number"?isNaN(n)&&isNaN(t)?!0:1/n==Infinity&&1/t==-Infinity?!0:1/n==-Infinity&&1/t==Infinity?!0:n===t?!0:!1:ct(n,t)}function a(t){if(t===null||t===n)throw TypeError();return t}function ot(t){var u,f;if(i(t)!=="object")return!1;if(u="Symbol"in this&&"match"in this.Symbol?r(t,this.Symbol.match):n,u!==n)return l(u);try{return f=t.lastIndex,t.lastIndex=0,RegExp.prototype.exec.call(t),!0}catch(e){}finally{t.lastIndex=f}return!1}function bt(n,t){return t in n}function st(n){var t=Number(n),i,r;return isNaN(t)||1/t==Infinity||1/t==-Infinity||t===Infinity||t===-Infinity?0:(i=(t<0?-1:1)*Math.floor(Math.abs(t)),r=i>>>0,r)}function nt(n,t){return i(n)!==i(t)?!1:i(n)==="number"?isNaN(n)&&isNaN(t)?!0:n===0&&t===0&&1/n!=1/t?!1:n===t?!0:!1:ct(n,t)}function kt(n,t){return(n-55296)*1024+(t-56320)+65536}function dt(n){return Object.prototype.toString.call(n)==="[object Array]"}var p,it,lt;"Symbol"in this&&this.Symbol.length===0||function(n,t,i){var p,ht=0,l=""+Math.random(),a="__\x01symbol:",ct=a.length,e="__\x01symbol@@"+l,g="defineProperty",nt="defineProperties",w="getOwnPropertyNames",tt="getOwnPropertyDescriptor",it="propertyIsEnumerable",f=n.prototype,o=f.hasOwnProperty,lt=f[it],rt=f.toString,at=Array.prototype.concat,vt=typeof window=="object"?n.getOwnPropertyNames(window):[],ut=n[w],b=function(n){if(rt.call(n)==="[object Window]")try{return ut(n)}catch(t){return at.call([],vt)}return ut(n)},k=n[tt],v=n.create,yt=n.keys,pt=n.freeze||n,u=n[g],wt=n[nt],r=k(n,w),ft=function(n,t,i){if(!o.call(n,e))try{u(n,e,{enumerable:!1,configurable:!1,writable:!1,value:{}})}catch(r){n[e]={}}n[e]["@@"+t]=i},bt=function(n,t){var i=v(n);return b(t).forEach(function(n){y.call(t,n)&&d(i,n,t[n])}),i},kt=function(n){var t=v(n);return t.enumerable=!1,t},dt=function(){},et=function(n){return n!=e&&!o.call(s,n)},h=function(n){return n!=e&&o.call(s,n)},y=function(n){var t=""+n;return h(t)?o.call(this,t)&&this[e]["@@"+t]:lt.call(this,n)},ot=function(t){var i={enumerable:!1,configurable:!0,get:dt,set:function(n){p(this,t,{enumerable:!1,configurable:!0,writable:!0,value:n});ft(this,t,!0)}};try{u(f,t,i)}catch(r){f[t]=i.value}return pt(s[t]=u(n(t),"constructor",gt))},c=function c(){var n=arguments[0];if(this instanceof c)throw new TypeError("Symbol is not a constructor");return ot(a.concat(n||"",l,++ht))},s=v(null),gt={value:c},ni=function(n){return s[n]},d=function(n,t,i){var r=""+t;return h(r)?(p(n,r,i.enumerable?kt(i):i),ft(n,r,!!i.enumerable)):u(n,t,i),n},ti=function(n){return function(t){return o.call(n,e)&&o.call(n[e],"@@"+t)}},st=function(n){return b(n).filter(n===f?ti(n):h).map(ni)};r.value=d;u(n,g,r);r.value=st;u(n,t,r);r.value=function(n){return b(n).filter(et)};u(n,w,r);r.value=function(n,t){var i=st(t);return i.length?yt(t).concat(i).forEach(function(i){y.call(t,i)&&d(n,i,t[i])}):wt(n,t),n};u(n,nt,r);r.value=y;u(f,it,r);r.value=c;u(i,"Symbol",r);r.value=function(n){var t=a.concat(a,n,l);return t in f?s[t]:ot(t)};u(c,"for",r);r.value=function(n){if(et(n))throw new TypeError(n+" is not a symbol");if(o.call(s,n))return n.slice(ct*2,-l.length)};u(c,"keyFor",r);r.value=function(n,t){var i=k(n,t);return i&&h(t)&&(i.enumerable=y.call(n,t)),i};u(n,tt,r);r.value=function(n,t){return arguments.length===1||typeof t=="undefined"?v(n):bt(n,t)};u(n,"create",r);r.value=function(){var n=rt.call(this);return n==="[object String]"&&h(this)?"[object Symbol]":n};u(f,"toString",r);p=function(n,t,i){var r=k(f,t);delete f[t];u(n,t,i);n!==f&&u(f,t,r)}}(Object,"getOwnPropertySymbols",this);"Symbol"in this&&"iterator"in this.Symbol||Object.defineProperty(Symbol,"iterator",{value:Symbol("iterator")});"Symbol"in this&&"species"in this.Symbol||Object.defineProperty(Symbol,"species",{value:Symbol("species")});"Map"in this&&function(){try{var n=new Map([[1,1],[2,2]]);return Map.length===0&&n.size===2&&"Symbol"in this&&"iterator"in Symbol&&typeof n[Symbol.iterator]=="function"?!0:!1}catch(t){return!1}}()||function(r){function l(n,t){if(i(n)!=="object")throw new TypeError("createMapIterator called on incompatible receiver "+Object.prototype.toString.call(n));if(n._es6Map!==!0)throw new TypeError("createMapIterator called on incompatible receiver "+Object.prototype.toString.call(n));var r=Object.create(s);return Object.defineProperty(r,"[[Map]]",{configurable:!0,enumerable:!1,writable:!0,value:n}),Object.defineProperty(r,"[[MapNextIndex]]",{configurable:!0,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"[[MapIterationKind]]",{configurable:!0,enumerable:!1,writable:!0,value:t}),r}var e=function(){try{var t={};return Object.defineProperty(t,"t",{configurable:!0,enumerable:!1,get:function(){return!0},set:n}),!!t.t}catch(i){return!1}}(),f=Symbol("undef"),u=function u(){var r,t,h,l,a,f,v,y,s,p;if(!(this instanceof u))throw new TypeError('Constructor Map requires "new"');if(r=b(this,u.prototype,{_keys:[],_values:[],_size:0,_es6Map:!0}),e||Object.defineProperty(r,"size",{configurable:!0,enumerable:!1,writable:!0,value:0}),t=arguments.length>0?arguments[0]:n,t===null||t===n)return r;if(h=r.set,!o(h))throw new TypeError("Map.prototype.set is not a function");try{for(l=k(t);;){if(a=d(l),a===!1)return r;if(f=g(a),i(f)!=="object")try{throw new TypeError("Iterator value "+f+" is not an entry object");}catch(w){return c(l,w)}try{v=f[0];y=f[1];h.call(r,v,y)}catch(nt){return c(l,nt)}}}catch(nt){if(Array.isArray(t)||Object.prototype.toString.call(t)==="[object Arguments]"||!!t.callee)for(p=t.length,s=0;s<p;s++)h.call(r,t[s][0],t[s][1])}return r},s;Object.defineProperty(u,"prototype",{configurable:!1,enumerable:!1,writable:!1,value:{}});e?Object.defineProperty(u,Symbol.species,{configurable:!0,enumerable:!1,get:function(){return this},set:n}):t(u,Symbol.species,u);t(u.prototype,"clear",function(){var t=this,u,r;if(i(t)!=="object")throw new TypeError("Method Map.prototype.clear called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6Map!==!0)throw new TypeError("Method Map.prototype.clear called on incompatible receiver "+Object.prototype.toString.call(t));for(u=t._keys,r=0;r<u.length;r++)t._keys[r]=f,t._values[r]=f;return this._size=0,e||(this.size=this._size),n});t(u.prototype,"constructor",u);t(u.prototype,"delete",function(n){var t=this,u,r;if(i(t)!=="object")throw new TypeError("Method Map.prototype.clear called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6Map!==!0)throw new TypeError("Method Map.prototype.clear called on incompatible receiver "+Object.prototype.toString.call(t));for(u=t._keys,r=0;r<u.length;r++)if(t._keys[r]!==f&&h(t._keys[r],n))return this._keys[r]=f,this._values[r]=f,this._size=--this._size,e||(this.size=this._size),!0;return!1});t(u.prototype,"entries",function(){var n=this;return l(n,"key+value")});t(u.prototype,"forEach",function(t){var r=this,e,s,u;if(i(r)!=="object")throw new TypeError("Method Map.prototype.forEach called on incompatible receiver "+Object.prototype.toString.call(r));if(r._es6Map!==!0)throw new TypeError("Method Map.prototype.forEach called on incompatible receiver "+Object.prototype.toString.call(r));if(!o(t))throw new TypeError(Object.prototype.toString.call(t)+" is not a function.");for(arguments[1]&&(e=arguments[1]),s=r._keys,u=0;u<s.length;u++)r._keys[u]!==f&&r._values[u]!==f&&t.call(e,r._values[u],r._keys[u],r);return n});t(u.prototype,"get",function(t){var r=this,e,u;if(i(r)!=="object")throw new TypeError("Method Map.prototype.get called on incompatible receiver "+Object.prototype.toString.call(r));if(r._es6Map!==!0)throw new TypeError("Method Map.prototype.get called on incompatible receiver "+Object.prototype.toString.call(r));for(e=r._keys,u=0;u<e.length;u++)if(r._keys[u]!==f&&h(r._keys[u],t))return r._values[u];return n});t(u.prototype,"has",function(n){var t=this,r,i;if(typeof t!="object")throw new TypeError("Method Map.prototype.has called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6Map!==!0)throw new TypeError("Method Map.prototype.has called on incompatible receiver "+Object.prototype.toString.call(t));for(r=t._keys,i=0;i<r.length;i++)if(t._keys[i]!==f&&h(t._keys[i],n))return!0;return!1});t(u.prototype,"keys",function(){var n=this;return l(n,"key")});t(u.prototype,"set",function(n,t){var r=this,s,u,o;if(i(r)!=="object")throw new TypeError("Method Map.prototype.set called on incompatible receiver "+Object.prototype.toString.call(r));if(r._es6Map!==!0)throw new TypeError("Method Map.prototype.set called on incompatible receiver "+Object.prototype.toString.call(r));for(s=r._keys,u=0;u<s.length;u++)if(r._keys[u]!==f&&h(r._keys[u],n))return r._values[u]=t,r;return 1/n==-Infinity&&(n=0),o={},o["[[Key]]"]=n,o["[[Value]]"]=t,r._keys.push(o["[[Key]]"]),r._values.push(o["[[Value]]"]),++r._size,e||(r.size=r._size),r});e&&Object.defineProperty(u.prototype,"size",{configurable:!0,enumerable:!1,get:function(){var n=this,u,t,r;if(i(n)!=="object")throw new TypeError("Method Map.prototype.size called on incompatible receiver "+Object.prototype.toString.call(n));if(n._es6Map!==!0)throw new TypeError("Method Map.prototype.size called on incompatible receiver "+Object.prototype.toString.call(n));for(u=n._keys,t=0,r=0;r<u.length;r++)n._keys[r]!==f&&(t=t+1);return t},set:n});t(u.prototype,"values",function(){var n=this;return l(n,"value")});t(u.prototype,Symbol.iterator,u.prototype.entries);"name"in u||Object.defineProperty(u,"name",{configurable:!0,enumerable:!1,writable:!1,value:"Map"});s={};Object.defineProperty(s,"isMapIterator",{configurable:!1,enumerable:!1,writable:!1,value:!0});t(s,"next",function(){var t=this,h,c,r,o;if(i(t)!=="object")throw new TypeError("Method %MapIteratorPrototype%.next called on incompatible receiver "+Object.prototype.toString.call(t));if(!t.isMapIterator)throw new TypeError("Method %MapIteratorPrototype%.next called on incompatible receiver "+Object.prototype.toString.call(t));var u=t["[[Map]]"],e=t["[[MapNextIndex]]"],s=t["[[MapIterationKind]]"];if(u===n)return y(n,!0);if(!u._es6Map)throw new Error(Object.prototype.toString.call(u)+" has a [[MapData]] internal slot.");for(h=u._keys,c=h.length;e<c;)if(r=Object.create(null),r["[[Key]]"]=u._keys[e],r["[[Value]]"]=u._values[e],e=e+1,t["[[MapNextIndex]]"]=e,r["[[Key]]"]!==f){if(s==="key")o=r["[[Key]]"];else if(s==="value")o=r["[[Value]]"];else{if(s!=="key+value")throw new Error;o=[r["[[Key]]"],r["[[Value]]"]]}return y(o,!1)}return t["[[Map]]"]=n,y(n,!0)});t(s,Symbol.iterator,function(){return this});try{t(r,"Map",u)}catch(ft){r.Map=u}}(this);"Set"in this&&function(){try{var n=new Set([1,2]);return Set.length===0&&n.size===2&&"Symbol"in this&&"iterator"in Symbol&&typeof n[Symbol.iterator]=="function"?!0:!1}catch(t){return!1}}()||function(i){function l(n,t){if(typeof n!="object")throw new TypeError("createSetIterator called on incompatible receiver "+Object.prototype.toString.call(n));if(n._es6Set!==!0)throw new TypeError("createSetIterator called on incompatible receiver "+Object.prototype.toString.call(n));var i=Object.create(e);return Object.defineProperty(i,"[[IteratedSet]]",{configurable:!0,enumerable:!1,writable:!0,value:n}),Object.defineProperty(i,"[[SetNextIndex]]",{configurable:!0,enumerable:!1,writable:!0,value:0}),Object.defineProperty(i,"[[SetIterationKind]]",{configurable:!0,enumerable:!1,writable:!0,value:t}),i}var f=function(){try{var t={};return Object.defineProperty(t,"t",{configurable:!0,enumerable:!1,get:function(){return!0},set:n}),!!t.t}catch(i){return!1}}(),u=Symbol("undef"),r=function r(){var i,t,u,s,h,l,e,a;if(!(this instanceof r))throw new TypeError('Constructor Set requires "new"');if(i=b(this,r.prototype,{_values:[],_size:0,_es6Set:!0}),f||Object.defineProperty(i,"size",{configurable:!0,enumerable:!1,writable:!0,value:0}),t=arguments.length>0?arguments[0]:n,t===null||t===n)return i;if(u=i.add,!o(u))throw new TypeError("Set.prototype.add is not a function");try{for(s=k(t);;){if(h=d(s),h===!1)return i;l=g(h);try{u.call(i,l)}catch(v){return c(s,v)}}}catch(v){if(Array.isArray(t)||Object.prototype.toString.call(t)==="[object Arguments]"||!!t.callee)for(a=t.length,e=0;e<a;e++)u.call(i,t[e])}return i},s,e;Object.defineProperty(r,"prototype",{configurable:!1,enumerable:!1,writable:!1,value:{}});f?Object.defineProperty(r,Symbol.species,{configurable:!0,enumerable:!1,get:function(){return this},set:n}):t(r,Symbol.species,r);t(r.prototype,"add",function(n){var t=this,r,i,e;if(typeof t!="object")throw new TypeError("Method Set.prototype.add called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6Set!==!0)throw new TypeError("Method Set.prototype.add called on incompatible receiver "+Object.prototype.toString.call(t));for(r=t._values,i=0;i<r.length;i++)if(e=r[i],e!==u&&h(e,n))return t;return 1/n==-Infinity&&(n=0),t._values.push(n),this._size=++this._size,f||(this.size=this._size),t});t(r.prototype,"clear",function(){var t=this,r,i;if(typeof t!="object")throw new TypeError("Method Set.prototype.clear called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6Set!==!0)throw new TypeError("Method Set.prototype.clear called on incompatible receiver "+Object.prototype.toString.call(t));for(r=t._values,i=0;i<r.length;i++)r[i]=u;return this._size=0,f||(this.size=this._size),n});t(r.prototype,"constructor",r);t(r.prototype,"delete",function(n){var t=this,r,i,e;if(typeof t!="object")throw new TypeError("Method Set.prototype.delete called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6Set!==!0)throw new TypeError("Method Set.prototype.delete called on incompatible receiver "+Object.prototype.toString.call(t));for(r=t._values,i=0;i<r.length;i++)if(e=r[i],e!==u&&h(e,n))return r[i]=u,this._size=--this._size,f||(this.size=this._size),!0;return!1});t(r.prototype,"entries",function(){var n=this;return l(n,"key+value")});t(r.prototype,"forEach",function(t){var i=this,s,e,r,f;if(typeof i!="object")throw new TypeError("Method Set.prototype.forEach called on incompatible receiver "+Object.prototype.toString.call(i));if(i._es6Set!==!0)throw new TypeError("Method Set.prototype.forEach called on incompatible receiver "+Object.prototype.toString.call(i));if(!o(t))throw new TypeError(Object.prototype.toString.call(t)+" is not a function.");for(arguments[1]&&(s=arguments[1]),e=i._values,r=0;r<e.length;r++)f=e[r],f!==u&&t.call(s,f,f,i);return n});t(r.prototype,"has",function(n){var t=this,r,i,f;if(typeof t!="object")throw new TypeError("Method Set.prototype.forEach called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6Set!==!0)throw new TypeError("Method Set.prototype.forEach called on incompatible receiver "+Object.prototype.toString.call(t));for(r=t._values,i=0;i<r.length;i++)if(f=r[i],f!==u&&h(f,n))return!0;return!1});s=function(){var n=this;return l(n,"value")};t(r.prototype,"values",s);t(r.prototype,"keys",s);f&&Object.defineProperty(r.prototype,"size",{configurable:!0,enumerable:!1,get:function(){var n=this,r,t,i,f;if(typeof n!="object")throw new TypeError("Method Set.prototype.size called on incompatible receiver "+Object.prototype.toString.call(n));if(n._es6Set!==!0)throw new TypeError("Method Set.prototype.size called on incompatible receiver "+Object.prototype.toString.call(n));for(r=n._values,t=0,i=0;i<r.length;i++)f=r[i],f!==u&&(t=t+1);return t},set:n});t(r.prototype,Symbol.iterator,s);"name"in r||Object.defineProperty(r,"name",{configurable:!0,enumerable:!1,writable:!1,value:"Set"});e={};Object.defineProperty(e,"isSetIterator",{configurable:!1,enumerable:!1,writable:!1,value:!0});t(e,"next",function(){var t=this,e,o,r;if(typeof t!="object")throw new TypeError("Method %SetIteratorPrototype%.next called on incompatible receiver "+Object.prototype.toString.call(t));if(!t.isSetIterator)throw new TypeError("Method %SetIteratorPrototype%.next called on incompatible receiver "+Object.prototype.toString.call(t));var f=t["[[IteratedSet]]"],i=t["[[SetNextIndex]]"],s=t["[[SetIterationKind]]"];if(f===n)return y(n,!0);if(!f._es6Set)throw new Error(Object.prototype.toString.call(f)+" does not have [[SetData]] internal slot.");for(e=f._values,o=e.length;i<o;)if(r=e[i],i=i+1,t["[[SetNextIndex]]"]=i,r!==u)return s==="key+value"?y([r,r],!1):y(r,!1);return t["[[IteratedSet]]"]=n,y(n,!0)});t(e,Symbol.iterator,function(){return this});try{t(i,"Set",r)}catch(rt){i.Set=r}}(this);"from"in Array&&function(){try{return Array.from({length:-Infinity}),!0}catch(n){return!1}}()||function(){function h(n){return typeof n=="string"?!0:typeof n!="object"?!1:i.call(n)==="[object String]"}var i=Object.prototype.toString,e=String.prototype.match;t(Array,"from",function(t){var it=this,a=arguments.length>1?arguments[1]:n,ft,ot,st,ht,l,y,i,yt,p,ct,lt,b,at,nt,vt;if(a===n)ft=!1;else{if(o(a)===!1)throw new TypeError(Object.prototype.toString.call(a)+" is not a function.");ot=arguments.length>2?arguments[2]:n;st=ot!==n?ot:n;ft=!0}if(ht=tt(t,Symbol.iterator),ht!==n)for(l=w(it)?rt(it):ut(0),y=k(t,ht),i=0;;){if(i>=Math.pow(2,53)-1)return yt=new TypeError("Iteration count can not be greater than or equal 9007199254740991."),c(y,yt);if(p=u(i),ct=d(y),ct===!1)return l.length=i,l;if(lt=g(ct),ft)try{b=f(a,st,[lt,i])}catch(pt){return c(y,pt)}else b=lt;try{et(l,p,b)}catch(pt){return c(y,pt)}i=i+1}for(at=h(t)?e.call(t,/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g)||[]:s(t),nt=v(r(at,"length")),l=w(it)?rt(it,[nt]):ut(nt),i=0;i<nt;)p=u(i),vt=r(at,p),b=ft===!0?f(a,st,[vt,i]):vt,et(l,p,b),i=i+1;return l.length=nt,l})}();"of"in Array||t(Array,"of",function(){for(var t=arguments.length,o=arguments,r=this,f,e,i=w(r)?rt(r,[t]):ut(t),n=0;n<t;)f=o[n],e=u(n),et(i,e,f),n=n+1;return i.length=t,i});"assign"in Object||t(Object,"assign",function(t){var c=s(t),l,i,u,f,e,o,h,a,v;if(arguments.length===1)return c;for(l=Array.prototype.slice.call(arguments,1),i=0;i<l.length;i++)for(o=l[i],o===n||o===null?f=[]:(e=s(o),f=Object.keys(e)),u=0;u<f.length;u++)h=f[u],a=Object.getOwnPropertyDescriptor(e,h),a!==n&&a.enumerable&&(v=r(e,h),c[h]=v);return c});"Symbol"in this&&"toStringTag"in this.Symbol||Object.defineProperty(Symbol,"toStringTag",{value:Symbol("toStringTag")});p=function(){var i=function(){return this.length=0,this},r=function(n){if(typeof n!="function")throw new TypeError(n+" is not a function");return n},t=function(n,i){if(!(this instanceof t))return new t(n,i);if(Object.defineProperties(this,{__list__:{writable:!0,value:n},__context__:{writable:!0,value:i},__nextIndex__:{writable:!0,value:0}}),i){r(i.on);i.on("_add",this._onAdd.bind(this));i.on("_delete",this._onDelete.bind(this));i.on("_clear",this._onClear.bind(this))}};return Object.defineProperties(t.prototype,Object.assign({constructor:{value:t,configurable:!0,enumerable:!1,writable:!0},_next:{value:function(){var t;if(this.__list__){if(this.__redo__&&(t=this.__redo__.shift(),t!==n))return t;if(this.__nextIndex__<this.__list__.length)return this.__nextIndex__++;this._unBind()}},configurable:!0,enumerable:!1,writable:!0},next:{value:function(){return this._createResult(this._next())},configurable:!0,enumerable:!1,writable:!0},_createResult:{value:function(t){return t===n?{done:!0,value:n}:{done:!1,value:this._resolve(t)}},configurable:!0,enumerable:!1,writable:!0},_resolve:{value:function(n){return this.__list__[n]},configurable:!0,enumerable:!1,writable:!0},_unBind:{value:function(){(this.__list__=null,delete this.__redo__,this.__context__)&&(this.__context__.off("_add",this._onAdd.bind(this)),this.__context__.off("_delete",this._onDelete.bind(this)),this.__context__.off("_clear",this._onClear.bind(this)),this.__context__=null)},configurable:!0,enumerable:!1,writable:!0},toString:{value:function(){return"[object Iterator]"},configurable:!0,enumerable:!1,writable:!0}},{_onAdd:{value:function(n){if(!(n>=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__){Object.defineProperty(this,"__redo__",{value:[n],configurable:!0,enumerable:!1,writable:!1});return}this.__redo__.forEach(function(t,i){t>=n&&(this.__redo__[i]=++t)},this);this.__redo__.push(n)}},configurable:!0,enumerable:!1,writable:!0},_onDelete:{value:function(n){var t;n>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__)&&(t=this.__redo__.indexOf(n),t!==-1&&this.__redo__.splice(t,1),this.__redo__.forEach(function(t,i){t>n&&(this.__redo__[i]=--t)},this))},configurable:!0,enumerable:!1,writable:!0},_onClear:{value:function(){this.__redo__&&i.call(this.__redo__);this.__nextIndex__=0},configurable:!0,enumerable:!1,writable:!0}})),Object.defineProperty(t.prototype,Symbol.iterator,{value:function(){return this},configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(t.prototype,Symbol.toStringTag,{value:"Iterator",configurable:!1,enumerable:!1,writable:!0}),t}(),function(){if(!Object.setPrototypeOf){var e=Object.getOwnPropertyNames,r=Object.getOwnPropertyDescriptor,o=Object.create,s=Object.defineProperty,h=Object.getPrototypeOf,u=Object.prototype,c=function(n,t){return e(t).forEach(function(i){s(n,i,r(t,i))}),n},f=function(n,t){return c(o(t),n)},n,i;try{n=r(u,"__proto__").set;n.call({},null);i=function(t,i){return n.call(t,i),t}}catch(a){n={__proto__:null};n instanceof Object?i=f:(n.__proto__=u,i=n instanceof Object?function(n,t){return n.__proto__=t,n}:function(n,t){return h(n)?(n.__proto__=t,n):f(n,t)})}t(Object,"setPrototypeOf",i)}}();"includes"in String.prototype||t(String.prototype,"includes",function(t){"use strict";var r=arguments.length>1?arguments[1]:n,f=a(this),i=u(f),o=ot(t);if(o)throw new TypeError("First argument to String.prototype.includes must not be a regular expression");var s=u(t),h=e(r),c=i.length,l=Math.min(Math.max(h,0),c);return String.prototype.indexOf.call(i,s,l)!==-1});"contains"in String.prototype||t(String.prototype,"contains",String.prototype.includes);it=function(){var n=function(t,i){if(!(this instanceof n))return new n(t,i);p.call(this,t);i=i?String.prototype.contains.call(i,"key+value")?"key+value":String.prototype.contains.call(i,"key")?"key":"value":"value";Object.defineProperty(this,"__kind__",{value:i,configurable:!1,enumerable:!1,writable:!1})};return Object.setPrototypeOf&&Object.setPrototypeOf(n,p.prototype),n.prototype=Object.create(p.prototype,{constructor:{value:n,configurable:!0,enumerable:!1,writable:!0},_resolve:{value:function(n){return this.__kind__==="value"?this.__list__[n]:this.__kind__==="key+value"?[n,this.__list__[n]]:n},configurable:!0,enumerable:!1,writable:!0},toString:{value:function(){return"[object Array Iterator]"},configurable:!0,enumerable:!1,writable:!0}}),n}();"values"in Array.prototype||("Symbol"in this&&"iterator"in Symbol&&typeof Array.prototype[Symbol.iterator]=="function"?t(Array.prototype,"values",Array.prototype[Symbol.iterator]):t(Array.prototype,"values",function(){var n=s(this);return new it(n,"value")}));"Symbol"in this&&"iterator"in this.Symbol&&!!Array.prototype[Symbol.iterator]||t(Array.prototype,Symbol.iterator,Array.prototype.values);"copyWithin"in Array.prototype&&function(){var i,t,n;try{return i=function(){},i.prototype[0]="foo",t=new i,t[1]=1,t[2]=2,t.length=3,n=Array.prototype.copyWithin.call(t,1,0),n["0"]&&!Object.prototype.hasOwnProperty.call(n,"0")&&Object.prototype.hasOwnProperty.call(n,"1")&&n[0]==="foo"&&n[1]==="foo"&&n[2]===1&&n.length===3?!0:!1}catch(r){return!1}}()||t(Array.prototype,"copyWithin",function(t,i){"use strict";var v=arguments[2],o,r,h,u,c,f,l,y,s,a,b;if(this===null||this===n)throw new TypeError("Cannot call method on "+this);for(o=Object(this),r=e(o.length),r<=0&&(r=0),r=r===Infinity?Math.pow(2,53)-1:Math.min(r,Math.pow(2,53)-1),r=Math.max(r,0),h=e(t),u=h<0?Math.max(r+h,0):Math.min(h,r),c=e(i),f=c<0?Math.max(r+c,0):Math.min(c,r),l=v===n?r:e(v),y=l<0?Math.max(r+l,0):Math.min(l,r),s=Math.min(y-f,r-u),f<u&&u<f+s?(a=-1,f=f+s-1,u=u+s-1):a=1;s>0;){var p=String(f),w=String(u),k=bt(o,p);k?(b=o[p],o[w]=b):delete o[w];f=f+a;u=u+a;s=s-1}return o});"Symbol"in this&&"iterator"in this.Symbol&&!!Array.prototype.entries||t(Array.prototype,"entries",function(){var n=s(this);return new it(n,"key+value")});"fill"in Array.prototype||t(Array.prototype,"fill",function(t){for(var y=arguments[1],l=arguments[2],o=s(this),i=v(r(o,"length")),h=e(y),f=h<0?Math.max(i+h,0):Math.min(h,i),c=l===n?i:e(l),p=c<0?Math.max(i+c,0):Math.min(c,i),a;f<p;)a=u(f),o[a]=t,f=f+1;return o});"find"in Array.prototype||t(Array.prototype,"find",function(t){var e=s(this),a=v(r(e,"length")),h,i;if(o(t)===!1)throw new TypeError(t+" is not a function");for(h=arguments.length>1?arguments[1]:n,i=0;i<a;){var y=u(i),c=r(e,y),p=l(f(t,h,[c,i,e]));if(p)return c;i=i+1}return n});"findIndex"in Array.prototype||t(Array.prototype,"findIndex",function(t){var e=s(this),c=v(r(e,"length")),h,i;if(o(t)===!1)throw new TypeError(t+" is not a function");for(h=arguments.length>1?arguments[1]:n,i=0;i<c;){var a=u(i),y=r(e,a),p=l(f(t,h,[y,i,e]));if(p)return i;i=i+1}return-1});"Symbol"in this&&"iterator"in this.Symbol&&!!Array.prototype.keys||t(Array.prototype,"keys",function(){var n=s(this);return new it(n,"key")});"name"in Function.prototype&&function(){}.name==="x"||function(){var t="name",r=/^\s*function\s+([^\(\s]*)\s*/,i=Function,u="Function",n=i.prototype,f=n.constructor,e=function(t){var e,o;return t===i||t===f?o=u:t!==n&&(e=(""+t).match(r),o=e&&e[1]),o||""};Object.defineProperty(n,t,{get:function(){var i=this,r=e(i);return i!==n&&Object.defineProperty(i,t,{value:r,configurable:!0}),r},configurable:!0})}();"acosh"in Math||t(Math,"acosh",function(n){return isNaN(n)?NaN:n<1?NaN:n===1?0:n===Infinity?Infinity:Math.log(n+Math.sqrt(n*n-1))});"asinh"in Math||t(Math,"asinh",function(n){return isNaN(n)?NaN:n===0&&1/n==Infinity?0:n===0&&1/n==-Infinity?-0:n===Infinity?Infinity:n===-Infinity?-Infinity:Math.log(n+Math.sqrt(n*n+1))});"atanh"in Math||t(Math,"atanh",function(n){return isNaN(n)?NaN:n<-1?NaN:n>1?NaN:n===-1?-Infinity:n===1?Infinity:n===0&&1/n==Infinity?0:n===0&&1/n==-Infinity?-0:Math.log((1+n)/(1-n))/2});"cosh"in Math||t(Math,"cosh",function(n){var t;return isNaN(n)?NaN:n===0&&1/n==Infinity?1:n===0&&1/n==-Infinity?1:n===Infinity?Infinity:n===-Infinity?Infinity:(n=Math.abs(n),n>709)?(t=Math.exp(.5*n),t/2*t):(t=Math.exp(n),(t+1/t)/2)});"clz32"in Math||t(Math,"clz32",function(n){var t=st(n);return t?32-t.toString(2).length:32});"cbrt"in Math||t(Math,"cbrt",function(n){if(isNaN(n))return NaN;if(n===0&&1/n==Infinity||n===0&&1/n==-Infinity)return 0;if(n===Infinity)return Infinity;if(n===-Infinity)return-Infinity;var t=Math.pow(Math.abs(n),1/3);return n<0?-t:t});"expm1"in Math||t(Math,"expm1",function(n){return isNaN(n)?NaN:n===0&&1/n==Infinity?0:n===0&&1/n==-Infinity?-0:n===Infinity?Infinity:n===-Infinity?-1:n>-1e-6&&n<1e-6?n+n*n/2:Math.exp(n)-1});"hypot"in Math||t(Math,"hypot",function(){var t,n,i,r;if(arguments.length===0)return 0;for(t=0,n=0,i=0;i<arguments.length;++i){if(arguments[i]===Infinity||arguments[i]===-Infinity)return Infinity;r=Math.abs(Number(arguments[i]));r>n&&(t=t*Math.pow(n/r,2),n=r);(r!==0||n!==0)&&(t=t+Math.pow(r/n,2))}return n*Math.sqrt(t)}),function(n){"use strict";function l(n){switch(typeof n){case"undefined":return"undefined";case"boolean":return"boolean";case"number":return"number";case"string":return"string";default:return n===null?"null":"object"}}function a(n){return Object.prototype.toString.call(n).replace(/^\[object *|\]$/g,"")}function u(n){return typeof n=="function"}function h(n){if(n===null||n===i)throw TypeError();return Object(n)}function r(n){return n>>0}function t(n){return n>>>0}function tt(t){function r(n){Object.defineProperty(t,n,{get:function(){return t._getter(n)},set:function(i){t._setter(n,i)},enumerable:!0,configurable:!1})}if(!("TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS"in n)){if(t.length>k)throw RangeError("Array too large for polyfill");for(var i=0;i<t.length;i+=1)r(i)}}function v(n,t){var i=32-t;return n<<i>>i}function y(n,t){var i=32-t;return n<<i>>>i}function it(n){return[n&255]}function rt(n){return v(n[0],8)}function ut(n){return[n&255]}function p(n){return y(n[0],8)}function ft(n){return n=nt(Number(n)),[n<0?0:n>255?255:n&255]}function et(n){return[n&255,n>>8&255]}function ot(n){return v(n[1]<<8|n[0],16)}function st(n){return[n&255,n>>8&255]}function ht(n){return y(n[1]<<8|n[0],16)}function ct(n){return[n&255,n>>8&255,n>>16&255,n>>24&255]}function lt(n){return v(n[3]<<24|n[2]<<16|n[1]<<8|n[0],32)}function at(n){return[n&255,n>>8&255,n>>16&255,n>>24&255]}function vt(n){return y(n[3]<<24|n[2]<<16|n[1]<<8|n[0],32)}function w(n,t,i){function b(n){var t=s(n),i=n-t;return i<.5?t:i>.5?t+1:t%2?t+1:t}var y=(1<<t-1)-1,a,r,u,f,p,h,l,v,w;for(n!==n?(r=(1<<t)-1,u=o(2,i-1),a=0):n===Infinity||n===-Infinity?(r=(1<<t)-1,u=0,a=n<0?1:0):n===0?(r=0,u=0,a=1/n==-Infinity?1:0):(a=n<0,n=c(n),n>=o(2,1-y)?(r=e(s(g(n)/d),1023),f=n/o(2,r),f<1&&(r-=1,f*=2),f>=2&&(r+=1,f/=2),p=o(2,i),u=b(f*p)-p,r+=y,u/p>=1&&(r+=1,u=0),r>2*y&&(r=(1<<t)-1,u=0)):(r=0,u=b(n/o(2,1-y-i)))),h=[],l=i;l;l-=1)h.push(u%2?1:0),u=s(u/2);for(l=t;l;l-=1)h.push(r%2?1:0),r=s(r/2);for(h.push(a?1:0),h.reverse(),v=h.join(""),w=[];v.length;)w.unshift(parseInt(v.substring(0,8),2)),v=v.substring(8);return w}function b(n,t,i){for(var c=[],l,e,s,a,r,h,u,f=0;f<n.length;++f)for(e=n[f],l=8;l;l-=1)c.push(e%2?1:0),e=e>>1;return c.reverse(),s=c.join(""),a=(1<<t-1)-1,r=parseInt(s.substring(0,1),2)?-1:1,h=parseInt(s.substring(1,1+t),2),u=parseInt(s.substring(1+t),2),h===(1<<t)-1?u!==0?NaN:r*Infinity:h>0?r*o(2,h-a)*(1+u/o(2,i)):u!==0?r*o(2,-(a-1))*(u/o(2,i)):r<0?-0:0}function yt(n){return b(n,11,52)}function pt(n){return w(n,11,52)}function wt(n){return b(n,8,23)}function bt(n){return w(n,8,23)}var i=void 0,k=1e5,d=Math.LN2,c=Math.abs,s=Math.floor,g=Math.log,f=Math.max,e=Math.min,o=Math.pow,nt=Math.round;(function(){var n=Object.defineProperty,t=!function(){try{return Object.defineProperty({},"x",{})}catch(n){return!1}}();(!n||t)&&(Object.defineProperty=function(t,i,r){if(n)try{return n(t,i,r)}catch(u){}if(t!==Object(t))throw TypeError("Object.defineProperty called on non-object");return Object.prototype.__defineGetter__&&"get"in r&&Object.prototype.__defineGetter__.call(t,i,r.get),Object.prototype.__defineSetter__&&"set"in r&&Object.prototype.__defineSetter__.call(t,i,r.set),"value"in r&&(t[i]=r.value),t})})(),function(){function y(n){if(n=r(n),n<0)throw RangeError("ArrayBuffer size is not a small enough positive integer.");Object.defineProperty(this,"byteLength",{value:n});Object.defineProperty(this,"_bytes",{value:Array(n)});for(var t=0;t<n;t+=1)this._bytes[t]=0}function o(){if(!arguments.length||typeof arguments[0]!="object")return function(n){if(n=r(n),n<0)throw RangeError("length is not a small enough positive integer.");Object.defineProperty(this,"length",{value:n});Object.defineProperty(this,"byteLength",{value:n*this.BYTES_PER_ELEMENT});Object.defineProperty(this,"buffer",{value:new y(this.byteLength)});Object.defineProperty(this,"byteOffset",{value:0})}.apply(this,arguments);if(arguments.length>=1&&l(arguments[0])==="object"&&arguments[0]instanceof o)return function(n){var i,t;if(this.constructor!==n.constructor)throw TypeError();for(i=n.length*this.BYTES_PER_ELEMENT,Object.defineProperty(this,"buffer",{value:new y(i)}),Object.defineProperty(this,"byteLength",{value:i}),Object.defineProperty(this,"byteOffset",{value:0}),Object.defineProperty(this,"length",{value:n.length}),t=0;t<this.length;t+=1)this._setter(t,n._getter(t))}.apply(this,arguments);if(arguments.length>=1&&l(arguments[0])==="object"&&!(arguments[0]instanceof o)&&!(arguments[0]instanceof y||a(arguments[0])==="ArrayBuffer"))return function(n){var i=n.length*this.BYTES_PER_ELEMENT,t,r;for(Object.defineProperty(this,"buffer",{value:new y(i)}),Object.defineProperty(this,"byteLength",{value:i}),Object.defineProperty(this,"byteOffset",{value:0}),Object.defineProperty(this,"length",{value:n.length}),t=0;t<this.length;t+=1)r=n[t],this._setter(t,Number(r))}.apply(this,arguments);if(arguments.length>=1&&l(arguments[0])==="object"&&(arguments[0]instanceof y||a(arguments[0])==="ArrayBuffer"))return function(n,r,u){if(r=t(r),r>n.byteLength)throw RangeError("byteOffset out of range");if(r%this.BYTES_PER_ELEMENT)throw RangeError("buffer length minus the byteOffset is not a multiple of the element size.");if(u===i){var f=n.byteLength-r;if(f%this.BYTES_PER_ELEMENT)throw RangeError("length of buffer minus byteOffset not a multiple of the element size");u=f/this.BYTES_PER_ELEMENT}else u=t(u),f=u*this.BYTES_PER_ELEMENT;if(r+f>n.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this,"buffer",{value:n});Object.defineProperty(this,"byteLength",{value:f});Object.defineProperty(this,"byteOffset",{value:r});Object.defineProperty(this,"length",{value:u})}.apply(this,arguments);throw TypeError();}function v(n,t,i){var r=function(){Object.defineProperty(this,"constructor",{value:r});o.apply(this,arguments);tt(this)},u;return"__proto__"in r?r.__proto__=o:(r.from=o.from,r.of=o.of),r.BYTES_PER_ELEMENT=n,u=function(){},u.prototype=w,r.prototype=new u,Object.defineProperty(r.prototype,"BYTES_PER_ELEMENT",{value:n}),Object.defineProperty(r.prototype,"_pack",{value:t}),Object.defineProperty(r.prototype,"_unpack",{value:i}),r}var w;n.ArrayBuffer=n.ArrayBuffer||y;Object.defineProperty(o,"from",{value:function(n){return new this(n)}});Object.defineProperty(o,"of",{value:function(){return new this(arguments)}});w={};o.prototype=w;Object.defineProperty(o.prototype,"_getter",{value:function(n){if(arguments.length<1)throw SyntaxError("Not enough arguments");if(n=t(n),n>=this.length)return i;for(var f=[],r=0,u=this.byteOffset+n*this.BYTES_PER_ELEMENT;r<this.BYTES_PER_ELEMENT;r+=1,u+=1)f.push(this.buffer._bytes[u]);return this._unpack(f)}});Object.defineProperty(o.prototype,"get",{value:o.prototype._getter});Object.defineProperty(o.prototype,"_setter",{value:function(n,i){if(arguments.length<2)throw SyntaxError("Not enough arguments");if(n=t(n),!(n>=this.length))for(var f=this._pack(i),r=0,u=this.byteOffset+n*this.BYTES_PER_ELEMENT;r<this.BYTES_PER_ELEMENT;r+=1,u+=1)this.buffer._bytes[u]=f[r]}});Object.defineProperty(o.prototype,"constructor",{value:o});Object.defineProperty(o.prototype,"copyWithin",{value:function(n,u){var b=arguments[2],a=h(this),d=a.length,o=t(d),v,s,y,c,p,k,l,w;for(o=f(o,0),v=r(n),s=v<0?f(o+v,0):e(v,o),y=r(u),c=y<0?f(o+y,0):e(y,o),p=b===i?o:r(b),k=p<0?f(o+p,0):e(p,o),l=e(k-c,o-s),c<s&&s<c+l?(w=-1,c=c+l-1,s=s+l-1):w=1;l>0;)a._setter(s,a._getter(c)),c=c+w,s=s+w,l=l-1;return a}});Object.defineProperty(o.prototype,"every",{value:function(n){var f,e,o,r;if(this===i||this===null)throw TypeError();if(f=Object(this),e=t(f.length),!u(n))throw TypeError();for(o=arguments[1],r=0;r<e;r++)if(!n.call(o,f._getter(r),r,f))return!1;return!0}});Object.defineProperty(o.prototype,"fill",{value:function(n){var y=arguments[1],a=arguments[2],l=h(this),p=l.length,u=t(p),o,s,c,v;for(u=f(u,0),o=r(y),s=o<0?f(u+o,0):e(o,u),c=a===i?u:r(a),v=c<0?f(u+c,0):e(c,u);s<v;)l._setter(s,n),s+=1;return l}});Object.defineProperty(o.prototype,"filter",{value:function(n){var f,s,e,h,r,o;if(this===i||this===null)throw TypeError();if(f=Object(this),s=t(f.length),!u(n))throw TypeError();for(e=[],h=arguments[1],r=0;r<s;r++)o=f._getter(r),n.call(h,o,r,f)&&e.push(o);return new this.constructor(e)}});Object.defineProperty(o.prototype,"find",{value:function(n){var f=h(this),c=f.length,l=t(c),o,r,e,s;if(!u(n))throw TypeError();for(o=arguments.length>1?arguments[1]:i,r=0;r<l;){if(e=f._getter(r),s=n.call(o,e,r,f),Boolean(s))return e;++r}return i}});Object.defineProperty(o.prototype,"findIndex",{value:function(n){var f=h(this),c=f.length,l=t(c),e,r,o,s;if(!u(n))throw TypeError();for(e=arguments.length>1?arguments[1]:i,r=0;r<l;){if(o=f._getter(r),s=n.call(e,o,r,f),Boolean(s))return r;++r}return-1}});Object.defineProperty(o.prototype,"forEach",{value:function(n){var f,e,o,r;if(this===i||this===null)throw TypeError();if(f=Object(this),e=t(f.length),!u(n))throw TypeError();for(o=arguments[1],r=0;r<e;r++)n.call(o,f._getter(r),r,f)}});Object.defineProperty(o.prototype,"indexOf",{value:function(n){var o,u,r,e;if(this===i||this===null)throw TypeError();if((o=Object(this),u=t(o.length),u===0)||(r=0,arguments.length>0&&(r=Number(arguments[1]),r!==r?r=0:r!==0&&r!==1/0&&r!==-(1/0)&&(r=(r>0||-1)*s(c(r)))),r>=u))return-1;for(e=r>=0?r:f(u-c(r),0);e<u;e++)if(o._getter(e)===n)return e;return-1}});Object.defineProperty(o.prototype,"join",{value:function(n){var r;if(this===i||this===null)throw TypeError();var u=Object(this),f=t(u.length),e=Array(f);for(r=0;r<f;++r)e[r]=u._getter(r);return e.join(n===i?",":n)}});Object.defineProperty(o.prototype,"lastIndexOf",{value:function(n){var o,u,r,f;if(this===i||this===null)throw TypeError();if(o=Object(this),u=t(o.length),u===0)return-1;for(r=u,arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:r!==0&&r!==1/0&&r!==-(1/0)&&(r=(r>0||-1)*s(c(r)))),f=r>=0?e(r,u-1):u-c(r);f>=0;f--)if(o._getter(f)===n)return f;return-1}});Object.defineProperty(o.prototype,"map",{value:function(n){var f,o,e,s,r;if(this===i||this===null)throw TypeError();if(f=Object(this),o=t(f.length),!u(n))throw TypeError();for(e=[],e.length=o,s=arguments[1],r=0;r<o;r++)e[r]=n.call(s,f._getter(r),r,f);return new this.constructor(e)}});Object.defineProperty(o.prototype,"reduce",{value:function(n){var f,o,r,e;if(this===i||this===null)throw TypeError();if(f=Object(this),o=t(f.length),!u(n))throw TypeError();if(o===0&&arguments.length===1)throw TypeError();for(r=0,e=arguments.length>=2?arguments[1]:f._getter(r++);r<o;)e=n.call(i,e,f._getter(r),r,f),r++;return e}});Object.defineProperty(o.prototype,"reduceRight",{value:function(n){var f,o,r,e;if(this===i||this===null)throw TypeError();if(f=Object(this),o=t(f.length),!u(n))throw TypeError();if(o===0&&arguments.length===1)throw TypeError();for(r=o-1,e=arguments.length>=2?arguments[1]:f._getter(r--);r>=0;)e=n.call(i,e,f._getter(r),r,f),r--;return e}});Object.defineProperty(o.prototype,"reverse",{value:function(){var r,u,e;if(this===i||this===null)throw TypeError();var n=Object(this),f=t(n.length),o=s(f/2);for(r=0,u=f-1;r<o;++r,--u)e=n._getter(r),n._setter(r,n._getter(u)),n._setter(u,e);return n}});Object.defineProperty(o.prototype,"set",{value:function(){if(arguments.length<1)throw SyntaxError("Not enough arguments");var i,o,u,s,n,r,f,h,e,c;if(typeof arguments[0]=="object"&&arguments[0].constructor===this.constructor){if(i=arguments[0],u=t(arguments[1]),u+i.length>this.length)throw RangeError("Offset plus length of array is out of range");if(h=this.byteOffset+u*this.BYTES_PER_ELEMENT,e=i.length*this.BYTES_PER_ELEMENT,i.buffer===this.buffer){for(c=[],n=0,r=i.byteOffset;n<e;n+=1,r+=1)c[n]=i.buffer._bytes[r];for(n=0,f=h;n<e;n+=1,f+=1)this.buffer._bytes[f]=c[n]}else for(n=0,r=i.byteOffset,f=h;n<e;n+=1,r+=1,f+=1)this.buffer._bytes[f]=i.buffer._bytes[r]}else if(typeof arguments[0]=="object"&&typeof arguments[0].length!="undefined"){if(o=arguments[0],s=t(o.length),u=t(arguments[1]),u+s>this.length)throw RangeError("Offset plus length of array is out of range");for(n=0;n<s;n+=1)r=o[n],this._setter(u+n,Number(r))}else throw TypeError("Unexpected argument type(s)");}});Object.defineProperty(o.prototype,"slice",{value:function(n,u){for(var c=h(this),b=c.length,o=t(b),l=r(n),s=l<0?f(o+l,0):e(l,o),a=u===i?o:r(u),v=a<0?f(o+a,0):e(a,o),k=v-s,d=c.constructor,y=new d(k),p=0,w;s<v;)w=c._getter(s),y._setter(p,w),++s,++p;return y}});Object.defineProperty(o.prototype,"some",{value:function(n){var f,e,o,r;if(this===i||this===null)throw TypeError();if(f=Object(this),e=t(f.length),!u(n))throw TypeError();for(o=arguments[1],r=0;r<e;r++)if(n.call(o,f._getter(r),r,f))return!0;return!1}});Object.defineProperty(o.prototype,"sort",{value:function(n){function o(t,r){return t!==t&&r!==r?0:t!==t?1:r!==r?-1:n!==i?n(t,r):t<r?-1:t>r?1:0}var r;if(this===i||this===null)throw TypeError();var u=Object(this),f=t(u.length),e=Array(f);for(r=0;r<f;++r)e[r]=u._getter(r);for(e.sort(o),r=0;r<f;++r)u._setter(r,e[r]);return u}});Object.defineProperty(o.prototype,"subarray",{value:function(n,t){function u(n,t,i){return n<t?t:n>i?i:n}n=r(n);t=r(t);arguments.length<1&&(n=0);arguments.length<2&&(t=this.length);n<0&&(n=this.length+n);t<0&&(t=this.length+t);n=u(n,0,this.length);t=u(t,0,this.length);var i=t-n;return i<0&&(i=0),new this.constructor(this.buffer,this.byteOffset+n*this.BYTES_PER_ELEMENT,i)}});var b=v(1,it,rt),k=v(1,ut,p),d=v(1,ft,p),g=v(2,et,ot),nt=v(2,st,ht),kt=v(4,ct,lt),dt=v(4,at,vt),gt=v(4,bt,wt),ni=v(8,pt,yt);n.Int8Array=n.Int8Array||b;n.Uint8Array=n.Uint8Array||k;n.Uint8ClampedArray=n.Uint8ClampedArray||d;n.Int16Array=n.Int16Array||g;n.Uint16Array=n.Uint16Array||nt;n.Int32Array=n.Int32Array||kt;n.Uint32Array=n.Uint32Array||dt;n.Float32Array=n.Float32Array||gt;n.Float64Array=n.Float64Array||ni}(),function(){function o(n,t){return u(n.get)?n.get(t):n[t]}function r(n,r,u){if(!(n instanceof ArrayBuffer||a(n)==="ArrayBuffer"))throw TypeError();if(r=t(r),r>n.byteLength)throw RangeError("byteOffset out of range");if(u=u===i?n.byteLength-r:t(u),r+u>n.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this,"buffer",{value:n});Object.defineProperty(this,"byteLength",{value:u});Object.defineProperty(this,"byteOffset",{value:r})}function f(n){return function(i,r){var e,u,f;if(i=t(i),i+n.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");for(i+=this.byteOffset,e=new Uint8Array(this.buffer,i,n.BYTES_PER_ELEMENT),u=[],f=0;f<n.BYTES_PER_ELEMENT;f+=1)u.push(o(e,f));return Boolean(r)===Boolean(s)&&u.reverse(),o(new n(new Uint8Array(u).buffer),0)}}function e(n){return function(i,r,u){if(i=t(i),i+n.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");for(var c=new n([r]),l=new Uint8Array(c.buffer),e=[],h,f=0;f<n.BYTES_PER_ELEMENT;f+=1)e.push(o(l,f));Boolean(u)===Boolean(s)&&e.reverse();h=new Uint8Array(this.buffer,i,n.BYTES_PER_ELEMENT);h.set(e)}}var s=function(){var n=new Uint16Array([4660]),t=new Uint8Array(n.buffer);return o(t,0)===18}();Object.defineProperty(r.prototype,"getUint8",{value:f(Uint8Array)});Object.defineProperty(r.prototype,"getInt8",{value:f(Int8Array)});Object.defineProperty(r.prototype,"getUint16",{value:f(Uint16Array)});Object.defineProperty(r.prototype,"getInt16",{value:f(Int16Array)});Object.defineProperty(r.prototype,"getUint32",{value:f(Uint32Array)});Object.defineProperty(r.prototype,"getInt32",{value:f(Int32Array)});Object.defineProperty(r.prototype,"getFloat32",{value:f(Float32Array)});Object.defineProperty(r.prototype,"getFloat64",{value:f(Float64Array)});Object.defineProperty(r.prototype,"setUint8",{value:e(Uint8Array)});Object.defineProperty(r.prototype,"setInt8",{value:e(Int8Array)});Object.defineProperty(r.prototype,"setUint16",{value:e(Uint16Array)});Object.defineProperty(r.prototype,"setInt16",{value:e(Int16Array)});Object.defineProperty(r.prototype,"setUint32",{value:e(Uint32Array)});Object.defineProperty(r.prototype,"setInt32",{value:e(Int32Array)});Object.defineProperty(r.prototype,"setFloat32",{value:e(Float32Array)});Object.defineProperty(r.prototype,"setFloat64",{value:e(Float64Array)});n.DataView=n.DataView||r}()}(self);"fround"in Math||t(Math,"fround",function(n){return isNaN(n)?NaN:1/n==+Infinity||1/n==-Infinity||n===+Infinity||n===-Infinity?n:new Float32Array([n])[0]});"imul"in Math||t(Math,"imul",function(n,t){var r=st(n),u=st(t),i=r*u%Math.pow(2,32);return i>=Math.pow(2,31)?i-Math.pow(2,32):i});"log1p"in Math||t(Math,"log1p",function(n){return Math.log(1+n)});"log2"in Math||t(Math,"log2",function(n){return Math.log(n)/Math.LN2});"log10"in Math||t(Math,"log10",function(n){return Math.log(n)/Math.LN10});"sign"in Math||t(Math,"sign",function(n){var n=Number(n);return isNaN(n)?NaN:1/n==-Infinity?-0:1/n==Infinity?0:n<0?-1:n>0?1:void 0});"sinh"in Math||t(Math,"sinh",function(n){var r=n<0?-1:1,i=Math.abs(n),u,t;return i<22?i<Math.pow(2,-28)?n:(t=Math.exp(i)-1,i<1)?r*(2*t-t*t/(t+1))/2:r*(t+t/(t+1))/2:i<709.7822265625?r*Math.exp(i)/2:(u=Math.exp(.5*i),t=r*u/2,t*u)});"trunc"in Math||t(Math,"trunc",function(n){return n<0?Math.ceil(n):Math.floor(n)});"EPSILON"in Number||Object.defineProperty(Number,"EPSILON",{enumerable:!1,configurable:!1,writable:!1,value:Math.pow(2,-52)});"tanh"in Math||t(Math,"tanh",function(n){var t;return n===Infinity?1:n===-Infinity?-1:(t=Math.exp(2*n),(t-1)/(t+1))});"MAX_SAFE_INTEGER"in Number||Object.defineProperty(Number,"MAX_SAFE_INTEGER",{enumerable:!1,configurable:!1,writable:!1,value:Math.pow(2,53)-1});"isFinite"in Number||function(){var n=this;t(Number,"isFinite",function(t){return i(t)!=="number"?!1:n.isFinite(t)})}();"MIN_SAFE_INTEGER"in Number||Object.defineProperty(Number,"MIN_SAFE_INTEGER",{enumerable:!1,configurable:!1,writable:!1,value:-(Math.pow(2,53)-1)});"isInteger"in Number||t(Number,"isInteger",function(n){if(i(n)!=="number"||isNaN(n)||n===Infinity||n===-Infinity)return!1;var t=e(n);return t!==n?!1:!0});"isSafeInteger"in Number||t(Number,"isSafeInteger",function(n){if(i(n)!=="number"||isNaN(n)||n===Infinity||n===-Infinity)return!1;var t=e(n);return t!==n?!1:Math.abs(t)<=Math.pow(2,53)-1?!0:!1});"isNaN"in Number||function(){var n=this;t(Number,"isNaN",function(t){return i(t)!=="number"?!1:n.isNaN(t)?!0:!1})}();"parseFloat"in Number||t(Number,"parseFloat",parseFloat);"parseInt"in Number||t(Number,"parseInt",parseInt);"is"in Object||t(Object,"is",function(n,t){return nt(n,t)});"Promise"in this||!function(n){function t(r){if(i[r])return i[r].exports;var u=i[r]={i:r,l:!1,exports:{}};return n[r].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var i={};t.m=n;t.c=i;t.i=function(n){return n};t.d=function(n,i,r){t.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:r})};t.n=function(n){var i=n&&n.__esModule?function(){return n["default"]}:function(){return n};return t.d(i,"a",i),i};t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)};t.p="";t(t.s=100)}({100:function(n,t,i){(function(n){var t=i(5);try{n.Promise=t;window.Promise=t}catch(r){}}).call(t,i(2))},2:function(n){var t=function(){return this}();try{t=t||Function("return this")()||eval("this")}catch(i){"object"==typeof window&&(t=window)}n.exports=t},5:function(t,i,r){(function(i){!function(){"use strict";function ft(){return r[d][ri]||yi}function et(n){return n&&"object"==typeof n}function e(n){return"function"==typeof n}function ot(n,t){return n instanceof t}function si(n){return ot(n,ii)}function st(n,t,i){if(!t(n))throw h(i);}function hi(){try{return bt.apply(kt,arguments)}catch(n){return o.e=n,o}}function s(n,t){return bt=n,kt=t,hi}function ht(n,t){function f(){for(var r=0;r<u;)t(i[r],i[r+1]),i[r++]=p,i[r++]=p;u=0;i.length>n&&(i.length=n)}var i=ti(n),u=0;return function(n,t){i[u++]=n;i[u++]=t;2===u&&r.nextTick(f)}}function ct(n,t){var c,u,l,a,i=0,f;if(!n)throw h(it);if(f=n[r[d][vi]],e(f))u=f.call(n);else{if(!e(n.next)){if(ot(n,ti)){for(c=n.length;i<c;)t(n[i],i++);return i}throw h(it);}u=n}for(;!(l=u.next()).done;)if((a=s(t)(l.value,i++))===o)throw e(u[ui])&&u[ui](),a.e;return i}function h(n){return new TypeError(n)}function lt(n){return(n?"":pi)+(new ii).stack}function at(n,t){var u="on"+n.toLowerCase(),i=v[u];w&&w.listeners(n).length?n===ei?w.emit(n,t._v,t):w.emit(n,t):i?i({reason:t._v,promise:t}):r[n](t._v,t)}function b(n){return n&&n._s}function y(n){if(b(n))return new n(rt);var t,i,r;return t=new n(function(n,u){if(t)throw h();i=n;r=u}),st(i,e),st(r,e),t}function vt(n,t){var i=!1;return function(r){i||(i=!0,c&&(n[tt]=lt(!0)),t===l?k(n,r):u(n,t,r))}}function ci(n,t,i,r){return e(i)&&(t._onFulfilled=i),e(r)&&(n[fi]&&at(bi,n),t._onRejected=r),c&&(t._p=n),n[n._c++]=t,n._s!==g&&ut(n,t),t}function yt(n){if(n._umark)return!0;n._umark=!0;for(var t,i=0,r=n._c;i<r;)if(t=n[i++],t._onRejected||yt(t))return!0}function pt(n,t){function i(n){return r.push(n.replace(/^\s+|\s+$/g,""))}var r=[];return c&&(t[tt]&&i(t[tt]),function u(n){n&&nt in n&&(u(n._next),i(n[nt]+""),u(n._p))}(t)),(n&&n.stack?n.stack:n)+("\n"+r.join("\n")).replace(ki,"")}function li(n,t){return n(t)}function u(n,t,i){var r=0,u=n._c;if(n._s===g)for(n._s=t,n._v=i,t===f&&(c&&si(i)&&(i.longStack=pt(i,n)),oi(n));r<u;)ut(n,n[r++]);return n}function k(n,t){if(t===n&&t)return u(n,f,h(wi)),n;if(t!==a&&(e(t)||et(t))){var i=s(ai)(t);if(i===o)return u(n,f,i.e),n;e(i)?(c&&b(t)&&(n._next=t),b(t)?wt(n,t,i):r.nextTick(function(){wt(n,t,i)})):u(n,l,t)}else u(n,l,t);return n}function ai(n){return n.then}function wt(n,t,i){var r=s(i,t)(function(i){t&&(t=a,k(n,i))},function(i){t&&(t=a,u(n,f,i))});r===o&&t&&(u(n,f,r.e),t=a)}var p,bt,kt,a=null,dt="object"==typeof self,v=dt?self:i,gt=v.Promise,w=v.process,ni=v.console,c=!1,ti=Array,ii=Error,f=1,l=2,g=3,d="Symbol",vi="iterator",ri="species",yi=d+"("+ri+")",ui="return",fi="_uh",nt="_pt",tt="_st",it="Invalid argument",pi="\nFrom previous ",wi="Chaining cycle detected for promise",bi="rejectionHandled",ei="unhandledRejection",o={e:a},rt=function(){},ki=/^.+\/node_modules\/yaku\/.+\n?/gm,r=function(n){var i,t=this;if(!et(t)||t._s!==p)throw h("Invalid this");if(t._s=g,c&&(t[nt]=lt()),n!==rt){if(!e(n))throw h(it);i=s(n)(vt(t,l),vt(t,f));i===o&&u(t,f,i.e)}},ut,oi;r["default"]=r,function(n,t){for(var i in t)n[i]=t[i]}(r.prototype,{then:function(t,i){if(this._s===n)throw h();return ci(this,y(r.speciesConstructor(this,r)),t,i)},"catch":function(n){return this.then(p,n)},"finally":function(n){return this.then(function(t){return r.resolve(n()).then(function(){return t})},function(t){return r.resolve(n()).then(function(){throw t;})})},_c:0,_p:a});r.resolve=function(n){return b(n)?n:k(y(this),n)};r.reject=function(n){return u(y(this),f,n)};r.race=function(n){var t=this,i=y(t),e=function(n){u(i,l,n)},h=function(n){u(i,f,n)},r=s(ct)(n,function(n){t.resolve(n).then(e,h)});return r===o?t.reject(r.e):i};r.all=function(n){function h(n){u(i,f,n)}var t,r=this,i=y(r),e=[];return(t=s(ct)(n,function(n,f){r.resolve(n).then(function(n){e[f]=n;--t||u(i,l,e)},h)}))===o?r.reject(t.e):(t||u(i,l,[]),i)};r.Symbol=v[d]||{};s(function(){Object.defineProperty(r,ft(),{get:function(){return this}})})();r.speciesConstructor=function(n,t){var i=n.constructor;return i?i[ft()]||t:t};r.unhandledRejection=function(n,t){ni&&ni.error("Uncaught (in promise)",c?t.longStack:pt(n,t))};r.rejectionHandled=rt;r.enableLongStackTrace=function(){c=!0};r.nextTick=dt?function(n){gt?new gt(function(n){n()}).then(n):setTimeout(n)}:w.nextTick;r._s=1;ut=ht(999,function(n,t){var i,r;return(r=n._s!==f?t._onFulfilled:t._onRejected)===p?void u(t,n._s,n._v):(i=s(li)(r,n._v))===o?void u(t,f,i.e):void k(t,i)});oi=ht(9,function(n){yt(n)||(n[fi]=1,at(ei,n))});try{t.exports=r}catch(di){v.Yaku=r}}()}).call(i,r(2))}});"flags"in RegExp.prototype||Object.defineProperty(RegExp.prototype,"flags",{configurable:!0,enumerable:!1,get:function(){var t=this,n,u,f,e,o,s;if(i(t)!=="object")throw new TypeError("Method called on incompatible type: must be an object.");return n="",u=l(r(t,"global")),u&&(n+="g"),f=l(r(t,"ignoreCase")),f&&(n+="i"),e=l(r(t,"multiline")),e&&(n+="m"),o=l(r(t,"unicode")),o&&(n+="u"),s=l(r(t,"sticky")),s&&(n+="y"),n}});lt=function(){var n=function(t){if(!(this instanceof n))return new n(t);t=String(t);p.call(this,t);Object.defineProperty(this,"__length__",{value:t.length,configurable:!1,enumerable:!1,writable:!1})};return Object.setPrototypeOf&&Object.setPrototypeOf(n,p),n.prototype=Object.create(p.prototype,{constructor:{value:n,configurable:!0,enumerable:!1,writable:!0},_next:{value:function(){if(this.__list__){if(this.__nextIndex__<this.__length__)return this.__nextIndex__++;this._unBind()}},configurable:!0,enumerable:!1,writable:!0},_resolve:{value:function(n){var t=this.__list__[n],i;return this.__nextIndex__===this.__length__?t:(i=t.charCodeAt(0),i>=55296&&i<=56319)?t+this.__list__[this.__nextIndex__++]:t},configurable:!0,enumerable:!1,writable:!0},toString:{value:function(){return"[object String Iterator]"},configurable:!0,enumerable:!1,writable:!0}}),n}();"Symbol"in this&&"iterator"in this.Symbol&&!!String.prototype[Symbol.iterator]||t(String.prototype,Symbol.iterator,function(){var n=a(this),t=u(n);return new lt(t)});"codePointAt"in String.prototype||t(String.prototype,"codePointAt",function(t){var h=a(this),o=u(h),r=e(t),s=o.length,i,f;return r<0||r>=s?n:(i=String.prototype.charCodeAt.call(o,r),i<55296||i>56319||r+1===s)?i:(f=String.prototype.charCodeAt.call(o,r+1),f<56320||f>57343)?i:kt(i,f)});"endsWith"in String.prototype||t(String.prototype,"endsWith",function(t){"use strict";var i=arguments.length>1?arguments[1]:n,c=a(this),r=u(c),l=ot(t);if(l)throw new TypeError("First argument to String.prototype.endsWith must not be a regular expression");var f=u(t),o=r.length,v=i===n?o:e(i),y=Math.min(Math.max(v,0),o),s=f.length,h=y-s;return h<0?!1:r.substr(h,s)===f?!0:!1});"repeat"in String.prototype||t(String.prototype,"repeat",function(n){"use strict";var i=a(this),r=u(i),t=e(n);if(t<0)throw new RangeError("Invalid count value");if(t===Infinity)throw new RangeError("Invalid count value");return t===0?"":new Array(t+1).join(r)});"startsWith"in String.prototype||t(String.prototype,"startsWith",function(t){"use strict";var o=arguments.length>1?arguments[1]:n,s=a(this),i=u(s),h=ot(t);if(h)throw new TypeError("First argument to String.prototype.startsWith must not be a regular expression");var c=u(t),l=e(o),r=i.length,f=Math.min(Math.max(l,0),r),v=c.length;return v+f>r?!1:i.substr(f).indexOf(t)===0?!0:!1});"Symbol"in this&&"isConcatSpreadable"in this.Symbol||Object.defineProperty(Symbol,"isConcatSpreadable",{value:Symbol("isConcatSpreadable")});"Symbol"in this&&"hasInstance"in this.Symbol||Object.defineProperty(Symbol,"hasInstance",{value:Symbol("hasInstance")});"Symbol"in this&&"match"in this.Symbol||Object.defineProperty(Symbol,"match",{value:Symbol("match")});"Symbol"in this&&"replace"in this.Symbol||Object.defineProperty(Symbol,"replace",{value:Symbol("replace")});"Symbol"in this&&"search"in this.Symbol||Object.defineProperty(Symbol,"search",{value:Symbol("search")});"Symbol"in this&&"toPrimitive"in this.Symbol||Object.defineProperty(Symbol,"toPrimitive",{value:Symbol("toPrimitive")});"Symbol"in this&&"split"in this.Symbol||Object.defineProperty(Symbol,"split",{value:Symbol("split")}),function(n){try{if("WeakSet"in n&&WeakSet.length===0){var t={},i=new WeakSet([t]);return i.has(t)&&i["delete"](0)===!1}return!1}catch(r){return!1}}(this)||function(u){var s=Symbol("undef"),e=function e(){var i,t,u,h,l,a,s,v;if(!(this instanceof e))throw new TypeError('Constructor WeakSet requires "new"');if(i=b(this,e.prototype,{_values:[],_size:0,_es6WeakSet:!0}),t=arguments.length>0?arguments[0]:n,t===null||t===n)return i;if(u=r(i,"add"),!o(u))throw new TypeError("WeakSet.prototype.add is not a function");try{for(h=k(t);;){if(l=d(h),l===!1)return i;a=g(l);try{f(u,i,[a])}catch(y){return c(h,y)}}}catch(y){if(dt(t)||Object.prototype.toString.call(t)==="[object Arguments]"||!!t.callee)for(v=t.length,s=0;s<v;s++)f(u,i,[t[s]])}return i};Object.defineProperty(e,"prototype",{configurable:!1,enumerable:!1,writable:!1,value:{}});t(e.prototype,"add",function(n){var t=this,u,r,f;if(i(t)!=="object")throw new TypeError("Method WeakSet.prototype.add called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6WeakSet!==!0)throw new TypeError("Method WeakSet.prototype.add called on incompatible receiver "+Object.prototype.toString.call(t));if(i(n)!=="object")throw new TypeError("Invalid value used in weak set");for(u=t._values,r=0;r<u.length;r++)if(f=u[r],f!==s&&h(f,n))return t;return t._values.push(n),t});t(e.prototype,"constructor",e);t(e.prototype,"delete",function(n){var t=this,u,r,f;if(i(t)!=="object")throw new TypeError("Method WeakSet.prototype.delete called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6WeakSet!==!0)throw new TypeError("Method WeakSet.prototype.delete called on incompatible receiver "+Object.prototype.toString.call(t));if(i(n)!=="object")return!1;for(u=t._values,r=0;r<u.length;r++)if(f=u[r],f!==s&&h(f,n))return u[r]=s,!0;return!1});t(e.prototype,"has",function(n){var t=this,u,r,f;if(i(t)!=="object")throw new TypeError("Method WeakSet.prototype.has called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6WeakSet!==!0)throw new TypeError("Method WeakSet.prototype.has called on incompatible receiver "+Object.prototype.toString.call(t));if(u=t._values,i(n)!=="object")return!1;for(r=0;r<u.length;r++)if(f=u[r],f!==s&&h(f,n))return!0;return!1});"name"in e||Object.defineProperty(e,"name",{configurable:!0,enumerable:!1,writable:!1,value:"WeakSet"});try{t(u,"WeakSet",e)}catch(v){u.WeakSet=e}}(this);"includes"in Array.prototype||t(Array.prototype,"includes",function(n){"use strict";var o=s(this),f=v(r(o,"length")),i,t,c;if(f===0)return!1;for(i=e(arguments[1]),i>=0?t=i:(t=f+i,t<0&&(t=0));t<f;){if(c=r(o,u(t)),h(n,c))return!0;t=t+1}return!1});"Symbol"in this&&"unscopables"in this.Symbol||Object.defineProperty(Symbol,"unscopables",{value:Symbol("unscopables")}),function(n){try{if("WeakMap"in n&&WeakMap.length===0){var t={},i=new WeakMap([[t,"test"]]);return i.get(t)==="test"&&i["delete"](0)===!1}return!1}catch(r){return!1}}(this)||function(u){var s=Symbol("undef"),e=function e(){var u,t,l,a,p,s,h,w,v,y;if(!(this instanceof e))throw new TypeError('Constructor WeakMap requires "new"');if(u=b(this,e.prototype,{_keys:[],_values:[],_es6WeakMap:!0}),t=arguments.length>0?arguments[0]:n,t===null||t===n)return u;if(l=r(u,"set"),!o(l))throw new TypeError("WeakMap.prototype.set is not a function");try{for(a=k(t);;){if(p=d(a),p===!1)return u;if(s=g(p),i(s)!=="object")try{throw new TypeError("Iterator value "+s+" is not an entry object");}catch(nt){return c(a,nt)}try{v=r(s,"0");y=r(s,"1");f(l,u,[v,y])}catch(tt){return c(a,tt)}}}catch(tt){if(Array.isArray(t)||Object.prototype.toString.call(t)==="[object Arguments]"||!!t.callee)for(w=t.length,h=0;h<w;h++)v=t[h][0],y=t[h][1],f(l,u,[v,y])}return u};Object.defineProperty(e,"prototype",{configurable:!1,enumerable:!1,writable:!1,value:{}});t(e.prototype,"constructor",e);t(e.prototype,"delete",function(n){var t=this,u,r;if(i(t)!=="object")throw new TypeError("Method WeakMap.prototype.clear called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6WeakMap!==!0)throw new TypeError("Method WeakMap.prototype.clear called on incompatible receiver "+Object.prototype.toString.call(t));if(u=t._keys,i(n)!=="object")return!1;for(r=0;r<u.length;r++)if(t._keys[r]!==s&&nt(t._keys[r],n))return this._keys[r]=s,this._values[r]=s,this._size=--this._size,!0;return!1});t(e.prototype,"get",function(t){var r=this,f,u;if(i(r)!=="object")throw new TypeError("Method WeakMap.prototype.get called on incompatible receiver "+Object.prototype.toString.call(r));if(r._es6WeakMap!==!0)throw new TypeError("Method WeakMap.prototype.get called on incompatible receiver "+Object.prototype.toString.call(r));if(f=r._keys,i(t)!=="object")return n;for(u=0;u<f.length;u++)if(r._keys[u]!==s&&nt(r._keys[u],t))return r._values[u];return n});t(e.prototype,"has",function(n){var t=this,u,r;if(typeof t!="object")throw new TypeError("Method WeakMap.prototype.has called on incompatible receiver "+Object.prototype.toString.call(t));if(t._es6WeakMap!==!0)throw new TypeError("Method WeakMap.prototype.has called on incompatible receiver "+Object.prototype.toString.call(t));if(u=t._keys,i(n)!=="object")return!1;for(r=0;r<u.length;r++)if(t._keys[r]!==s&&nt(t._keys[r],n))return!0;return!1});t(e.prototype,"set",function(n,t){var r=this,e,u,f;if(i(r)!=="object")throw new TypeError("Method WeakMap.prototype.set called on incompatible receiver "+Object.prototype.toString.call(r));if(r._es6WeakMap!==!0)throw new TypeError("Method WeakMap.prototype.set called on incompatible receiver "+Object.prototype.toString.call(r));if(e=r._keys,i(n)!=="object")throw new TypeError("Invalid value used as weak map key");for(u=0;u<e.length;u++)if(r._keys[u]!==s&&nt(r._keys[u],n))return r._values[u]=t,r;return f={"[[Key]]":n,"[[Value]]":t},r._keys.push(f["[[Key]]"]),r._values.push(f["[[Value]]"]),r});"name"in e||Object.defineProperty(e,"name",{configurable:!0,enumerable:!1,writable:!1,value:"WeakMap"});try{t(u,"WeakMap",e)}catch(v){u.WeakMap=e}}(this);"padEnd"in String.prototype||t(String.prototype,"padEnd",function(t){"use strict";var s=arguments.length>1?arguments[1]:n,l=a(this),r=u(l),h=v(t),c=r.length,f,e,i,o;if(h<=c||(f=s===n?" ":u(s),f===""))return r;for(e=h-c,i="",o=0;o<e;o++)i+=f;return i=i.substr(0,e),r+i});"padStart"in String.prototype||t(String.prototype,"padStart",function(t){"use strict";var s=arguments.length>1?arguments[1]:n,l=a(this),r=u(l),h=v(t),c=r.length,f,e,i,o;if(h<=c||(f=s===n?" ":u(s),f===""))return r;for(e=h-c,i="",o=0;o<e;o++)i+=f;return i=i.substr(0,e),i+r})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{})