function BlackbookItem(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b){this.Black_Book_Seq=n;this.Bet_Account_Num=t;this.Fix_Type=i;this.TypeOfName=ko.observable(r);this.Name=u;this.Min_Distance=f;this.Max_Distance=e;this.Ground_Condition=o;this.Weather_Type=s;this.Notes=h;this.Trainer_Name=c;this.Jockey_Name=l;this.Animal_Name=a;this.NotesEntries=v;this.BlackbookCriterias=y;this.Alert_Indicator=p;this.NextRace=w;this.NextRaceUrl=b}function BlackbookItemNotes(n,t,i,r,u){this.Black_Book_Seq=n;this.Black_Book_Notes_Seq=t;this.Notes=i;this.Notes_Mod_Datetime=ko.observable(r);this.isEdit=ko.observable(u)}function BlackbookWeatherCondition(n,t){this.WeatherDescription=n;this.WeatherType=t}function BlackbookGroundCondition(n,t){this.ID=n;this.Description=t}function TrackDistanceCondition(n,t){this.TrackDistanceRange=n;this.TrackDistanceValue=t}function ThroughbredCriteria(n,t,i,r,u,f,e,o,s,h,c){var l=this;l.Black_Book_Criteria_Seq=n;l.Min_Distance=t;l.Max_Distance=i;l.Ground_Condition=r;l.GroundDescription=ko.observable(u);l.FirstSecondUp=f;l.MyParent=e;l.isEdit=ko.observable(o);l.Distance=l.Min_Distance+","+l.Max_Distance;l.firstSecondUps=ko.observableArray(s);l.trackDistances=ko.observableArray(h);l.groundConditions=ko.observableArray(c);l.selectedFirstSecondUp=ko.observable(f);l.selectedGroundCondition=ko.observable(r);l.selectedDistance=ko.observable(l.Min_Distance+","+l.Max_Distance);l.selectedDistanceText=ko.computed(function(){var n=_.find(l.trackDistances(),function(n){return n.TrackDistanceValue==l.selectedDistance()});return n?n.TrackDistanceRange:"Any Distance"});l.selectedTrackText=ko.computed(function(){var n=_.find(l.groundConditions(),function(n){return n.ID==l.selectedGroundCondition()});return n?n.Description:"Any Condition"});l.selectedfirstSecondUpText=ko.computed(function(){var n=_.find(l.firstSecondUps(),function(n){return n.id==l.selectedFirstSecondUp()});return n?n.value:"Any"});l.getFirstSecondUpText=function(n){var t=_.find(l.firstSecondUps(),function(t){return t.id==n});return t?t.value:"Any"};l.getTrackDistanceText=function(n){var t=_.find(l.trackDistances(),function(t){return t.TrackDistanceValue==n});return t?t.TrackDistanceRange:"Any Distance"};l.getGroundCondText=function(n){var t=_.find(l.groundConditions(),function(t){return t.ID==n});return t?t.Description:"Any Condition"};l.selectedDistance.subscribe(function(n){l.Distance=n});l.selectedGroundCondition.subscribe(function(n){l.Ground_Condition=n});l.selectedFirstSecondUp.subscribe(function(n){l.FirstSecondUp=n})}function HarnessCriteria(n,t,i,r,u,f,e,o,s,h,c){var l=this;l.Black_Book_Criteria_Seq=n;l.Min_Distance=t;l.Max_Distance=i;l.Ground_Condition=r;l.GroundDescription=ko.observable(u);l.Startcode=f;l.MyParent=e;l.isEdit=ko.observable(o);l.Distance=l.Min_Distance+","+l.Max_Distance;l.startCodes=ko.observableArray(s);l.trackDistances=ko.observableArray(h);l.groundConditions=ko.observableArray(c);l.selectedStartCode=ko.observable(f);l.selectedGroundCondition=ko.observable(r);l.selectedDistance=ko.observable(l.Min_Distance+","+l.Max_Distance);l.selectedDistanceText=ko.computed(function(){var n=_.find(l.trackDistances(),function(n){return n.TrackDistanceValue==l.selectedDistance()});return n?n.TrackDistanceRange:"Any Distance"});l.selectedTrackText=ko.computed(function(){var n=_.find(l.groundConditions(),function(n){return n.ID==l.selectedGroundCondition()});return n?n.Description:"Any Condition"});l.selectedStartCodeText=ko.computed(function(){var n=_.find(l.startCodes(),function(n){return n==l.selectedStartCode()});return n?n:"Any"});l.getStartCodeText=function(n){var t=_.find(l.startCodes(),function(t){return t==n});return t?t:"Any"};l.getTrackDistanceText=function(n){var t=_.find(l.trackDistances(),function(t){return t.TrackDistanceValue==n});return t?t.TrackDistanceRange:"Any Distance"};l.getGroundCondText=function(n){var t=_.find(l.groundConditions(),function(t){return t.ID==n});return t?t.Description:"Any Condition"};l.selectedDistance.subscribe(function(n){l.Distance=n});l.selectedGroundCondition.subscribe(function(n){l.Ground_Condition=n});l.selectedStartCode.subscribe(function(n){l.Startcode=n})}function GreyhoundCriteria(n,t,i,r,u,f,e,o,s,h){var c=this;c.Black_Book_Criteria_Seq=n;c.Min_Distance=t;c.Max_Distance=i;c.Ground_Condition=r;c.GroundDescription=ko.observable(u);c.isError=ko.observable(!1);c.Box=ko.observable(f).extend({validation:{validator:function(n){if(!n)return!0;if(!isNaN(n)){var t=n>=1&&n<=10;return c.isError(!t),t}return c.isError(!0),!1},message:"Valid box number range 1-10"}});c.MyParent=e;c.isEdit=ko.observable(o);c.Distance=c.Min_Distance+","+c.Max_Distance;c.trackDistances=ko.observableArray(s);c.groundConditions=ko.observableArray(h);c.selectedGroundCondition=ko.observable(r);c.selectedDistance=ko.observable(c.Min_Distance+","+c.Max_Distance);c.selectedDistanceText=ko.computed(function(){var n=_.find(c.trackDistances(),function(n){return n.TrackDistanceValue==c.selectedDistance()});return n?n.TrackDistanceRange:"Any Distance"});c.selectedTrackText=ko.computed(function(){var n=_.find(c.groundConditions(),function(n){return n.ID==c.selectedGroundCondition()});return n?n.Description:"Any Condition"});c.getTrackDistanceText=function(n){var t=_.find(c.trackDistances(),function(t){return t.TrackDistanceValue==n});return t?t.TrackDistanceRange:"Any Distance"};c.getGroundCondText=function(n){var t=_.find(c.groundConditions(),function(t){return t.ID==n});return t?t.Description:"Any Condition"};c.selectedDistance.subscribe(function(n){c.Distance=n});c.selectedGroundCondition.subscribe(function(n){c.Ground_Condition=n});c.isValid=function(){return c.Box.isValid()}}var locking,search,raceBetting,myblackbook;require=function e(n,t,i){function u(r,e){var s,h,o;if(!t[r]){if(!n[r]){if(s=typeof require=="function"&&require,!e&&s)return s(r,!0);if(f)return f(r,!0);h=new Error("Cannot find module '"+r+"'");throw h.code="MODULE_NOT_FOUND",h;}o=t[r]={exports:{}};n[r][0].call(o.exports,function(t){var i=n[r][1][t];return u(i?i:t)},o,o.exports,e,n,t,i)}return t[r].exports}for(var f=typeof require=="function"&&require,r=0;r<i.length;r++)u(i[r]);return u}({"./analytics/analytics-betslip-calculator":[function(n,t){(function(i){var r=typeof window!="undefined"?window._:typeof i!="undefined"?i._:null,u=n("./analytics-betslip-item-grouper");t.exports=function(){var n=function(n){return r.reduce(n,function(n,t){return n+t.cost()},0)},t=function(t,f,e){var h=t.mode().toLowerCase(),c=!1,l=!1,o={betSlipMode:h,isCashBet:t.cashMode(),userId:globals.userId,batchId:e||i(t,f),racing:{tote:{numberOfTickets:0,cost:0},fixed:{numberOfTickets:0,cost:0,specialOffers:[]}},sports:{fixed:{numberOfTickets:0,cost:0}},mixed:{fixed:{numberOfTickets:0,cost:0}}},s;return f.length===0?o:(r.each(f,function(n){n.isSports&&(c=!0);n.isRacing&&(l=!0)}),h==="multi"?c&&l?(o.mixed.fixed.numberOfTickets=1,o.mixed.fixed.cost=t.totalCost()):c?(o.sports.fixed.numberOfTickets=1,o.sports.fixed.cost=t.totalCost()):l&&(o.racing.fixed.numberOfTickets=1,o.racing.fixed.cost=t.totalCost()):h==="allup"?(o.racing.tote.numberOfTickets=1,o.racing.tote.cost=t.totalCost()):h==="standard"&&(s=u(f),s.racingFixed.length>0&&(o.racing.fixed.numberOfTickets=s.racingFixed.length,o.racing.fixed.cost=n(s.racingFixed),o.racing.fixed.specialOffers=r.chain(f).filter(function(n){return n.hasSpecialOffer()&&n.chosenSpecialOffer()}).map(function(n){return{title:n.chosenSpecialOffer().title,cost:n.cost()}}).value()),s.racingTote.length>0&&(o.racing.tote.numberOfTickets=s.racingTote.length,o.racing.tote.cost=n(s.racingTote)),s.sportsFixed.length>0&&(o.sports.fixed.numberOfTickets=s.sportsFixed.length,o.sports.fixed.cost=n(s.sportsFixed))),o)},i=function(n,t){var i=n.mode().toLowerCase(),r=i==="standard";return n.committed()?r?t[0].ticketSeq:n.multiTicketSeq():0},f=function(n){return r.filter(n,function(n){return n.selected()&&n.responseCode===ozbetApi.responseCodes.Success})};return{calculate:function(n,i,r){var u=i||n.betSlipItems();return t(n,f(u),r)}}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./analytics-betslip-item-grouper":"./analytics/analytics-betslip-item-grouper"}],"./analytics/analytics-betslip-item-grouper":[function(n,t){(function(n){var i=typeof window!="undefined"?window._:typeof n!="undefined"?n._:null;t.exports=function(n){var t=[],r=[],u=[];return i.each(n,function(n){n.isRacing&&(n.isFixed?t.push(n):u.push(n));n.isSports&&n.isFixed&&r.push(n)}),{racingFixed:t,sportsFixed:r,racingTote:u}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./analytics/analytics-google-service":[function(n,t){(function(n){var r=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null,i=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null;t.exports=function(){var t=function(){return typeof ga!="undefined"},n=function(n,i,u){if(!t()){r.debug("Google Analytics not loaded");return}ga("send","event",n,i,u)};i.subscribe({channel:"analytics",topic:"#",callback:function(t,i){n(i.topic,t.action||"interact",t.label)}});i.subscribe({topic:"meeting-results-contract-single",callback:function(){n("meeting-results-page","button_click","hide-single")}});i.subscribe({topic:"meeting-results-expand-single",callback:function(){n("meeting-results-page","button_click","show-single")}});i.subscribe({topic:"meeting-results-show-all",callback:function(){n("meeting-results-page","button_click","show-all")}});i.subscribe({topic:"meeting-results-hide-all",callback:function(){n("meeting-results-page","button_click","hide-all")}})}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./analytics/analytics-omniture-service":[function(n,t){(function(i){var r=typeof window!="undefined"?window.log:typeof i!="undefined"?i.log:null,f=typeof window!="undefined"?window.postal:typeof i!="undefined"?i.postal:null,u=typeof window!="undefined"?window.$:typeof i!="undefined"?i.$:null,e=n("./analytics-betslip-calculator");t.exports=function(){var t=new e,n;f.subscribe({topic:"analytics.#",callback:function(t,i){switch(i.topic){case"analytics.track-sport":r.debug("Tracking sports page with Sport/Event/Market selection");n("sport-selection",{sportName:t.sportName,competitionName:t.competitionName,tournamentName:t.tournamentName,marketName:t.marketName});break;case"analytics.track-sport-market":r.debug("Tracking sports page market selection");n("sport-market-selection",{market:t});break;case"analytics.track-the-west-afl-tipping":r.debug("Tracking The West AFL Tipping - "+t);n("the-west-afl-tipping",{theWestAflTippingView:"'"+t+"'"});break;case"analytics.track-media":r.debug("Tracking media - "+t);n("media",{mediaType:t});break;case"analytics.recover-password":r.debug("Tracking Recover Password");n("recover-password-"+t.stepNumber,t);break;case"analytics.recover-account-number":r.debug("Tracking Recover Account Number");n("recover-account-number-"+t.stepNumber,t)}}});f.subscribe({topic:"logon.successful",callback:function(t){r.debug("Tracking successful logon");n("logon",{loginId:t.logonId})}});f.subscribe({topic:"betslip.#",callback:function(i,u){switch(u.topic.toLowerCase()){case"betslip.cashmode":r.debug("Tracking betslip cash-mode toggle");n("betslip-cashmode-toggle",{newMode:i.newMode});break;case"betslip.add":(function(){var u,f,e;r.debug("Tracking betslip item add");u=i.viewModel.betSlipItems();f=u.length;f>0&&(e=[],e.push(u[f-1]),n("betslip-add",t.calculate(i.viewModel,e)))})();break;case"betslip.remove":(function(){r.debug("Tracking betslip item removal");var u=[];u.push(i.removedItem);n("betslip-remove",t.calculate(i.viewModel,u))})();break;case"betslip.clear":r.debug("Tracking betslip clear");n("betslip-clear-bets");break;case"betslip.special-offer.selected":r.debug("Tracking SuperPick special offer selection");n("betslip-special-offer-selection",{superPickSelection:i.title});break;case"betslip.special-offer.unselected":r.debug("Tracking SuperPick special offer selection removal");n("betslip-special-offer-selection",{superPickSelection:null});break;case"betslip.create-cash-bet":r.debug("Tracking cash bet creation");n("cash-betslip-continue",t.calculate(i.viewModel,i.viewModel.betSlipItems(),i.draftBetId));break;case"betslip.continue":r.debug("Tracking betslip continue");n("betslip-continue",t.calculate(i.viewModel));break;case"betslip.cancel":r.debug("Tracking betslip cancel (back from continue) -- no tracking");break;case"betslip.pre-commit":r.debug("Tracking betslip pre-commit");n("betslip-confirm-bets",t.calculate(i.viewModel));break;case"betslip.post-commit":r.debug("Tracking betslip post-commit");n("betslip-confirmed",t.calculate(i.viewModel));break;case"betslip.close":r.debug("Tracking betslip closure");break;default:r.debug("Unknown betslip topic "+u.topic.toLowerCase())}}});f.subscribe({topic:"signup.#",callback:function(t,i){switch(i.topic.toLowerCase()){case"signup.step5next":r.debug("Tracking signup step 5. On Redirect back to home screen with popup box displayed");n("signup-step5next",{applicationId:t.applicationId,optIn:t.optIn,userId:t.userId})}}});u("#openAccountButton").click(function(){n("clicktobecomeamember")});u("*[data-interact-track]").click(function(){n("interaction",{interactionType:u(this).attr("data-interact-track")})});u("#contact-form-link").click(function(){n("emailus")});u(".sky1").click(function(){n("sky1")});u(".sky2").click(function(){n("sky2")});u(".gbi").click(function(){n("gbi racing")});u(".vvision").click(function(){n("vision")});u("*[data-account-track]").click(function(){n("account-interaction",{accountOperationType:u(this).attr("data-account-track")})});n=function(n,t){typeof window._satellite!="undefined"&&(globals.analyticsData=t||{},r.debug("Tracking '"+n+"', data: "+JSON.stringify(globals.analyticsData)),window._satellite.track(n))}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./analytics-betslip-calculator":"./analytics/analytics-betslip-calculator"}],"./analytics/analytics-publisher":[function(n,t){(function(n){var i=typeof window!="undefined"?window.$:typeof n!="undefined"?n.$:null,r=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null,u=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null;t.exports=function(n,t){i(n).on("click","*[data-track]",function(n){var f=i(this);u.debug("Publishing analytics event: category: "+t+", event: "+n.type+", label: "+f.data("track"));r.publish({channel:"analytics",topic:t,data:{action:n.type,label:f.data("track")}})})}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./betslip/betslip-allup-formula-viewmodel":[function(n,t){(function(n){function i(n,t,i,u){var f=this;f.index=n;f.value=r.observable(t);f.parent=u;f.state=r.observable(i?i:0)}var r=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null;i.prototype.highlighted=function(){var t=!1,n=this;return n.maxParlay()==1||n.index>n.maxParlay()?(t=!1,n.state(0)):n.state()!=-1||n.isMaxParlay()?n.state()==-1?t=!1:n.state()==0&&n.isMaxParlay()?t=!0:n.state()==0?t=!1:n.state()==1&&(t=!0):(n.state(0),t=!1),t};i.prototype.toggle=function(){var n=this;n.state()==1?n.state(-1):n.state()==0&&n.isMaxParlay()?n.state(-1):n.state()==0?n.state(1):n.state()==-1&&n.state(1)};i.prototype.isMaxParlay=function(){return this.index==this.parent.betSlipItems().length};i.prototype.maxParlay=function(){return this.parent.betSlipItems().length};t.exports={create:function(n,t,r,u){return new i(n,t,r,u)}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./betslip/betslip-fixed-item":[function(n,t){(function(n){function r(n){var t=this;t.fixedType=n.fixedType;t.propositionName=n.propositionName;t.propositionNumber=n.propositionNumber;t.propShortName=n.propositionShortName;t.fixedWinReturn=n.fixedWinReturn;t.fixedPlaceReturn=n.fixedPlaceReturn;t.displayWinReturn=i.observable(n.fixedWinReturn);t.displayPlaceReturn=i.observable(n.fixedPlaceReturn);t.fixedWinPriceChange=n.fixedWinPriceChange;t.fixedPlacePriceChange=n.fixedPlacePriceChange;t.rules=n.rules;t.currentBoostedPrice=i.observable("")}var i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null;t.exports=r}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./betslip/betslip-item":[function(n,t){(function(i){function l(n,t){var i=this;i.parent=t;i.responseCode=n.responseCode;i.responseMessage=n.responseMessage;i.itemId=n.itemId;i.ticketSeq=n.ticketSeq;i.isPlaced=n.isPlaced;i.isReadOnly=n.isReadOnly;i.startTime=o(n.startTime);i.betType=n.betType;i.betName=n.betName;i.winPlaceOption=r.observable(n.winPlaceOption);i.investment=r.observable(n.investment);i.investmentPlace=r.observable(n.investmentPlace);i.combinations=n.combinations;i.betCost=n.betCost;i.isMysteryCombo=n.betType==="Combo";i.isWinPlace=n.betType==="WinPlace";i.isFlexi=r.observable(n.isFlexi);i.isPlaceAvailable=n.isPlaceAvailable;i.selected=r.observable(_.isUndefined(n.selected)?!0:n.selected);i.showCampaign=n.showCampaign;i.showOfferLink=n.showOfferLink;i.campaignText=n.campaignText;i.notes=r.observable(n.notes).extend({rateLimit:{timeout:350,method:"notifyWhenChangesStop"}});i.ignoreMysterySelections=r.observable(n.ignoreMysterySelections);i.hasSpecialOffer=r.observable(n.hasSpecialOffer);i.calcVisible=r.observable(!1);i.calcAction=r.observable("");i.placeInvestmentHasFocus=r.observable(!1);i.isRacing=!1;i.isSports=!1;i.isFixed=!1;i.isTote=!1;i.specialOffersTokenId=r.observable();i.specialOffersTokenCount=r.observable();i.specialOffers=r.observableArray();i.chosenSpecialOffer=r.observable();i.isSpecialOfferEnabled=r.observable(!0);i.canShowInducements=t.canShowInducements;n.racingItem&&(i.isRacing=!0,i.racingItem=new BetSlipRacingItem(n.racingItem));n.sportsItem&&(i.isSports=!0,i.sportsItem=new BetSlipSportsItem(n.sportsItem));n.fixedItem&&(i.isFixed=!0,i.fixedItem=new h(n.fixedItem));n.toteRacingItem&&(i.isTote=!0,i.toteRacingItem=new BetSlipToteRacingItem(n.toteRacingItem));n.specialOffers&&(i.specialOffersTokenId(n.specialOffersTokenId),i.specialOffersTokenCount(n.specialOffersTokensCount),i.specialOffers(_.map(n.specialOffers,function(n){return new s(i,n)})),n.selectedSpecialOfferSequence&&i.chosenSpecialOffer(_.find(i.specialOffers(),function(t){return t.specialSequence===n.selectedSpecialOfferSequence})));i.showSpecialOfferAwardedAtBetPlacement=function(){return n.hasSpecialOffer&&n.isPlaced&&!n.specialOffers};i.showPlace=r.pureComputed(function(){return i.isPlaceAvailable},i);i.showSpecialOffers=r.pureComputed(function(){return i.specialOffers&&i.specialOffers().length>0&&!i.isReadOnly&&i.canShowInducements()},i);i.showSpecialOfferSelected=r.pureComputed(function(){return i.chosenSpecialOffer()&&i.isReadOnly},i);i.shouldHighlightBoostedWinPrice=r.pureComputed(function(){return!i.isPlaced&&i.fixedItem&&i.fixedItem.currentBoostedPrice()==="W"},i);i.shouldHighlightBoostedPlacePrice=r.pureComputed(function(){return!i.isPlaced&&i.fixedItem&&i.fixedItem.currentBoostedPrice()==="P"},i);i.flexiPercent=r.observable(maths.calcFlexiFromSpend(n.investment,n.combinations));i.isNonFlexiMystery=r.pureComputed(function(){return i.toteRacingItem.isMystery&&!i.isFlexi()&&!i.isPlaceAvailable});i.cost=function(){return i.isReadOnly?i.betCost:i.isFlexi()?i.investment():(i.investment()+i.investmentPlace())*i.combinations};i.projectedReturn=r.computed(function(){return i.fixedItem?i.investment()*i.fixedItem.fixedWinReturn+i.investmentPlace()*i.fixedItem.fixedPlaceReturn:0});i.displayProjectedReturn=r.observable(i.projectedReturn());i.shouldHighlightBoostedReturn=r.pureComputed(function(){return(i.shouldHighlightBoostedWinPrice()||i.shouldHighlightBoostedPlacePrice())&&i.displayProjectedReturn()},i);i.expanded=r.observable(!1);i.toggleExpand=function(){i.expanded(!i.expanded())};i.toggleCalculator=function(n){f.debug("BetSlipItem: toggleCalculator - winSpend = "+n+", visible = "+i.calcVisible());i.calcVisible()?n===i.calcAction()?(i.calcAction(""),i.calcVisible(!1)):i.calcAction(n):(i.calcAction(n),i.calcVisible(!0))};i.startTimeDisplay=o().isSame(i.startTime,"day")?i.startTime.format("H:mm"):i.startTime.format("H:mm, D MMM YYYY");i.setFlexiSpend=function(n){var t=maths.calculateMinValue(i.combinations);n>0&&n<t&&(n=t);i.investment(n);i.flexiPercent(maths.calcFlexiFromSpend(i.investment(),i.combinations))};i.setFlexiPercent=function(n){var t=99999.5,r=maths.calcFlexiFromSpend(t,i.combinations);n>=r?i.setFlexiSpend(t):i.setFlexiSpend(maths.calcSpendFromFlexi(n,i.combinations))};i.setInvestmentFromExternal=function(n,t){if(i.isFlexi())i.setFlexiSpend(n);else{var r=i.betType===betTypes.Fixed?1:.5;t?i.investment(maths.roundToHalf(n,r)):i.isPlaceAvailable&&i.winPlaceOption()!=winPlaceOptions.EachWay&&i.investmentPlace(maths.roundToHalf(n,r))}};i.addInvestment=function(n){f.debug("BetSlipItemViewModel: addInvestment - value = "+n);var t=i.calcAction()==="win";i.betType===betTypes.Fixed?t?i.investment(maths.convertToRange(i.investment()+n,0,99999)):i.investmentPlace(maths.convertToRange(i.investmentPlace()+n,0,99999)):i.isFlexi()?i.setFlexiSpend(maths.convertToRange(i.investment()+n,0,99999.5)):t?i.investment(maths.convertToRange(i.investment()+n,0,99999.5)):i.investmentPlace(maths.convertToRange(i.investmentPlace()+n,0,99999.5))};i.clearInvestment=function(){var n=i.calcAction()==="win";i.isFlexi()?(i.investment(0),i.flexiPercent(0)):n?i.investment(0):i.investmentPlace(0)};i.multiReturn=function(){return i.winPlaceOption()===winPlaceOptions.Place?i.fixedItem.fixedPlaceReturn:i.fixedItem.fixedWinReturn};i.investment.subscribe(function(n){i.betType===betTypes.Fixed&&i.winPlaceOption()===winPlaceOptions.EachWay&&i.investmentPlace()!==n&&i.investmentPlace(n);l(!1)});i.investmentPlace.subscribe(function(){l(!1)});i.notes.subscribe(function(){i.parent.saveCookie()},i);i.ignoreMysterySelections.subscribe(function(){i.parent.saveCookie()},i);i.chosenSpecialOffer.subscribe(function(n){i.parent.saveCookie();v();l(!_.isUndefined(n))});i.selected.subscribe(function(n){n?e.publish({topic:"betslip.item.selected"}):(i.chosenSpecialOffer(undefined),e.publish({topic:"betslip.item.unselected"}))});var v=function(){var n=i.chosenSpecialOffer(),t=n&&n.firstBoostElement();t?n.legTypeCode==="W"?(i.fixedItem.currentBoostedPrice("W"),a(i.fixedItem.fixedWinReturn,t.priceIncrease.win,function(n){this.fixedItem.displayWinReturn(n)}),i.fixedItem.displayPlaceReturn(i.fixedItem.fixedPlaceReturn)):(i.fixedItem.displayWinReturn(i.fixedItem.fixedWinReturn),i.fixedItem.currentBoostedPrice("P"),a(i.fixedItem.fixedPlaceReturn,t.priceIncrease.place,function(n){this.fixedItem.displayPlaceReturn(n)})):y()},l=function(n){var t=0,r=i.chosenSpecialOffer(),f=r&&r.firstBoostElement();if(f){var e={Win:i.investment(),Place:i.investmentPlace()},o={Win:{DollarReturn:i.fixedItem.fixedWinReturn},Place:{DollarReturn:i.fixedItem.fixedPlaceReturn}},u=c().calculateProjectedReward(r,f,e,o);u&&u>0&&(t=u)}n?a(i.projectedReturn(),t,function(n){this.displayProjectedReturn(n)}):i.displayProjectedReturn(i.projectedReturn()+t)},a=function(n,t,r){var o=new u(t||0),f=o.dividedBy(10),s;f.lessThan(.01)&&(f=new u(.01));s=new u(n||0);o.lessThanOrEqualTo(0)&&(f=new u(0));var h=s.plus(o),e=new u(s),c=window.setInterval(function(){e=e.plus(f);r.call(i,e.toNumber());e.greaterThanOrEqualTo(h)&&window.clearInterval(c)},60)},y=function(){var n=i.fixedItem;n.currentBoostedPrice("");n.displayWinReturn(n.fixedWinReturn);n.displayPlaceReturn(n.fixedPlaceReturn)};i.fixedItem&&(v(),l(!1))}var f=typeof window!="undefined"?window.log:typeof i!="undefined"?i.log:null,r=typeof window!="undefined"?window.ko:typeof i!="undefined"?i.ko:null,s=n("./special-offer"),h=n("./betslip-fixed-item"),c=n("./betslip-specials-reward-calculator"),e=typeof window!="undefined"?window.postal:typeof i!="undefined"?i.postal:null,o=typeof window!="undefined"?window.moment:typeof i!="undefined"?i.moment:null,u=n("decimal.js");t.exports=l}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./betslip-fixed-item":"./betslip/betslip-fixed-item","./betslip-specials-reward-calculator":"./betslip/betslip-specials-reward-calculator","./special-offer":"./betslip/special-offer","decimal.js":7}],"./betslip/betslip-multi-formula-cost-calculator":[function(n,t){function u(n,t,u){var f=0,e=_.chain(r.combination(n,u).toArray()).tap(function(n){f=n.length}).map(function(n){return t*_.reduce(n,function(n,t){return n*t})}).reduce(function(n,t){return n+i(t)}).value();return{cost:e,numberOfCombinations:f}}function i(n){return Math.floor((n*100).toFixed(6))/100}var r=n("js-combinatorics");t.exports=function(n,t){for(var o=0,s=0,f,e,r=0;r<n.length;r++)f=n[r],f>0&&(e=u(t,f,r+1),o+=e.cost,s+=e.numberOfCombinations);return{cost:i(o),totalCombinations:s}}},{"js-combinatorics":8}],"./betslip/betslip-multi-formula-viewmodel":[function(n,t){(function(i){function u(n){var t=this;t.parent=n;t.formulas=[];t.calcVisible=e.observable(!1);t.calcAction=e.observable("");t.formulas.push(f.create("Singles",1,{},n));t.formulas.push(f.create("Doubles",2,{3:3,4:6,5:10,6:15},n));t.formulas.push(f.create("Trebles",3,{4:4,5:10,6:20},n));t.formulas.push(f.create("Pick 4",4,{5:5,6:15},n));t.formulas.push(f.create("Pick 5",5,{6:6},n));t.isAvailable=e.pureComputed(function(){return n.mode()!=="Multi"?!1:n.selectedBetsCount()<2?!1:n.selectedBetsCount()>6?!1:!0},t);t.toggleCalculator=function(n){o.debug("BetSlipMultiFormulaViewModel: toggleCalculator - formulaName = "+n+", visible = "+t.calcVisible());t.calcVisible()?n===t.calcAction()?(t.calcAction(""),t.calcVisible(!1)):t.calcAction(n):(t.calcAction(n),t.calcVisible(!0))}}var e=typeof window!="undefined"?window.ko:typeof i!="undefined"?i.ko:null,o=typeof window!="undefined"?window.log:typeof i!="undefined"?i.log:null,r=typeof window!="undefined"?window._:typeof i!="undefined"?i._:null,f=n("./multi-formula-viewmodel"),s=n("./betslip-multi-formula-cost-calculator");u.prototype.init=function(n){var t=this;n&&n.multiFormulas?r.each(n.multiFormulas,function(n){r.each(t.formulas,function(t){t.name===n.name&&(t.investment(n.investment),t.formulaNumber=n.formulaNumber)})}):r.each(t.formulas,function(n){n.clearInvestment()})};u.prototype.formulasWithInvestment=function(){return r.filter(this.formulas,function(n){return n.investment()>0})};u.prototype.clearAll=function(){r.each(this.formulas,function(n){n.clearInvestment()});this.parent.saveCookie();this.parent.recalculateBonusBetAndUpdateTotalCost()};u.prototype.calculateCost=function(){return r.chain(this.formulas).filter(function(n){return n.isVisible()}).reduce(function(n,t){return n+t.investment()*t.optionNumberCalc()},0).value()};u.prototype.calculateProjectedReturn=function(n){var t=r.chain(this.formulas).where(function(n){return n.isVisible()}).map(function(n){return n.investment()}).value();return s(t,n)};u.prototype.hasMultiFormulas=function(){return this.formulasWithInvestment().length>0};u.prototype.clearOutRemovedLegs=function(n){r.each(r.where(this.formulas,function(t){return t.minLegs>n}),function(n){n.clearInvestment()});this.parent.saveCookie();this.parent.recalculateBonusBetAndUpdateTotalCost()};t.exports={create:function(n){return new u(n)}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./betslip-multi-formula-cost-calculator":"./betslip/betslip-multi-formula-cost-calculator","./multi-formula-viewmodel":"./betslip/multi-formula-viewmodel"}],"./betslip/betslip-persister":[function(n,t){(function(n){var i=typeof window!="undefined"?window._:typeof n!="undefined"?n._:null;t.exports=function(n){var t={multiInv:n.multiInvestment(),allUpFormulas:[],allUpFormulaStates:[],items:[],cashMode:n.cashMode(),multiNotes:n.allupMultiNotes(),isMultiFormulaSectionExpanded:n.multiFormulasExpanded(),multiFormulas:[]};return _.each(n.betSlipItems(),function(n){t.items.push({item:n.itemId,inv1:n.investment(),inv2:n.investmentPlace(),wpOption:n.winPlaceOption(),sel:n.selected(),notes:n.notes(),ignoreMysterySelections:n.ignoreMysterySelections(),specialSequence:n.chosenSpecialOffer()?n.chosenSpecialOffer().specialSequence:undefined})}),n.allUpOn()&&_.each(n.formulas(),function(n){n.highlighted()&&t.allUpFormulas.push(n.index);t.allUpFormulaStates.push(n.state())}),n.multiFormulaViewModel.isAvailable()&&_.each(n.multiFormulaViewModel.formulas,function(n){n.isVisible()&&n.investment()>0&&t.multiFormulas.push({name:n.name,investment:n.investment(),formulaNumber:n.formulaNumber})}),t}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./betslip/betslip-specials-reward-calculator":[function(n,t){(function(i){var o=typeof window!="undefined"?window.log:typeof i!="undefined"?i.log:null,f=typeof window!="undefined"?window._:typeof i!="undefined"?i._:null,r=n("decimal.js"),e=function(n,t){return n.legTypeCode==="WP"||n.legTypeCode===t},u=function(n,t,i,u,f){var o,s;if(!e(n,f))return 0;o=new r(i);s=new r(t&&t.maxStake||0);s.greaterThan(0)&&(o=r.min(s,o));var h=new r(u).plus(-1),c=new r(h).times(t&&t.profitMultiplier||0),l=new r(c).plus(t&&t.stakeMultiplier||0),a=t&&t.priceIncrease?f==="P"?new r(t.priceIncrease.place||0):new r(t.priceIncrease.win||0):new r(0),v=l.plus(a);return o.times(v)};t.exports=function(){var n=function(n,t){t=f.extend({Win:0,Place:0},t);var i=t.Win||0,r=t.Place||0;return n.isExclusiveLegType?n.legTypeCode==="W"&&r===0||n.legTypeCode==="P"&&i===0||n.legTypeCode==="WP"&&(i===0||r===0):n.legTypeCode==="W"&&(i!==0||r===0)||n.legTypeCode==="P"&&(i===0||r!==0)||n.legTypeCode==="WP"},t=function(t,i,f,e){if(!i||!n(t,f))return 0;var h=u(t,i,f.Win,e.Win.DollarReturn,"W"),c=u(t,i,f.Place,e.Place.DollarReturn,"P"),o=r(h).plus(c),s=new r(i.maxReward||0);return s.greaterThan(0)&&(o=r.min(s,o)),o.toDecimalPlaces(2,1).toNumber()};return{calculateProjectedReward:t,checkEligible:n}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"decimal.js":7}],"./betslip/betslip-viewmodel":[function(n,t){(function(i){function l(n,t){var i=this,a,v,y;i.isInitialising="";i.maxBets=6;i.availableBonus=0;i.validationId="";i.cashMode=r.observable(!1);i.mode=r.observable("");i.state=r.observable("");i.modeCourseName=r.observable("");i.betSlipItems=r.observableArray();i.formulas=r.observableArray();i.totalCost=r.observable(0);i.combinations=r.observable(0);i.bannerMessage=r.observable("");i.displayBanner=r.observable(!1);i.bannerLevel=r.observable("");i.isBusy=r.observable(!1);i.bonusBetAmount=r.observable(0);i.multiInvestment=r.observable(0);i.multiTicketSeq=r.observable(0);i.totalPayable=r.observable(0);i.multiReturn=r.observable(0);i.multiProjPay=r.observable(0);i.totalBetCount=r.observable(0);i.serverTime=r.observable(moment());i.failedBetCount=r.observable(0);i.showAllUpMultiCampaign=r.observable(!1);i.showAllUpMultiOfferLink=r.observable(!1);i.allUpMultiCampaignText=r.observable("");i.campaignUrl=r.observable("");i.totalCampaignsCount=r.observable(0);i.showCampaignTooltip=r.observable(!1);i.calcVisible=r.observable(!1);i.calcAction=r.observable("");i.allupMultiNotes=r.observable("").extend({rateLimit:{timeout:350,method:"notifyWhenChangesStop"}});i.multiFormulasExpanded=r.observable(!1);i.multiFormulaViewModel=s.create(i);i.multiHasSpecialOffer=r.observable(!1);i.canShowInducements=r.observable(!1);i.isBetSlipEmpty=r.pureComputed(function(){return i.betSlipItems().length===0},i);i.editable=r.pureComputed(function(){return i.state()==="Editable"});i.validated=r.pureComputed(function(){return i.state()==="Validated"});i.committed=r.pureComputed(function(){return i.state()==="Committed"});i.showAddMore=r.pureComputed(function(){return i.betSlipItems().length===0&&i.state()==="Editable"});i.addMoreText=r.pureComputed(function(){return i.betSlipItems().length===0?"No active bets":""});i.isBannerWarning=r.pureComputed(function(){return i.bannerLevel()==="Warning"});i.isBannerError=r.pureComputed(function(){return i.bannerLevel()==="Error"});i.allUpOn=r.pureComputed(function(){return i.mode()==="AllUp"});i.multiOn=r.pureComputed(function(){return i.mode()==="Multi"});i.nextButtonText=r.pureComputed(function(){return i.cashMode()?"BET WITH CASH":"CONTINUE"});i.allupMultiNotes.subscribe(function(){i.saveCookie()},i);u.subscribe({topic:"betting.betAdded",callback:function(n){i.add(n.betPlacementResponse);i.validateSpecialOffers()}});u.subscribe({topic:"betslip.special-offer.*",callback:function(){i.validateSpecialOffers()}});u.subscribe({topic:"betslip.item.selected",callback:function(){i.validateSpecialOffers()}});u.subscribe({topic:"betslip.item.unselected",callback:function(){i.validateSpecialOffers()}});u.subscribe({topic:"logon.success",callback:function(){i.cashMode()&&i.toggleCashMode();i.hasBets()&&$.ajax({url:"/api/campaignapi/getcampaigns",type:"POST",async:!0}).done(function(n){i.processCampaign(n);i.updateTotalCost()})}});i.init=function(n,t){var s=[],c=[],f,u;for(i.cashMode(n.isCashMode),i.state(n.state),i.mode(n.mode),i.modeCourseName(n.modeCourseName),i.multiInvestment(n.multiInvestment),i.multiTicketSeq(n.multiTicketSeq),i.validationId=n.validationId,i.maxBets=n.maxBets,i.totalCost(n.totalCost),i.combinations(n.totalCombinations),i.totalPayable(n.totalCost-n.committedBonus),i.multiReturn(n.multiReturn),i.multiProjPay(n.potentialPayout),i.totalBetCount(n.totalBetCount),i.campaignInfo=r.observable("Campaign Info"),i.failedBetCount(n.failedBetCount),i.showAllUpMultiCampaign(n.showAllUpMultiCampaign),i.showAllUpMultiOfferLink(n.showAllUpMultiOfferLink),i.allUpMultiCampaignText(n.allUpMultiCampaignText),i.bannerMessage(n.bannerMessage),i.bannerLevel(n.bannerLevel),i.displayBanner(n.bannerLevel!=="None"),i.serverTime(moment(n.serverTime)),i.campaignUrl(n.campaign.campaignsUrl),i.totalCampaignsCount(n.campaign.totalNumberOfCampaigns),i.allupMultiNotes(n.allupMultiNotes||""),i.canShowInducements(n.canShowInducements),f=o.get("betslip"),f&&i.multiFormulasExpanded(f.isMultiFormulaSectionExpanded||!1),_.each(n.betSlipItems,function(n){s.push(new e(n,i))}),u=0;u<n.comboValues.length;u++)c.push(h.create(u+1,n.comboValues[u],n.formulaStates[u],i));i.multiFormulaViewModel.init(n);i.multiHasSpecialOffer(n.multiHasSpecialOffer);i.isInitialising=t?"":"init";i.formulas(c);i.betSlipItems(s);i.isInitialising="";i.processCampaign(n.campaign);i.validateSpecialOffers();i.state()==="Committed"?i.bonusBetAmount(n.committedBonus):i.updateTotalCost()};i.toggleCashMode=function(){var n=!i.cashMode();i.cashMode(n);u.publish({topic:"betslip.cashmode",data:{newMode:n}});i.saveCookie()};i.toggleMultiFormulaSection=function(){return i.multiFormulasExpanded(!i.multiFormulasExpanded()),i.saveCookie(),!1};i.toggleCalculator=function(n){f.debug("BetSlipViewModel: toggleCalculator - winSpend = "+n+", visible = "+i.calcVisible());i.calcVisible()?n===i.calcAction()?(i.calcAction(""),i.calcVisible(!1)):i.calcAction(n):(i.calcAction(n),i.calcVisible(!0))};i.add=function(n){var t,r=[];n.isFullModel?(i.betSlipItems([]),i.init(n,!0)):(n.isReplace?(i.isInitialising="replace",_.each(n.betSlipItems,function(n){t=new e(n,i);for(var r=0;r<i.betSlipItems().length;r++)i.betSlipItems()[r].itemId==t.itemId&&i.betSlipItems.replace(i.betSlipItems()[r],t)}),i.isInitialising=""):(_.each(n.betSlipItems,function(n){r.push(new e(n,i))}),i.betSlipItems.push.apply(i.betSlipItems,r)),i.serverTime(moment(n.serverTime)),i.processUpdatedCombos(n.comboValues),i.processCampaign(n.campaign),i.bannerMessage(""),i.displayBanner(!1),i.updateTotalCost());i.saveCookie();u.publish({topic:"betslip.add",data:{viewModel:i}})};i.processUpdatedCombos=function(n){if(i.allUpOn()&&n){for(var t=0;t<n.length;t++)i.formulas().length>t&&i.formulas()[t].value(n[t]);i.saveCookie()}};i.processCampaign=function(n){var t;n&&(i.availableBonus=n.betSlipAvailableBonus,n.activeCampaigns&&n.activeCampaigns.length>0?(t="<div class='text-left'><b>Offers $"+n.availableBonus.toFixed(2)+"<\/b><\/div>",_.each(n.activeCampaigns,function(n){t=t+"<div class='text-left'>"+n.campaignTitle+" : $"+n.availableAmount.toFixed(2)+"<\/div>"}),i.campaignInfo(t),i.showCampaignTooltip(!0)):i.showCampaignTooltip(!1))};i.remove=function(n){i.isBusy()||(i.isBusy(!0),ozbetApi.postJson({url:"/api/betslip/delete?item="+n.itemId,blockUI:!1}).done(function(n){var t=r.utils.arrayFirst(i.betSlipItems(),function(t){return t.itemId===n.itemId});t&&(u.publish({topic:"betslip.remove",data:{viewModel:i,removedItem:t}}),i.processRemoveResponse(t,n),i.multiFormulaViewModel.clearOutRemovedLegs(i.betSlipItems().length))}).always(function(){i.validateSpecialOffers();i.isBusy(!1)}))};i.recalc=function(){i.isBusy()||(i.isBusy(!0),ozbetApi.postJson({url:"/api/betslip/recalculate",blockUI:!1}).done(i.processRecalculateResponse).always(function(){i.isBusy(!1)}))};i.refreshFixedPrices=function(n){i.isBusy()||(i.isBusy(!0),ozbetApi.postJson({url:"/api/betslip/refreshfixed?item="+n.itemId,blockUI:!1}).done(i.processRefreshFixedResponse).always(function(){i.isBusy(!1)}))};i.hasSelectedBets=r.computed(function(){return _.any(i.betSlipItems(),function(n){return n.selected()===!0})});i.selectedBetsCount=function(){return _.filter(i.betSlipItems(),function(n){return n.selected()===!0}).length};i.showDraftBetLink=r.computed(function(){return i.editable()?i.mode()==="Standard"?i.selectedBetsCount()===1&&!i.containsMysteryBet():i.selectedBetsCount()>=1:!1},i);i.hasBets=r.computed(function(){return i.betSlipItems().length>0});i.containsMysteryBet=function(){return _.any(i.betSlipItems(),function(n){return n.toteRacingItem!=undefined&&n.toteRacingItem.isMystery})};i.clear=function(){if(f.debug("BetSlipViewModel: clear"),!i.isBusy()){var n=i.cashMode();i.isBusy(!0);ozbetApi.postJson({url:"/api/betslip/clear",blockUI:!1}).done(function(){p(n)}).always(function(){i.isBusy(!1)});u.publish({topic:"betslip.clear"})}};i.precommit=function(){i.isBusy()||i.hasSelectedBets()&&(i.isBusy(!0),i.cashMode()?ozbetApi.postJson({url:"/api/betslip/createcashbet",blockUI:!1}).done(function(n){n.draftBetGroupSeq?(u.publish({topic:"betslip.create-cash-bet",data:{viewModel:i,draftBetId:n.draftBetGroupSeq}}),p(!0),globals.windowService.redirect&&globals.windowService.redirect("/cashbet/"+n.draftBetGroupSeq)):l(n)}).always(function(){i.isBusy(!1)}):ozbetApi.postJson({url:"/api/betslip/precommit",blockUI:!1}).done(function(n){l(n);u.publish({topic:"betslip.continue",data:{viewModel:i}})}).always(function(){i.isBusy(!1)}))};i.cancel=function(){i.isBusy()||(i.isBusy(!0),ozbetApi.postJson({url:"/api/betslip/cancel",blockUI:!1}).done(l).always(function(){i.isBusy(!1)}),u.publish({topic:"betslip.cancel"}))};i.changeMode=function(n){i.editable()&&(i.isBusy()||(i.isBusy(!0),ozbetApi.postJson({url:"/api/betslip/mode?mode="+n.toLowerCase(),blockUI:!1}).done(l).always(function(){i.isBusy(!1)})))};i.commit=function(){i.isBusy()||(i.isBusy(!0),u.publish({topic:"betslip.pre-commit",data:{viewModel:i}}),ozbetApi.postJson({url:"/api/betslip/commit",blockUI:!1}).done(w).always(function(){i.isBusy(!1)}))};i.closeAndClear=function(){a(!1)};i.closeAndRetry=function(){a(!0)};a=function(n){i.isBusy()||(i.isBusy(!0),u.publish({topic:"betslip.close",data:{betSlipItems:i.betSlipItems,mode:i.mode().toLowerCase()}}),ozbetApi.postJson({url:"/api/betslip/close?persistfailed="+n,blockUI:!1}).done(l).always(function(){i.isBusy(!1)}))};i.validateSpecialOffers=function(){f.debug("BetSlip: validateSpecialOffers");i.validateSpecialOfferAvailabilityByGroup(i.betSlipItems(),{groupBy:function(n){return n.specialOffersTokenId()},getNumberOfAvailableTokensForGroup:function(n){return _.head(n).specialOffersTokenCount()},disableOnly:!1});i.validateSpecialOfferAvailabilityByGroup(i.betSlipItems(),{groupBy:function(n){return n.racingItem?n.racingItem.raceUrl:undefined},getNumberOfAvailableTokensForGroup:function(){return 1},disableOnly:!0})};i.validateSpecialOfferAvailabilityByGroup=function(n,t){_.chain(n).groupBy(t.groupBy).omit(undefined).each(function(n){var r=t.getNumberOfAvailableTokensForGroup(n),u=_.filter(n,function(n){return n.selected()&&n.chosenSpecialOffer()!=null}).length,i=u<r;_.chain(n).filter(function(n){return n.chosenSpecialOffer()==null}).each(function(n){t.disableOnly&&i||n.isSpecialOfferEnabled(i)}).value()}).value()};i.recalculateBonusBetAndUpdateTotalCost=function(){if(i.state()!=="Committed"){if(i.totalCampaignsCount()===0){i.updateTotalCost();return}ozbetApi.getJson({url:"/api/campaignApi/calculateBetCampaigns",blockUI:!1,handleErrors:!1}).done(function(n){i.availableBonus=n.total}).fail(function(){i.availableBonus=0}).always(function(){i.updateTotalCost()})}};i.updateTotalCost=function(){var r=0,t=0,n;i.state()!=="Committed"&&(n=v(),i.availableBonus>0&&(n.totalCost>i.availableBonus?(r=n.totalCost-i.availableBonus,t=i.availableBonus):t=n.totalCost),i.multiReturn(n.multiReturn),i.multiProjPay(n.multiProjPay),i.combinations(n.combinations),i.totalCost(n.totalCost),i.totalBetCount(n.totalBetCount),i.totalPayable(r),i.bonusBetAmount(t))};v=function(){var t=0,n=0,f,r=_.filter(i.betSlipItems(),function(n){return n.selected()}),u;if(f=r.length,i.allUpOn())u=0,_.each(i.formulas(),function(t){var i=t.value();t.highlighted()&&(n+=i);i!==0&&(u=i)}),n===0&&(n=u),t=n*i.multiInvestment();else{if(i.multiOn())return y(r);_.each(r,function(n){t+=n.cost()})}return{multiReturn:1,multiProjPay:0,combinations:n,totalCost:t,totalBetCount:f}};y=function(n){var t=i.multiInvestment(),r=0,e=0,o=n.length,u={cost:0,totalCombinations:0},s=t,h=i.multiFormulaViewModel.isAvailable(),f;h&&(s+=i.multiFormulaViewModel.calculateCost());f=_.map(n,function(n){return n.multiReturn()});o>0&&(e=_.chain(f).filter(function(n){return n!==0}).reduce(function(n,t){return n*t},1).value());t>0&&(r=1);h&&(u=i.multiFormulaViewModel.calculateProjectedReturn(f));var c=maths.truncate(e),l=c*t+u.cost,a=maths.truncate(l);return r+=u.totalCombinations,{multiReturn:c,multiProjPay:a,combinations:r,totalCost:s,totalBetCount:o}};i.processRemoveResponse=function(n,t){i.betSlipItems.remove(n);i.processUpdatedCombos(t.comboValues);i.recalculateBonusBetAndUpdateTotalCost();i.bannerMessage("");i.displayBanner(!1)};i.processRecalculateResponse=function(n){i.processUpdatedCombos(n.comboValues);i.recalculateBonusBetAndUpdateTotalCost();i.updateTotalCost()};i.processRefreshFixedResponse=function(n){i.isInitialising="replace";_.each(n.betSlipItems,function(n){for(var r=new e(n,i),t=0;t<i.betSlipItems().length;t++)i.betSlipItems()[t].itemId==r.itemId&&i.betSlipItems.replace(i.betSlipItems()[t],r)});i.isInitialising="";i.updateTotalCost()};var p=function(n){i.betSlipItems([]);i.updateTotalCost();_.each(i.multiFormulaTypes,function(n){n.investment(0)});n&&(i.cashMode(!0),i.saveCookie());i.bannerMessage("");i.displayBanner(!1)},l=function(t){t.isBalanceUpdated&&u.publish({topic:"account.balanceUpdated",data:{balance:t.accountBalance}});i.init(t);n.scrollToTop()},w=function(t){f.debug('BetSlipViewModel: processCommitResponse - publish "account.offersUpdated" message (availableBonus = '+t.campaign.availableBonus+", totalNumberOfCampaigns = "+t.campaign.totalNumberOfCampaigns+", actionableCampaignCount = "+t.campaign.actionableCampaignCount+")");u.publish({topic:"account.offersUpdated",data:{availableBonus:t.campaign.availableBonus,totalNumberOfCampaigns:t.campaign.totalNumberOfCampaigns,actionableCampaignCount:t.campaign.actionableCampaignCount}});f.debug('BetSlipViewModel: processCommitResponse - publish "account.balanceUpdated" message (balance = '+t.accountBalance+")");u.publish({topic:"account.balanceUpdated",data:{balance:t.accountBalance}});i.init(t);n.scrollToTop();u.publish({topic:"betslip.post-commit",data:{viewModel:i}})};i.saveCookie=function(){f.debug("BetSlipViewModel: saveCookie");var n=c(i);t.set("betslip",JSON.stringify(n));o.save("betslip",n)};i.applyToAll=function(n){f.debug("BetSlipViewModel: applyToAll (type = "+n.betType+")");var t=n.calcAction()==="win",r=t?n.investment():n.investmentPlace();_.each(i.betSlipItems(),function(i){i.betType===n.betType&&i.setInvestmentFromExternal(r,t)})};i.displayTemplate=function(n){return i.allUpOn()?"all-up-template":n.betType===betTypes.Fixed?n.fixedItem.fixedType===fixedBetTypes.Sport?"fixed-sport-template":"fixed-template":"tote-template"};i.showInvestment=function(n){return i.editable()||!i.editable()&&n!=0};i.displayPredeterminedBetDialog=function(){ozbetApi.postJson({url:"/api/betslip/prevalidatebetslip",blockUI:!0,handleErrors:!0}).done(function(){u.publish({topic:"predeterminedBetDialog.display"})})}}var a=typeof window!="undefined"?window.$:typeof i!="undefined"?i.$:null,u=typeof window!="undefined"?window.postal:typeof i!="undefined"?i.postal:null,r=typeof window!="undefined"?window.ko:typeof i!="undefined"?i.ko:null,f=typeof window!="undefined"?window.log:typeof i!="undefined"?i.log:null,e=n("./betslip-item"),s=n("./betslip-multi-formula-viewmodel"),h=n("./betslip-allup-formula-viewmodel"),o=n("../settings"),c=n("./betslip-persister");t.exports=l}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../settings":9,"./betslip-allup-formula-viewmodel":"./betslip/betslip-allup-formula-viewmodel","./betslip-item":"./betslip/betslip-item","./betslip-multi-formula-viewmodel":"./betslip/betslip-multi-formula-viewmodel","./betslip-persister":"./betslip/betslip-persister"}],"./betslip/fob-amount":[function(n,t){function r(n){var t=this;t.win=new i(n.win||0);t.place=new i(n.place||0)}var i=n("decimal.js");t.exports=r},{"decimal.js":7}],"./betslip/multi-formula-viewmodel":[function(n,t){(function(n){function r(n,t,r,f){var e=this;e.name=n;e.formulaNumber=t;e.minLegs=t+1;e.combinations=r;e.betSlip=f;e.investment=i.observable(0);e.isVisible=i.pureComputed(function(){return e.betSlip.selectedBetsCount()>=e.minLegs},e,{deferEvaluation:!0});e.optionNumberCalc=i.pureComputed(function(){var n=e.betSlip.selectedBetsCount();return u.isEmpty(e.combinations)?n:e.combinations[n]},e,{deferEvaluation:!0});e.betAmountText=i.pureComputed(function(){var n=e.investment();return n===0?"":"$"+n.toFixed(2)},e);e.totalCostText=i.pureComputed(function(){var n=e.investment();return n===0?"":"$"+(e.optionNumberCalc()*n).toFixed(2)},e)}var i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,f=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null,u=typeof window!="undefined"?window._:typeof n!="undefined"?n._:null;r.prototype.addInvestment=function(n){this.investment(this.investment()+n)};r.prototype.clearInvestment=function(){this.investment(0)};r.prototype.saveCookie=function(){return this.betSlip.saveCookie()};r.prototype.recalculateBonusBetAndUpdateTotalCost=function(){return this.betSlip.recalculateBonusBetAndUpdateTotalCost()};t.exports={create:function(n,t,i,u){return new r(n,t,i,u)}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./betslip/special-offer-element":[function(n,t){(function(i){function f(n,t){var i=this;i.specialProductCode=t.specialProductCode;i.specialProductName=t.specialProductName;i.maxReward=t.maxReward;i.maxStake=t.maxStake;i.profitMultiplier=t.profitMultiplier;i.stakeMultiplier=t.stakeMultiplier;i.priceIncrease=t.priceIncrease?new r(t.priceIncrease):undefined;i.rewardReturn=t.rewardReturn?new r(t.rewardReturn):undefined;i.totalReward=t.rewardReturn?(parseFloat(t.rewardReturn.win)||0)+(parseFloat(t.rewardReturn.place)||0):undefined;i.isBoost=u.pureComputed(function(){return i.specialProductCode==="BST"},i)}var u=typeof window!="undefined"?window.ko:typeof i!="undefined"?i.ko:null,r=n("./fob-amount");t.exports=f}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./fob-amount":"./betslip/fob-amount"}],"./betslip/special-offer":[function(n,t){(function(i){function s(n,t){var i=this;i.title=t.title;i.description=t.description;i.isExclusiveLegType=t.isExclusiveLegType;i.legTypeCode=t.legTypeCode;i.shortDescription=t.shortDescription;i.specialSequence=t.specialSequence;i.specialType=t.specialType;i.specialTypeCode=t.specialTypeCode;i.elements=r.observableArray();i.elements(u.map(t.elements,function(n){return new o(i,n)}));i.isBoostOffer=r.pureComputed(function(){return i.specialTypeCode==="BST"},i);i.isWinBoostInsurance=r.pureComputed(function(){return i.specialTypeCode==="WBI"},i);i.firstBoostElement=r.pureComputed(function(){return u.find(i.elements(),function(n){return n.isBoost()})},i);i.firstRewardElement=r.pureComputed(function(){return u.find(i.elements(),function(n){return n.maxReward>0})},i);i.upToMaxAmountText=function(){var e={Win:n.investment(),Place:n.investmentPlace()},o={Win:{DollarReturn:n.fixedItem.fixedWinReturn},Place:{DollarReturn:n.fixedItem.fixedPlaceReturn}},t=i.firstRewardElement(),u=t?t.maxReward:0,r;return u===0?"":(r=f().calculateProjectedReward(i,t,e,o),(i.isWinBoostInsurance()?"Money back:":"")+(r===0?"":" $"+r)+" up to $"+u)};i.isEligible=r.pureComputed(function(){e.debug("Calculate eligibility of special offer '"+i.title+'"');var t={Win:n.investment(),Place:n.investmentPlace()};return f().checkEligible(i,t)},i)}var r=typeof window!="undefined"?window.ko:typeof i!="undefined"?i.ko:null,e=typeof window!="undefined"?window.log:typeof i!="undefined"?i.log:null,u=typeof window!="undefined"?window._:typeof i!="undefined"?i._:null,o=n("./special-offer-element"),f=n("./betslip-specials-reward-calculator");t.exports=s}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./betslip-specials-reward-calculator":"./betslip/betslip-specials-reward-calculator","./special-offer-element":"./betslip/special-offer-element"}],"./components/available-specials/viewmodel":[function(n,t){(function(i){var r=typeof window!="undefined"?window.ko:typeof i!="undefined"?i.ko:null,u=typeof window!="undefined"?window.postal:typeof i!="undefined"?i.postal:null,f=n("../../settings"),e=typeof window!="undefined"?window.ozbetApi:typeof i!="undefined"?i.ozbetApi:null,o=n("./special-token");t.exports=function(n){var t=this;t.windowService=n.windowService||new services.WindowService;t.isReady=r.observable(!0);t.isUserAuthenticated=r.observable(!1);t.isExpandedView=r.observable(f.get("available-special-expanded"));t.standardTokenId=r.observable(null);t.bonusTokens=r.observableArray([]);t.numberOfStandardBets=r.observable(0);t.numberOfBonusBets=r.observable(0);t.totalNumberOfBets=r.observable(0);t.emptyTokensReason=r.observable();t.shouldDisplayEmptyTokensReason=r.observable(!1);u.subscribe({topic:"betslip.continue",callback:function(){t.getSpecialTokens()}});u.subscribe({topic:"betslip.post-commit",callback:function(){t.getSpecialTokens()}});t.init=function(){t.isUserAuthenticated(globals.isUserAuthenticated);t.getSpecialTokens()};t.getSpecialTokens=function(){t.isReady(!1);e.getJson({url:"/api/special-offers/retrieve-tokens",blockUI:!1,handleErrors:!1}).done(function(n){n!=undefined&&n.responseCode==="Success"&&t.updateData(n)}).fail(function(){t.clearData()}).always(function(){t.isReady(!0)})};t.navigateToToken=function(n){n&&(t.isReady(!1),e.getJson({url:"/api/special-offers/token-url",blockUI:!1,handleErrors:!1,data:{tokenId:n}}).done(function(n){n!=undefined&&n.responseCode==="Success"&&n.redirectUrl!=undefined&&n.redirectUrl.length>0?t.windowService.redirect(n.redirectUrl):t.getSpecialTokens()}).always(function(){t.isReady(!0)}))};t.updateData=function(n){var i=0,r=0,u=[];t.standardTokenId(null);n.tokens.forEach(function(n){n.isBonusToken?(u.push(new o(n.tokenId,n.tokenName,n.betsAvailable)),i=i+n.betsAvailable):(r=r+n.betsAvailable,t.standardTokenId(n.tokenId))});t.numberOfBonusBets(i);t.numberOfStandardBets(r);t.totalNumberOfBets(i+r);t.bonusTokens(u);t.emptyTokensReason(n.emptyTokenReason);t.shouldDisplayEmptyTokensReason(n.tokens.length<=0&&n.emptyTokenReason!=null&&n.emptyTokenReason.length>0)};t.clearData=function(){t.standardTokenId(null);t.numberOfBonusBets(0);t.numberOfStandardBets(0);t.totalNumberOfBets(0);t.bonusTokens.removeAll();t.isExpandedView(!1);t.emptyTokensReason(null);t.shouldDisplayEmptyTokensReason(!1)};t.toggleView=function(){var n=!t.isExpandedView();t.isExpandedView(n);f.save("available-special-expanded",n);n&&t.getSpecialTokens()};t.init()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../../settings":9,"./special-token":1}],"./components/betslip-calculator/viewmodel":[function(n,t){(function(n){var i=typeof window!="undefined"?window._:typeof n!="undefined"?n._:null;t.exports=function(n,t){var r=this,u=i.extend({disableFiftyCents:!1,disableApplyToAll:!1,applyToAllButtonText:"Apply to all"},t);r.applyToAllButtonText=ko.observable(ko.unwrap(u.applyToAllButtonText));r.disableFiftyCents=ko.observable(ko.unwrap(u.disableFiftyCents));r.disableApplyToAll=ko.observable(ko.unwrap(u.disableApplyToAll));r.add=function(t){t===.5&&r.disableFiftyCents()||n.add(t)};r.clear=function(){n.clear()};r.applyToAll=function(){n.applyToAll()}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./components/betslip-item-specials/viewmodel":[function(n,t){(function(n){var i=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null;t.exports=function(n){var t=this;t.specialOffers=n.specialOffers;t.selected=n.selected;t.isEnabled=n.isEnabled;t.select=function(n){t.selected()&&t.selected().specialSequence===n.specialSequence?(t.selected(null),i.publish({topic:"betslip.special-offer.unselected"})):(t.selected(n),i.publish({topic:"betslip.special-offer.selected",data:t.selected()}))};t.isSelected=function(n){var i=t.selected();return n&&i&&i.specialSequence===n.specialSequence};t.shouldDisplayReward=function(n){if(n.isBoostOffer())return!1;var i=t.selected();return i?i.specialSequence===n.specialSequence:!0}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./components/countdown-timer/viewmodel":[function(n,t){(function(n){var r=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,i=typeof window!="undefined"?window.moment:typeof n!="undefined"?n.moment:null,f=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null,u=new services.WindowService;t.exports=function(n){var t=this;t.timer=undefined;t.timeLeft=r.observable("");t.status=r.observable("");t.eventTime=i(n.startAt);t.update=function(){var u=n.now?i(n.now):i(),f=t.eventTime.diff(u,"seconds"),r=i.duration(f,"seconds");r.asSeconds()<=-60?t.timeLeft(r.minutes()+"m "+Math.abs(r.seconds())+"s"):r.asSeconds()<0?t.timeLeft(r.seconds()+"s"):r.asSeconds()<60?t.timeLeft(r.seconds()+"s"):r.asMinutes()<10?t.timeLeft(r.minutes()+"m "+r.seconds()+"s"):r.asHours()<1?t.timeLeft(r.minutes()+"m"):r.asDays()<1?t.timeLeft(r.hours()+"h "+r.minutes()+"m"):t.timeLeft(r.days()+"d "+r.hours()+"h");r.asMinutes()<3?t.status("red"):r.asMinutes()<10?t.status("orange"):t.status("green")};t.dispose=function(){t.timer&&u.clearInterval(t.timer)};t.update();n.disableTimer||(t.timer=u.setInterval(t.update,1e3))}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./error-viewmodel":[function(n,t){(function(n){var i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,r=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null,u=new services.WindowService;t.exports=function(n,t){var f=this;f.windowService=t||u;f.dialogVisible=i.observable(!1);f.title=i.observable("");f.content=i.observable("");f.buttonText=i.observable("");f.reload=!1;f.redirect=null;f.show=function(n){(n=n||{},f.title(n.title||"Unexpected error"),f.content(n.content||"An unexpected error has occurred."),f.reload=n.reload||!1,f.buttonText(n.buttonText||(f.reload?"RELOAD":"CONTINUE")),f.redirect=n.redirect||null,f.onClose=n.onClose||null,f.dialogVisible()!==!0)&&f.dialogVisible(!0)};f.close=function(){f.dialogVisible()!==!1&&(f.dialogVisible(!1),f.reload?f.windowService.reload(!0):f.redirect?f.windowService.redirect(f.redirect):f.onClose&&f.onClose())};r.subscribe({topic:"error.display",callback:function(n){f.show(n)}})}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./feedback-viewmodel":[function(n,t){(function(n){function e(n){var t=this;t.windowService=f||n;t.dialogVisible=i.observable(!1);t.isBusy=i.observable(!1);t.subjects=i.observableArray();t.selectedSubject=i.observable();t.firstName=i.observable("");t.lastName=i.observable("");t.email=i.observable("");t.phone=i.observable("");t.message=i.observable("");t.account=i.observable("");t.error=i.observable("");t.showEntry=i.observable(!0);t.showSuccess=i.observable(!1);t.showError=i.observable(!1);t.showForm=function(){t.dialogVisible()!==!0&&(t.showEntry(!0),t.showSuccess(!1),t.showError(!1),t.dialogVisible(!0))};t.afterDisplay=function(){t.loadInitialData()};t.submitForm=function(){var n={Account:t.account(),Email:t.email(),FirstName:t.firstName(),Message:t.message(),Phone:t.phone(),Subject:t.selectedSubject(),Surname:t.lastName(),ScreenHeight:t.windowService.screen.height(),ScreenWidth:t.windowService.screen.width(),PixelDepth:t.windowService.screen.pixelDepth()};t.isBusy()||(t.isBusy(!0),r.postJson({url:"/api/feedback/submit",data:i.toJSON(n),blockUI:!1,useAntiForgeryToken:!1,handleErrors:!1}).done(function(){t.clearForm();t.showEntry(!1);t.showSuccess(!0)}).fail(function(n){t.error(n&&n.responseMessage?n.responseMessage:r.genericFailureMessage());t.showEntry(!1);t.showError(!0)}).always(function(){t.isBusy(!1)}))};t.loadInitialData=function(){t.subjects().length==0&&(t.isBusy(!0),r.postJson({url:"/api/feedback/init",blockUI:!1,useAntiForgeryToken:!1}).done(t.processInitResponse).fail(function(){t.dialogVisible(!1)}).always(function(){t.isBusy(!1)}))};t.processInitResponse=function(n){t.subjects(n.subjects);t.account(n.account)};t.doNothing=function(){};t.retry=function(){t.showEntry(!0);t.showError(!1)};t.cancel=function(){t.dialogVisible()!==!1&&t.dialogVisible(!1)};t.clearForm=function(){t.firstName("");t.lastName("");t.email("");t.phone("");t.message("")};u.subscribe({topic:"feedback.request",callback:function(){t.showForm()}})}var i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,u=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null,r=typeof window!="undefined"?window.ozbetApi:typeof n!="undefined"?n.ozbetApi:null,f=new services.WindowService;t.exports=e}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./ko/component-registrations-common":[function(n,t){(function(i){var r=typeof window!="undefined"?window.ko:typeof i!="undefined"?i.ko:null,u=typeof window!="undefined"?window._:typeof i!="undefined"?i._:null;t.exports=function(){r.components.register("no-data",{template:'<div class="l-faux-table l-table-fixed w100 t10em lh1 fz-14 fg-ui-info text-center">\r\n    <span class="l-faux-cell">\r\n        <span class="tticon tticon-info alignmid fz-18"><\/span>\r\n        <span class="alignmid lh1.5" data-bind="text: message"><\/span>\r\n    <\/span>\r\n<\/div>'});r.components.register("busy-overlay-panel",{viewModel:n("../components/busy-overlay-panel/viewmodel"),template:'<div class="loader" data-bind="fadeVisible: show">\r\n    <div class="overlay"><\/div>\r\n    <div class="window">\r\n        <img src="/content/ozbet/images/ajax-loader.gif" alt="Loading...">\r\n    <\/div>\r\n<\/div>'});r.components.register("race-betting-menu",{viewModel:n("../components/race-betting-menu/viewmodel"),template:'<div class="faux-select viewmode" data-bind="click: toggleOpen, css: { \'open\': isOpen }, mouseFocus: hasMouseFocus">\r\n    <p class="title">\r\n        <a href="#"><b>View:<\/b> <!-- ko text: selectedOption().text --> <!-- /ko --><span class="tticon tticon-arrowdownsolid"><\/span><\/a>\r\n    <\/p>\r\n    <ul data-bind="foreach: options">\r\n        <li data-bind="click: onSelect, css: { \'separator-top\': hasSeparator }, visible: isVisible"><a href="#" data-bind="text: $data.text"><\/a><\/li>\r\n    <\/ul>\r\n<\/div>'});r.components.register("betslip-item-specials",{viewModel:n("../components/betslip-item-specials/viewmodel"),template:'<div class="superPick" data-bind="visible: isEnabled">\r\n\r\n    <div class="splitlines-title faux-strong fz-12"><span class="tticon fz-21 tticon-special special-bright alignmid"><\/span> SuperPick<\/div>\r\n\r\n    <div class="l-faux-table l-table-fixed w100 pt1em text-center">\r\n        <!-- ko foreach: specialOffers() -->\r\n        <div class="l-faux-cell alignmid superPick-offer inside-cell-spaced">\r\n            <div class="l-faux-table w100">\r\n                <div class="l-faux-row">\r\n                    <div class="l-faux-cell alignmid">\r\n                        <button class="btn-superpick phalfem fz-12" data-bind="click: $component.select, css: { insurance : isWinBoostInsurance, selected : $component.isSelected($data)}" data-ui="special-offer-item">\r\n                            <span data-bind="text: title" data-ui="special-offer-name"><\/span>\r\n                        <\/button>\r\n                    <\/div>\r\n                <\/div>\r\n\r\n                <div class="l-faux-row">\r\n                    <div class="l-faux-cell">\r\n                        <span data-bind="visible: $component.shouldDisplayReward($data), text: upToMaxAmountText()"><\/span>\r\n                        <span data-bind="visible: !$component.shouldDisplayReward($data)">&nbsp;<\/span>\r\n                    <\/div>\r\n                <\/div>\r\n            <\/div>\r\n        <\/div>\r\n        <!-- /ko -->\r\n    <\/div>\r\n\r\n<\/div>\r\n'});r.components.register("betslip-item-selected-special",{viewModel:n("../components/betslip-item-selected-special/viewmodel"),template:'<div class="superpick" data-bind="if: hasSpecialOffer">\r\n    <div class="splitlines-title faux-strong fz-12"><span class="tticon fz-21 tticon-special special-bright alignmid"><\/span> SuperPick<\/div>\r\n    <span class="btn btn-selected-play block fz-12 mthalfem mbhalfem">\r\n        <span class="l-faux-table l-table-fixed w100">\r\n            <span class="special-title l-faux-cell pt5 pb5 pl10 alignmid" data-ui="special-offer-name" data-bind="text: title"><\/span>\r\n            <span class="l-faux-cell l-cell-xs-3 pt5 pr10 pb5 alignmid text-right faux-strong" data-bind="visible: !(specialOffer().firstBoostElement()), text: totalReward"><\/span>\r\n        <\/span>\r\n    <\/span>\r\n<\/div>\r\n'});r.components.register("betslip-item-price-change",{viewModel:n("../components/betslip-item-price-change/viewmodel"),template:'﻿<span class="tticon" data-bind="visible: show, css: arrowDirection">\r\n    <span class="accessible" data-bind="text: accessibilityText">Price has changed<\/span>\r\n<\/span>'});r.components.register("available-specials",{viewModel:n("../components/available-specials/viewmodel"),template:'<!-- ko if: isUserAuthenticated -->\r\n<span class="specials-remaining">\r\n    <h3 class="dark l-faux-table l-table-fixed w100 pr0 pl0">\r\n        <a href="#" class="l-faux-row" data-bind="click: toggleView">\r\n            <span class="cell-icon l-faux-cell alignmid text-center">\r\n                <span class="tticon tticon-special special-bright fz-24"><\/span>\r\n            <\/span>\r\n            <span class="power-play-label l-faux-cell alignmid text-upper">\r\n                Available SuperPicks\r\n            <\/span>\r\n            <span class="l-faux-cell l-cell-xs-2 pr10 text-right alignmid">\r\n                <!-- ko if: isReady -->\r\n                <span data-bind="text: totalNumberOfBets, css: {\'number-indicator number-indicator-special fz-12\': totalNumberOfBets() > 0, \'left l5\': totalNumberOfBets() == 0}"><\/span>\r\n                <!-- /ko -->\r\n                <span class="tticon" data-bind="css : {\'tticon-arrowdown\': !isExpandedView(), \'tticon-arrowup\': isExpandedView()}"><\/span>\r\n            <\/span>\r\n        <\/a>\r\n    <\/h3>\r\n    <ul class="panel-list links" data-bind="slideIn: isExpandedView">\r\n        <!-- ko if: isReady -->\r\n        <!-- ko if:shouldDisplayEmptyTokensReason -->\r\n        <li>\r\n            <span class="faux-a" data-bind="text: emptyTokensReason"><\/span>\r\n        <\/li>\r\n        <!-- /ko -->\r\n        <!-- ko ifnot:shouldDisplayEmptyTokensReason -->\r\n        <li>\r\n            <span class="faux-a">\r\n                SuperPicks\r\n                <span class="tticon tticon-infoinvertround tooltip" title="SuperPick is available on every Australian race. <a href=\'/superpick\'>Find out more.<\/a>" data-bind="toolTipster: { contentAsHTML: true, interactive: true }">\r\n                    <span class="accessible">More info<\/span>\r\n                <\/span>\r\n                <span class="right" data-bind="text: numberOfStandardBets, css: {\'number-indicator number-indicator-special r-5\': numberOfStandardBets() > 0}"><\/span>\r\n            <\/span>\r\n        <\/li>\r\n        <!-- /ko -->\r\n        <!-- ko if: numberOfBonusBets() > 0 -->\r\n        <li>\r\n            <span class="faux-a">Bonus SuperPicks<\/span>\r\n            <ul class="list-unstyled t0 b0" data-bind="foreach: bonusTokens">\r\n                <li data-bind="click: function(data,event){ $parent.navigateToToken(data.id); return false;}">\r\n                    <a href="#">\r\n                        <span data-bind="text: name"><\/span>\r\n                        <span class="number-indicator number-indicator-special right r-5" data-bind="text: betsAvailable"><\/span>\r\n                    <\/a>\r\n                <\/li>\r\n            <\/ul>\r\n        <\/li>\r\n        <!-- /ko -->\r\n        <!-- /ko -->\r\n        <!-- ko ifnot: isReady -->\r\n        <li class="text-center">\r\n            <span class="spinner spinner-purple fz-21 alignmid"><span class="accessible">Loading ...<\/span><\/span>\r\n        <\/li>\r\n        <!-- /ko -->\r\n    <\/ul>\r\n<\/span>\r\n<!-- /ko -->\r\n'});r.components.register("betslip-calculator",{viewModel:{createViewModel:function(t,i){var o=r.contextFor(i.element),f=o.$data,h=u.has(f,"betSlipItems"),e,s,c=n("../components/betslip-calculator/viewmodel");return h?e=new BetSlipCalculatorCommand(f):(s=u.find(o.$parents,function(n){return u.has(n,"betSlipItems")}),e=new BetSlipItemCalculatorCommand(f,s)),new c(e,t)}},template:'﻿<ul class="link-list inline number-inputs">\r\n    <li><a data-bind="click: add.bind($data, 0.5), css: { \'disabled\': disableFiftyCents }">50c<\/a><\/li>\r\n    <li><a data-bind="click: add.bind($data, 1)">$1<\/a><\/li>\r\n    <li><a data-bind="click: add.bind($data, 2)">$2<\/a><\/li>\r\n    <li><a data-bind="click: add.bind($data, 5)">$5<\/a><\/li>\r\n    <li><a data-bind="click: add.bind($data, 10)">$10<\/a><\/li>\r\n    <li><a data-bind="click: add.bind($data, 20)">$20<\/a><\/li>\r\n    <li><a data-bind="click: add.bind($data, 50)">$50<\/a><\/li>\r\n    <li class="number-inputs-100"><a data-bind="click: add.bind($data, 100)">$100<\/a><\/li>\r\n    <li class="clear"><a data-bind="click: clear">Clear field<\/a><\/li>\r\n    <li class="apply-all"><a data-bind="text: applyToAllButtonText, click: applyToAll, css: { \'disabled\': disableApplyToAll }">Apply to all fields<\/a><\/li>\r\n<\/ul>',synchronous:!0});r.components.register("logon-dialog",{viewModel:n("../logon-dialog-viewmodel"),template:{element:"logon-dialog-template"},synchronous:!0});r.components.register("create-predetermined-bet-dialog",{viewModel:n("../predetermined-bet-viewmodel"),template:{element:"create-predetermined-bet-dialog-template"},synchronous:!0});r.components.register("error-dialog",{viewModel:n("../error-viewmodel"),template:{element:"error-dialog-template"},synchronous:!0});r.components.register("feedback-dialog",{viewModel:n("../feedback-viewmodel"),template:{element:"feedback-form-dialog-template"},synchronous:!0});r.components.register("next-races",{viewModel:n("../nextraces-viewmodel"),template:{element:"next-races-template"},synchronous:!0});r.components.register("next-jackpots",{viewModel:n("../nextjackpots-viewmodel"),template:{element:"next-jackpots-template"},synchronous:!0});r.components.register("next-sports",{viewModel:n("../sports/nextsportsevents-viewmodel"),template:{element:"next-sports-template"},synchronous:!0})}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../components/available-specials/viewmodel":"./components/available-specials/viewmodel","../components/betslip-calculator/viewmodel":"./components/betslip-calculator/viewmodel","../components/betslip-item-price-change/viewmodel":2,"../components/betslip-item-selected-special/viewmodel":3,"../components/betslip-item-specials/viewmodel":"./components/betslip-item-specials/viewmodel","../components/busy-overlay-panel/viewmodel":4,"../components/race-betting-menu/viewmodel":6,"../error-viewmodel":"./error-viewmodel","../feedback-viewmodel":"./feedback-viewmodel","../logon-dialog-viewmodel":"./logon-dialog-viewmodel","../nextjackpots-viewmodel":"./nextjackpots-viewmodel","../nextraces-viewmodel":"./nextraces-viewmodel","../predetermined-bet-viewmodel":"./predetermined-bet-viewmodel","../sports/nextsportsevents-viewmodel":"./sports/nextsportsevents-viewmodel"}],"./ko/component-registrations-racing":[function(n,t){(function(i){var r=typeof window!="undefined"?window.ko:typeof i!="undefined"?i.ko:null,u=n("./component-registrations-common");t.exports=function(){u();r.components.register("countdown-timer",{viewModel:n("../components/countdown-timer/viewmodel"),template:'<span class="indicator-disc r5" data-bind="css: status"><\/span><span data-bind="text: timeLeft"><\/span>'});r.components.register("pool-totals",{viewModel:n("../components/pool-totals/viewmodel"),template:'<div class="pool-totals">\r\n    <h4 class="more-betting-options">Pool Totals<\/h4>\r\n    <ul class="link-list list-totals clearfix">\r\n        <li>\r\n            <b data-bind="text: winPlacePoolName"><\/b>\r\n            <span class="figure" data-bind="text: winPlacePoolTotal"><\/span>\r\n        <\/li>\r\n        <!-- ko foreach: availableNoveltyPools -->\r\n        <li>\r\n            <b data-bind="text: displayName"><\/b>\r\n            <span class="figure">\r\n                <!-- ko text: isAbandoned() ? \'Abandoned\' : poolTotal() --><!-- /ko -->\r\n                <!-- ko if: hasJackpot -->\r\n                <span class="tticon tticon-jackpot tticon-jackpot-blackbg"><span class="accessible">Jackpot<\/span><\/span><!-- ko text: jackpotTotal --><!-- /ko -->\r\n                <!-- /ko -->\r\n            <\/span>\r\n        <\/li>\r\n        <!-- /ko -->\r\n    <\/ul>\r\n<\/div>'})}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../components/countdown-timer/viewmodel":"./components/countdown-timer/viewmodel","../components/pool-totals/viewmodel":5,"./component-registrations-common":"./ko/component-registrations-common"}],"./logon-dialog-viewmodel":[function(n,t){(function(n){var f=typeof window!="undefined"?window.$:typeof n!="undefined"?n.$:null,u=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null,i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,e=new services.WindowService,r=globals.persistedAccount;t.exports=function(n,t){var o=this;r=r||{userName:"",rememberMe:!1};o.windowService=t||e;o.dialogVisible=i.observable(!1);o.logonPaneVisible=i.observable(!0);o.userName=i.observable("").extend({numeric:{}});o.password=i.observable("");o.isBusy=i.observable(!1);o.logonAttemptFailed=i.observable(!1);o.invalidLogonMessage=i.observable("");o.focusUserName=i.observable(!1);o.focusPassword=i.observable(!1);o.settings={};o.rememberMe=i.observable(r.rememberMe);sessionStorage&&o.userName.subscribe(function(n){sessionStorage.accountRecoveryEnteredAccountNumber=n},o);o.userName(r.userName);o.loginFailAttempt=i.observable(0);o.sliderVisible=i.observable(!1);o.slideValue=i.observable(0);o.sliderEnable=i.observable(!0);o.loginFailAttempt.subscribe(function(n){n===globals.logon.MaxNumberOfLoginAttempts-1?o.sliderVisible(!0):n>=globals.logon.MaxNumberOfLoginAttempts});o.showLogon=function(){o.dialogVisible()!==!0&&o.dialogVisible(!0)};o.canLogon=i.computed(function(){return o.userName()===""?!1:o.password()===""?!1:!0},o);o.setLogonFailure=function(n){o.invalidLogonMessage(n);o.logonAttemptFailed(!0)};o.clearLogonFailure=function(){o.logonAttemptFailed(!1);o.invalidLogonMessage("")};o.logon=function(){o.canLogon()&&(o.isBusy(!0),f.ajax({url:"/api/security/authenticate",data:{userName:o.userName(),password:o.password(),rememberMe:o.rememberMe()},type:"POST",async:!o.settings}).done(function(n){if(n.changePassword)o.changePassword(n.redirectUrl);else if(n.success){if(n.success){var t={logonId:n.logonId,requestorId:"unknown"};o.settings&&o.settings.requestorId&&(t.requestorId=o.settings.requestorId);u.publish({topic:"logon.successful",data:t});o.settings&&o.settings.returnUrl?o.windowService.redirect(o.settings.returnUrl):o.dialogVisible(!1)}}else o.loginFailAttempt(o.loginFailAttempt()+1),o.setLogonFailure(n.errorMessage),o.isBusy(!1)}).fail(function(){o.isBusy(!1)}))};o.changePassword=function(n){o.windowService.redirect(n)};o.cancel=function(){o.dialogVisible()!==!1&&o.dialogVisible(!1)};o.afterDisplay=function(){o.focusUserName(!o.rememberMe());o.focusPassword(o.rememberMe())};o.onClosed=function(){o.rememberMe()||o.userName("");o.password("");o.clearLogonFailure();o.logonPaneVisible(!0);o.isBusy(!1);o.sliderVisible(!1);o.loginFailAttempt(0);o.slideValue(-1);o.settings={}};u.subscribe({topic:"logon.request",callback:function(n){o.settings=n||{};o.showLogon()}})}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./nextjackpots-viewmodel":[function(n,t){(function(n){function e(){var n=this;n.isBusy=i.observable(!1);n.nextFiveJackpots=i.observableArray();n.init=function(){r.debug("NextJackpotsViewModel: Initializing");u.subscribe({topic:"betslip.clear",callback:function(){n.update()}});u.subscribe({topic:"betslip.close",callback:function(){n.update()}});n.update()};n.update=function(){r.debug("NextJackpotsViewModel: Retrieving next jackpots");n.isBusy(!0);f.ajax({url:"/api/jackpots/nextjackpots",dataType:"json",contentType:"application/json; charset=utf-8",method:"GET"}).done(function(t){n.nextFiveJackpots(t)}).always(function(){n.isBusy(!1)})};n.init()}var i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,f=typeof window!="undefined"?window.$:typeof n!="undefined"?n.$:null,r=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null,u=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null;t.exports=e}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./nextraces-viewmodel":[function(n,t){(function(n){function e(){var n=this;n.isBusy=i.observable(!1);n.nextFiveRaces=i.observableArray();n.init=function(){r.debug("NextRacesViewModel: Initializing");u.subscribe({topic:"betslip.clear",callback:function(){n.update()}});u.subscribe({topic:"betslip.close",callback:function(){n.update()}});n.update()};n.update=function(){r.debug("NextRacesViewModel: Retrieving next races");n.isBusy(!0);f.ajax({url:"/api/raceinfo/nextraces",dataType:"json",contentType:"application/json; charset=utf-8",method:"GET"}).done(function(t){n.nextFiveRaces(t)}).always(function(){n.isBusy(!1)})};n.init()}var i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,f=typeof window!="undefined"?window.$:typeof n!="undefined"?n.$:null,r=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null,u=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null;t.exports=e}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./predetermined-bet-viewmodel":[function(n,t){(function(n){function e(){var n=this;n.isShown=i.observable(!1);n.errorText=i.observable("");n.serverErrorText=i.observable("");n.data=i.observable("");n.isBusy=i.observable(!1);n.showEntryScreen=i.observable(!0);n.predeterminedText=i.observable("");n.show=function(){n.isShown()!==!0&&(n.data(""),n.errorText(""),n.serverErrorText(""),n.isShown(!0),n.showEntryScreen(!0),n.predeterminedText(""))};n.showError=i.computed(function(){return n.errorText().length>0&&r.trim(n.data()).length===0},n);n.showServerError=i.computed(function(){return n.serverErrorText().length>0},n);n.closeDialog=function(){n.isShown()!==!1&&(n.isShown(!1),n.showEntryScreen(!0))};n.create=function(){if(r.trim(n.data()).length===0){n.errorText("Invalid Bet Shortcut Name");return}n.errorText("");n.isBusy()||(n.isBusy(!0),f.getJson({url:"/api/predeterminedbet/create?label="+n.data(),blockUI:!1}).done(function(t){n.showEntryScreen(!1);n.predeterminedText('data-draft-bet-id="'+t.draftBetId+'"\r\ndata-draft-bet-label="'+t.label+'"\r\ndata-draft-bet-navigate="Y"')}).fail(function(t){n.serverErrorText(t.responseMessage)}).always(function(){n.isBusy(!1)}))};u.subscribe({topic:"predeterminedBetDialog.display",callback:function(){n.show()}})}var r=typeof window!="undefined"?window.$:typeof n!="undefined"?n.$:null,u=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null,i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,f=typeof window!="undefined"?window.ozbetApi:typeof n!="undefined"?n.ozbetApi:null;t.exports=e}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./raceBetting/predetermined-bet":[function(n,t){(function(n){var i=typeof window!="undefined"?window.$:typeof n!="undefined"?n.$:null,r=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null,u=typeof window!="undefined"?window.ozbetApi:typeof n!="undefined"?n.ozbetApi:null;t.exports=function(){var n={},t;return n.attachClickHandlers=function(){i("*[data-draft-bet-id]").each(function(){var n=i(this),r=n.data();if(r.draftBetId.toString().match(/^[0-9]{1,20}$/))n.on("click",t);else n.addClass("disabled")})},t=function(n){var t=i(this),f=t.data(),e={draftBetGroupSequence:f.draftBetId},o=f.draftBetNavigate||"N",s=new services.WindowService;t.addClass("disabled");o==="Y"?u.postJson({url:"/api/betslip/addnonnavigatingdraftbet",data:ko.toJSON(e),blockUI:!1,useAntiForgeryToken:!1}).done(function(n){s.redirect(n.url)}).always(function(){t.removeClass("disabled")}):u.postJson({url:"/api/betslip/adddraftbet",data:ko.toJSON(e),blockUI:!1,useAntiForgeryToken:!1,ignoreErrorCodes:[u.responseCodes.BettingError]}).done(function(n){n.isBalanceUpdated&&r.publish({topic:"account.balanceUpdated",data:{balance:n.accountBalance}});r.publish({topic:"betting.betAdded",data:{betPlacementResponse:n}})}).fail(function(n){r.publish({topic:"error.display",data:{title:"Bet cannot be added",content:n.responseMessage}})}).always(function(){t.removeClass("disabled")});n.preventDefault()},n}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./racing-master-init":[function(n,t){(function(i){var f=typeof window!="undefined"?window.ko:typeof i!="undefined"?i.ko:null,r=typeof window!="undefined"?window.$:typeof i!="undefined"?i.$:null,u=typeof window!="undefined"?window.postal:typeof i!="undefined"?i.postal:null,e=n("./ko/component-registrations-racing"),o=n("./analytics/analytics-omniture-service"),s=n("./analytics/analytics-google-service"),h=n("./racing-viewmodel"),c=n("./timezone-adjuster"),l=n("./raceBetting/predetermined-bet"),a=new myblackbook.BlackBookService,v=new myblackbook.BlackBookStore(ozbetApi),y=new services.WindowService,p=function(){r(window).load(function(){l().attachClickHandlers();c();r(".tooltip").not("[data-bind*=toolTip]").not("[data-bind*=ToolTip]").tooltipster({contentAsHTML:!0,interactive:!0});r(".colorbox-modal-slideshow").colorbox({slideshow:!0,slideshowSpeed:2e4,className:"slideshow",width:"100%"})});r(window).resize(function(){r(".bet-items").css("max-height",r(window).height()-450)});r("#account-log-in-link").click(function(){u.publish({topic:"logon.request"})});r("#close-notification-banner-link").click(function(){r("#notification-banner").hide();r.cookie("hideNotificationBanner","true")});r(".drop").hover(function(){r(this).addClass("hover")},function(){r(this).removeClass("hover")});r("#contact-form-link").click(function(){u.publish({topic:"feedback.request"})});w();b()},w=function(){r("#account-info-hidden-account-balance-button").on("click",function(){r("#account-info-balance-detail, #account-info-hidden-balance-detail").toggle();r.cookie("hideAccountBalance","false",{expires:365,path:"/",secure:!0})});r("#account-info-account-balance-button").on("click",function(){r("#account-info-balance-detail, #account-info-hidden-balance-detail").toggle();r.cookie("hideAccountBalance","true",{expires:365,path:"/",secure:!0})})},b=function(){r("#account-link").click(function(){r("#account-menu").toggleClass("hover");r("#account-menu-options").fadeToggle("fast")})},k=function(){r.ajaxSetup({cache:!1,headers:{"cache-control":"no-cache"}});r.fn.tooltipster("setDefaults",{debug:!1});p();globals.initScripts();globals.windowService=y;globals.blackBookService=a;globals.blackBookStore=v;globals.captureAnalytics&&o();globals.captureGoogleAnalytics&&s();e();var n=h.create();n.init(globals.betSlipData);f.applyBindings(n);globals.isBlackbookEnabled?(new myblackbook.BlackBookControl).enable():(new myblackbook.BlackBookControl).clear();globals.blackbookAlertsData&&globals.blackbookAlertsData.length>0&&u.channel(ozbetNotifications.Constants.notificationChannelName).publish({topic:"ozbetNotifications.addnotification",data:new ozbetNotifications.Notification("","Blackbook",'One or more alerts in your Blackbook. You can view your Blackbook alerts in <strong><a style="white-space: nowrap;" href="/account/myblackbook">My Blackbook<\/a><\/strong>',ozbetNotifications.Constants.messageType.blackbookMessage,!1)});u.subscribe({topic:"logon.successful",callback:function(n){n.returnUrl!==undefined?globals.windowService.redirect(n.returnUrl):globals.windowService.reload()}});svg4everybody()};t.exports={run:k}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./analytics/analytics-google-service":"./analytics/analytics-google-service","./analytics/analytics-omniture-service":"./analytics/analytics-omniture-service","./ko/component-registrations-racing":"./ko/component-registrations-racing","./raceBetting/predetermined-bet":"./raceBetting/predetermined-bet","./racing-viewmodel":"./racing-viewmodel","./timezone-adjuster":"./timezone-adjuster"}],"./racing-viewmodel":[function(n,t){var i=n("./betslip/betslip-viewmodel"),r=new services.WindowService,u=new services.CookieService,f=function(){var n=this;n.betSlipViewModel={};n.clockViewModel={};n.notificationsViewModel={};n.init=function(t){n.betSlipViewModel.init(t)}};t.exports={create:function(){var n=new f;return n.betSlipViewModel=new i(betSlipAnimation,u),n.clockViewModel=new ClockViewModel(r,globals.serverTime,1),n.notificationsViewModel=new OzbetNotificationsViewModel,n}}},{"./betslip/betslip-viewmodel":"./betslip/betslip-viewmodel"}],"./sports/nextsportsevents-viewmodel":[function(n,t){(function(n){function e(){var n=this;n.isBusy=i.observable(!1);n.nextFiveSportsEvents=i.observableArray();n.init=function(){r.debug("NextSportsEventsViewModel: Initializing");u.subscribe({topic:"betslip.clear",callback:function(){n.update()}});u.subscribe({topic:"betslip.close",callback:function(){n.update()}});n.update()};n.update=function(){r.debug("NextSportsEventsViewModel: Retrieving next sports events");n.isBusy(!0);f.ajax({url:"/api/sportsinfo/nextsportsevents",dataType:"json",contentType:"application/json; charset=utf-8",method:"GET"}).done(function(t){n.nextFiveSportsEvents(t)}).always(function(){n.isBusy(!1)})};n.init()}var i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,f=typeof window!="undefined"?window.$:typeof n!="undefined"?n.$:null,r=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null,u=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null;t.exports=e}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./timezone-adjuster":[function(n,t){(function(n){var i=typeof window!="undefined"?window.$:typeof n!="undefined"?n.$:null,r=typeof window!="undefined"?window.moment:typeof n!="undefined"?n.moment:null;t.exports=function(){globals.isDisplayClientTimeEnabled&&i("[data-datetime]").each(function(n,t){try{var u=i(t),f=r(u.data("datetime")),e=u.data("datetimeformat")||"DD-MMM-YYYY";u.html(f.format(e))}catch(o){console.error(o)}})}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"./timezone-detection":[function(n,t){(function(n){var r=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null,i=typeof window!="undefined"?window.$:typeof n!="undefined"?n.$:null,u=typeof window!="undefined"?window.moment:typeof n!="undefined"?n.moment:null;t.exports=function(){var n="tz",t=(new Date).getTimezoneOffset(),f=i.cookie(n);f||(r.debug("Creating time zone cookie."),i.cookie(n,t,{expires:u().add(1,"hours").toDate(),path:"/"}))}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],1:[function(n,t){(function(n){function i(n,t,i){var r=this;r.id=n;r.name=t;r.betsAvailable=i}var r=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null;t.exports=i}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,t){(function(n){var i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null;t.exports=function(n){var t=this;t.priceChange=n.priceChange;t.show=i.pureComputed(function(){return t.priceChange!=="NoChange"},t);t.arrowDirection=i.pureComputed(function(){return t.priceChange==="Increase"?"tticon-arrowupsolid":t.priceChange==="Decrease"?"tticon-arrowdownsolid":""},t);t.accessibilityText=i.pureComputed(function(){return t.priceChange==="Increase"?"Price increasing":t.priceChange==="Decrease"?"Price decreasing":""},t)}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],3:[function(n,t){t.exports=function(n){var t=this;t.specialOffer=n.specialOffer;t.hasSpecialOffer=ko.pureComputed(function(){return t.specialOffer&&t.specialOffer()},t);t.title=ko.pureComputed(function(){var n,r,i;return t.hasSpecialOffer()?(n=t.specialOffer(),r="",n.isWinBoostInsurance()&&(i=n.firstRewardElement(),i&&i.totalReward&&(r=" ("+i.totalReward.toMoney()+")")),n.title+r):""},t);t.totalReward=ko.pureComputed(function(){if(!t.hasSpecialOffer())return"";var n=t.specialOffer().firstRewardElement();return n&&n.totalReward?n.totalReward.toMoney():""},t)}},{}],4:[function(n,t){t.exports=function(n){this.show=n.show||!1}},{}],5:[function(n,t){t.exports=function(n){var t=this;t.data=n.data;t.winPlacePoolName=ko.pureComputed(function(){var n=t.data.winPlace;return n.isAvailable()&&n.isPlaceAvailable()?"Win & Place":"Win"},t);t.winPlacePoolTotal=ko.pureComputed(function(){var n=t.data.winPlace,i;return i=n.isAbandoned()?"Aban.":n.poolTotal(),n.isPlaceAvailable()&&(i+=" & ",i+=n.isPlaceAbandoned()?"Aban.":n.placePoolTotal()),i},t);t.availableNoveltyPools=ko.pureComputed(function(){return _.chain(t.data).pick(["quinella","exacta","trifecta","first4","double","quaddie"]).values().filter(function(n){return n.isAvailable()}).value()},t)}},{}],6:[function(n,t){(function(n){var i=typeof window!="undefined"?window.ko:typeof n!="undefined"?n.ko:null,f=typeof window!="undefined"?window.postal:typeof n!="undefined"?n.postal:null,r=typeof window!="undefined"?window._:typeof n!="undefined"?n._:null,u=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null;t.exports=function(n){var t=this,o=function(n){u.debug("Menu option selected: "+i.toJSON(n));n.isSelectable&&t.selectedOption(n);f.publish({channel:"race-betting-menu",topic:"item-selected",data:{optionText:i.utils.unwrapObservable(n.text)}})},e;t.isOpen=i.observable(!1);t.options=[];t.selectedOption=i.observable({text:"None"});t.selectedOptionText=i.observable("");t.hasMouseFocus=i.observable(!1);t.toggleOpen=function(){t.isOpen(!t.isOpen())};e=function(n){u.debug("Initialising race-betting-menu component view model");r.each(n.options,function(u){var f=r.extend({text:"Unknown",isVisible:!0,hasSeparator:!1,isSelectable:!0},u);f.onSelect=function(){o(f)};n.defaultOption&&f.text===i.utils.unwrapObservable(n.defaultOption)&&t.selectedOption(f);t.options.push(f)})};t.hasMouseFocus.subscribe(function(n){n||t.isOpen(!1)},t);e(n)}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],7:[function(n,t){(function(i){"use strict";function s(n){var r,i,u,o=n.length-1,e="",t=n[0];if(o>0){for(e+=t,r=1;r<o;r++)u=n[r]+"",i=f-u.length,i&&(e+=d(i)),e+=u;t=n[r];u=t+"";i=f-u.length;i&&(e+=d(i))}else if(t===0)return"0";for(;t%10==0;)t/=10;return e+t}function l(n,t,i){if(n!==~~n||n<t||n>i)throw Error(nt+n);}function rt(n,t,i,r){for(var o,s,u,e=n[0];e>=10;e/=10)--t;return--t<0?(t+=f,o=0):(o=Math.ceil((t+1)/f),t%=f),e=c(10,f-t),u=n[o]%e|0,r==null?t<3?(t==0?u=u/100|0:t==1&&(u=u/10|0),s=i<4&&u==99999||i>3&&u==49999||u==5e4||u==0):s=(i<4&&u+1==e||i>3&&u+1==e/2)&&(n[o+1]/e/100|0)==c(10,t-2)-1||(u==e/2||u==0)&&(n[o+1]/e/100|0)==0:t<4?(t==0?u=u/1e3|0:t==1?u=u/100|0:t==2&&(u=u/10|0),s=(r||i<4)&&u==9999||!r&&i>3&&u==4999):s=((r||i<4)&&u+1==e||!r&&i>3&&u+1==e/2)&&(n[o+1]/e/1e3|0)==c(10,t-3)-1,s}function ot(n,t,i){for(var u,r=[0],f,e=0,o=n.length;e<o;){for(f=r.length;f--;)r[f]*=t;for(r[0]+=ct.indexOf(n.charAt(e++)),u=0;u<r.length;u++)r[u]>i-1&&(r[u+1]===void 0&&(r[u+1]=0),r[u+1]+=r[u]/i|0,r[u]%=i)}return r.reverse()}function li(n,t){var i,u,f=t.d.length,e,r;for(f<32?(i=Math.ceil(f/3),u=Math.pow(4,-i).toString()):(i=16,u="2.3283064365386962890625e-10"),n.precision+=i,t=it(n,1,t.times(u),new n(1)),e=i;e--;)r=t.times(t),t=r.times(r).minus(r).times(8).plus(1);return n.precision-=i,t}function u(n,t,i,r){var a,h,o,s,p,w,y,u,l,b=n.constructor;n:if(t!=null){if(u=n.d,!u)return n;for(a=1,s=u[0];s>=10;s/=10)a++;if(h=t-a,h<0)h+=f,o=t,y=u[l=0],p=y/c(10,a-o-1)%10|0;else if(l=Math.ceil((h+1)/f),s=u.length,l>=s)if(r){for(;s++<=l;)u.push(0);y=p=0;a=1;h%=f;o=h-f+1}else break n;else{for(y=s=u[l],a=1;s>=10;s/=10)a++;h%=f;o=h-f+a;p=o<0?0:y/c(10,a-o-1)%10|0}if(r=r||t<0||u[l+1]!==void 0||(o<0?y:y%c(10,a-o-1)),w=i<4?(p||r)&&(i==0||i==(n.s<0?3:2)):p>5||p==5&&(i==4||r||i==6&&(h>0?o>0?y/c(10,a-o):0:u[l-1])%10&1||i==(n.s<0?8:7)),t<1||!u[0])return u.length=0,w?(t-=n.e+1,u[0]=c(10,(f-t%f)%f),n.e=-t||0):u[0]=n.e=0,n;if(h==0?(u.length=l,s=1,l--):(u.length=l+1,s=c(10,f-h),u[l]=o>0?(y/c(10,a-o)%c(10,o)|0)*s:0),w)for(;;)if(l==0){for(h=1,o=u[0];o>=10;o/=10)h++;for(o=u[0]+=s,s=1;o>=10;o/=10)s++;h!=s&&(n.e++,u[0]==v&&(u[0]=1));break}else{if(u[l]+=s,u[l]!=v)break;u[l--]=0;s=1}for(h=u.length;u[--h]===0;)u.pop()}return e&&(n.e>b.maxE?(n.d=null,n.e=NaN):n.e<b.minE&&(n.e=0,n.d=[0])),n}function w(n,t,i){if(!n.isFinite())return ni(n);var u,e=n.e,r=s(n.d),f=r.length;return t?(i&&(u=i-f)>0?r=r.charAt(0)+"."+r.slice(1)+d(u):f>1&&(r=r.charAt(0)+"."+r.slice(1)),r=r+(n.e<0?"e":"e+")+n.e):e<0?(r="0."+d(-e-1)+r,i&&(u=i-f)>0&&(r+=d(u))):e>=f?(r+=d(e+1-f),i&&(u=i-e-1)>0&&(r=r+"."+d(u))):((u=e+1)<f&&(r=r.slice(0,u)+"."+r.slice(u)),i&&(u=i-f)>0&&(e+1===f&&(r+="."),r+=d(u))),r}function st(n,t){for(var i=1,r=n[0];r>=10;r/=10)i++;return i+t*f-1}function ht(n,t,i){if(t>ci){e=!0;i&&(n.precision=i);throw Error(wt);}return u(new n(ut),t,1,!0)}function y(n,t,i){if(t>lt)throw Error(wt);return u(new n(ft),t,i,!0)}function bt(n){var t=n.length-1,i=t*f+1;if(t=n[t],t){for(;t%10==0;t/=10)i--;for(t=n[0];t>=10;t/=10)i++}return i}function d(n){for(var t="";n--;)t+="0";return t}function kt(n,t,i,r){var o,u=new n(1),s=Math.ceil(r/f+4);for(e=!1;;){if(i%2&&(u=u.times(t),ri(u.d,s)&&(o=!0)),i=h(i/2),i===0){i=u.d.length-1;o&&u.d[i]===0&&++u.d[i];break}t=t.times(t);ri(t.d,s)}return e=!0,u}function dt(n){return n.d[n.d.length-1]&1}function gt(n,t,i){for(var r,u=new n(t[0]),f=0;++f<t.length;)if(r=new n(t[f]),r.s)u[i](r)&&(u=r);else{u=r;break}return u}function at(n,t){var l,v,b,a,r,h,i,y=0,k=0,p=0,f=n.constructor,d=f.rounding,w=f.precision;if(!n.d||!n.d[0]||n.e>17)return new f(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(t==null?(e=!1,i=w):i=t,h=new f(.03125);n.e>-2;)n=n.times(h),p+=5;for(v=Math.log(c(2,p))/Math.LN10*2+5|0,i+=v,l=a=r=new f(1),f.precision=i;;){if(a=u(a.times(n),i,1),l=l.times(++k),h=r.plus(o(a,l,i,1)),s(h.d).slice(0,i)===s(r.d).slice(0,i)){for(b=p;b--;)r=u(r.times(r),i,1);if(t==null)if(y<3&&rt(r.d,i-v,d,y))f.precision=i+=10,l=a=h=new f(1),k=0,y++;else return u(r,f.precision=w,d,e=!0);else return f.precision=w,r}r=h}}function g(n,t){var c,l,b,y,w,it,h,p,r,d,nt,ut=1,k=10,i=n,a=i.d,f=i.constructor,tt=f.rounding,v=f.precision;if(i.s<0||!a||!a[0]||!i.e&&a[0]==1&&a.length==1)return new f(a&&!a[0]?-1/0:i.s!=1?NaN:a?0:i);if(t==null?(e=!1,r=v):r=t,f.precision=r+=k,c=s(a),l=c.charAt(0),Math.abs(y=i.e)<15e14){while(l<7&&l!=1||l==1&&c.charAt(1)>3)i=i.times(n),c=s(i.d),l=c.charAt(0),ut++;y=i.e;l>1?(i=new f("0."+c),y++):i=new f(l+"."+c.slice(1))}else return p=ht(f,r+2,v).times(y+""),i=g(new f(l+"."+c.slice(1)),r-k).plus(p),f.precision=v,t==null?u(i,v,tt,e=!0):i;for(d=i,h=w=i=o(i.minus(1),i.plus(1),r,1),nt=u(i.times(i),r,1),b=3;;){if(w=u(w.times(nt),r,1),p=h.plus(o(w,new f(b),r,1)),s(p.d).slice(0,r)===s(h.d).slice(0,r))if(h=h.times(2),y!==0&&(h=h.plus(ht(f,r+2,v).times(y+""))),h=o(h,new f(ut),r,1),t==null)if(rt(h.d,r-k,tt,it))f.precision=r+=k,p=w=i=o(d.minus(1),d.plus(1),r,1),nt=u(i.times(i),r,1),b=it=1;else return u(h,f.precision=v,tt,e=!0);else return f.precision=v,h;h=p;b+=2}}function ni(n){return String(n.s*n.s/0)}function ti(n,t){var r,i,u;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(r<0&&(r=i),r+=+t.slice(i+1),t=t.substring(0,i)):r<0&&(r=t.length),i=0;t.charCodeAt(i)===48;i++);for(u=t.length;t.charCodeAt(u-1)===48;--u);if(t=t.slice(i,u),t){if(u-=i,n.e=r=r-i-1,n.d=[],i=(r+1)%f,r<0&&(i+=f),i<u){for(i&&n.d.push(+t.slice(0,i)),u-=f;i<u;)n.d.push(+t.slice(i,i+=f));t=t.slice(i);i=f-t.length}else i-=u;for(;i--;)t+="0";n.d.push(+t);e&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e<n.constructor.minE&&(n.e=0,n.d=[0]))}else n.e=0,n.d=[0];return n}function ai(n,t){var u,s,a,i,h,c,f,r,l;if(t==="Infinity"||t==="NaN")return+t||(n.s=NaN),n.e=NaN,n.d=null,n;if(ei.test(t))u=16,t=t.toLowerCase();else if(fi.test(t))u=2;else if(oi.test(t))u=8;else throw Error(nt+t);for(i=t.search(/p/i),i>0?(f=+t.slice(i+1),t=t.substring(2,i)):t=t.slice(2),i=t.indexOf("."),h=i>=0,s=n.constructor,h&&(t=t.replace(".",""),c=t.length,i=c-i,a=kt(s,new s(u),i,i*2)),r=ot(t,u,v),l=r.length-1,i=l;r[i]===0;--i)r.pop();return i<0?new s(n.s*0):(n.e=st(r,l),n.d=r,e=!1,h&&(n=o(n,a,c*4)),f&&(n=n.times(Math.abs(f)<54?Math.pow(2,f):p.pow(2,f))),e=!0,n)}function vi(n,t){var i,u=t.d.length;if(u<3)return it(n,2,t,t);i=1.4*Math.sqrt(u);i=i>16?16:i|0;t=t.times(Math.pow(5,-i));t=it(n,2,t,t);for(var r,f=new n(5),e=new n(16),o=new n(20);i--;)r=t.times(t),t=t.times(f.plus(r.times(e.times(r).minus(o))));return t}function it(n,t,i,r,u){var h,s,c,l,y=1,a=n.precision,v=Math.ceil(a/f);for(e=!1,l=i.times(i),c=new n(r);;){if(s=o(c.times(l),new n(t++*t++),a,1),c=u?r.plus(s):r.minus(s),r=o(s.times(l),new n(t++*t++),a,1),s=c.plus(r),s.d[v]!==void 0){for(h=v;s.d[h]===c.d[h]&&h--;);if(h==-1)break}h=c;c=r;r=s;s=h;y++}return e=!0,s.d.length=v+1,s}function ii(n,t){var r,i=t.s<0,u=y(n,n.precision,1),f=u.times(.5);if(t=t.abs(),t.lte(f))return b=i?4:1,t;if(r=t.divToInt(u),r.isZero())b=i?3:2;else{if(t=t.minus(r.times(u)),t.lte(f))return b=dt(r)?i?2:3:i?4:1,t;b=dt(r)?i?1:4:i?3:2}return t.minus(u).abs()}function vt(n,t,i,r){var c,h,e,b,s,a,u,f,v,y=n.constructor,p=i!==void 0;if(p?(l(i,1,k),r===void 0?r=y.rounding:l(r,0,8)):(i=y.precision,r=y.rounding),n.isFinite()){for(u=w(n),e=u.indexOf("."),p?(c=2,t==16?i=i*4-3:t==8&&(i=i*3-2)):c=t,e>=0&&(u=u.replace(".",""),v=new y(1),v.e=u.length-e,v.d=ot(w(v),10,c),v.e=v.d.length),f=ot(u,10,c),h=s=f.length;f[--s]==0;)f.pop();if(f[0]){if(e<0?h--:(n=new y(n),n.d=f,n.e=h,n=o(n,v,i,r,0,c),f=n.d,h=n.e,a=yt),e=f[i],b=c/2,a=a||f[i+1]!==void 0,a=r<4?(e!==void 0||a)&&(r===0||r===(n.s<0?3:2)):e>b||e===b&&(r===4||a||r===6&&f[i-1]&1||r===(n.s<0?8:7)),f.length=i,a)for(;++f[--i]>c-1;)f[i]=0,i||(++h,f.unshift(1));for(s=f.length;!f[s-1];--s);for(e=0,u="";e<s;e++)u+=ct.charAt(f[e]);if(p){if(s>1)if(t==16||t==8){for(e=t==16?4:3,--s;s%e;s++)u+="0";for(f=ot(u,c,t),s=f.length;!f[s-1];--s);for(e=1,u="1.";e<s;e++)u+=ct.charAt(f[e])}else u=u.charAt(0)+"."+u.slice(1);u=u+(h<0?"p":"p+")+h}else if(h<0){for(;++h;)u="0"+u;u="0."+u}else if(++h>s)for(h-=s;h--;)u+="0";else h<s&&(u=u.slice(0,h)+"."+u.slice(h))}else u=p?"0p+0":"0";u=(t==16?"0x":t==2?"0b":t==8?"0o":"")+u}else u=ni(n);return n.s<0?"-"+u:u}function ri(n,t){if(n.length>t)return n.length=t,!0}function yi(n){return new this(n).abs()}function pi(n){return new this(n).acos()}function wi(n){return new this(n).acosh()}function bi(n,t){return new this(n).plus(t)}function ki(n){return new this(n).asin()}function di(n){return new this(n).asinh()}function gi(n){return new this(n).atan()}function nr(n){return new this(n).atanh()}function tr(n,t){n=new this(n);t=new this(t);var i,u=this.precision,f=this.rounding,r=u+4;return n.s&&t.s?n.d||t.d?!t.d||n.isZero()?(i=t.s<0?y(this,u,f):new this(0),i.s=n.s):!n.d||t.isZero()?(i=y(this,r,1).times(.5),i.s=n.s):t.s<0?(this.precision=r,this.rounding=1,i=this.atan(o(n,t,r,1)),t=y(this,r,1),this.precision=u,this.rounding=f,i=n.s<0?i.minus(t):i.plus(t)):i=this.atan(o(n,t,r,1)):(i=y(this,r,1).times(t.s>0?.25:.75),i.s=n.s):i=new this(NaN),i}function ir(n){return new this(n).cbrt()}function rr(n){return u(n=new this(n),n.e+1,2)}function ur(n){if(!n||typeof n!="object")throw Error(et+"Object expected");for(var i,t,u=["precision",1,k,"rounding",0,8,"toExpNeg",-tt,0,"toExpPos",0,tt,"maxE",0,tt,"minE",-tt,0,"modulo",0,9],r=0;r<u.length;r+=3)if((t=n[i=u[r]])!==void 0)if(h(t)===t&&t>=u[r+1]&&t<=u[r+2])this[i]=t;else throw Error(nt+i+": "+t);if(n.hasOwnProperty(i="crypto"))if((t=n[i])===void 0)this[i]=t;else if(t===!0||t===!1||t===0||t===1)this[i]=!!(t&&a&&(a.getRandomValues||a.randomBytes));else throw Error(nt+i+": "+t);return this}function fr(n){return new this(n).cos()}function er(n){return new this(n).cosh()}function ui(n){function t(n){var r,u,f,i=this;if(!(i instanceof t))return new t(n);if(i.constructor=t,n instanceof t){i.s=n.s;i.e=n.e;i.d=(n=n.d)?n.slice():n;return}if(f=typeof n,f==="number"){if(n===0){i.s=1/n<0?-1:1;i.e=0;i.d=[0];return}if(n<0?(n=-n,i.s=-1):i.s=1,n===~~n&&n<1e7){for(r=0,u=n;u>=10;u/=10)r++;i.e=r;i.d=[n];return}if(n*0!=0){n||(i.s=NaN);i.e=NaN;i.d=null;return}return ti(i,n.toString())}if(f!=="string")throw Error(nt+n);return n.charCodeAt(0)===45?(n=n.slice(1),i.s=-1):i.s=1,si.test(n)?ti(i,n):ai(i,n)}var i,u,f;if(t.prototype=r,t.ROUND_UP=0,t.ROUND_DOWN=1,t.ROUND_CEIL=2,t.ROUND_FLOOR=3,t.ROUND_HALF_UP=4,t.ROUND_HALF_DOWN=5,t.ROUND_HALF_EVEN=6,t.ROUND_HALF_CEIL=7,t.ROUND_HALF_FLOOR=8,t.EUCLID=9,t.config=ur,t.clone=ui,t.abs=yi,t.acos=pi,t.acosh=wi,t.add=bi,t.asin=ki,t.asinh=di,t.atan=gi,t.atanh=nr,t.atan2=tr,t.cbrt=ir,t.ceil=rr,t.cos=fr,t.cosh=er,t.div=or,t.exp=sr,t.floor=hr,t.hypot=cr,t.ln=lr,t.log=ar,t.log10=yr,t.log2=vr,t.max=pr,t.min=wr,t.mod=br,t.mul=kr,t.pow=dr,t.random=gr,t.round=nu,t.sign=tu,t.sin=iu,t.sinh=ru,t.sqrt=uu,t.sub=fu,t.tan=eu,t.tanh=ou,t.trunc=su,n===void 0&&(n={}),n)for(f=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],i=0;i<f.length;)n.hasOwnProperty(u=f[i++])||(n[u]=this[u]);return t.config(n),t}function or(n,t){return new this(n).div(t)}function sr(n){return new this(n).exp()}function hr(n){return u(n=new this(n),n.e+1,3)}function cr(){var i,n,t=new this(0);for(e=!1,i=0;i<arguments.length;)if(n=new this(arguments[i++]),n.d)t.d&&(t=t.plus(n.times(n)));else{if(n.s)return e=!0,new this(1/0);t=n}return e=!0,t.sqrt()}function lr(n){return new this(n).ln()}function ar(n,t){return new this(n).log(t)}function vr(n){return new this(n).log(2)}function yr(n){return new this(n).log(10)}function pr(){return gt(this,arguments,"lt")}function wr(){return gt(this,arguments,"gt")}function br(n,t){return new this(n).mod(t)}function kr(n,t){return new this(n).mul(t)}function dr(n,t){return new this(n).pow(t)}function gr(n){var e,o,i,u,t=0,s=new this(1),r=[];if(n===void 0?n=this.precision:l(n,1,k),i=Math.ceil(n/f),this.crypto===!1)for(;t<i;)r[t++]=Math.random()*1e7|0;else if(a&&a.getRandomValues)for(e=a.getRandomValues(new Uint32Array(i));t<i;)u=e[t],u>=429e7?e[t]=a.getRandomValues(new Uint32Array(1))[0]:r[t++]=u%1e7;else if(a&&a.randomBytes){for(e=a.randomBytes(i*=4);t<i;)u=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+((e[t+3]&127)<<24),u>=214e7?a.randomBytes(4).copy(e,t):(r.push(u%1e7),t+=4);t=i/4}else if(this.crypto)throw Error(et+"crypto unavailable");else for(;t<i;)r[t++]=Math.random()*1e7|0;for(i=r[--t],n%=f,i&&n&&(u=c(10,f-n),r[t]=(i/u|0)*u);r[t]===0;t--)r.pop();if(t<0)o=0,r=[0];else{for(o=-1;r[0]===0;o-=f)r.shift();for(i=1,u=r[0];u>=10;u/=10)i++;i<f&&(o-=f-i)}return s.e=o,s.d=r,s}function nu(n){return u(n=new this(n),n.e+1,this.rounding)}function tu(n){return n=new this(n),n.d?n.d[0]?n.s:0*n.s:n.s||NaN}function iu(n){return new this(n).sin()}function ru(n){return new this(n).sinh()}function uu(n){return new this(n).sqrt()}function fu(n,t){return new this(n).sub(t)}function eu(n){return new this(n).tan()}function ou(n){return new this(n).tanh()}function su(n){return u(n=new this(n),n.e+1,1)}var tt=9e15,k=1e9,ct="0123456789abcdef",ut="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",ft="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",p={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-tt,maxE:tt,crypto:void 0},yt,pt,b,a=typeof crypto!="undefined"?crypto:null,e=!0,et="[DecimalError] ",nt=et+"Invalid argument: ",wt=et+"Precision limit exceeded",h=Math.floor,c=Math.pow,fi=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ei=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,oi=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,si=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,v=1e7,f=7,hi=9007199254740991,ci=ut.length-1,lt=ft.length-1,r={},o;if(r.absoluteValue=r.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),u(n)},r.ceil=function(){return u(new this.constructor(this),this.e+1,2)},r.comparedTo=r.cmp=function(n){var r,h,f,e,o=this,i=o.d,u=(n=new o.constructor(n)).d,t=o.s,s=n.s;if(!i||!u)return!t||!s?NaN:t!==s?t:i===u?0:!i^t<0?1:-1;if(!i[0]||!u[0])return i[0]?t:u[0]?-s:0;if(t!==s)return t;if(o.e!==n.e)return o.e>n.e^t<0?1:-1;for(f=i.length,e=u.length,r=0,h=f<e?f:e;r<h;++r)if(i[r]!==u[r])return i[r]>u[r]^t<0?1:-1;return f===e?0:f>e^t<0?1:-1},r.cosine=r.cos=function(){var i,r,t=this,n=t.constructor;return t.d?t.d[0]?(i=n.precision,r=n.rounding,n.precision=i+Math.max(t.e,t.sd())+f,n.rounding=1,t=li(n,ii(n,t)),n.precision=i,n.rounding=r,u(b==2||b==3?t.neg():t,i,r,!0)):new n(1):new n(NaN)},r.cubeRoot=r.cbrt=function(){var i,w,n,r,v,c,l,f,y,p,t=this,a=t.constructor;if(!t.isFinite()||t.isZero())return new a(t);for(e=!1,c=t.s*Math.pow(t.s*t,1/3),c&&Math.abs(c)!=1/0?r=new a(c.toString()):(n=s(t.d),i=t.e,(c=(i-n.length+1)%3)&&(n+=c==1||c==-2?"0":"00"),c=Math.pow(n,1/3),i=h((i+1)/3)-(i%3==(i<0?-1:2)),c==1/0?n="5e"+i:(n=c.toExponential(),n=n.slice(0,n.indexOf("e")+1)+i),r=new a(n),r.s=t.s),l=(i=a.precision)+3;;)if(f=r,y=f.times(f).times(f),p=y.plus(t),r=o(p.plus(t).times(f),p.plus(y),l+2,1),s(f.d).slice(0,l)===(n=s(r.d)).slice(0,l))if(n=n.slice(l-3,l+1),n!="9999"&&(v||n!="4999")){+n&&(+n.slice(1)||n.charAt(0)!="5")||(u(r,i+1,1),w=!r.times(r).times(r).eq(t));break}else{if(!v&&(u(f,i+1,0),f.times(f).times(f).eq(t))){r=f;break}l+=4;v=1}return e=!0,u(r,i,a.rounding,w)},r.decimalPlaces=r.dp=function(){var n,i=this.d,t=NaN;if(i){if(n=i.length-1,t=(n-h(this.e/f))*f,n=i[n],n)for(;n%10==0;n/=10)t--;t<0&&(t=0)}return t},r.dividedBy=r.div=function(n){return o(this,new this.constructor(n))},r.dividedToIntegerBy=r.divToInt=function(n){var i=this,t=i.constructor;return u(o(i,new t(n),0,1,1),t.precision,t.rounding)},r.equals=r.eq=function(n){return this.cmp(n)===0},r.floor=function(){return u(new this.constructor(this),this.e+1,3)},r.greaterThan=r.gt=function(n){return this.cmp(n)>0},r.greaterThanOrEqualTo=r.gte=function(n){var t=this.cmp(n);return t==1||t===0},r.hyperbolicCosine=r.cosh=function(){var i,r,f,h,e,n=this,t=n.constructor,c=new t(1),o,l,s;if(!n.isFinite())return new t(n.s?1/0:NaN);if(n.isZero())return c;for(f=t.precision,h=t.rounding,t.precision=f+Math.max(n.e,n.sd())+4,t.rounding=1,e=n.d.length,e<32?(i=Math.ceil(e/3),r=Math.pow(4,-i).toString()):(i=16,r="2.3283064365386962890625e-10"),n=it(t,1,n.times(r),new t(1),!0),l=i,s=new t(8);l--;)o=n.times(n),n=c.minus(o.times(s.minus(o.times(s))));return u(n,t.precision=f,t.rounding=h,!0)},r.hyperbolicSine=r.sinh=function(){var i,r,f,e,n=this,t=n.constructor;if(!n.isFinite()||n.isZero())return new t(n);if(r=t.precision,f=t.rounding,t.precision=r+Math.max(n.e,n.sd())+4,t.rounding=1,e=n.d.length,e<3)n=it(t,2,n,n,!0);else{i=1.4*Math.sqrt(e);i=i>16?16:i|0;n=n.times(Math.pow(5,-i));n=it(t,2,n,n,!0);for(var o,s=new t(5),h=new t(16),c=new t(20);i--;)o=n.times(n),n=n.times(s.plus(o.times(h.times(o).plus(c))))}return t.precision=r,t.rounding=f,u(n,r,f,!0)},r.hyperbolicTangent=r.tanh=function(){var i,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,r=n.rounding,n.precision=i+7,n.rounding=1,o(t.sinh(),t.cosh(),n.precision=i,n.rounding=r)):new n(t.s)},r.inverseCosine=r.acos=function(){var u,t=this,n=t.constructor,f=t.abs().cmp(1),i=n.precision,r=n.rounding;return f!==-1?f===0?t.isNeg()?y(n,i,r):new n(0):new n(NaN):t.isZero()?y(n,i+4,r).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),u=y(n,i+4,r).times(.5),n.precision=i,n.rounding=r,u.minus(t))},r.inverseHyperbolicCosine=r.acosh=function(){var i,r,n=this,t=n.constructor;return n.lte(1)?new t(n.eq(1)?0:NaN):n.isFinite()?(i=t.precision,r=t.rounding,t.precision=i+Math.max(Math.abs(n.e),n.sd())+4,t.rounding=1,e=!1,n=n.times(n).minus(1).sqrt().plus(n),e=!0,t.precision=i,t.rounding=r,n.ln()):new t(n)},r.inverseHyperbolicSine=r.asinh=function(){var i,r,n=this,t=n.constructor;return!n.isFinite()||n.isZero()?new t(n):(i=t.precision,r=t.rounding,t.precision=i+2*Math.max(Math.abs(n.e),n.sd())+6,t.rounding=1,e=!1,n=n.times(n).plus(1).sqrt().plus(n),e=!0,t.precision=i,t.rounding=r,n.ln())},r.inverseHyperbolicTangent=r.atanh=function(){var i,r,e,f,n=this,t=n.constructor;return n.isFinite()?n.e>=0?new t(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(i=t.precision,r=t.rounding,f=n.sd(),Math.max(f,i)<2*-n.e-1)?u(new t(n),i,r,!0):(t.precision=e=f-n.e,n=o(n.plus(1),new t(1).minus(n),e+i,1),t.precision=i+4,t.rounding=1,n=n.ln(),t.precision=i,t.rounding=r,n.times(.5)):new t(NaN)},r.inverseSine=r.asin=function(){var r,u,i,f,n=this,t=n.constructor;return n.isZero()?new t(n):(u=n.abs().cmp(1),i=t.precision,f=t.rounding,u!==-1)?u===0?(r=y(t,i+4,f).times(.5),r.s=n.s,r):new t(NaN):(t.precision=i+6,t.rounding=1,n=n.div(new t(1).minus(n.times(n)).sqrt().plus(1)).atan(),t.precision=i,t.rounding=f,n.times(2))},r.inverseTangent=r.atan=function(){var r,c,h,l,o,a,t,v,p,n=this,i=n.constructor,s=i.precision,w=i.rounding;if(n.isFinite()){if(n.isZero())return new i(n);if(n.abs().eq(1)&&s+4<=lt)return t=y(i,s+4,w).times(.25),t.s=n.s,t}else{if(!n.s)return new i(NaN);if(s+4<=lt)return t=y(i,s+4,w).times(.5),t.s=n.s,t}for(i.precision=v=s+10,i.rounding=1,h=Math.min(28,v/f+2|0),r=h;r;--r)n=n.div(n.times(n).plus(1).sqrt().plus(1));for(e=!1,c=Math.ceil(v/f),l=1,p=n.times(n),t=new i(n),o=n;r!==-1;)if(o=o.times(p),a=t.minus(o.div(l+=2)),o=o.times(p),t=a.plus(o.div(l+=2)),t.d[c]!==void 0)for(r=c;t.d[r]===a.d[r]&&r--;);return h&&(t=t.times(2<<h-1)),e=!0,u(t,i.precision=s,i.rounding=w,!0)},r.isFinite=function(){return!!this.d},r.isInteger=r.isInt=function(){return!!this.d&&h(this.e/f)>this.d.length-2},r.isNaN=function(){return!this.s},r.isNegative=r.isNeg=function(){return this.s<0},r.isPositive=r.isPos=function(){return this.s>0},r.isZero=function(){return!!this.d&&this.d[0]===0},r.lessThan=r.lt=function(n){return this.cmp(n)<0},r.lessThanOrEqualTo=r.lte=function(n){return this.cmp(n)<1},r.logarithm=r.log=function(n){var l,t,a,r,p,v,i,f,c=this,h=c.constructor,y=h.precision,w=h.rounding;if(n==null)n=new h(10),l=!0;else{if(n=new h(n),t=n.d,n.s<0||!t||!t[0]||n.eq(1))return new h(NaN);l=n.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new h(t&&!t[0]?-1/0:c.s!=1?NaN:t?0:1/0);if(l)if(t.length>1)p=!0;else{for(r=t[0];r%10==0;)r/=10;p=r!==1}if(e=!1,i=y+5,v=g(c,i),a=l?ht(h,i+10):g(n,i),f=o(v,a,i,1),rt(f.d,r=y,w))do if(i+=10,v=g(c,i),a=l?ht(h,i+10):g(n,i),f=o(v,a,i,1),!p){+s(f.d).slice(r+1,r+15)+1==1e14&&(f=u(f,y+1,0));break}while(rt(f.d,r+=10,w));return e=!0,u(f,y,w)},r.minus=r.sub=function(n){var l,p,i,w,c,o,k,b,t,d,y,r,s=this,a=s.constructor;if(n=new a(n),!s.d||!n.d)return s.s&&n.s?s.d?n.s=-n.s:n=new a(n.d||s.s!==n.s?s:NaN):n=new a(NaN),n;if(s.s!=n.s)return n.s=-n.s,s.plus(n);if(t=s.d,r=n.d,k=a.precision,b=a.rounding,!t[0]||!r[0]){if(r[0])n.s=-n.s;else if(t[0])n=new a(s);else return new a(b===3?-0:0);return e?u(n,k,b):n}if(p=h(n.e/f),d=h(s.e/f),t=t.slice(),c=d-p,c){for(y=c<0,y?(l=t,c=-c,o=r.length):(l=r,p=d,o=t.length),i=Math.max(Math.ceil(k/f),o)+2,c>i&&(c=i,l.length=1),l.reverse(),i=c;i--;)l.push(0);l.reverse()}else{for(i=t.length,o=r.length,y=i<o,y&&(o=i),i=0;i<o;i++)if(t[i]!=r[i]){y=t[i]<r[i];break}c=0}for(y&&(l=t,t=r,r=l,n.s=-n.s),o=t.length,i=r.length-o;i>0;--i)t[o++]=0;for(i=r.length;i>c;){if(t[--i]<r[i]){for(w=i;w&&t[--w]===0;)t[w]=v-1;--t[w];t[i]+=v}t[i]-=r[i]}for(;t[--o]===0;)t.pop();for(;t[0]===0;t.shift())--p;return t[0]?(n.d=t,n.e=st(t,p),e?u(n,k,b):n):new a(b===3?-0:0)},r.modulo=r.mod=function(n){var r,t=this,i=t.constructor;return(n=new i(n),!t.d||!n.s||n.d&&!n.d[0])?new i(NaN):!n.d||t.d&&!t.d[0]?u(new i(t),i.precision,i.rounding):(e=!1,i.modulo==9?(r=o(t,n.abs(),0,3,1),r.s*=n.s):r=o(t,n,0,i.modulo,1),r=r.times(n),e=!0,t.minus(r))},r.naturalExponential=r.exp=function(){return at(this)},r.naturalLogarithm=r.ln=function(){return g(this)},r.negated=r.neg=function(){var n=new this.constructor(this);return n.s=-n.s,u(n)},r.plus=r.add=function(n){var y,c,p,i,l,r,w,b,t,s,o=this,a=o.constructor;if(n=new a(n),!o.d||!n.d)return o.s&&n.s?o.d||(n=new a(n.d||o.s===n.s?o:NaN)):n=new a(NaN),n;if(o.s!=n.s)return n.s=-n.s,o.minus(n);if(t=o.d,s=n.d,w=a.precision,b=a.rounding,!t[0]||!s[0])return s[0]||(n=new a(o)),e?u(n,w,b):n;if(l=h(o.e/f),p=h(n.e/f),t=t.slice(),i=l-p,i){for(i<0?(c=t,i=-i,r=s.length):(c=s,p=l,r=t.length),l=Math.ceil(w/f),r=l>r?l+1:r+1,i>r&&(i=r,c.length=1),c.reverse();i--;)c.push(0);c.reverse()}for(r=t.length,i=s.length,r-i<0&&(i=r,c=s,s=t,t=c),y=0;i;)y=(t[--i]=t[i]+s[i]+y)/v|0,t[i]%=v;for(y&&(t.unshift(y),++p),r=t.length;t[--r]==0;)t.pop();return n.d=t,n.e=st(t,p),e?u(n,w,b):n},r.precision=r.sd=function(n){var t,i=this;if(n!==void 0&&n!==!!n&&n!==1&&n!==0)throw Error(nt+n);return i.d?(t=bt(i.d),n&&i.e+1>t&&(t=i.e+1)):t=NaN,t},r.round=function(){var n=this,t=n.constructor;return u(new t(n),n.e+1,t.rounding)},r.sine=r.sin=function(){var i,r,n=this,t=n.constructor;return n.isFinite()?n.isZero()?new t(n):(i=t.precision,r=t.rounding,t.precision=i+Math.max(n.e,n.sd())+f,t.rounding=1,n=vi(t,ii(t,n)),t.precision=i,t.rounding=r,u(b>2?n.neg():n,i,r,!0)):new t(NaN)},r.squareRoot=r.sqrt=function(){var p,n,l,i,y,c,f=this,a=f.d,t=f.e,r=f.s,v=f.constructor;if(r!==1||!a||!a[0])return new v(!r||r<0&&(!a||a[0])?NaN:a?f:1/0);for(e=!1,r=Math.sqrt(+f),r==0||r==1/0?(n=s(a),(n.length+t)%2==0&&(n+="0"),r=Math.sqrt(n),t=h((t+1)/2)-(t<0||t%2),r==1/0?n="1e"+t:(n=r.toExponential(),n=n.slice(0,n.indexOf("e")+1)+t),i=new v(n)):i=new v(r.toString()),l=(t=v.precision)+3;;)if(c=i,i=c.plus(o(f,c,l+2,1)).times(.5),s(c.d).slice(0,l)===(n=s(i.d)).slice(0,l))if(n=n.slice(l-3,l+1),n!="9999"&&(y||n!="4999")){+n&&(+n.slice(1)||n.charAt(0)!="5")||(u(i,t+1,1),p=!i.times(i).eq(f));break}else{if(!y&&(u(c,t+1,0),c.times(c).eq(f))){i=c;break}l+=4;y=1}return e=!0,u(i,t,v.rounding,p)},r.tangent=r.tan=function(){var i,r,n=this,t=n.constructor;return n.isFinite()?n.isZero()?new t(n):(i=t.precision,r=t.rounding,t.precision=i+10,t.rounding=1,n=n.sin(),n.s=1,n=o(n,new t(1).minus(n.times(n)).sqrt(),i+10,0),t.precision=i,t.rounding=r,u(b==2||b==4?n.neg():n,i,r,!0)):new t(NaN)},r.times=r.mul=function(n){var a,b,i,s,t,y,k,c,l,p=this,w=p.constructor,r=p.d,o=(n=new w(n)).d;if(n.s*=p.s,!r||!r[0]||!o||!o[0])return new w(!n.s||r&&!r[0]&&!o||o&&!o[0]&&!r?NaN:!r||!o?n.s/0:n.s*0);for(b=h(p.e/f)+h(n.e/f),c=r.length,l=o.length,c<l&&(t=r,r=o,o=t,y=c,c=l,l=y),t=[],y=c+l,i=y;i--;)t.push(0);for(i=l;--i>=0;){for(a=0,s=c+i;s>i;)k=t[s]+o[i]*r[s-i-1]+a,t[s--]=k%v|0,a=k/v|0;t[s]=(t[s]+a)%v|0}for(;!t[--y];)t.pop();for(a?++b:t.shift(),i=t.length;!t[--i];)t.pop();return n.d=t,n.e=st(t,b),e?u(n,w.precision,w.rounding):n},r.toBinary=function(n,t){return vt(this,2,n,t)},r.toDecimalPlaces=r.toDP=function(n,t){var i=this,r=i.constructor;return(i=new r(i),n===void 0)?i:(l(n,0,k),t===void 0?t=r.rounding:l(t,0,8),u(i,n+i.e+1,t))},r.toExponential=function(n,t){var r,i=this,f=i.constructor;return n===void 0?r=w(i,!0):(l(n,0,k),t===void 0?t=f.rounding:l(t,0,8),i=u(new f(i),n+1,t),r=w(i,!0,n+1)),i.isNeg()&&!i.isZero()?"-"+r:r},r.toFixed=function(n,t){var r,f,i=this,e=i.constructor;return n===void 0?r=w(i):(l(n,0,k),t===void 0?t=e.rounding:l(t,0,8),f=u(new e(i),n+i.e+1,t),r=w(f,!1,n+f.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},r.toFraction=function(n){var u,a,h,t,y,w,i,v,r,d,b,g,p=this,k=p.d,l=p.constructor;if(!k)return new l(p);if(r=a=new l(1),h=v=new l(0),u=new l(h),y=u.e=bt(k)-p.e-1,w=y%f,u.d[0]=c(10,w<0?f+w:w),n==null)n=y>0?u:r;else{if(i=new l(n),!i.isInt()||i.lt(r))throw Error(nt+i);n=i.gt(u)?y>0?u:r:i}for(e=!1,i=new l(s(k)),d=l.precision,l.precision=y=k.length*f*2;;){if(b=o(i,u,0,1,1),t=a.plus(b.times(h)),t.cmp(n)==1)break;a=h;h=t;t=r;r=v.plus(b.times(t));v=t;t=u;u=i.minus(b.times(t));i=t}return t=o(n.minus(a),h,0,1,1),v=v.plus(t.times(r)),a=a.plus(t.times(h)),v.s=r.s=p.s,g=o(r,h,y,1).minus(p).abs().cmp(o(v,a,y,1).minus(p).abs())<1?[r,h]:[v,a],l.precision=d,e=!0,g},r.toHexadecimal=r.toHex=function(n,t){return vt(this,16,n,t)},r.toNearest=function(n,t){var i=this,r=i.constructor;if(i=new r(i),n==null){if(!i.d)return i;n=new r(1);t=r.rounding}else{if(n=new r(n),t!==void 0&&l(t,0,8),!i.d)return n.s?i:n;if(!n.d)return n.s&&(n.s=i.s),n}return n.d[0]?(e=!1,t<4&&(t=[4,5,7,8][t]),i=o(i,n,0,t,1).times(n),e=!0,u(i)):(n.s=i.s,i=n),i},r.toNumber=function(){return+this},r.toOctal=function(n,t){return vt(this,8,n,t)},r.toPower=r.pow=function(n){var l,a,r,o,v,y,w,t=this,i=t.constructor,p=+(n=new i(n));if(!t.d||!n.d||!t.d[0]||!n.d[0])return new i(c(+t,p));if(t=new i(t),t.eq(1))return t;if(r=i.precision,v=i.rounding,n.eq(1))return u(t,r,v);if(l=h(n.e/f),a=n.d.length-1,w=l>=a,y=t.s,w){if((a=p<0?-p:p)<=hi)return o=kt(i,t,a,r),n.s<0?new i(1).div(o):u(o,r,v)}else if(y<0)return new i(NaN);return(y=y<0&&n.d[Math.max(l,a)]&1?-1:1,a=c(+t,p),l=a==0||!isFinite(a)?h(p*(Math.log("0."+s(t.d))/Math.LN10+t.e+1)):new i(a+"").e,l>i.maxE+1||l<i.minE-1)?new i(l>0?y/0:0):(e=!1,i.rounding=t.s=1,a=Math.min(12,(l+"").length),o=at(n.times(g(t,r+a)),r),o=u(o,r+5,1),rt(o.d,r,v)&&(l=r+10,o=u(at(n.times(g(t,l+a)),l),l+5,1),+s(o.d).slice(r+1,r+15)+1==1e14&&(o=u(o,r+1,0))),o.s=y,e=!0,i.rounding=v,u(o,r,v))},r.toPrecision=function(n,t){var f,i=this,r=i.constructor;return n===void 0?f=w(i,i.e<=r.toExpNeg||i.e>=r.toExpPos):(l(n,1,k),t===void 0?t=r.rounding:l(t,0,8),i=u(new r(i),n,t),f=w(i,n<=i.e||i.e<=r.toExpNeg,n)),i.isNeg()&&!i.isZero()?"-"+f:f},r.toSignificantDigits=r.toSD=function(n,t){var r=this,i=r.constructor;return n===void 0?(n=i.precision,t=i.rounding):(l(n,1,k),t===void 0?t=i.rounding:l(t,0,8)),u(new i(r),n,t)},r.toString=function(){var n=this,t=n.constructor,i=w(n,n.e<=t.toExpNeg||n.e>=t.toExpPos);return n.isNeg()&&!n.isZero()?"-"+i:i},r.truncated=r.trunc=function(){return u(new this.constructor(this),this.e+1,1)},r.valueOf=r.toJSON=function(){var n=this,t=n.constructor,i=w(n,n.e<=t.toExpNeg||n.e>=t.toExpPos);return n.isNeg()?"-"+i:i},o=function(){function n(n,t,i){var u,r=0,f=n.length;for(n=n.slice();f--;)u=n[f]*t+r,n[f]=u%i|0,r=u/i|0;return r&&n.unshift(r),n}function t(n,t,i,r){var u,f;if(i!=r)f=i>r?1:-1;else for(u=f=0;u<i;u++)if(n[u]!=t[u]){f=n[u]>t[u]?1:-1;break}return f}function i(n,t,i,r){for(var u=0;i--;)n[i]-=u,u=n[i]<t[i]?1:0,n[i]=u*r+n[i]-t[i];for(;!n[0]&&n.length>1;)n.shift()}return function(r,e,o,s,c,l){var g,et,w,y,it,ot,nt,ft,rt,ut,p,b,ht,tt,vt,ct,st,pt,d,lt,at=r.constructor,wt=r.s==e.s?1:-1,k=r.d,a=e.d;if(!k||!k[0]||!a||!a[0])return new at(!r.s||!e.s||(k?a&&k[0]==a[0]:!a)?NaN:k&&k[0]==0||!a?wt*0:wt/0);for(l?(it=1,et=r.e-e.e):(l=v,it=f,et=h(r.e/it)-h(e.e/it)),d=a.length,st=k.length,rt=new at(wt),ut=rt.d=[],w=0;a[w]==(k[w]||0);w++);if(a[w]>(k[w]||0)&&et--,o==null?(tt=o=at.precision,s=at.rounding):tt=c?o+(r.e-e.e)+1:o,tt<0)ut.push(1),ot=!0;else{if(tt=tt/it+2|0,w=0,d==1){for(y=0,a=a[0],tt++;(w<st||y)&&tt--;w++)vt=y*l+(k[w]||0),ut[w]=vt/a|0,y=vt%a|0;ot=y||w<st}else{for(y=l/(a[0]+1)|0,y>1&&(a=n(a,y,l),k=n(k,y,l),d=a.length,st=k.length),ct=d,p=k.slice(0,d),b=p.length;b<d;)p[b++]=0;lt=a.slice();lt.unshift(0);pt=a[0];a[1]>=l/2&&++pt;do y=0,g=t(a,p,d,b),g<0?(ht=p[0],d!=b&&(ht=ht*l+(p[1]||0)),y=ht/pt|0,y>1?(y>=l&&(y=l-1),nt=n(a,y,l),ft=nt.length,b=p.length,g=t(nt,p,ft,b),g==1&&(y--,i(nt,d<ft?lt:a,ft,l))):(y==0&&(g=y=1),nt=a.slice()),ft=nt.length,ft<b&&nt.unshift(0),i(p,nt,b,l),g==-1&&(b=p.length,g=t(a,p,d,b),g<1&&(y++,i(p,d<b?lt:a,b,l))),b=p.length):g===0&&(y++,p=[0]),ut[w++]=y,g&&p[0]?p[b++]=k[ct]||0:(p=[k[ct]],b=1);while((ct++<st||p[0]!==void 0)&&tt--);ot=p[0]!==void 0}ut[0]||ut.shift()}if(it==1)rt.e=et,yt=ot;else{for(w=1,y=ut[0];y>=10;y/=10)w++;rt.e=w+et*it-1;u(rt,c?o+rt.e+1:o,s,ot)}return rt}}(),p=ui(p),ut=new p(ut),ft=new p(ft),typeof define=="function"&&define.amd)define(function(){return p});else if(typeof t!="undefined"&&t.exports){if(t.exports=p,!a)try{a=n("crypto")}catch(hu){}}else i||(i=typeof self!="undefined"&&self&&self.self==self?self:Function("return this")()),pt=i.Decimal,p.noConflict=function(){return i.Decimal=pt,p},i.Decimal=p})(this)},{}],8:[function(n,t,i){(function(n,r){typeof define=="function"&&define.amd?define([],r):typeof i=="object"?t.exports=r():n.Combinatorics=r()})(this,function(){"use strict";var r=function(n,t){for(var i=1;t--;)i*=n--;return i},e=function(n,t){return t>n?0:r(n,t)/r(t,t)},o=function(n){return r(n,n)},s=function(n,t){var i=1,r;if(t)i=o(t);else{for(t=1;i<n;i*=++t);i>n&&(i/=t--)}for(r=[0];t;i/=t--)r[t]=Math.floor(n/i),n%=i;return r},n=function(n,t){Object.keys(t).forEach(function(i){Object.defineProperty(n,i,{value:t[i],configurable:i=="next"})})},t=function(n,t){Object.defineProperty(n,t,{writable:!0})},h=function(n){var t,i=[];for(this.init();t=this.next();)i.push(n?n(t):t);return this.init(),i},i={toArray:h,map:h,forEach:function(n){var t;for(this.init();t=this.next();)n(t);this.init()},filter:function(n){var t,i=[];for(this.init();t=this.next();)n(t)&&i.push(t);return this.init(),i},lazyMap:function(n){return this._lazyMap=n,this},lazyFilter:function(n){if(Object.defineProperty(this,"next",{writable:!0}),typeof n!="function")this.next=this._next;else{typeof this._next!="function"&&(this._next=this.next);var t=this._next.bind(this);this.next=function(){for(var i;i=t();)if(n(i))return i;return i}.bind(this)}return Object.defineProperty(this,"next",{writable:!1}),this}},l=function(r,u){var e=1<<r.length,o=function(){return e},f=Object.create(r.slice(),{length:{get:o}});return t(f,"index"),n(f,{valueOf:o,init:function(){f.index=0},nth:function(n){if(!(n>=e)){for(var i=0,t=[];n;n>>>=1,i++)n&1&&t.push(this[i]);return typeof f._lazyMap=="function"?f._lazyMap(t):t}},next:function(){return this.nth(this.index++)}}),n(f,i),f.init(),typeof u=="function"?f.map(u):f},a=function(n){var i=n&-n,t=n+i,r=t&-t,u=(r/i>>1)-1;return t|u},u=function(r,u,f){if(u||(u=r.length),u<1)throw new RangeError;if(u>r.length)throw new RangeError;var h=(1<<u)-1,c=e(r.length,u),l=1<<r.length,s=function(){return c},o=Object.create(r.slice(),{length:{get:s}});return t(o,"index"),n(o,{valueOf:s,init:function(){this.index=h},next:function(){if(!(this.index>=l)){for(var i=0,t=this.index,n=[];t;t>>>=1,i++)t&1&&(n[n.length]=this[i]);return this.index=a(this.index),typeof o._lazyMap=="function"?o._lazyMap(n):n}}}),n(o,i),o.init(),typeof f=="function"?o.map(f):o},v=function(n,t){for(var r=n,f=t,i=0,e,u,o,i=r.length-1;i>=0;i--)if(r[i]==1)f--;else break;if(f==0)for(r[r.length]=1,e=r.length-2;e>=0;e--)r[e]=e<t-1?1:0;else{for(u=-1,o=-1,i=0;i<r.length;i++)if(r[i]==0&&u!=-1&&(o=i),r[i]==1&&(u=i),o!=-1&&u!=-1){r[o]=1;r[u]=0;break}for(f=t,i=r.length-1;i>=u;i--)r[i]==1&&f--;for(i=0;i<u;i++)r[i]=i<f?1:0}return r},y=function(n){for(var i=[],t=0;t<n;t++)i[t]=1;return i[0]=1,i},p=function(r,u,f){if(u||(u=r.length),u<1)throw new RangeError;if(u>r.length)throw new RangeError;var h=y(u),c=e(r.length,u),l=r.length,s=function(){return c},o=Object.create(r.slice(),{length:{get:s}});return t(o,"index"),n(o,{valueOf:s,init:function(){this.index=h.concat()},next:function(){var t;if(!(this.index.length>l)){var i=0,r=this.index,n=[];for(t=0;t<r.length;t++,i++)r[t]&&(n[n.length]=this[i]);return v(this.index,u),typeof o._lazyMap=="function"?o._lazyMap(n):n}}}),n(o,i),o.init(),typeof f=="function"?o.map(f):o},f=function(n){var t=n.slice(),i=o(t.length);return t.index=0,t.next=function(){if(!(this.index>=i)){for(var u=this.slice(),f=s(this.index,this.length),n=[],r=this.length-1;r>=0;--r)n.push(u.splice(f[r],1)[0]);return this.index++,typeof t._lazyMap=="function"?t._lazyMap(n):n}},t},w=function(e,o,s){if(o||(o=e.length),o<1)throw new RangeError;if(o>e.length)throw new RangeError;var c=r(e.length,o),l=function(){return c},h=Object.create(e.slice(),{length:{get:l}});return t(h,"cmb"),t(h,"per"),n(h,{valueOf:function(){return c},init:function(){this.cmb=u(e,o);this.per=f(this.cmb.next())},next:function(){var n=this.per.next(),t;return n?typeof h._lazyMap=="function"?h._lazyMap(n):n:(t=this.cmb.next(),!t)?void 0:(this.per=f(t),this.next())}}),n(h,i),h.init(),typeof s=="function"?h.map(s):h},b=function(n){for(var i=0,u,t=1;t<=n;t++)u=r(n,t),i+=u;return i},k=function(r,e){var s=b(r.length),h=function(){return s},o=Object.create(r.slice(),{length:{get:h}});return t(o,"cmb"),t(o,"per"),t(o,"nelem"),n(o,{valueOf:function(){return s},init:function(){this.nelem=1;this.cmb=u(r,this.nelem);this.per=f(this.cmb.next())},next:function(){var t=this.per.next(),n;if(!t){if(n=this.cmb.next(),!n){if(this.nelem++,this.nelem>r.length)return;if(this.cmb=u(r,this.nelem),n=this.cmb.next(),!n)return}return this.per=f(n),this.next()}return typeof o._lazyMap=="function"?o._lazyMap(t):t}}),n(o,i),o.init(),typeof e=="function"?o.map(e):o},d=Array.prototype.slice,g=function(){if(!arguments.length)throw new RangeError;var u=d.call(arguments),f=u.reduce(function(n,t){return n*t.length},1),o=function(){return f},e=u.length,r=Object.create(u,{length:{get:o}});if(!f)throw new RangeError;return t(r,"index"),n(r,{valueOf:o,dim:e,init:function(){this.index=0},get:function(){var t,n,i;if(arguments.length===this.length){for(t=[],n=0;n<e;n++){if(i=arguments[n],i>=this[n].length)return;t.push(this[n][i])}return typeof r._lazyMap=="function"?r._lazyMap(t):t}},nth:function(n){for(var i=[],t=0,u,f;t<e;t++)u=this[t].length,f=n%u,i.push(this[t][f]),n-=f,n/=u;return typeof r._lazyMap=="function"?r._lazyMap(i):i},next:function(){if(!(this.index>=f)){var n=this.nth(this.index);return this.index++,n}}}),n(r,i),r.init(),r},nt=function(r,u,f){if(u||(u=r.length),u<1)throw new RangeError;var o=r.length,s=Math.pow(o,u),h=function(){return s},e=Object.create(r.slice(),{length:{get:h}});return t(e,"index"),n(e,{valueOf:h,init:function(){e.index=0},nth:function(n){var t,i,f;if(!(n>=s)){for(t=[],i=0;i<u;i++)f=n%o,t.push(r[f]),n-=f,n/=o;return typeof e._lazyMap=="function"?e._lazyMap(t):t}},next:function(){return this.nth(this.index++)}}),n(e,i),e.init(),typeof f=="function"?e.map(f):e},c=Object.create(null);return n(c,{C:e,P:r,factorial:o,factoradic:s,cartesianProduct:g,combination:u,bigCombination:p,permutation:w,permutationCombination:k,power:l,baseN:nt,VERSION:"0.5.2"}),c})},{}],9:[function(n,t){(function(n){var i=typeof window!="undefined"?window.amplify:typeof n!="undefined"?n.amplify:null,r=typeof window!="undefined"?window.log:typeof n!="undefined"?n.log:null;t.exports={save:function(n,t){r.debug('Saving "'+n+'" to localstorage');i.store(n,t)},get:function(n){return r.debug('Getting "'+n+'" from localstorage'),i.store(n)}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[]);locking=locking||{};locking._sharedLocks={};locking.lock=function(){var t=this,n=ko.observable(0);t.trylock=function(){return n()?0:(n(1),1)};t.unlock=function(){n(0)};t.count=function(){return n()}};locking.shared_lock=function(n){return locking._sharedLocks[n]||(locking._sharedLocks[n]=new locking.lock),locking._sharedLocks[n]};search=search||{};search.MyBlackBookViewModelDecorator=function(n){var t=this,i=new raceBetting.MyBlackBookMenuItemProviderFactory;t.extendKeywordSearchViewModel=function(t){t.createBlackBookViewModel=function(t,r,u){return new myblackbook.AddToMyBlackBookViewModel(i.createWithSearchResults(raceBetting.RacingCode.FromFixtureId(t),r,u),n)}}};myblackbook=myblackbook||{};myblackbook.constants={fixtureTypeCode:{races:"R",trots:"T",dogs:"D"},nameTypeCode:{animal:0,trainer:1,jockey:2},DeleteOperation:{single:0,all:1,unknown:2},Month:{0:"Jan",1:"Feb",2:"Mar",3:"Apr",4:"May",5:"Jun",6:"Jul",7:"Aug",8:"Sep",9:"Oct",10:"Nov",11:"Dec"},alertMeBy:{email:1,mobile:2,unknown:3}};myblackbook.AddToMyBlackBookMenuItem=function(n,t,i,r){var u=this;u.entryLabel=r;u.entryName=i;u.fixtureType=n;u.entryCount=0;u.nameType=t};myblackbook.MenuItemProvider=function(n,t){var i=this;i.hasItems=n;i.buildItems=t};myblackbook=myblackbook||{};myblackbook.BlackBookControl=function(){var n=this,t=postal.channel("myblackbook-data");n.clear=function(){t.publish("compositeKeys.clear")};n.enable=function(){t.publish("blackbookService.enable")}};myblackbook=myblackbook||{};myblackbook.BlackBookService=function(){var n=this,i=locking.shared_lock("myblackbook-service"),t=postal.channel("myblackbook-data"),r=!1,u=ko.observable(null),f=ko.observable(!1),e=function(n){return n.fixtureType+n.nameType+jQuery.trim(n.entryName.toUpperCase())},o=function(n){u(collections.multiset.withArray(n))},s=function(){return u()?u():(r||(r=!0,t.publish("compositeKeys.pull")),new collections.multiset)},h=function(n){t.publish("compositeKeys.insert",{data:e(n)})};t.subscribe("compositeKeys.update",function(n){r=!1;o(n.data)});t.subscribe("blackbookService.enable",function(){f(!0)});n.entryCount=function(n){return f()?s().count(e(n)):0};n.entryAdded=function(n){f()&&h(n)};n.isBusy=function(){return i.count()};n.trySynchronise=function(n){return i.trylock()?(n(i.unlock),!0):!1}};myblackbook=myblackbook||{};myblackbook.BlackBookStore=function(n){var u=this,r="myblackbook.compositeKeys",f=9e5,e="ChecksessionStorage",o=locking.shared_lock("myblackbook-service"),t={};try{t=amplify.store.sessionStorage;t(e,"x",{expires:f});t(e,null)}catch(a){t=amplify.store.types.memory}var i=postal.channel("myblackbook-data"),s=function(n){return n!==undefined?(t(r+".logging",n),n):t(r+".logging")},c=function(t){o.trylock()&&n.postJson({url:"/api/blackbookapi/getmembershipset",useAntiForgeryToken:!0,data:JSON.stringify({timestamp:t.timestamp}),blockUI:!1}).done(function(n){n.notModified||i.publish("compositeKeys.update",{source:"server",timestamp:n.timestamp,data:n.compositeKeys});o.unlock()})},l=function(){var n=t(r);return n?(n.source="store",i.publish("compositeKeys.update",n),n):{source:null,timestamp:null,data:null}},h=function(){i.subscribe("#",function(n,t){console.log(t)})};i.subscribe("compositeKeys.update",function(n){n.source=="server"&&t(r,n,{expires:f})});i.subscribe("compositeKeys.clear",function(){t(r,null)});i.subscribe("compositeKeys.pull",function(){var n=l();c(n)});i.subscribe("compositeKeys.insert",function(n){var u=t(r);u&&(u.source="store",u.timestamp=null,u.data.push(n.data),i.publish("compositeKeys.update",u),t(r,u,{expires:f}))});s()&&h();u.clear=function(){i.publish("compositeKeys.clear")};u.dump=function(){console.log(t(r))};u.setLogging=function(n){s(n)&&h()}};myblackbook=myblackbook||{};myblackbook.AddToMyBlackBookViewModel=function(n,t){var i=this;i.decorateItems=function(n){return _(n).chain().filter(function(n){return n.entryName}).map(function(n){return n.entryName=jQuery.trim(n.entryName.toUpperCase()),n.entryCount=t.entryCount(n),n}).value()};i.buildRequest=function(n){return{Fix_Type:n.fixtureType,TypeOfName:n.nameType,Name:n.entryName}};i.showIcon=ko.computed(function(){return n.hasItems()});i.numberIndicator=ko.computed({read:function(){var i=n.buildItems();return _(i).reduce(function(n,i){return i.entryName!=null&&(n+=t.entryCount(i)),n},0)},deferEvaluation:!0});i.menuItems=ko.computed({read:function(){return i.decorateItems(n.buildItems())},deferEvaluation:!0});i.isBlocked=ko.computed(function(){return t.isBusy()});i.addToBlackBook=function(n){n.entryName&&t.trySynchronise(function(r){ozbetApi.postJson({url:"/api/blackbookapi/addblackbookentry",data:JSON.stringify(i.buildRequest(n)),blockUI:!1}).done(function(){t.entryAdded(n);postal.channel(ozbetNotifications.Constants.notificationChannelName).publish({topic:"ozbetNotifications.addnotification",data:new ozbetNotifications.Notification("","Blackbook","&#39;"+n.entryName+'&#39; added to your Blackbook. You can manage your Blackbook entries in <strong><a style="white-space: nowrap;" href="/account/myblackbook">My Blackbook<\/a><\/strong>',ozbetNotifications.Constants.messageType.blackbookMessage,!1)})}).always(function(){r()})})}};myblackbook=myblackbook||{};myblackbook.MyBlackBookMenuItemRacesProvider=function(){var n=myblackbook.constants.nameTypeCode;return function(t){var i={};return i.fixtureType=myblackbook.constants.fixtureTypeCode.races,i.hasItems=function(){return!0},i.cleanRunner=function(){return/^[^(]+/.exec(t).join("")},i.buildItems=function(){return[new myblackbook.AddToMyBlackBookMenuItem(i.fixtureType,n.animal,i.cleanRunner(),"Horse")]},myblackbook.MenuItemProvider.call(this,i.hasItems,i.buildItems)}}();myblackbook.MyBlackBookMenuItemTrotsProvider=function(){var n=myblackbook.constants.nameTypeCode;return function(t){var i={};return i.fixtureType=myblackbook.constants.fixtureTypeCode.trots,i.hasItems=function(){return!0},i.cleanRunner=function(){return/^[^(]+/.exec(t).join("")},i.buildItems=function(){return[new myblackbook.AddToMyBlackBookMenuItem(i.fixtureType,n.animal,i.cleanRunner(),"Horse")]},myblackbook.MenuItemProvider.call(this,i.hasItems,i.buildItems)}}();myblackbook.MyBlackBookMenuItemDogsProvider=function(){var n=myblackbook.constants.nameTypeCode;return function(t){var i={};return i.fixtureType=myblackbook.constants.fixtureTypeCode.dogs,i.cleanRunner=function(){return/^[^(]+/.exec(t).join("")},i.isVacantBox=function(){return/VACANT BOX/i.test(t)},i.hasItems=function(){return!i.isVacantBox()},i.buildItems=function(){return[new myblackbook.AddToMyBlackBookMenuItem(i.fixtureType,n.animal,i.cleanRunner(),"Dog")]},myblackbook.MenuItemProvider.call(this,i.hasItems,i.buildItems)}}();raceBetting=raceBetting||{};myblackbook=myblackbook||{};raceBetting.MyBlackBookMenuItemProviderFactory=function(){var n=this;n.createWithStarter=function(n,t){return n.racingCode()==="Races"?new myblackbook.MyBlackBookMenuItemRacesProvider(t.name,t.trainer,t.rider):n.racingCode()==="Trots"?new myblackbook.MyBlackBookMenuItemTrotsProvider(t.name,t.trainer,t.rider):n.racingCode()==="Dogs"?new myblackbook.MyBlackBookMenuItemDogsProvider(t.name,t.trainer):new myblackbook.MenuItemProvider(function(){return!1},function(){return[]})};n.createWithResultsStarter=function(n,t,i,r){return n.isRaces()?new myblackbook.MyBlackBookMenuItemRacesProvider(t,i,r):n.isTrots()?new myblackbook.MyBlackBookMenuItemTrotsProvider(t,i,r):n.isDogs()?new myblackbook.MyBlackBookMenuItemDogsProvider(t,r):new myblackbook.MenuItemProvider(function(){return!1},function(){return[]})};n.createWithSearchResults=function(n,t,i){return n.isRaces()?new myblackbook.MyBlackBookMenuItemRacesProvider(t,null,i):n.isTrots()?new myblackbook.MyBlackBookMenuItemTrotsProvider(t,null,i):n.isDogs()?new myblackbook.MyBlackBookMenuItemDogsProvider(t,i):new myblackbook.MenuItemProvider(function(){return!1},function(){return[]})}}