function toogleTopNavDynamic(){$(window).scroll(function(){$(window).width()<768&&($(this).scrollTop()<5?$("#top-status-bar").show():$("#top-status-bar").hide())})}function bindQueue(){(!window.matchMedia||window.matchMedia("(min-width: 992px)").matches)&&$(".queue-item").hover(function(){var n=$(this).find(".queue-item-details").find(".resize-portion");$(this).find(".queue-img").css("height","0");n.height(186);n.find(".queue-description").removeClass("line-clamp").height(155);n.find(".queue-title").removeClass("truncate")},function(){var n=$(this).find(".queue-item-details").find(".resize-portion");$(this).find(".queue-img").css("height","120");n.height(66);n.find(".queue-description").addClass("line-clamp").height(34);n.find(".queue-title").addClass("truncate")});bindTagClicks()}function bindTagClicks(){$(".tag").off("click");$(".tag").click(function(n){n.stopPropagation();addTag($(this).html(),$(this).data("id"))})}function showPaymentModal(n){var t="/Purchases/GetPaymentModal?auctionId="+n;$.get(t,function(n){$("#paymentModalContainer").html(n);$("#paymentModal").modal("show")})}function showPaymentResult(){}function payAuctionNow(n){var t="/Purchases/GetPaymentModal?auctionId="+n;$.get(t,function(n){$("#paymentModalContainer").html(n);$("#paymentModal").on("shown.bs.modal",function(){$("#wonAuctionModal").modal("hide")});$("#paymentModal").modal("show")})}function showFeedbackModal(n){var t={auctionId:n};$.post("/Dashboard/GetFeedbackModal",t,function(n){$("#feedbackModalContainer").html(n);$("#feedbackModal").modal("show")})}function setDemoDummyText(){$("#feature-auction-details").find(".vertical-center").removeClass("vertical-center");updateExampleTitle("Example title for Whafish");updateExampleDescription("This is an example description. It will be replaced when you type into the input fields on the left.")}function payAuction(n){function i(n,i,r){n=="Complete"?(alert("Payment complete! E-way Transaction ID: "+i),confirmPayment(t)):n=="Error"&&alert("There was a problem completing the payment: "+r)}var t=n;$.post("/Purchases/CreateTransaction",{auctionId:n},function(n){var t={sharedPaymentUrl:n.url};eCrypt.showModalPayment(t,i)})}function confirmPayment(n){var t="/Purchases/ConfirmTransaction?auctionId="+n;$.get(t,function(t){$("#"+n).html(t)})}function showSuccessModal(n){$("#wonAuctionModal").length==0&&$("body").append('<div id="wonAuctionModal" class="modal fade" role="dialog" aria-labelledby="wonAuctionModal" aria-hidden="true"><div class="modal-dialog"><div class="modal-content blue-gradient-back"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×<\/button><h2 id="dataConfirmLabel" class="text-center text-white">Congratulations<\/h2><\/div><div class="modal-body col-md-12 text-center text-medium background-white"><\/div><\/div><\/div><\/div>');$("#wonAuctionModal").find(".modal-body").html(n);$("#wonAuctionModal").modal({show:!0})}function showSorryModal(n){$("#sorryModal").length==0&&$("body").append('<div id="sorryModal" class="modal fade" role="dialog" aria-labelledby="wonAuctionModal" aria-hidden="true"><div class="modal-dialog"><div class="modal-content blue-gradient-back"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×<\/button><h2 id="dataConfirmLabel" class="text-center text-white">Sorry<\/h2><\/div><div class="modal-body col-md-12 text-center text-medium background-white"><\/div><\/div><\/div><\/div>');$("#sorryModal").find(".modal-body").html(n);$("#sorryModal").modal({show:!0})}function showSoCloseModal(){$("#soCloseModal").length==0&&$("body").append('<div id="soCloseModal" class="modal fade" role="dialog" aria-labelledby="soCloseModal" aria-hidden="true"><div class="modal-dialog"><div class="modal-content blue-gradient-back"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×<\/button><h2 id="dataConfirmLabel" class="text-center text-white">Oh no so close!<\/h2><\/div><div class="modal-body col-md-12 text-center text-medium background-white">Sorry you just missed out. Hopefully you will get the next one.<\/div><\/div><\/div><\/div>');$("#soCloseModal").modal({show:!0})}function playThemeSong(){soundEnabled()&&(audioElement==null&&(audioElement=document.createElement("audio"),audioElement.setAttribute("src","/Content/Audio/whafish-theme-song.mp3")),audioElement.play())}function generateAuctions(){$.post("/Auctions/GenerateAuctions",null,function(){window.location.reload()})}function updateShoppingCart(n){var t=parseInt($("#shopping-cart-count").html());t+=n;t==0?$("#shopping-cart").removeClass("active"):$("#shopping-cart").hasClass("active")||$("#shopping-cart").addClass("active");$("#shopping-cart-count").html(t)}function facebookWinShare(n,t,i,r){r=window.location.protocol+"//"+window.location.host+r+"?w=217";var u="https://www.facebook.com/dialog/feed?app_id=157397877963701",f=encodeURIComponent("https://whafish.co.nz");u+="&name="+encodeURIComponent("I just got hooked up on Whafish")+"&link=whafish.co.nz&redirect_uri="+f+"&display=popup&caption=WHAFISH.CO.NZ - Whafish Limited&description="+encodeURIComponent(n+" - Started at $"+t+" and I got it for $"+i)+"&picture="+encodeURIComponent(window.location.protocol+"//"+window.location.host+"/"+r+"?w=217");window.open(u,"fbshare","width=640,height=480");ga("send",{hitType:"event",eventCategory:"Share",eventAction:"PurchasedAuction"});console.log(r)}function emailSubscribe(n){var t={Email:n};$.post("Home/EmailSubscribe",t,function(n,t){t=="success"?console.log("Email subscribed succesfully!"):console.log("Email subscription failed: "+n)})}function removeHoverCSSRule(){var u,i,n,t,r;if("createTouch"in document)try{for(u=/:hover/,i=0;i<document.styleSheets.length;i++)if(n=document.styleSheets[i],n.cssRules)for(t=n.cssRules.length-1;t>=0;t--)r=n.cssRules[t],r.type===CSSRule.STYLE_RULE&&u.test(r.selectorText)&&n.deleteRule(t)}catch(f){}}function getScrollBarWidth(){var n=$("<div>").css({visibility:"hidden",width:100,overflow:"scroll"}).appendTo("body"),t=$("<div>").css({width:"100%"}).appendTo(n).outerWidth();return n.remove(),100-t}function toggleRegisterBtn(n,t){console.log($(n).is(":checked"));$(n).is(":checked")?$("#"+t).fadeIn():$("#"+t).fadeOut()}function toggleFooter(n){$(window).width()<992&&$("#footer-"+n).slideToggle()}function setUpLiveConnection(){timerHub=$.connection.timerHub;timerHub.client.purchase=featureProductPurchased;timerHub.client.youGotIt=youGotIt;timerHub.client.soClose=soClose;timerHub.client.updateUserCount=updateUserCount;timerHub.client.mouseEntered=mouseEntered;timerHub.client.mouseLeft=mouseLeft;timerHub.client.hoverHeatbeat=sendHoverHeartbeat;timerHub.client.updateHoverCount=updateHoverCount;timerHub.client.cantBuyYourOwn=cantBuyYourOwn;timerHub.client.updateCartCount=updateCartCount;$.connection.hub.qs="page="+window.location.pathname;$.connection.hub.start().done(function(){disconnected=!1;$("#buyBtn").removeClass("not-connected");bindBuyBtn()});$.connection.hub.disconnected(function(){disconnected=!0;$("#buyBtn").addClass("not-connected");setTimeout(function(){$.connection.hub.start().done(function(){disconnected=!1;$("#buyBtn").removeClass("not-connected")})},5e3)})}function showSearchFilters(){$("#search-filters").slideToggle()}function bindBuyBtn(){$("#buyButtonInner").unbind();$("#buyButtonInner").on("click",purchaseProduct);$("#buyButtonInner").mouseover(mouseEntered).mouseout(mouseLeft)}function youGotIt(n){showSuccessModal(n)}function cantBuyYourOwn(){showSorryModal("You cannot purchase your own auction!");startTimer()}function soClose(){showSoCloseModal();getFeatureAuction(!1)}function purchaseProduct(){$("#buyBtn").hasClass("buy-on")&&!$("#buyBtn").hasClass("not-connected")&&(stopTimer(),$("#priceText").attr("font-size",28),$("#priceText").text("Validating"),timerHub.server.purchase(aid))}function sendHoverHeartbeat(){timerHub.server.hoverHeartbeat()}function mouseEntered(){$("#buyBtn").hasClass("buy-on")&&!$("#buyBtn").hasClass("not-connected")&&(timerHub.server.mouseEntered(),hoverHeartbeatTimerId=setInterval(function(){sendHoverHeartbeat()},3e3))}function mouseLeft(){hoverHeartbeatTimerId&&clearInterval(hoverHeartbeatTimerId);hoverHeartbeatTimerId=null;$("#buyBtn").hasClass("buy-on")&&timerHub.server.mouseLeft()}function updateHoverCount(n){$("#feature-auction-hovers").html(n);n>0?startBuyButtonAnimation():stopBuyButtonAnimation();buyButtonAnimationSpeed=300-Math.min((n-1)/50,1)*240}function updateCartCount(n){updateShoppingCart(n)}function featureProductPurchased(n,t){if(stopTimer(),featureAuction.Id==t){hidePurchaseButtons();$("#auctionStartingText").text("Auction sold");priceDropper.style("fill","url(#purchaseGradient)");var i=$("#countdown-timer");i.addClass("purchased");$("#priceText").attr("font-size",40);svg.select("#priceText").text(n);singleAuction||setTimeout(getFeatureAuction,1e4);playThemeSong();ga("send",{hitType:"event",eventCategory:"Products",eventAction:"Purchase"})}}function updateUserCount(n){$("#feature-auction-watchers").html(n)}function setUpHorizontalScroll(){function n(n){n=window.event||n;var t=Math.max(-1,Math.min(1,n.wheelDelta||-n.detail));document.getElementById("queue-outter").scrollLeft-=t*80;n.preventDefault()}document.getElementById("queue-outter").addEventListener?(document.getElementById("queue-outter").addEventListener("mousewheel",n,!1),document.getElementById("queue-outter").addEventListener("DOMMouseScroll",n,!1)):document.getElementById("queue-outter").attachEvent("onmousewheel",n);document.getElementById("loadingDiv").addEventListener?(document.getElementById("loadingDiv").addEventListener("mousewheel",n,!1),document.getElementById("loadingDiv").addEventListener("DOMMouseScroll",n,!1)):document.getElementById("loadingDiv").attachEvent("onmousewheel",n)}function initAuctionScroller(){var i=$(".queue-item").first();$("#queue-inner").width(i.outerWidth(!0)*$(".queue-item").length+$("loadingDiv").outerWidth(!0));var n=2,r=!1,t=!1;$("#queue-outter").scroll(function(){if($("#queue-outter").scrollLeft()==$("#queue-inner").width()-$("#queue-outter").width()&&!r&&!t){t=!0;$("#loadingDiv").show();var u={tags:searchFilterTags,region:searchFilterRegion,terms:searchFilterTerms,BlockNumber:n,type:searchFilterType};$.post("/Auctions/InfinateScroll",u,function(u){$("#queue-inner").width(i.outerWidth(!0)*($(".queue-item").length+u.ItemCount)+$("loadingDiv").outerWidth(!0));n=n+1;r=u.NoMoreData;$("#queue-inner").append(u.HTMLString);bindQueue();$("#loadingDiv").hide();t=!1})}});window.setInterval(updateQueTimes,15e3)}function setupWatchlist(){$(document).on("click",".watchlist-icon",function(n){var t=$(this),i=!0,r,u;return t.hasClass("fa-heart")?(t.removeClass("fa-heart"),t.addClass("fa-heart-o"),i=!1):(t.removeClass("fa-heart-o"),t.addClass("fa-heart"),i=!0),r={AuctionId:t.data("id")},u=i?"/Auctions/AddToWatchlist":"/Auctions/RemoveFromWatchlist",$.post(u,r,function(){}),n.stopPropagation(),!1})}function setUpSearchAutocomplete(){if($("#filter-tag").length>0){$("#filter-tag").autocomplete({minLength:0,source:"/Auctions/Tags/Search",messages:{noResults:"",results:function(){}},select:function(n,t){return addTag(t.item.name,t.item.id),!1}}).data("ui-autocomplete")._renderItem=function(n,t){text="tag";cssClass="label-primary";var i=$("<li>").attr("data-value",t.id).append("<div class='dropdown-item-container clearfix'><div class='dropdown-item-left col-xs-12'><h4>"+t.name+"<\/h4><\/div><\/div>");return i.append("<\/li>").appendTo(n),i};$("#filter-tag").on("focus",function(){$(this).autocomplete("search")});$("#tag-btn").on("click",function(){$("#filter-tag").focus()})}if($("#filter-region").length>0){$("#filter-region").autocomplete({minLength:0,source:"/Auctions/Region/Search",messages:{noResults:"",results:function(){}},select:function(n,t){return changeRegion(t.item.name,t.item.id),!1}}).data("ui-autocomplete")._renderItem=function(n,t){text="region";cssClass="label-success";var i=$("<li>").attr("data-value",t.id).append("<div class='dropdown-item-container clearfix'><div class='dropdown-item-left col-xs-12'><h4>"+t.name+"<\/h4><\/div><\/div>");return i.append("<\/li>").appendTo(n),i};$("#filter-region").on("focus",function(){$(this).autocomplete("search")});$("#region-btn").on("click",function(){$("#filter-region").focus()})}$("#filter-search").length>0&&($("#search-btn").click(function(){document.activeElement.blur();addSearchTerm($("#filter-search").val());$("#filter-search").val("")}),$("#filter-search").keyup(function(n){n.keyCode==13&&$("#search-btn").click()}))}function addTag(n,t){document.activeElement.blur();searchFilterTags.indexOf(t)==-1&&($("#search-terms").show(),searchFilterTags.push(t),$("#search-terms").append("<span class='label label-primary search-filter pull-right' data-id='"+t+"' data-type='tag'>"+n+"<i class='fa fa-remove'><\/i><\/span>"),bindSearchTerms(),getNewQueue())}function addSearchTerm(n){document.activeElement.blur();searchFilterTerms.indexOf(n)==-1&&n.length>0&&($("#search-terms").show(),searchFilterTerms.push(n),$("#search-terms").append("<span class='label label-default search-filter pull-right' data-type='term'><\/span>"),$(".search-filter").last().html(n+"<i class='fa fa-remove'><\/i>"),bindSearchTerms(),getNewQueue())}function changeRegion(n,t){document.activeElement.blur();searchFilterRegion!=t&&($("#search-terms").show(),searchFilterRegion=t,$("#search-region").remove(),$("#search-terms").append("<span class='label label-success search-filter pull-right' id='search-region' data-type='region'>"+n+"<i class='fa fa-remove'><\/i><\/span>"),bindSearchTerms(),getNewQueue())}function changeFilterType(n){if(searchFilterType!=n){searchFilterType=n;$(".search-include").removeClass("label-primary");$(".search-include").addClass("label-default");var t="#filter-type-"+n;$(t).removeClass("label-default");$(t).addClass("label-primary");getNewQueue()}}function bindSearchTerms(){$(".search-filter").off("click");$(".search-filter").click(function(n){var t;n.stopPropagation();switch($(this).data("type")){case"region":searchFilterRegion=null;break;case"term":t=searchFilterTerms.indexOf($(this).html().split("<")[0]);t!=-1&&searchFilterTerms.splice(t,1);break;case"tag":t=searchFilterTags.indexOf($(this).data("id"));t!=-1&&searchFilterTags.splice(t,1)}$(this).remove();searchFilterRegion==null&&searchFilterTags.length==0&&searchFilterTerms.length==0&&$("#search-terms").hide();getNewQueue()})}function getNewQueue(){$("#empty-auction-queue").hide();$("#loadingDiv").show();var n={tags:searchFilterTags,region:searchFilterRegion,terms:searchFilterTerms,type:searchFilterType,BlockNumber:1};$.post("/Auctions/InfinateScroll",n,function(n){$("#loadingDiv").hide();n.ItemCount>0?($("#queue-inner").show(),$("#queue-inner").html(n.HTMLString),resizeQueueWrapper(),bindQueue()):($("#queue-inner").hide(),$("#empty-auction-queue").show())})}function resizeQueueWrapper(){var n=$(".queue-item").first();$("#queue-inner").width(n.outerWidth(!0)*$(".queue-item").length+$("loadingDiv").outerWidth(!0))}function getSingleAuctionId(){return window.location.pathname.split("/")[2]}function getFeatureAuction(n){var t,i;$("#feature-auction-share").hide();$.ajaxSetup({cache:!1});t="";n?(t="?aid="+getSingleAuctionId(),singleAuction=!0):featureAuction!=null&&(t="?oid="+featureAuction.Id);i="/Auctions/GetFeature"+t;startTime=new Date;$.getJSON(i,null,function(n){n!=null?(n.Sold?setSoldAuction(n):(setFeatureAuction(n),bindBuyBtn()),bindTagClicks()):noAuctions()})}function noAuctions(){$("#feature-auction").fadeTo("slow",0);$("#no-auction").fadeIn("slow")}function initializeFeatureArea(){function c(){var l,a,i,e,o,c;createShadowFilter("countdownDialShadow",0,4,14,.8);priceDropper=svg.append("circle").attr("cx",centerX).attr("cy",centerY).attr("r",n).style("fill","url(#gradient)").style("filter","url(#countdownDialShadow)");var y=2*Math.PI,p=d3.svg.arc().innerRadius(f).outerRadius(s).startAngle(0).endAngle(y),w=svg.append("path").attr("fill","#FFF").attr("d",p).attr("transform","translate("+centerX+","+centerY+")"),t=40;for(tinyScreen&&(t=26),price=svg.append("text").attr("id","priceText").attr("fill","#FFF").attr("font-size",t+"px").attr("text-anchor","middle").attr("transform","translate("+centerX+","+(centerY+t/2-5)+")").text(""),pricePercentText=svg.append("text").attr("id","pricePercentText").attr("fill","#FFF").attr("font-size",t*.6+"px").attr("text-anchor","middle").attr("transform","translate("+(centerX-150)+","+(centerY+t/2-150)+")").style("display","none").text("10%"),l=Math.round(n*.07),a=Math.round(n*.04),i=0;i<60;++i)i%5==0?(e=l,o="hourtick"):(e=a,o="minutetick"),svg.append("line").attr("class",o+" face").attr("x1",centerX).attr("y1",centerY+n+h).attr("x2",centerX).attr("y2",centerY+n+h+e).attr("transform","rotate("+i*6+","+centerX+","+centerY+")");foregroundArc=d3.svg.arc().innerRadius(f).outerRadius(s).startAngle(0);innerArc=svg.append("path").datum({endAngle:0*Math.PI}).attr("class","time-arc").attr("fill-opacity",.8).attr("d",foregroundArc).attr("transform","translate("+centerX+","+centerY+")");svg.append("text").attr("id","auctionStartingText").attr("class","blinkybill").attr("transform","translate("+centerX+","+(centerY-40)+")").attr("text-anchor","middle").attr("fill","#000").attr("style","pointer-events: none").attr("font-size","10").text("Next Item Starts In...");c="";disconnected&&(c="not-connected");createShadowFilter("buyButtonDropShadow",2,2,5,.7);buyBtn=svg.append("g").attr("id","buyBtn").attr("class",c).attr("pointer-events","boundingBox").attr("title","You must be logged on when the button goes green and the prices go live. First to hit buy wins!");$("#buyBtn").tooltip({container:"body",placement:"bottom"});buyBtnOuterRadius=47;var v=40,r=centerX+n,u=centerY+n/1.5;tinyScreen&&(buyBtnOuterRadius=40,v=34,r=centerX+80,u+(centerY+n/1.5)+2e3);this.buyBtnOuter=buyBtn.append("circle").attr("cx",r).attr("cy",u).attr("r",buyBtnOuterRadius).attr("filter","url(#buyButtonDropShadow)").attr("class","outter").attr("stroke-width",2).attr("fill-opacity",0);buyBtn.append("circle").attr("id","buyButtonInner").attr("cx",r).attr("cy",u).attr("r",v).attr("filter","url(#buyButtonDropShadow)").attr("class","inner");buyBtn.append("text").attr("transform","translate("+r+","+(u+8)+")").attr("text-anchor","middle").attr("fill","#FFF").attr("style","pointer-events: none").attr("font-size","25px").text("Buy");buyBtn.append("text").attr("id","buyBtnConnecting").attr("font-family","FontAwesome").attr("transform","translate("+r+","+(u+28)+")").attr("text-anchor","middle").attr("fill","#FFF").attr("style","pointer-events: none").attr("font-size","16px").text(function(){return""});bindBuyBtn()}var r,t;getCookie("global-sound-enabled")!="false"!=soundEnabled()&&toggleSound();$("#whacard").unbind("click");$("#whacard").click(function(){$("#comments-popup").slideToggle("fast")});r=$("#countdown-timer");tinyScreen=$(window).width()<961;var u=r.width(),e=r.height(),i=tinyScreen?{top:10,right:10,bottom:10,left:10}:{top:50,right:50,bottom:100,left:50},o={width:u-i.left-i.right,height:e-i.top-i.bottom},n=tinyScreen?$(window).width()>400?150:120:150,f=n-Math.round(n*.13),s=n-Math.round(n*.45),h=-n-f+5;centerX=o.width/2+i.left;centerY=o.height/2+i.top;svg!=null&&svg.remove();t=$(".clock");$(window).width()<500?(t.css("left",u/2-t.outerWidth()/2+"px"),t.css("top","49px")):tinyScreen?(t.css("left",""),t.css("top","49px")):(t.css("left",""),t.css("top",""));svg=d3.select("#countdown-timer").append("svg").attr("class","countdown-timer").attr("width",u).attr("height",e);defs=svg.append("svg:defs");gradient=defs.append("svg:linearGradient").attr("id","gradient").attr("x1","0%").attr("y1","100%").attr("x2","100%").attr("y2","100%").attr("spreadMethod","pad");gradient.append("svg:stop").attr("offset","0%").attr("stop-color","#4a7ec0").attr("stop-opacity",1);gradient.append("svg:stop").attr("offset","100%").attr("stop-color","#7ed6fe").attr("stop-opacity",1);purchaseGradient=defs.append("svg:linearGradient").attr("id","purchaseGradient").attr("x1","0%").attr("y1","100%").attr("x2","100%").attr("y2","100%").attr("spreadMethod","pad");purchaseGradient.append("svg:stop").attr("offset","0%").attr("stop-color","#55aa65").attr("stop-opacity",1);purchaseGradient.append("svg:stop").attr("offset","100%").attr("stop-color","#8ae186").attr("stop-opacity",1);c()}function createShadowFilter(n,t,i,r,u){var f=defs.append("filter").attr("id",n).attr("height","130%"),e;f.append("feGaussianBlur").attr("in","SourceAlpha").attr("stdDeviation",r);f.append("feComponentTransfer").append("feFuncA").attr("type","linear").attr("slope",u);f.append("feOffset").attr("dx",t).attr("dy",i).attr("result","offsetblur");e=f.append("feMerge");e.append("feMergeNode");e.append("feMergeNode").attr("in","SourceGraphic")}function setBuyButtonAnimationSpeed(n){this.buyButtonAnimationSpeed=n}function startBuyButtonAnimation(){if(!buyButtonAnimating){buyButtonAnimating=!0;var n=function(){var t=buyButtonAnimationSpeed;buyBtnOuter.transition().ease("sin").duration(t).attr("r",buyBtnOuterRadius*1.08).ease("sin").delay(t).transition().attr("r",buyBtnOuterRadius).each("end",function(){buyButtonAnimating&&n()})};n()}}function stopBuyButtonAnimation(){buyButtonAnimating=!1}function setSoldAuction(n){var t,i;$("#feature-auction-share").show();aid=n.Id;featureAuction=n;$("head title",window.parent.document).text(n.Title+" - Sold");$("#feature-auction").css("background","url('"+n.Image+"?w=100&blur=70') no-repeat center");$("#feature-auction").css("background-size","cover");priceDropper.style("fill","url(#purchaseGradient)");svg.select("#priceText").text("$"+n.Price);t=$("#countdown-timer");t.addClass("purchased");$("#feature-auction-tags").html("");$.each(n.Tags,function(n,t){var i="<span data-id='"+t.Id+"'>"+t.Name+"<\/span> | ";$("#feature-auction-tags").append(i)});$("#feature-auction-tags").html($("#feature-auction-tags").html().slice(0,-3));i=d3.scale.linear().domain([n.StartPrice,n.EndPrice]).range([0,360]);innerArc.datum({endAngle:i(n.Price)*Math.PI/180}).attr("d",foregroundArc)}function showLegalBuyingInformation(){getCookie("buy-information-dsa")!="true"&&($("#buying-legal-information-dsa").prop("checked",!1),$("#buying-legal-information").modal("show"))}function getCookie(n){var i="; "+document.cookie,t=i.split("; "+n+"=");if(t.length==2)return t.pop().split(";").shift()}function setInfiniteCookie(n,t){document.cookie=n+"="+t+"; expires=Fri, 31 Dec 9999 23:59:59 GMT"}function acceptLegal(){$("#buying-legal-information").modal("hide");$("#buying-legal-information-dsa").is(":checked")?setInfiniteCookie("buy-information-dsa",!0):setInfiniteCookie("buy-information-dsa",!1)}function dontAcceptLegal(){$("#buying-legal-information").modal("hide");$('input[name="saftey-switch"]').bootstrapSwitch("state",!1,!0);setInfiniteCookie("buy-active",!1);$("#buyBtn").removeClass("buy-on");console.log("buy button set off");setInfiniteCookie("buy-information-dsa",!1)}function setFeatureAuction(n){var u,s,i,r,t;aid=n.Id;featureAuction=n;$("#feature-auction-share").show();featureAuction.EndPrice!=0&&$("#feature-reserver-sticker").hide();$("head title",window.parent.document).text(n.Title+" - Whafish");priceDropper.style("fill","url(#gradient)");svg.select("#priceText").text("");featureAuction.CompanyName?pricePercentText.style("display","initial"):pricePercentText.style("display","none");u=$("#countdown-timer");u.removeClass("purchased");var f=moment.utc(n.ServerUtc),e=moment.utc().valueOf()-startTime,o=moment.utc();for(offset=f.valueOf()+e/2-o.valueOf(),$.each(n.Tags,function(n,t){var i="<span data-id='"+t.Id+"'>"+t.Name+"<\/span> | ";$("#feature-auction-tags").append(i)}),$("#feature-auction-tags").html($("#feature-auction-tags").html().slice(0,-3)),s=new Date,$("#feature-auction-timing").html(featureAuction.Duration+" MIN AUCTION"),i=moment(n.StartTime),$("#feature-auction-start-time").html(i.format("DD MMMM YYYY")+"<br/>Starts at <span>"+i.format("h:mm a")+"<\/span>"),r="",t=0;t<n.Description.length;t++)r+=n.Description.charAt(t)=="\n"?"<br/>":n.Description.charAt(t);$("#feature-auction-description").html(r);$("#feature-auction-title").html(n.Title);$("#feature-auction-region").html(n.Region);$("#feature-auction-price").html(n.StartPrice);$("#feature-auction-seller").html(n.UserFeedback.UserName);$("#feature-auction-feedback-sold").html(n.UserFeedback.AuctionsSold);$("#feature-auction-feedback-won").html(n.UserFeedback.AuctionsWon);$("#feature-auction-feedback-score").html(n.UserFeedback.FeedbackScore);$("#feature-auction-email").attr("href","mailto:"+n.Email);loadSellerComments();updateImages(n,function(){$("#feature-auction").fadeTo("slow",1);$("#no-auction").fadeOut("slow")});updateMoreInfoImages(n);moment.utc(n.EndTime).valueOf()<moment.utc().valueOf()?setAuctionFinished():startTimer();$(".custom.carousel.slide").each(function(){var n="";$(this).siblings(".custom.feature-auction-detail-over").each(function(){n=$(this).height()+30+"px"});$(this).css("max-height",n)})}function loadSellerComments(){$("#comments-popup").empty();$.getJSON("/Auctions/GetSellerFeedback/"+aid,function(n,t){var i,u,r;if(t=="success")if(n.length==0)r=$('<div style="text-align: center">This seller has not yet received feedback<\/div>').appendTo("#comments-popup");else for(i=0;i<n.length;i++)r=$("<div><\/div>").appendTo("#comments-popup"),u=$('<i class="fa pull-right featuredicon" aria-hidden="true"><\/i>').appendTo(r),n[i].Vote=="Neutral"?u.addClass("fa-minus"):n[i].Vote=="Positive"?u.addClass("fa-thumbs-up"):n[i].Vote=="Negative"&&u.addClass("fa-thumbs-down"),r.append(n[i].Comment),i<n.length-1&&$("#comments-popup").append("<hr/>");else r=$('<div style="text-align: center">Could not load seller comments<\/div>').appendTo("#comments-popup")})}function reportAuction(){var n=aid;$.post("/Auctions/Report/"+n,{},function(){$("#auction-flag").remove();$(".tooltip").remove()})}function updateImages(n,t){var u,f,i,e,r;return $("#feature-auction-carousel-images").empty(),$("#feature-auction-carousel-indicators").empty(),f=function(n,t){var r=$('<div class="item"><\/div>'),i;t==0&&(u=n);i=$('<div class="feature-image" style=""><\/div>');i.css("height","297px");i.css("background-image","url("+n+"?w=400)");i.css("background-size","cover");i.css("background-position","center");i.css("background-repeat","no-repeat");r.append(i);$("#feature-auction-carousel-images").append(r);t==0&&r.addClass("active");$("#feature-auction-carousel-indicators").append('<li data-target="#myCarousel" class="'+(t==0?"active":"")+'" data-slide-to="'+t+'"><\/li>')},n?n.Images.forEach(function(n,t){f(n,t)}):(i=[],e=$(".single-file.selected").each(function(){i.push($(this))}),i.sort(function(n,t){return t.data("priority")-n.data("priority")}),i.forEach(function(n,t){var i=n.data("url")+"?w=400";f(i,t)})),$("#feature-auction-img").carousel("pause").removeData(),$("#feature-auction-img").carousel(0),t&&(r=new Image,r.onerror=r.onload=function(){t()},r.src=u),$("#feature-auction-img-more-info").html($("#feature-auction-img").html()),u}function updateMoreInfoImages(n){$("#modalPopupContent").html("");var t='<div id="more-info-carousel" class="carousel slide" data-ride="carousel"><div class="carousel-inner" role="listbox">',i=1;n.Images.forEach(function(n){i==1?(i=0,t+='<div class="item active"><div class="feature-image" style="height: 297px; background-image: url('+n+'); background-size: cover; background-position: center center; background-repeat: no-repeat;"><\/div><\/div>'):t+='<div class="item"><div class="feature-image" style="height: 297px; background-image: url('+n+'); background-size: cover; background-position: center center; background-repeat: no-repeat;"><\/div><\/div>'});t+="<\/div>";t+='<a class="left carousel-control" href="#more-info-carousel" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"><\/span><span class="sr-only">Previous<\/span><\/a><a class="right carousel-control" href="#more-info-carousel" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"><\/span><span class="sr-only">Next<\/span><\/a>';t+="<\/div><br/>";$("#modalPopupContent").html(t);$("#more-info-carousel").carousel("pause").removeData();$("#more-info-carousel").carousel(0);$("#myModalLabel").html($("#feature-auction-title").html())}function setAuctionFinished(){hidePurchaseButtons();$("#feature-auction-share").show();var n=$("#countdown-timer");$("#auctionStartingText").text("Auction Finished");svg.select("#priceText").text("$"+featureAuction.EndPrice);innerArc.datum({endAngle:2*Math.PI}).attr("d",foregroundArc)}function hidePurchaseButtons(){$("#saftey-switch").hide();setBuyEnabled(!1);timerHub.server.mouseLeft();$("#users-hovering-span").hide()}function setBuyEnabled(n){n?($("#buyBtn").addClass("buy-on"),$("#buyBtn").tooltip("disable")):($("#buyBtn").removeClass("buy-on"),$("#buyBtn").tooltip("enable"))}function stopCountdownBeep(){beepElement.stop()}function playCountdown(n,t,i,r){if(soundEnabled()){beepElement==null&&(beepElement=document.createElement("audio"));var u=d3.time.scale().domain([t,i]);switch(n){case 1:u.range([0,60]);beepElement.setAttribute("src","/Content/Audio/oneminute.wav");break;case 2:u.range([0,120]);beepElement.setAttribute("src","/Content/Audio/twominute.wav");break;case 3:u.range([0,180]);beepElement.setAttribute("src","/Content/Audio/threeminute.wav")}console.log(u(r));beepElement.play()}}function startTimer(){function y(){var w=moment.utc().valueOf()+offset,p,b,t,y,k,d;n.valueOf()<w?(f||(featureAuction.CompanyName?$("#pricePercentText").show():$("#pricePercentText").hide(),$("#auctionStartingText").text("Live Auction"),$(".clock").hide(),setBuyEnabled(isAuthenticated),v=!0,console.log("1st quater"),$("#users-hovering-span").show(),$("#queue-item-"+aid).length>0&&($("#queue-item-"+aid).remove(),$("#queue-inner").children().length==0&&$("#queue-partial").slideUp()),f=!0),p=r+(w-n.valueOf())*(u-r)/(i.valueOf()-n.valueOf()),p=Math.max(p,u),p==u&&(stopTimer(),singleAuction?setAuctionFinished():getFeatureAuction(!1)),price<1e3&&price.attr("font-size","60px"),innerArc.datum({endAngle:l(w)*Math.PI/180}).attr("d",foregroundArc),b="$"+parseFloat(p,10).toFixed(0).replace(/(\d)(?=(\d{3})+\.)/g,"$1,").toString(),price.text(b),pricePercentText.text(Math.round(100-p/r*100)+"% off"),t=a(w),t>=75||(t>=50&&t<75&&!o?(o=!0,console.log("2nd quater")):t>=25&&t<50&&!s?(s=!0,console.log("3nd quater")):t<25&&!h&&(h=!0,console.log("4th quater"))),$("head title",window.parent.document).text(b+" - Whafish")):($("#pricePercentText").hide(),$("#auctionStartingText").text("Next Item Starts In..."),$("#users-hovering-span").hide(),c.html(""),$(".clock").show(),y=n.valueOf()/1e3-w/1e3,e||(innerArc.transition().ease("elastic").duration(2e3).call(arcTween,0),setBuyEnabled(!1),countdownClock!=null?countdownTimer.start(y):(countdownClock=$(".clock").FlipClock(y,{countdown:!1,clockFace:"HourCounter"}),countdownClock.stop(),countdownTimer=new Timer(countdownClock),countdownTimer.start(y),$(".flip-clock-label").remove()),y>=36e4&&(tinyScreen?($(".clock").css("cssText","width : 531px !important;"),$(".clock").css("left","-123px"),$(".clock").css({"-webkit-transform":"scale(0.45)","-moz-transform":"scale(0.45)","-ms-transform":"scale(0.45)","-o-transform":"scale(0.45)",transform:"scale(0.45)"})):($(".clock").css("cssText","width : 636px !important;"),$(".clock").css({"-webkit-transform":"scale(0.65)","-moz-transform":"scale(0.65)","-ms-transform":"scale(0.65)","-o-transform":"scale(0.65)",transform:"scale(0.65)"}))),e=!0),y<120&&(k=parseInt(y,0),d="seconds",k==1&&(d="second"),$("head title",window.parent.document).text(k+" "+d+" - Whafish")))}if(featureAuction!=null){stopTimer();$(pricePercentText).show();var n=moment.utc(featureAuction.StartTime),i=moment.utc(featureAuction.EndTime),r=featureAuction.StartPrice,u=featureAuction.EndPrice;t=setInterval(y,50);var c=$("#feature-auction-countdown-price"),p=$("#feature-auction-countdown-timer"),l=d3.time.scale().domain([n,i]).range([0,360]),a=d3.time.scale().domain([n,i]).range([100,0]),w=$("#buy-btn"),f=!1,e=!1,v=!1,o=!1,s=!1,h=!1}}function stopTimer(){clearInterval(t);t=null}function arcTween(n,t){n.attrTween("d",function(n){var i=d3.interpolate(n.endAngle,t);return function(t){return n.endAngle=i(t),foregroundArc(n)}})}function InitializeView(n){isAuthenticated=n;setUpLiveConnection();initializeFeatureArea(isAuthenticated);setUpSearchAutocomplete();getNewQueue();setupWatchlist()}function InitializeDemo(){initializeFeatureArea(!0)}function setDemoStartPrice(n){demoStartPrice=parseInt(n)}function setDemoEndPrice(n){demoEndPrice=parseInt(n)}function setDemoDuration(n){demoDuration=n}function startDemoAuction(n){n.preventDefault();$("#demoModal").modal("show");stopTimer();setTimeout(function(){initializeFeatureArea()},0);demoStartPrice<=0||isNaN(demoStartPrice)||isNaN(demoEndPrice)?$("#invalidAuctionMessage").show():($("#invalidAuctionMessage").hide(),featureAuction={StartTime:moment().valueOf(),EndTime:moment().add(demoDuration,"minutes").valueOf(),StartPrice:demoStartPrice,EndPrice:demoEndPrice},offset=0,singleAuction=!0,startTimer())}function facebookShare(){var n="https://www.facebook.com/dialog/feed?app_id=157397877963701",i=window.location.protocol+"//"+window.location.host+featureAuction.Images[0]+"?w=217&h=200mode=max",t=encodeURIComponent("https://whafish.co.nz");n+="&name="+featureAuction.Title+"&link="+t+"&redirect_uri="+t+"&display=popup&caption=WHAFISH.CO.NZ - WHafish Limited&description="+encodeURIComponent(featureAuction.Description)+"&picture="+encodeURIComponent(i);window.open(n,"fbshare","width=640,height=480");ga("send",{hitType:"event",eventCategory:"Share",eventAction:"FeatureAuction"})}function resizeend(){new Date-rtime<delta?setTimeout(resizeend,delta):(timeout=!1,initializeFeatureArea(isAuthenticated),startTimer())}function updateQueTimes(){var n=864e5,t=36e5,i=6e4;$(".counter-unit-minutes").each(function(){var n=Math.max(moment.utc($(this).data("time")).valueOf()-moment.utc().valueOf(),0),r=Math.floor(n/t),u=Math.floor((n-r*t)/i);$(this).html(u)});$(".counter-unit-hours").each(function(){var i=Math.max(moment.utc($(this).data("time")).valueOf()-moment.utc().valueOf(),0),r=Math.floor(i/n),u=Math.floor((i-r*n)/t);$(this).html(u)});$(".counter-unit-days").each(function(){var t=Math.max(moment.utc($(this).data("time")).valueOf()-moment.utc().valueOf(),0),i=Math.floor(t/n);$(this).html(i)})}function toggleSound(){$("#sound-toggle").toggleClass("fa-volume-up");$("#sound-toggle").toggleClass("fa-volume-off");setInfiniteCookie("global-sound-enabled",soundEnabled())}function soundEnabled(){return $("#sound-toggle").hasClass("fa-volume-up")}var audioElement,aid,timerHub,featureAution,singleAuction,centerX,centerY,disconnected,hoverHeartbeatTimerId,buyButtonAnimating,buyButtonAnimationSpeed,demoStartPrice,demoEndPrice,demoDuration,rtime,timeout,delta,Timer;jQuery.loadAsync=function(n,t){jQuery.ajax({url:n,dataType:"script",cache:!0,success:t||jQuery.noop})};$(document).ready(function(){$.ajaxSetup({cache:!1});(!window.matchMedia||window.matchMedia("(min-width: 767px)").matches)&&$('[data-toggle="tooltip"]').tooltip({trigger:"hover"});removeHoverCSSRule();$(document).on("click",".dropdown-container .dropdown-menu",function(n){n.stopPropagation()});bindQueue();$("#CreateForm").length>0&&$("#CreateForm :input").change(function(){validateDetails()});$("#paymentResultModal").modal("show");$("[name='saftey-switch']").bootstrapSwitch();$(window).resize(function(){toogleTopNavDynamic()});toogleTopNavDynamic()});singleAuction=!1;disconnected=!0;buyButtonAnimating=!1;buyButtonAnimationSpeed=300;var startTime,svg,price,pricePercentText,tau=2*Math.PI,foregroundArc,countdownClock,countdownTimer,buyBtn,buyBtnOuter,priceDropper,purchaseGradient,gradient,defs,t,tinyScreen,featureAuction,offset,isAuthenticated,auctionFinished,searchFilterTags=[],searchFilterTerms=[],searchFilterRegion,searchFilterType="featured",buyButtonShadowTransfer,buyBtnOuterRadius;timeout=!1;delta=300;$(window).resize(function(){rtime=new Date;timeout===!1&&(timeout=!0,setTimeout(resizeend,delta))});$("#moreInfoToggle").on("click",function(){$("#modalPopupContent").html().indexOf($(this).parent().siblings("#moreInfo").children("#feature-auction-description").html())<0&&$("#modalPopupContent").html($("#modalPopupContent").html()+$(this).parent().siblings("#moreInfo").children("#feature-auction-description").html())});$(function(){var n=$("#login-form");n.submit(function(t){return t.preventDefault(),$("#login-message").hide(),$.ajax({type:n.attr("method"),url:n.attr("action"),data:n.serialize(),success:function(n){n.success?location.reload():($("#login-message").html(n.message),$("#login-message").show())}}),!1})}),function(n){function it(n,t,i){switch(arguments.length){case 2:return n!=null?n:t;case 3:return n!=null?n:t!=null?t:i;default:throw new Error("Implement me");}}function g(n,t){return dr.call(n,t)}function vt(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function pi(n){t.suppressDeprecationWarnings===!1&&typeof console!="undefined"&&console.warn&&console.warn("Deprecation warning: "+n)}function o(n,t){var i=!0;return nt(function(){return i&&(pi(n),i=!1),t.apply(this,arguments)},t)}function bu(n,t){vi[n]||(pi(t),vi[n]=!0)}function wi(n,t){return function(i){return r(n.call(this,i),t)}}function ku(n,t){return function(i){return this.localeData().ordinal(n.call(this,i),t)}}function du(n,t){var r=(t.year()-n.year())*12+(t.month()-n.month()),i=n.clone().add(r,"months"),u,f;return t-i<0?(u=n.clone().add(r-1,"months"),f=(t-i)/(i-u)):(u=n.clone().add(r+1,"months"),f=(t-i)/(u-i)),-(r+f)}function gu(n,t,i){var r;return i==null?t:n.meridiemHour!=null?n.meridiemHour(t,i):n.isPM!=null?(r=n.isPM(i),r&&t<12&&(t+=12),r||t!==12||(t=0),t):t}function bi(){}function et(n,i){i!==!1&&er(n);ki(this,n);this._d=new Date(+n._d);at===!1&&(at=!0,t.updateOffset(this),at=!1)}function yt(n){var i=ir(n),r=i.year||0,u=i.quarter||0,f=i.month||0,e=i.week||0,o=i.day||0,s=i.hour||0,h=i.minute||0,c=i.second||0,l=i.millisecond||0;this._milliseconds=+l+c*1e3+h*6e4+s*36e5;this._days=+o+e*7;this._months=+f+u*3+r*12;this._data={};this._locale=t.localeData();this._bubble()}function nt(n,t){for(var i in t)g(t,i)&&(n[i]=t[i]);return g(t,"toString")&&(n.toString=t.toString),g(t,"valueOf")&&(n.valueOf=t.valueOf),n}function ki(n,t){var u,i,r;if(typeof t._isAMomentObject!="undefined"&&(n._isAMomentObject=t._isAMomentObject),typeof t._i!="undefined"&&(n._i=t._i),typeof t._f!="undefined"&&(n._f=t._f),typeof t._l!="undefined"&&(n._l=t._l),typeof t._strict!="undefined"&&(n._strict=t._strict),typeof t._tzm!="undefined"&&(n._tzm=t._tzm),typeof t._isUTC!="undefined"&&(n._isUTC=t._isUTC),typeof t._offset!="undefined"&&(n._offset=t._offset),typeof t._pf!="undefined"&&(n._pf=t._pf),typeof t._locale!="undefined"&&(n._locale=t._locale),ut.length>0)for(u in ut)i=ut[u],r=t[i],typeof r!="undefined"&&(n[i]=r);return n}function h(n){return n<0?Math.ceil(n):Math.floor(n)}function r(n,t,i){for(var r=""+Math.abs(n),u=n>=0;r.length<t;)r="0"+r;return(u?i?"+":"":"-")+r}function di(n,t){var i={milliseconds:0,months:0};return i.months=t.month()-n.month()+(t.year()-n.year())*12,n.clone().add(i.months,"M").isAfter(t)&&--i.months,i.milliseconds=+t-+n.clone().add(i.months,"M"),i}function nf(n,t){var i;return t=bt(t,n),n.isBefore(t)?i=di(n,t):(i=di(t,n),i.milliseconds=-i.milliseconds,i.months=-i.months),i}function gi(n,i){return function(r,u){var f,e;return u===null||isNaN(+u)||(bu(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period)."),e=r,r=u,u=e),r=typeof r=="string"?+r:r,f=t.duration(r,u),nr(this,f,n),this}}function nr(n,i,r,u){var o=i._milliseconds,f=i._days,e=i._months;u=u==null?!0:u;o&&n._d.setTime(+n._d+o*r);f&&pr(n,"Date",ii(n,"Date")+f*r);e&&yr(n,ii(n,"Month")+e*r);u&&t.updateOffset(n,f||e)}function ot(n){return Object.prototype.toString.call(n)==="[object Array]"}function pt(n){return Object.prototype.toString.call(n)==="[object Date]"||n instanceof Date}function tr(n,t,r){for(var e=Math.min(n.length,t.length),o=Math.abs(n.length-t.length),f=0,u=0;u<e;u++)(r&&n[u]!==t[u]||!r&&i(n[u])!==i(t[u]))&&f++;return f+o}function e(n){if(n){var t=n.toLowerCase().replace(/(.)s$/,"$1");n=pu[n]||wu[t]||t}return n}function ir(n){var r={},i,t;for(t in n)g(n,t)&&(i=e(t),i&&(r[i]=n[t]));return r}function tf(i){var r,u;if(i.indexOf("week")===0)r=7,u="day";else if(i.indexOf("month")===0)r=12,u="month";else return;t[i]=function(f,e){var o,s,c=t._locale[i],h=[];if(typeof f=="number"&&(e=f,f=n),s=function(n){var i=t().utc().set(u,n);return c.call(t._locale,i,f||"")},e!=null)return s(e);for(o=0;o<r;o++)h.push(s(o));return h}}function i(n){var t=+n,i=0;return t!==0&&isFinite(t)&&(i=t>=0?Math.floor(t):Math.ceil(t)),i}function wt(n,t){return new Date(Date.UTC(n,t+1,0)).getUTCDate()}function rr(n,i,r){return tt(t([n,11,31+i-r]),i,r).week}function ur(n){return fr(n)?366:365}function fr(n){return n%4==0&&n%100!=0||n%400==0}function er(n){var t;n._a&&n._pf.overflow===-2&&(t=n._a[l]<0||n._a[l]>11?l:n._a[s]<1||n._a[s]>wt(n._a[c],n._a[l])?s:n._a[f]<0||n._a[f]>24||n._a[f]===24&&(n._a[w]!==0||n._a[b]!==0||n._a[k]!==0)?f:n._a[w]<0||n._a[w]>59?w:n._a[b]<0||n._a[b]>59?b:n._a[k]<0||n._a[k]>999?k:-1,n._pf._overflowDayOfYear&&(t<c||t>s)&&(t=s),n._pf.overflow=t)}function or(t){return t._isValid==null&&(t._isValid=!isNaN(t._d.getTime())&&t._pf.overflow<0&&!t._pf.empty&&!t._pf.invalidMonth&&!t._pf.nullInput&&!t._pf.invalidFormat&&!t._pf.userInvalidated,t._strict&&(t._isValid=t._isValid&&t._pf.charsLeftOver===0&&t._pf.unusedTokens.length===0&&t._pf.bigHour===n)),t._isValid}function sr(n){return n?n.toLowerCase().replace("_","-"):n}function rf(n){for(var r=0,i,t,f,u;r<n.length;){for(u=sr(n[r]).split("-"),i=u.length,t=sr(n[r+1]),t=t?t.split("-"):null;i>0;){if(f=hr(u.slice(0,i).join("-")),f)return f;if(t&&t.length>=i&&tr(u,t,!0)>=i-1)break;i--}r++}return null}function hr(n){var i=null;if(!d[n]&&ui)try{i=t.locale();require("./locale/"+n);t.locale(i)}catch(r){}return d[n]}function bt(n,i){var r,u;return i._isUTC?(r=i.clone(),u=(t.isMoment(n)||pt(n)?+n:+t(n))-+r,r._d.setTime(+r._d+u),t.updateOffset(r,!1),r):t(n).local()}function uf(n){return n.match(/\[[\s\S]/)?n.replace(/^\[|\]$/g,""):n.replace(/\\/g,"")}function ff(n){for(var i=n.match(fi),t=0,r=i.length;t<r;t++)i[t]=a[i[t]]?a[i[t]]:uf(i[t]);return function(u){var f="";for(t=0;t<r;t++)f+=i[t]instanceof Function?i[t].call(u,n):i[t];return f}}function kt(n,t){return n.isValid()?(t=cr(t,n.localeData()),lt[t]||(lt[t]=ff(t)),lt[t](n)):n.localeData().invalidDate()}function cr(n,t){function r(n){return t.longDateFormat(n)||n}var i=5;for(ft.lastIndex=0;i>=0&&ft.test(n);)n=n.replace(ft,r),ft.lastIndex=0,i-=1;return n}function ef(n,t){var i=t._strict;switch(n){case"Q":return oi;case"DDDD":return hi;case"YYYY":case"GGGG":case"gggg":return i?cu:ru;case"Y":case"G":case"g":return au;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return i?lu:uu;case"S":if(i)return oi;case"SS":if(i)return si;case"SSS":if(i)return hi;case"DDD":return iu;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return eu;case"a":case"A":return t._locale._meridiemParse;case"x":return su;case"X":return hu;case"Z":case"ZZ":return st;case"T":return ou;case"SSSS":return fu;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return i?si:ei;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return ei;case"Do":return i?t._locale._ordinalParse:t._locale._ordinalParseLenient;default:return new RegExp(af(lf(n.replace("\\","")),"i"))}}function dt(n){n=n||"";var r=n.match(st)||[],f=r[r.length-1]||[],t=(f+"").match(yu)||["-",0,0],u=+(t[1]*60)+i(t[2]);return t[0]==="+"?u:-u}function of(n,r,u){var o,e=u._a;switch(n){case"Q":r!=null&&(e[l]=(i(r)-1)*3);break;case"M":case"MM":r!=null&&(e[l]=i(r)-1);break;case"MMM":case"MMMM":o=u._locale.monthsParse(r,n,u._strict);o!=null?e[l]=o:u._pf.invalidMonth=r;break;case"D":case"DD":r!=null&&(e[s]=i(r));break;case"Do":r!=null&&(e[s]=i(parseInt(r.match(/\d{1,2}/)[0],10)));break;case"DDD":case"DDDD":r!=null&&(u._dayOfYear=i(r));break;case"YY":e[c]=t.parseTwoDigitYear(r);break;case"YYYY":case"YYYYY":case"YYYYYY":e[c]=i(r);break;case"a":case"A":u._meridiem=r;break;case"h":case"hh":u._pf.bigHour=!0;case"H":case"HH":e[f]=i(r);break;case"m":case"mm":e[w]=i(r);break;case"s":case"ss":e[b]=i(r);break;case"S":case"SS":case"SSS":case"SSSS":e[k]=i(("0."+r)*1e3);break;case"x":u._d=new Date(i(r));break;case"X":u._d=new Date(parseFloat(r)*1e3);break;case"Z":case"ZZ":u._useUTC=!0;u._tzm=dt(r);break;case"dd":case"ddd":case"dddd":o=u._locale.weekdaysParse(r);o!=null?(u._w=u._w||{},u._w.d=o):u._pf.invalidWeekday=r;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":n=n.substr(0,1);case"gggg":case"GGGG":case"GGGGG":n=n.substr(0,2);r&&(u._w=u._w||{},u._w[n]=i(r));break;case"gg":case"GG":u._w=u._w||{};u._w[n]=t.parseTwoDigitYear(r)}}function sf(n){var i,o,f,u,r,e,s;i=n._w;i.GG!=null||i.W!=null||i.E!=null?(r=1,e=4,o=it(i.GG,n._a[c],tt(t(),1,4).year),f=it(i.W,1),u=it(i.E,1)):(r=n._locale._week.dow,e=n._locale._week.doy,o=it(i.gg,n._a[c],tt(t(),r,e).year),f=it(i.w,1),i.d!=null?(u=i.d,u<r&&++f):u=i.e!=null?i.e+r:r);s=ne(o,f,u,e,r);n._a[c]=s.year;n._dayOfYear=s.dayOfYear}function gt(n){var t,i,r=[],u,e;if(!n._d){for(u=cf(n),n._w&&n._a[s]==null&&n._a[l]==null&&sf(n),n._dayOfYear&&(e=it(n._a[c],u[c]),n._dayOfYear>ur(e)&&(n._pf._overflowDayOfYear=!0),i=ti(e,0,n._dayOfYear),n._a[l]=i.getUTCMonth(),n._a[s]=i.getUTCDate()),t=0;t<3&&n._a[t]==null;++t)n._a[t]=r[t]=u[t];for(;t<7;t++)n._a[t]=r[t]=n._a[t]==null?t===2?1:0:n._a[t];n._a[f]===24&&n._a[w]===0&&n._a[b]===0&&n._a[k]===0&&(n._nextDay=!0,n._a[f]=0);n._d=(n._useUTC?ti:bf).apply(null,r);n._tzm!=null&&n._d.setUTCMinutes(n._d.getUTCMinutes()-n._tzm);n._nextDay&&(n._a[f]=24)}}function hf(n){var t;n._d||(t=ir(n._i),n._a=[t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],gt(n))}function cf(n){var t=new Date;return n._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function ni(i){if(i._f===t.ISO_8601){lr(i);return}i._a=[];i._pf.empty=!0;for(var r=""+i._i,u,e,h,l=r.length,c=0,s=cr(i._f,i._locale).match(fi)||[],o=0;o<s.length;o++)e=s[o],u=(r.match(ef(e,i))||[])[0],u&&(h=r.substr(0,r.indexOf(u)),h.length>0&&i._pf.unusedInput.push(h),r=r.slice(r.indexOf(u)+u.length),c+=u.length),a[e]?(u?i._pf.empty=!1:i._pf.unusedTokens.push(e),of(e,u,i)):i._strict&&!u&&i._pf.unusedTokens.push(e);i._pf.charsLeftOver=l-c;r.length>0&&i._pf.unusedInput.push(r);i._pf.bigHour===!0&&i._a[f]<=12&&(i._pf.bigHour=n);i._a[f]=gu(i._locale,i._a[f],i._meridiem);gt(i);er(i)}function lf(n){return n.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(n,t,i,r,u){return t||i||r||u})}function af(n){return n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function vf(n){var t,f,u,r,i;if(n._f.length===0){n._pf.invalidFormat=!0;n._d=new Date(NaN);return}for(r=0;r<n._f.length;r++)(i=0,t=ki({},n),n._useUTC!=null&&(t._useUTC=n._useUTC),t._pf=vt(),t._f=n._f[r],ni(t),or(t))&&(i+=t._pf.charsLeftOver,i+=t._pf.unusedTokens.length*10,t._pf.score=i,(u==null||i<u)&&(u=i,f=t));nt(n,f||t)}function lr(n){var t,i,r=n._i,u=vu.exec(r);if(u){for(n._pf.iso=!0,t=0,i=ht.length;t<i;t++)if(ht[t][1].exec(r)){n._f=ht[t][0]+(u[6]||" ");break}for(t=0,i=ct.length;t<i;t++)if(ct[t][1].exec(r)){n._f+=ct[t][0];break}r.match(st)&&(n._f+="Z");ni(n)}else n._isValid=!1}function yf(n){lr(n);n._isValid===!1&&(delete n._isValid,t.createFromInputFallback(n))}function pf(n,t){for(var r=[],i=0;i<n.length;++i)r.push(t(n[i],i));return r}function wf(i){var r=i._i,u;r===n?i._d=new Date:pt(r)?i._d=new Date(+r):(u=gr.exec(r))!==null?i._d=new Date(+u[1]):typeof r=="string"?yf(i):ot(r)?(i._a=pf(r.slice(0),function(n){return parseInt(n,10)}),gt(i)):typeof r=="object"?hf(i):typeof r=="number"?i._d=new Date(r):t.createFromInputFallback(i)}function bf(n,t,i,r,u,f,e){var o=new Date(n,t,i,r,u,f,e);return n<1970&&o.setFullYear(n),o}function ti(n){var t=new Date(Date.UTC.apply(null,arguments));return n<1970&&t.setUTCFullYear(n),t}function kf(n,t){if(typeof n=="string")if(isNaN(n)){if(n=t.weekdaysParse(n),typeof n!="number")return null}else n=parseInt(n,10);return n}function df(n,t,i,r,u){return u.relativeTime(t||1,!!i,n,r)}function gf(n,i,r){var u=t.duration(n).abs(),c=p(u.as("s")),e=p(u.as("m")),o=p(u.as("h")),s=p(u.as("d")),h=p(u.as("M")),l=p(u.as("y")),f=c<y.s&&["s",c]||e===1&&["m"]||e<y.m&&["mm",e]||o===1&&["h"]||o<y.h&&["hh",o]||s===1&&["d"]||s<y.d&&["dd",s]||h===1&&["M"]||h<y.M&&["MM",h]||l===1&&["y"]||["yy",l];return f[2]=i,f[3]=+n>0,f[4]=r,df.apply({},f)}function tt(n,i,r){var e=r-i,u=r-n.day(),f;return u>e&&(u-=7),u<e-7&&(u+=7),f=t(n).add(u,"d"),{week:Math.ceil(f.dayOfYear()/7),year:f.year()}}function ne(n,t,i,r,u){var f=ti(n,0,1).getUTCDay(),o,e;return f=f===0?7:f,i=i!=null?i:u,o=u-f+(f>r?7:0)-(f<u?7:0),e=7*(t-1)+(i-u)+o+1,{year:e>0?n:n-1,dayOfYear:e>0?e:ur(n-1)+e}}function ar(i){var r=i._i,f=i._f,u;return(i._locale=i._locale||t.localeData(i._l),r===null||f===n&&r==="")?t.invalid({nullInput:!0}):(typeof r=="string"&&(i._i=r=i._locale.preparse(r)),t.isMoment(r))?new et(r,!0):(f?ot(f)?vf(i):ni(i):wf(i),u=new et(i),u._nextDay&&(u.add(1,"d"),u._nextDay=n),u)}function vr(n,i){var u,r;if(i.length===1&&ot(i[0])&&(i=i[0]),!i.length)return t();for(u=i[0],r=1;r<i.length;++r)i[r][n](u)&&(u=i[r]);return u}function yr(n,t){var i;return typeof t=="string"&&(t=n.localeData().monthsParse(t),typeof t!="number")?n:(i=Math.min(n.date(),wt(n.year(),t)),n._d["set"+(n._isUTC?"UTC":"")+"Month"](t,i),n)}function ii(n,t){return n._d["get"+(n._isUTC?"UTC":"")+t]()}function pr(n,t,i){return t==="Month"?yr(n,i):n._d["set"+(n._isUTC?"UTC":"")+t](i)}function v(n,i){return function(r){return r!=null?(pr(this,n,r),t.updateOffset(this,i),this):ii(this,n)}}function wr(n){return n*400/146097}function br(n){return n*146097/400}function te(n){t.duration.fn[n]=function(){return this._data[n]}}function kr(n){typeof ender=="undefined"&&(ri=rt.moment,rt.moment=n?o("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",t):t)}for(var t,rt=typeof global!="undefined"&&(typeof window=="undefined"||window===global.window)?global:this,ri,p=Math.round,dr=Object.prototype.hasOwnProperty,u,c=0,l=1,s=2,f=3,w=4,b=5,k=6,d={},ut=[],ui=typeof module!="undefined"&&module&&module.exports,gr=/^\/?Date\((\-?\d+)/i,nu=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,tu=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,fi=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,ft=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ei=/\d\d?/,iu=/\d{1,3}/,ru=/\d{1,4}/,uu=/[+\-]?\d{1,6}/,fu=/\d+/,eu=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,st=/Z|[\+\-]\d\d:?\d\d/gi,ou=/T/i,su=/[\+\-]?\d+/,hu=/[\+\-]?\d+(\.\d{1,3})?/,oi=/\d/,si=/\d\d/,hi=/\d{3}/,cu=/\d{4}/,lu=/[+-]?\d{6}/,au=/[+-]?\d+/,vu=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ht=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],ct=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],yu=/([\+\-]|\d\d)/gi,ie="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),ci={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},pu={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},wu={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},lt={},y={s:45,m:45,h:22,d:26,M:11},li="DDD w W M D d".split(" "),ai="M D H h m s w W".split(" "),a={M:function(){return this.month()+1},MMM:function(n){return this.localeData().monthsShort(this,n)},MMMM:function(n){return this.localeData().months(this,n)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(n){return this.localeData().weekdaysMin(this,n)},ddd:function(n){return this.localeData().weekdaysShort(this,n)},dddd:function(n){return this.localeData().weekdays(this,n)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return r(this.year()%100,2)},YYYY:function(){return r(this.year(),4)},YYYYY:function(){return r(this.year(),5)},YYYYYY:function(){var n=this.year(),t=n>=0?"+":"-";return t+r(Math.abs(n),6)},gg:function(){return r(this.weekYear()%100,2)},gggg:function(){return r(this.weekYear(),4)},ggggg:function(){return r(this.weekYear(),5)},GG:function(){return r(this.isoWeekYear()%100,2)},GGGG:function(){return r(this.isoWeekYear(),4)},GGGGG:function(){return r(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return i(this.milliseconds()/100)},SS:function(){return r(i(this.milliseconds()/10),2)},SSS:function(){return r(this.milliseconds(),3)},SSSS:function(){return r(this.milliseconds(),3)},Z:function(){var n=this.utcOffset(),t="+";return n<0&&(n=-n,t="-"),t+r(i(n/60),2)+":"+r(i(n)%60,2)},ZZ:function(){var n=this.utcOffset(),t="+";return n<0&&(n=-n,t="-"),t+r(i(n/60),2)+r(i(n)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},x:function(){return this.valueOf()},X:function(){return this.unix()},Q:function(){return this.quarter()}},vi={},yi=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"],at=!1;li.length;)u=li.pop(),a[u+"o"]=ku(a[u],u);while(ai.length)u=ai.pop(),a[u+u]=wi(a[u],2);for(a.DDDD=wi(a.DDD,3),nt(bi.prototype,{set:function(n){var t,i;for(i in n)t=n[i],typeof t=="function"?this[i]=t:this["_"+i]=t;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(n){return this._months[n.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(n){return this._monthsShort[n.month()]},monthsParse:function(n,i,r){var u,f,e;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),u=0;u<12;u++)if((f=t.utc([2e3,u]),r&&!this._longMonthsParse[u]&&(this._longMonthsParse[u]=new RegExp("^"+this.months(f,"").replace(".","")+"$","i"),this._shortMonthsParse[u]=new RegExp("^"+this.monthsShort(f,"").replace(".","")+"$","i")),r||this._monthsParse[u]||(e="^"+this.months(f,"")+"|^"+this.monthsShort(f,""),this._monthsParse[u]=new RegExp(e.replace(".",""),"i")),r&&i==="MMMM"&&this._longMonthsParse[u].test(n))||r&&i==="MMM"&&this._shortMonthsParse[u].test(n)||!r&&this._monthsParse[u].test(n))return u},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(n){return this._weekdays[n.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(n){return this._weekdaysShort[n.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(n){return this._weekdaysMin[n.day()]},weekdaysParse:function(n){var i,r,u;for(this._weekdaysParse||(this._weekdaysParse=[]),i=0;i<7;i++)if(this._weekdaysParse[i]||(r=t([2e3,1]).day(i),u="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[i]=new RegExp(u.replace(".",""),"i")),this._weekdaysParse[i].test(n))return i},_longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(n){var t=this._longDateFormat[n];return!t&&this._longDateFormat[n.toUpperCase()]&&(t=this._longDateFormat[n.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(n){return n.slice(1)}),this._longDateFormat[n]=t),t},isPM:function(n){return(n+"").toLowerCase().charAt(0)==="p"},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(n,t,i){return n>11?i?"pm":"PM":i?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(n,t,i){var r=this._calendar[n];return typeof r=="function"?r.apply(t,[i]):r},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(n,t,i,r){var u=this._relativeTime[i];return typeof u=="function"?u(n,t,i,r):u.replace(/%d/i,n)},pastFuture:function(n,t){var i=this._relativeTime[n>0?"future":"past"];return typeof i=="function"?i(t):i.replace(/%s/i,t)},ordinal:function(n){return this._ordinal.replace("%d",n)},_ordinal:"%d",_ordinalParse:/\d{1,2}/,preparse:function(n){return n},postformat:function(n){return n},week:function(n){return tt(n,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},firstDayOfWeek:function(){return this._week.dow},firstDayOfYear:function(){return this._week.doy},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),t=function(t,i,r,u){var f;return typeof r=="boolean"&&(u=r,r=n),f={},f._isAMomentObject=!0,f._i=t,f._f=i,f._l=r,f._strict=u,f._isUTC=!1,f._pf=vt(),ar(f)},t.suppressDeprecationWarnings=!1,t.createFromInputFallback=o("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(n){n._d=new Date(n._i+(n._useUTC?" UTC":""))}),t.min=function(){var n=[].slice.call(arguments,0);return vr("isBefore",n)},t.max=function(){var n=[].slice.call(arguments,0);return vr("isAfter",n)},t.utc=function(t,i,r,u){var f;return typeof r=="boolean"&&(u=r,r=n),f={},f._isAMomentObject=!0,f._useUTC=!0,f._isUTC=!0,f._l=r,f._i=t,f._f=i,f._strict=u,f._pf=vt(),ar(f).utc()},t.unix=function(n){return t(n*1e3)},t.duration=function(n,r){var u=n,e=null,o,c,h,l;return t.isDuration(n)?u={ms:n._milliseconds,d:n._days,M:n._months}:typeof n=="number"?(u={},r?u[r]=n:u.milliseconds=n):(e=nu.exec(n))?(o=e[1]==="-"?-1:1,u={y:0,d:i(e[s])*o,h:i(e[f])*o,m:i(e[w])*o,s:i(e[b])*o,ms:i(e[k])*o}):(e=tu.exec(n))?(o=e[1]==="-"?-1:1,h=function(n){var t=n&&parseFloat(n.replace(",","."));return(isNaN(t)?0:t)*o},u={y:h(e[2]),M:h(e[3]),d:h(e[4]),h:h(e[5]),m:h(e[6]),s:h(e[7]),w:h(e[8])}):u==null?u={}:typeof u=="object"&&("from"in u||"to"in u)&&(l=nf(t(u.from),t(u.to)),u={},u.ms=l.milliseconds,u.M=l.months),c=new yt(u),t.isDuration(n)&&g(n,"_locale")&&(c._locale=n._locale),c},t.version="2.9.0",t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.ISO_8601=function(){},t.momentProperties=ut,t.updateOffset=function(){},t.relativeTimeThreshold=function(t,i){return y[t]===n?!1:i===n?y[t]:(y[t]=i,!0)},t.lang=o("moment.lang is deprecated. Use moment.locale instead.",function(n,i){return t.locale(n,i)}),t.locale=function(n,i){var r;return n&&(r=typeof i!="undefined"?t.defineLocale(n,i):t.localeData(n),r&&(t.duration._locale=t._locale=r)),t._locale._abbr},t.defineLocale=function(n,i){return i!==null?(i.abbr=n,d[n]||(d[n]=new bi),d[n].set(i),t.locale(n),d[n]):(delete d[n],null)},t.langData=o("moment.langData is deprecated. Use moment.localeData instead.",function(n){return t.localeData(n)}),t.localeData=function(n){var i;if(n&&n._locale&&n._locale._abbr&&(n=n._locale._abbr),!n)return t._locale;if(!ot(n)){if(i=hr(n),i)return i;n=[n]}return rf(n)},t.isMoment=function(n){return n instanceof et||n!=null&&g(n,"_isAMomentObject")},t.isDuration=function(n){return n instanceof yt},u=yi.length-1;u>=0;--u)tf(yi[u]);t.normalizeUnits=function(n){return e(n)};t.invalid=function(n){var i=t.utc(NaN);return n!=null?nt(i._pf,n):i._pf.userInvalidated=!0,i};t.parseZone=function(){return t.apply(null,arguments).parseZone()};t.parseTwoDigitYear=function(n){return i(n)+(i(n)>68?1900:2e3)};t.isDate=pt;nt(t.fn=et.prototype,{clone:function(){return t(this)},valueOf:function(){return+this._d-(this._offset||0)*6e4},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var n=t(this).utc();return 0<n.year()&&n.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():kt(n,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):kt(n,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var n=this;return[n.year(),n.month(),n.date(),n.hours(),n.minutes(),n.seconds(),n.milliseconds()]},isValid:function(){return or(this)},isDSTShifted:function(){return this._a?this.isValid()&&tr(this._a,(this._isUTC?t.utc(this._a):t(this._a)).toArray())>0:!1},parsingFlags:function(){return nt({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(n){return this.utcOffset(0,n)},local:function(n){return this._isUTC&&(this.utcOffset(0,n),this._isUTC=!1,n&&this.subtract(this._dateUtcOffset(),"m")),this},format:function(n){var i=kt(this,n||t.defaultFormat);return this.localeData().postformat(i)},add:gi(1,"add"),subtract:gi(-1,"subtract"),diff:function(n,t,i){var f=bt(n,this),o=(f.utcOffset()-this.utcOffset())*6e4,u,r;return t=e(t),t==="year"||t==="month"||t==="quarter"?(r=du(this,f),t==="quarter"?r=r/3:t==="year"&&(r=r/12)):(u=this-f,r=t==="second"?u/1e3:t==="minute"?u/6e4:t==="hour"?u/36e5:t==="day"?(u-o)/864e5:t==="week"?(u-o)/6048e5:u),i?r:h(r)},from:function(n,i){return t.duration({to:this,from:n}).locale(this.locale()).humanize(!i)},fromNow:function(n){return this.from(t(),n)},calendar:function(n){var r=n||t(),u=bt(r,this).startOf("day"),i=this.diff(u,"days",!0),f=i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse";return this.format(this.localeData().calendar(f,this,t(r)))},isLeapYear:function(){return fr(this.year())},isDST:function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},day:function(n){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return n!=null?(n=kf(n,this.localeData()),this.add(n-t,"d")):t},month:v("Month",!0),startOf:function(n){n=e(n);switch(n){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return n==="week"?this.weekday(0):n==="isoWeek"&&this.isoWeekday(1),n==="quarter"&&this.month(Math.floor(this.month()/3)*3),this},endOf:function(t){return(t=e(t),t===n||t==="millisecond")?this:this.startOf(t).add(1,t==="isoWeek"?"week":t).subtract(1,"ms")},isAfter:function(n,i){var r;return i=e(typeof i!="undefined"?i:"millisecond"),i==="millisecond"?(n=t.isMoment(n)?n:t(n),+this>+n):(r=t.isMoment(n)?+n:+t(n),r<+this.clone().startOf(i))},isBefore:function(n,i){var r;return i=e(typeof i!="undefined"?i:"millisecond"),i==="millisecond"?(n=t.isMoment(n)?n:t(n),+this<+n):(r=t.isMoment(n)?+n:+t(n),+this.clone().endOf(i)<r)},isBetween:function(n,t,i){return this.isAfter(n,i)&&this.isBefore(t,i)},isSame:function(n,i){var r;return i=e(i||"millisecond"),i==="millisecond"?(n=t.isMoment(n)?n:t(n),+this==+n):(r=+t(n),+this.clone().startOf(i)<=r&&r<=+this.clone().endOf(i))},min:o("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(n){return n=t.apply(null,arguments),n<this?this:n}),max:o("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(n){return n=t.apply(null,arguments),n>this?this:n}),zone:o("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",function(n,t){return n!=null?(typeof n!="string"&&(n=-n),this.utcOffset(n,t),this):-this.utcOffset()}),utcOffset:function(n,i){var r=this._offset||0,u;return n!=null?(typeof n=="string"&&(n=dt(n)),Math.abs(n)<16&&(n=n*60),!this._isUTC&&i&&(u=this._dateUtcOffset()),this._offset=n,this._isUTC=!0,u!=null&&this.add(u,"m"),r!==n&&(!i||this._changeInProgress?nr(this,t.duration(n-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?r:this._dateUtcOffset()},isLocal:function(){return!this._isUTC},isUtcOffset:function(){return this._isUTC},isUtc:function(){return this._isUTC&&this._offset===0},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.utcOffset(this._tzm):typeof this._i=="string"&&this.utcOffset(dt(this._i)),this},hasAlignedHourOffset:function(n){return n=n?t(n).utcOffset():0,(this.utcOffset()-n)%60==0},daysInMonth:function(){return wt(this.year(),this.month())},dayOfYear:function(n){var i=p((t(this).startOf("day")-t(this).startOf("year"))/864e5)+1;return n==null?i:this.add(n-i,"d")},quarter:function(n){return n==null?Math.ceil((this.month()+1)/3):this.month((n-1)*3+this.month()%3)},weekYear:function(n){var t=tt(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return n==null?t:this.add(n-t,"y")},isoWeekYear:function(n){var t=tt(this,1,4).year;return n==null?t:this.add(n-t,"y")},week:function(n){var t=this.localeData().week(this);return n==null?t:this.add((n-t)*7,"d")},isoWeek:function(n){var t=tt(this,1,4).week;return n==null?t:this.add((n-t)*7,"d")},weekday:function(n){var t=(this.day()+7-this.localeData()._week.dow)%7;return n==null?t:this.add(n-t,"d")},isoWeekday:function(n){return n==null?this.day()||7:this.day(this.day()%7?n:n-7)},isoWeeksInYear:function(){return rr(this.year(),1,4)},weeksInYear:function(){var n=this.localeData()._week;return rr(this.year(),n.dow,n.doy)},get:function(n){return n=e(n),this[n]()},set:function(n,t){var i;if(typeof n=="object")for(i in n)this.set(i,n[i]);else n=e(n),typeof this[n]=="function"&&this[n](t);return this},locale:function(i){var r;return i===n?this._locale._abbr:(r=t.localeData(i),r!=null&&(this._locale=r),this)},lang:o("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===n?this.localeData():this.locale(t)}),localeData:function(){return this._locale},_dateUtcOffset:function(){return-Math.round(this._d.getTimezoneOffset()/15)*15}});t.fn.millisecond=t.fn.milliseconds=v("Milliseconds",!1);t.fn.second=t.fn.seconds=v("Seconds",!1);t.fn.minute=t.fn.minutes=v("Minutes",!1);t.fn.hour=t.fn.hours=v("Hours",!0);t.fn.date=v("Date",!0);t.fn.dates=o("dates accessor is deprecated. Use date instead.",v("Date",!0));t.fn.year=v("FullYear",!0);t.fn.years=o("years accessor is deprecated. Use year instead.",v("FullYear",!0));t.fn.days=t.fn.day;t.fn.months=t.fn.month;t.fn.weeks=t.fn.week;t.fn.isoWeeks=t.fn.isoWeek;t.fn.quarters=t.fn.quarter;t.fn.toJSON=t.fn.toISOString;t.fn.isUTC=t.fn.isUtc;nt(t.duration.fn=yt.prototype,{_bubble:function(){var o=this._milliseconds,t=this._days,i=this._months,n=this._data,u,f,e,r=0;n.milliseconds=o%1e3;u=h(o/1e3);n.seconds=u%60;f=h(u/60);n.minutes=f%60;e=h(f/60);n.hours=e%24;t+=h(e/24);r=h(wr(t));t-=h(br(r));i+=h(t/30);t%=30;r+=h(i/12);i%=12;n.days=t;n.months=i;n.years=r},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return h(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months%12*2592e6+i(this._months/12)*31536e6},humanize:function(n){var t=gf(this,!n,this.localeData());return n&&(t=this.localeData().pastFuture(+this,t)),this.localeData().postformat(t)},add:function(n,i){var r=t.duration(n,i);return this._milliseconds+=r._milliseconds,this._days+=r._days,this._months+=r._months,this._bubble(),this},subtract:function(n,i){var r=t.duration(n,i);return this._milliseconds-=r._milliseconds,this._days-=r._days,this._months-=r._months,this._bubble(),this},get:function(n){return n=e(n),this[n.toLowerCase()+"s"]()},as:function(n){var t,i;if(n=e(n),n==="month"||n==="year")return t=this._days+this._milliseconds/864e5,i=this._months+wr(t)*12,n==="month"?i:i/12;t=this._days+Math.round(br(this._months/12));switch(n){case"week":return t/7+this._milliseconds/6048e5;case"day":return t+this._milliseconds/864e5;case"hour":return t*24+this._milliseconds/36e5;case"minute":return t*1440+this._milliseconds/6e4;case"second":return t*86400+this._milliseconds/1e3;case"millisecond":return Math.floor(t*864e5)+this._milliseconds;default:throw new Error("Unknown unit "+n);}},lang:t.fn.lang,locale:t.fn.locale,toIsoString:o("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var r=Math.abs(this.years()),u=Math.abs(this.months()),f=Math.abs(this.days()),n=Math.abs(this.hours()),t=Math.abs(this.minutes()),i=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(r?r+"Y":"")+(u?u+"M":"")+(f?f+"D":"")+(n||t||i?"T":"")+(n?n+"H":"")+(t?t+"M":"")+(i?i+"S":""):"P0D"},localeData:function(){return this._locale},toJSON:function(){return this.toISOString()}});t.duration.fn.toString=t.duration.fn.toISOString;for(u in ci)g(ci,u)&&te(u.toLowerCase());t.duration.fn.asMilliseconds=function(){return this.as("ms")};t.duration.fn.asSeconds=function(){return this.as("s")};t.duration.fn.asMinutes=function(){return this.as("m")};t.duration.fn.asHours=function(){return this.as("h")};t.duration.fn.asDays=function(){return this.as("d")};t.duration.fn.asWeeks=function(){return this.as("weeks")};t.duration.fn.asMonths=function(){return this.as("M")};t.duration.fn.asYears=function(){return this.as("y")};t.locale("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(n){var t=n%10,r=i(n%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return n+r}});ui?module.exports=t:typeof define=="function"&&define.amd?(define(function(n,i,r){return r.config&&r.config()&&r.config().noGlobal===!0&&(rt.moment=ri),t}),kr(!0)):kr()}.call(this);Timer=function(n){this.end_time=moment.utc();this.flipclock=n;this.running=!1;this.timer_task=null};Timer.prototype.tick=function(n){var t=Math.max(Math.floor((n.end_time.valueOf()-moment.utc().valueOf())/1e3),0);n.flipclock.setTime(t)};Timer.prototype.start=function(n){this.running&&this.stop();this.running=!0;this.end_time=moment.utc();this.end_time.add(n,"s");this.timer_task=setInterval(this.tick,100,this)};Timer.prototype.stop=function(){clearTimeout(this.timer_task);this.timer_task=null;this.running=!1}