!function(e){var t={init:function(){e("#svod .tab_content").hide(),e("#svod ul.tabs li").on("click",function(){e(this).hasClass("active")?(e("#svod .tab_content").hide(),e("#"+t.init.activeTab).fadeOut(),e(this).removeClass("active"),e("#svod .tab_drawer_heading").addClass("d_active"),e("#svod .tab_drawer_heading[rel^='"+t.init.activeTab+"']").removeClass("d_active"),t.initSlider()):(e("#svod .tab_content").hide(),t.init.activeTab=e(this).attr("rel"),e("#"+t.init.activeTab).fadeIn(),e("#svod ul.tabs li").removeClass("active"),e(this).addClass("active"),t.initSlider())}),e("#svod .tab_drawer_heading").on("click",function(){e(this).hasClass("d_active")?(e("#svod .tab_content").hide(),t.init.activeTab=e(this).attr("rel"),e("#"+t.init.activeTab).fadeOut(),e("#svod .tab_drawer_heading").removeClass("d_active"),t.initSlider()):(e("#svod .tab_content").hide(),t.init.activeTab=e(this).attr("rel"),e("#"+t.init.activeTab).fadeIn(),e("#svod .tab_drawer_heading").removeClass("d_active"),e(this).addClass("d_active"),e("#svod ul.tabs li").removeClass("active"),e("#svod ul.tabs li[rel^='"+t.init.activeTab+"']").addClass("active"),t.initSlider())});ractiveHandsetCarousel.get("page");e("#svod .tab_drawer_heading").is(":visible")||e("#svod ul.tabs li[rel='mobile-tv']").click()},initSlider:function(){new Swiper(".music-streaming-slick .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,nextButton:".music-streaming-slick .swiper-container .swiper-button-next",prevButton:".music-streaming-slick .swiper-container .swiper-button-prev",pagination:".music-streaming-slick .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:3,spaceBetween:10},800:{slidesPerView:1}}}),new Swiper(".mobile-tv-slick .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,nextButton:".mobile-tv-slick .swiper-container .swiper-button-next",prevButton:".mobile-tv-slick .swiper-container .swiper-button-prev",pagination:".mobile-tv-slick .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:4,spaceBetween:10,slidesPerGroup:4},800:{slidesPerView:1,slidesPerGroup:1}}}),new Swiper(".optus-sport-slick .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,centeredSlides:!0,nextButton:".optus-sport-slick .swiper-container .swiper-button-next",prevButton:".optus-sport-slick .swiper-container .swiper-button-prev",pagination:".optus-sport-slick .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:4,spaceBetween:10},800:{slidesPerView:1,slidesPerGroup:1}}})}},a=!1;e.OptusHandsetCarousel=function(s){function o(e,t){if("byo"==s.carousel)var o="byo";else if("mbb"==s.carousel)var o="mbb";else if("postpaid-tablet"==s.carousel)var o="tablets";else var o="handsetplans";var n=ractiveHandsetCarousel.get("selectSku");if(s.pageConfig)if("slugs"in s.pageConfig.plans[o]){var r=s.pageConfig.plans[o].skus;console.log(r);for(var l=0;l<r.length;l++)if(r[l].id==n.id){for(var i=0;i<r[l].plans.plus.length;i++)if(r[l].plans.plus[i].id==e)return r[l].plans.plus[i];for(var i=0;i<r[l].plans.flex.length;i++)if(r[l].plans.flex[i].id==e)return r[l].plans.flex[i];r[l].location?(r[l].location.flex?a=r[l].location.flex:r[l].location.plus&&(a=r[l].location.plus),a=parseInt(a)):a=!1}handsets=s.pageConfig.plans[o].slugs;for(var l=0;l<handsets.length;l++){var r=handsets[l];if(r.id==t.slug){for(var i=0;i<r.plans.plus.length;i++)if(r.plans.plus[i].id==e)return r.plans.plus[i];for(var i=0;i<r.plans.flex.length;i++)if(r.plans.flex[i].id==e)return r.plans.flex[i]}}}else for(var c=s.pageConfig.plans[o],l=0;l<c.length;l++)if(c[l].id==e)return c[l];return!1}function n(e,t,a){console.log(a),console.log("getting "+t+" for "+e);var n=o(e,a);if(console.log(n),n&&t in n)return console.log(n[t]),n[t];var r=ractiveHandsetCarousel.get("contractLengthFilter");return s.pageConfig.page[t]?("ptr"!=s.pageConfig.page.id||"discount"!=t||1!=r)&&(console.log("defaulting to page level property",s.pageConfig.page[t]),s.pageConfig.page[t]):(console.log("no property"),!1)}function r(t,a){e.each(t,function(e,t){t.defaultValue&&(a.push(t),t.added=!0)})}function l(t,a){return t=e.grep(t,function(e,t){return e.id!=a.id&&e.groupChild!=a.compID||(e.added=!1),e.id!==a.id&&e.groupChild!==a.compID})}function i(){for(var t=[".plan-header",".feature.PO_Included_Data",".feature.PO_Business_Care",".feature.PO_Included_Calls_Text",".feature.PO_Included_int",".feature.PO_Included_roaming",".feature.PO_Included_Entertainment",".plan-footer",".feature.bundle",".feature.PO_save",".feature.PO_onemonth"],a=0;a<t.length;a++){var s=0;e(t[a]).each(function(){e(this).css("height","auto"),e(this).height()>s&&(s=e(this).height())}),e(t[a]).each(function(){e(this).height(s)})}}function c(e,t,a){if(""!=e&&""==t){e=parseInt(e.substring(0,e.toLowerCase().indexOf("gb")));var s=v(e,a);s.length>0&&(t=s[0].colour)}else if(""==e&&""!=t){var o=g(t,a);e=o[0]}else _.isString(e)&&(e=parseInt(e.substring(0,e.toLowerCase().indexOf("gb"))));for(var n=0;n<a.skus.length;n++)if(a.skus[n].storage===e&&a.skus[n].colour.toLowerCase().replace(" ","")===t.toLowerCase().replace(" ",""))return a.skus[n]}function d(e){for(var t=ractiveHandsetCarousel.get("handsets"),a=0;a<t.length;a++)if(t[a].name.toLowerCase()===e.name.toLowerCase())return a}function u(e,t){var a=[];if(t.length>0){for(var s=0;s<e.length;s++)for(var o=0;o<t.length;o++)if(t[o].toLowerCase()==e[s].name.toLowerCase()){a.push(e[s]);break}}else a=e;return a}function p(e){for(var t=[],a=0;a<e.skus.length;a++)-1==t.indexOf(e.skus[a].storage)&&t.push(e.skus[a].storage);return t}function g(e,t){for(var a=[],s=0;s<t.skus.length;s++)t.skus[s].colour.toLowerCase().replace(" ","")===e.toLowerCase().replace(" ","")&&a.push(t.skus[s].storage);return a}function v(e,t){for(var a=[],s=0;s<t.skus.length;s++)if(t.skus[s].storage===e){var o={};o.colour=t.skus[s].colour.toLowerCase(),o.imageColour=t.skus[s].imageColour,o.listImage=t.skus[s].listImage,o.proImage=t.skus[s].proImage,o.colorIndex=t.skus[s].colorIndex,a.push(o)}return a.sort(function(e,t){return e.colorIndex>t.colorIndex?1:-1}),a}function f(){return Math.floor((Date.now()-onLoadTime)/1e3)+"secs"}function C(){var e=ractiveHandsetCarousel.get("selectPlan");if(""!=e.plan){var t=ractiveHandsetCarousel.get("summary"),a=ractiveHandsetCarousel.get("selectHandset"),o=ractiveHandsetCarousel.get("customerType"),r=ractiveHandsetCarousel.get("selectSku");console.log("==> calculateSummary 1 | selectedPlan"),console.log(e),console.log(a),console.log(r);var l=P(e.plan,a.name,o);t.monthlyCost=l.disPlanCost,t.originalMonthlyCost=l.planCost,console.log("inti summary.monthlyCost = "+t.monthlyCost),console.log("options.offerDiscount = "+s.offerDiscount),console.log("options.dollarDiscount = "+s.dollarDiscount),console.log("summary.monthlyCost before = "+t.monthlyCost);var i=n(e.plan.id,"discount",ractiveHandsetCarousel.get("selectHandset"));ractiveHandsetCarousel.get("secondServiceAdded");console.log("checking discount"),console.log(i),i.percent?(console.log("applying discount"),s.offerDiscount=i.percent,t.monthlyCost=t.monthlyCost*((100-s.offerDiscount)/100),e.plan.percent_discount=i.percent,ractiveHandsetCarousel.set("selectPlan",e),console.log("setting discount in ractive",e),console.log("summary.monthlyCost after = "+t.monthlyCost)):i.dollar&&(console.log("applying dollar discount"),t.monthlyCost=t.monthlyCost,e.plan.dollar_discount=s.dollarDiscount,ractiveHandsetCarousel.set("selectPlan",e),console.log("setting discount in ractive",e),console.log("summary.monthlyCost after1 = "+t.monthlyCost));var c=e.plan.position-1;"plus"===e.plan.planType?t.handsetCost=r.mro.postpaid[c]:"flex"===e.plan.planType?t.handsetCost=r.mro.leasing[c]:t.handsetCost=0;var d=0,u=0;_.each(e.selectedBoltons,function(t){"MONTHLY"===t.costType?"YES_STREAMING_MOB_5"==t.id?(console.log("selected plan summary",e.plan),"byo"==e.plan.planType?d+=t.cost:d=d):d+=t.cost:u+=t.cost}),t.totalMonthlyExtraCost=d,t.totalUpfrontFeeCost=u,t.totalMonthlyCost=t.monthlyCost+t.totalMonthlyExtraCost+t.handsetCost,t.mtc=t.totalMonthlyCost*e.plan.contractLength+t.totalUpfrontFeeCost,1==ractiveHandsetCarousel.get("secondServiceAdded")&&(console.log("adding second service cost"),t.totalMonthlyCost+=15,t.mtc+=180),("ptr"==s.pageConfig.page.id&&"byo"==s.carousel&&12==ractiveHandsetCarousel.get("contractLengthFilter")||"ptr"==s.pageConfig.page.id&&"byo"!=s.carousel)&&(console.log("summary.originalMonthlyCost",t.originalMonthlyCost),console.log("discountPercent",discountPercent),t.discountAmount=15*t.originalMonthlyCost/100,console.log("summary.discountAmount",t.discountAmount)),console.log("______ Processed summary in Local ______"),console.log(t),ractiveHandsetCarousel.set("summary",t),console.log("______ Ractive data in summary  ______"),console.log(ractiveHandsetCarousel.get("summary"))}}function m(e){for(var t="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",s=0;s<e;s++)t+=a.charAt(Math.floor(Math.random()*a.length));return t}function w(){var e="https://offer.optus.com.au/rebuild/offline/";s.development||(e="https://offer.optus.com.au/offlineform/");var t=ractiveHandsetCarousel.get("selectSku"),a=ractiveHandsetCarousel.get("selectPlan"),o=ractiveHandsetCarousel.get("customerType"),r=ractiveHandsetCarousel.get("student"),l=ractiveHandsetCarousel.get("selectHandset"),i=ractiveHandsetCarousel.get("page"),c=ractiveHandsetCarousel.get("isWatchAdded");if(e+="new"===o||"new1"===o?"shoppingcart?action=addToCart":"p2p"===o?"shoppingcart?action=pre2Post":"existing"===o?"upgrade?action=addToCart&":"shoppingcart?action=addToCart","mbb"===ractiveHandsetCarousel.get("carouselType")?e+="&resourceId=SIM-4G%20SIM%20OMB&device=OMB":"postpaid-tablet"===ractiveHandsetCarousel.get("carouselType")?e+="&resourceId="+t.id+"&device=OMB":"mbb-modems"===ractiveHandsetCarousel.get("carouselType")?e+="&resourceId="+t.id+"&device=OMB":e+="&resourceId="+t.id,e+="&externalPackageId="+a.plan.id,e+="&resourceCL="+a.plan.contractLength,"BYO-Handset"===t.id?e+="&colorId=BYO-Handset":e+="&colorId=",a.selectedBoltons.length>0||s.boltons.length>0||"epl"==i||("fbreg"==i||"fbmetro"==i)&&("10227"==a.plan.id||"10228"==a.plan.id)){boltons="&boltonIds=";for(var d=0;d<a.selectedBoltons.length;d++)boltons+=a.selectedBoltons[d].compID+",";for(var d=0;d<s.boltons.length;d++)boltons+=s.boltons[d]+",";"fbreg"!=i&&"fbmetro"!=i||"10227"!=a.plan.id||(boltons+="11424,");var u=n(a.plan.id,"discount",l);boltons+=u?u.bolton_id+",":s.pageConfig.page.discount.bolton_id+",",boltons=boltons.slice(0,-1),e+=boltons}e+="&productOfferingCL="+a.plan.contractLength;for(var d=0;d<s.urlparams.length;d++)e+="&"+s.urlparams[d].name+"="+s.urlparams[d].value,console.log("&"+s.urlparams[d].name+"="+s.urlparams[d].value);if(e+="&ctype="+s.propType,!0===r&&(e+="&student=true"),c&&(e+="&visa=Samsung-GS9-tab-a-bundle"),e+="&tactical="+k(a.plan,l.name,o),1==ractiveHandsetCarousel.get("secondServiceAdded")){e+="&accessory=second-service";e+="&second-service="+ractiveHandsetCarousel.get("secondService").id}return e}function h(){var e="https://www.optus.com.au/";s.development||(e="https://www.optus.com.au/");var t=ractiveHandsetCarousel.get("selectSku"),a=ractiveHandsetCarousel.get("selectPlan"),o=ractiveHandsetCarousel.get("customerType"),n=ractiveHandsetCarousel.get("page"),r="shop/shoppingcart?action=addToCart&resourceId=";"new"===o?r="smb"===s.propType?"business/shoppingcart?action=onlineOfflineOrder&resourceId=":"shop/shoppingcart?action=addToCart&resourceId=":"p2p"===o?r="shop/shoppingcart?action=pre2Post&resourceId=":"existing"===o&&(r="smb"===s.propType?"business/upgrade?action=addToCart&resourceId=":"shop/upgrade?action=addToCart&resourceId="),e+=r+t.id,e+="&resourceCL="+a.plan.contractLength,"BYO-Handset"===t.id?e+="&colorId=BYO-Handset":e+="&colorId=",e+="&externalPackageId="+a.plan.id,e+="&productOfferingCL="+a.plan.contractLength;var l=(new Date).getTime();if(l=m(1)+Math.floor(1e3*Math.random()).toString()+l,console.log("atcid atcid atcid"),console.log(l),e+="&atcid="+l,a.selectedBoltons.length>0||s.boltons.length>0||"spring"==n){boltons="&boltonIds=";for(var i=0;i<a.selectedBoltons.length;i++)boltons+=a.selectedBoltons[i].compID+",";for(var i=0;i<s.boltons.length;i++)boltons+=s.boltons[i]+",";"spring"==n&&(boltons+="30892,"),boltons=boltons.slice(0,-1),e+=boltons}for(var i=0;i<s.urlparams.length;i++)e+="&"+s.urlparams[i].name+"="+s.urlparams[i].value;if(1==ractiveHandsetCarousel.get("secondServiceAdded")){e+="&accessory=second-service";e+="&second-service="+ractiveHandsetCarousel.get("secondService").id}return e}function b(t){var a=e(".product-selector-sticky-header"),s=0;a.length>0&&(s=a.height()),e("html, body").animate({scrollTop:e(t).offset().top-s},350)}function y(e,t){if(t)for(var a=0;a<t.length;a++)for(var s=0;s<e.length;s++)if(e[s].name===t[a]){var o=e[s];e.splice(s,1),e.splice(a,0,o)}return e}function H(e,t){return e<t?-1:e>t?1:0}function x(e,t){for(var a=0,s=0;s<t.colours.length;s++)if(e.colour.toLowerCase()==t.colours[s].colour.toLowerCase()){a=s;break}return a}function P(t,a,s){var o=t.value,n=o,r=ractiveHandsetCarousel.get("page"),l=[],i=!1,c=[],d=!1,u={};if(console.log(t),ractiveHandsetCarousel.set({data1:t}),t.tacticalOffer){for(var p=[],g=[],v=0;v<t.tacticalOffer.length;v++)"discount(%)"===t.tacticalOffer[v].offerType?g.push(v):"discount($)"===t.tacticalOffer[v].offerType&&p.push(v);if(console.log("dolDisIndex"),console.log(p),p.length>0)for(var f in p){var C=e.inArray(p[f],p);if(C>=0){l.length=0,i=!1,l=t.tacticalOffer[p[f]].offerPage.split("|");for(var m in l){var w=e.inArray(l[m],l);w>=0&&r.toLowerCase()===l[m].trim().toLowerCase()&&(i=!0)}if((""==t.tacticalOffer[p[f]].offerCustomerType||t.tacticalOffer[p[f]].offerCustomerType==s)&&i&&a){d=!1,c.length=0,c=t.tacticalOffer[p[f]].offerDeviceList.split("|");for(var h in c){var w=e.inArray(c[h],c);w>=0&&a.toLowerCase()===c[h].trim().toLowerCase()&&(d=!0)}n="all"===t.tacticalOffer[p[f]].offerDeviceRange?o-t.tacticalOffer[p[f]].offervalue:"excluded"!==t.tacticalOffer[p[f]].offerDeviceRange||d?"included"===t.tacticalOffer[p[f]].offerDeviceRange&&d?o-t.tacticalOffer[p[f]].offervalue:o:o-t.tacticalOffer[p[f]].offervalue}}}if(g.length>0)for(var f in g){var b=e.inArray(g[f],g);if(b>=0){l.length=0,i=!1,l=t.tacticalOffer[g[f]].offerPage.split("|");for(var m in l){var w=e.inArray(l[m],l);w>=0&&r.toLowerCase()===l[m].trim().toLowerCase()&&(i=!0)}if((""==t.tacticalOffer[g[f]].offerCustomerType||t.tacticalOffer[g[f]].offerCustomerType==s)&&i&&a){d=!1,c.length=0,c=t.tacticalOffer[g[f]].offerDeviceList.split("|");for(var h in c){var w=e.inArray(c[h],c);w>=0&&a.toLowerCase()===c[h].trim().toLowerCase()&&(d=!0)}n="all"===t.tacticalOffer[g[f]].offerDeviceRange?o*(100-t.tacticalOffer[g[f]].offervalue)/100:"excluded"!==t.tacticalOffer[g[f]].offerDeviceRange||d?"included"===t.tacticalOffer[g[f]].offerDeviceRange&&d?o*(100-t.tacticalOffer[g[f]].offervalue)/100:o:o*(100-t.tacticalOffer[g[f]].offervalue)/100}}}}return u.planCost=parseFloat(o),u.disPlanCost=parseFloat(n),console.log(o),u}function k(e,t,a){var s="",o=ractiveHandsetCarousel.get("page"),n=[],r=!1,l=[],i=!1;if(e.tacticalOffer){for(var c=0;c<e.tacticalOffer.length;c++){if(n.length=0,r=!1,e.tacticalOffer[c].offerPage.indexOf("|")>=0){n=e.tacticalOffer[c].offerPage.split("|");for(var d in n)o.toLowerCase()===n[d].trim().toLowerCase()&&(r=!0)}else o.toLowerCase()===e.tacticalOffer[c].offerPage.trim().toLowerCase()&&(r=!0);if((""==e.tacticalOffer[c].offerCustomerType||e.tacticalOffer[c].offerCustomerType==a)&&r){if(i=!1,l.length=0,l=e.tacticalOffer[c].offerDeviceList.split("|"),t)for(var u in l)t.toLowerCase()===l[u].trim().toLowerCase()&&(i=!0);"all"===e.tacticalOffer[c].offerDeviceRange?s+=e.tacticalOffer[c].id+",":"excluded"!==e.tacticalOffer[c].offerDeviceRange||i?"included"===e.tacticalOffer[c].offerDeviceRange&&i&&(s+=e.tacticalOffer[c].id+","):s+=e.tacticalOffer[c].id+","}}s=s.slice(0,-1)}return s}function S(e,t){var a=e[0],s=t.name,o=ractiveHandsetCarousel.get("customerType"),n=ractiveHandsetCarousel.get("page"),r=[],l=[],i=!1,c=[],d=!1;if(a.tacticalOffer.length>0)for(var u=0;u<a.tacticalOffer.length;u++)if("banner"===a.tacticalOffer[u].offerType){l.length=0,i=!1,l=a.tacticalOffer[u].offerPage.split("|");for(var p in l)n.toLowerCase()===l[p].trim().toLowerCase()&&(i=!0);if((""==a.tacticalOffer[u].offerCustomerType||a.tacticalOffer[u].offerCustomerType==o)&&i){d=!1,c.length=0,c=a.tacticalOffer[u].offerDeviceList.split("|");for(var g in c)s.toLowerCase()===c[g].trim().toLowerCase()&&(d=!0);"all"===a.tacticalOffer[u].offerDeviceRange?r.push(a.tacticalOffer[u]):"excluded"!==a.tacticalOffer[u].offerDeviceRange||d?"included"===a.tacticalOffer[u].offerDeviceRange&&d&&r.push(a.tacticalOffer[u]):r.push(a.tacticalOffer[u])}}return r}function T(t,a){var s=[];return t.length>0&&e.each(a,function(e,a){t.indexOf(a.id)>-1&&s.push(a)}),s}function B(t,a){var s={};return e.each(a,function(e,a){a.id===t&&(s=a)}),s}function O(e,t,a,s,o){ga("optus.send",{hitType:e,eventCategory:t,eventAction:a,eventLabel:s,eventValue:o})}Ractive.DEBUG=!1;var L=Ractive.defaults.data;L.isSuggestedPlan=function(e){ractiveHandsetCarousel.get("selectHandset").name;if(n(e,"hero",ractiveHandsetCarousel.get("selectHandset")))return!0},L.hasTactical=function(e,t){return e.tacticalOfferID.toLowerCase().indexOf(t.toLowerCase())>-1},L.isSuggestedPlanDescription=function(e){var t=(ractiveHandsetCarousel.get("selectHandset").name,n(e,"badge",ractiveHandsetCarousel.get("selectHandset")));if(t)return t},L.isShow=function(e,t,a,n){return s.pageConfig?!!o(e,ractiveHandsetCarousel.get("selectHandset"))&&(console.log("is show true for "+e+" with "+ractiveHandsetCarousel.get("selectHandset").slug),console.log("is show handset",ractiveHandsetCarousel.get("selectHandset")),!0):"10140"!=e&&"10142"!=e||"Samsung Galaxy Note9"!=t||128==a},L.offerDiscountSet=function(e,t,a){var o=n(e,"discount",ractiveHandsetCarousel.get("selectHandset"));if(o)return o.percent;var r=ractiveHandsetCarousel.get("contractLengthFilter"),l=["10162","10163","10164","10165"];return"ptr"==s.pageConfig.page.id&&1==r&&l.includes(e)?0:s.pageConfig.page.discount.percent};var I={development:!1,carousel:"postpaid-mobile",heroHandsets:[],campaignHandsets:[],heroPlans:null,urlparams:[],extraInclusions:"",propType:"consumer",excludedPlans:[],personalisedOffer:"",offerDiscount:0,dollarDiscount:0,customerToggle:!0,customerType:"new",contractToggle:!0,contractLength:12,selectedSku:{colour:"",storage:""},boltons:[],layout:"iphone",recommendPlan:"",initPaymentType:"",paymentType:"buy",planIdx:"0",templateSelector:"#contentTemplate",callback:function(){console.log("finished load")}},s=e.extend({},I,s);s.pageConfig&&(console.log(s.pageConfig),s.page=s.pageConfig.page.id,s.offerDiscount=s.pageConfig.page.discount.percent,s.dollarDiscount=s.pageConfig.page.discount.dollar),ractiveHandsetCarousel=new Ractive({el:"#contentContainer",template:s.templateSelector,data:{carouselType:s.carousel,offerDiscount:s.offerDiscount,dollarDiscount:s.dollarDiscount,propType:s.propType,initPaymentType:s.initPaymentType,page:s.page,paymentType:s.paymentType,customerType:s.customerType,contractToggle:s.contractToggle,customerToggle:s.customerToggle,contractLengthFilter:s.contractLength,discountPercent:.15,recommendPlanID:s.recommendPlan,recommendPlan:{},handsets:[],rawPlans:{},plans:[],selectHandset:{},selectSku:{},selectPlan:{plan:"",boltons:"",boltonGroup:"",selectedBoltons:""},isWatchAdded:!1,student:!1,prePlanType:"ultimate",summary:{discountAmount:0,monthlyCost:0,handsetCost:0,totalMonthlyCost:0,totalMonthlyExtraCost:0,totalUpfrontFeeCost:0,mtc:0},bannerOffers:[],pageConfig:s.pageConfig,format:function(e){return e=parseFloat(e),e%1!=0?e.toFixed(2):e},getMonthlyPlanCost:function(e){var t=this.get("plans."+e),a=this.get("selectHandset").name,s=this.get("customerType");console.log(a),console.log(s);var o=P(t,a,s);return console.log("getMonthlyPlanCost",o),o},getHandsetCost:function(e){var t=this.get("plans."+e),a=this.get("selectSku"),s=0;return s="plus"===t.planType?a.mro.postpaid[t.position-1]:"flex"===t.planType?a.mro.leasing[t.position-1]:"mbb"===t.planType?a.mro.postpaid[t.position-1]:0,parseFloat(s)},getBonusData:function(e){var t=this.get("plans."+e),a=this.get("selectHandset").name,s=this.get("customerType"),o=this.get("page"),n=!1,r=[],l=!1,i=[],c=!1;if(t.tacticalOffer)for(var d=0;d<t.tacticalOffer.length;d++)if("bonus_data"===t.tacticalOffer[d].offerType){r.length=0,l=!1,r=t.tacticalOffer[d].offerPage.split("|");for(var u in r)o.toLowerCase()===r[u].trim().toLowerCase()&&(l=!0);if((""==t.tacticalOffer[d].offerCustomerType||t.tacticalOffer[d].offerCustomerType==s)&&l){c=!1,i.length=0,i=t.tacticalOffer[d].offerDeviceList.split("|");for(var p in i)a.toLowerCase()===i[p].trim().toLowerCase()&&(c=!0);"all"===t.tacticalOffer[d].offerDeviceRange?n=t.tacticalOffer[d]:"excluded"!==t.tacticalOffer[d].offerDeviceRange||c?"included"===t.tacticalOffer[d].offerDeviceRange&&c&&(n=t.tacticalOffer[d]):n=t.tacticalOffer[d]}}return n}}}),e("#spinner").show(),e("#hcpm").hide();var D="";if("byo"===s.carousel){ractiveHandsetCarousel.get("page");D="https://offer.optus.com.au/dev/api/byo-plan-new/","undefined"!=typeof secondservice&&(D="https://offer.optus.com.au/dev/api/byo-plan-secondservice"),s.development||(D="https://offer.optus.com.au/live/api/byo-plan-new/","undefined"!=typeof secondservice&&(D="https://offer.optus.com.au/live/api/byo-plan-secondservice"))}else"postpaid-mobile"===s.carousel?(D="https://offer.optus.com.au/dev/api/handset-plan-new/","undefined"!=typeof secondservice&&(D="https://offer.optus.com.au/dev/api/handset-plan-secondservice"),s.development||(D="https://offer.optus.com.au/live/api/handset-plan-new/","undefined"!=typeof secondservice&&(D="https://offer.optus.com.au/live/api/handset-plan-secondservice"))):"postpaid-single"===s.carousel?(D="https://offer.optus.com.au/dev/api/handset-plan-new/",s.development||(D="https://offer.optus.com.au/live/api/handset-plan-new/")):"mbb"==s.carousel?(D="https://offer.optus.com.au/services/dev/api/hpcm/mbb/",s.development||(D="https://offer.optus.com.au/live/api/mbb-plan-new")):"mbb-modems"==s.carousel?(console.log("Modem API has been called"),D="https://offer.optus.com.au/dev/api/modem-plan-new",s.development||(D="https://offer.optus.com.au/live/api/modem-plan-new")):"postpaid-tablet"===s.carousel&&(D="https://offer.optus.com.au/dev/api/tablet-plan-new",s.development||(D="https://offer.optus.com.au/live/api/tablet-plan-new"));"smb"===s.propType?D+="?type=smb":D+="?type=consumer","prepaid-sim"==s.carousel?(D="https://offer.optus.com.au/dev/api/prepaid-data/?type=sim",s.development||(D="https://offer.optus.com.au/api/prepaid-data/?type=sim")):"prepaid-handset"==s.carousel&&(D="https://offer.optus.com.au/dev/api/prepaid-data/?type=handset",s.development||(D="https://offer.optus.com.au/api/prepaid-data/?type=handset")),s.excludedPlans&&(D=D+"&exclusions="+s.excludedPlans),"postpaid-single"===s.carousel&&(s.campaignHandsets.length>0&&(D=D+"&name="+s.campaignHandsets.toString()),""!=s.layout&&e(".single-handset-wrap").attr("id",s.layout));var V,A,M,G,N,R=[];if(s.dataInfo){e("#spinner").hide(),e("#hcpm").show();var F=s.dataInfo;if("prepaid-sim"==s.carousel){ractiveHandsetCarousel.set({plans:F});new Swiper(".plan-slider .swiper-container",{grabCursor:!0,observer:!0,nextButton:".plan-slider .swiper-container .swiper-button-next",prevButton:".plan-slider .swiper-container .swiper-button-prev",pagination:".plan-slider .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:3,spaceBetween:10},986:{slidesPerView:3,spaceBetween:10},860:{slidesPerView:2,spaceBetween:10},500:{slidesPerView:1,spaceBetween:10}}})}else if("prepaid-handset"==s.carousel)ractiveHandsetCarousel.set({handsets:F});else{if("new"==s.customerType?(e(".filter.customer_type").addClass("hide"),e(".filter-option.new_or_existing_new").addClass("active")):"existing"==s.customerType?(e(".filter.customer_type").removeClass("hide"),e(".filter-option.new_or_existing_new").removeClass("active"),e(".filter-option.new_or_existing_existing").addClass("active"),e(".ux-radio-button input[type=radio][value=existing]").prop("checked","checked")):"p2p"==s.customerType&&(e(".filter.customer_type").removeClass("hide"),e(".filter-option.new_or_existing_new").removeClass("active"),e(".filter-option.new_or_existing_existing").addClass("active"),e(".ux-radio-button input[type=radio][value=p2p]").prop("checked","checked")),"mbb"!=s.carousel){var W=y(F.handsets,s.heroHandsets);"postpaid-mobile"!==s.carousel&&"postpaid-tablet"!==s.carousel&&"mbb-modems"!==s.carousel||(W=u(W,s.campaignHandsets)),W[0].skus=W[0].skus,W[0].storage=W[0].storage;var $=c(s.selectedSku.storage,s.selectedSku.colour,W[0])||W[0].skus[0];W[0].colours=v($.storage,W[0]);var E=[];E="buy"==s.paymentType?T(W[0].buyPlanList,F.plans.postpaid):T(W[0].leasingPlanList,F.plans.leasing),console.log("------paymentType-----"),console.log(ractiveHandsetCarousel.get("paymentType"));var U={};""!=s.recommendPlan?(console.log(s.recommendPlan),U=B(s.recommendPlan,E),console.log("set remommend plan"),console.log(U)):(U=E[0],console.log("default remommend plan"),console.log(U)),ractiveHandsetCarousel.set({handsets:W,selectHandset:W[0],selectSku:$,plans:E,rawPlans:F.plans,rawBoltons:F.boltons,recommendPlan:U})}"byo"===s.carousel?(E=F.plans.byo,ractiveHandsetCarousel.set({plans:F.plans.byo,contractLengthFilter:s.contractLength})):"mbb"==s.carousel?(E=F.plans.mbb,ractiveHandsetCarousel.set({plans:F.plans.mbb,rawPlans:F.plans,rawBoltons:F.boltons,contractLengthFilter:s.contractLength})):"mbb-modems"==s.carousel&&ractiveHandsetCarousel.set({contractLengthFilter:24}),"buy"==s.paymentType?e(".leasing_copy").addClass("hide"):e(".leasing_copy").removeClass("hide"),console.log("------paymentType-----"),console.log(ractiveHandsetCarousel.get("paymentType")),"mbb"!=s.carousel&&ractiveHandsetCarousel.set("bannerOffers",S(E,W[0]));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1});if("postpaid-mobile"===s.carousel||"postpaid-tablet"===s.carousel||"mbb-modems"===s.carousel){new Swiper(".phone-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,nextButton:".phone-slider .swiper-container .swiper-button-next",prevButton:".phone-slider .swiper-container .swiper-button-prev",pagination:".phone-slider .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:4,spaceBetween:10,slidesPerGroup:4},860:{slidesPerView:3,spaceBetween:10,slidesPerGroup:2},500:{slidesPerView:1,spaceBetween:10,slidesPerGroup:1}}})}else"postpaid-single"===s.carousel&&(V=new Swiper(".product-image-main-gallery  .swiper-container",{spaceBetween:10,grabCursor:!0,observer:!0,onSlideChangeStart:function(t){console.log("Slide change START"),console.log(t),console.log(t.activeIndex);var a=ractiveHandsetCarousel.get("selectHandset"),s=ractiveHandsetCarousel.get("selectSku"),o=c(s.storage,a.colours[t.activeIndex].colour,a);a.storage=g(a.colours[t.activeIndex].colour,a),ractiveHandsetCarousel.set({selectHandset:a,selectSku:o}),C(),e(".summary").addClass("hide")}}),A=new Swiper(".product-image-nav-gallery .swiper-container",{centeredSlides:!0,grabCursor:!0,observer:!0,slideToClickedSlide:!0,breakpoints:{6e3:{slidesPerView:5,spaceBetween:12},860:{slidesPerView:4,spaceBetween:10},500:{slidesPerView:4,spaceBetween:10}}}),V.params.control=A,A.params.control=V,A.slideTo($.colorIndex-1),e(window).scroll(function(){var t=e(".product-selector-sticky-header").height(),a=e(".sticky-holder").offset().top-100-t;e(window).scrollTop()>a?e(".product-selector-sticky-header").addClass("show"):e(".product-selector-sticky-header ").removeClass("show")}));M="epl"===s.page?new Swiper(".plan-slider .swiper-container",{grabCursor:!0,observer:!0,nextButton:".plan-slider .swiper-container .swiper-button-next",prevButton:".plan-slider .swiper-container .swiper-button-prev",pagination:".plan-slider .swiper-container .swiper-pagination",initialSlide:parseInt(s.planIdx),breakpoints:{6e3:{slidesPerView:2,spaceBetween:10},860:{slidesPerView:2,spaceBetween:10},500:{slidesPerView:1,spaceBetween:10}}}):"aoss"===s.page||"spring"===s.page?new Swiper(".plan-slider .swiper-container",{grabCursor:!0,observer:!0,nextButton:".plan-slider .swiper-container .swiper-button-next",prevButton:".plan-slider .swiper-container .swiper-button-prev",pagination:".plan-slider .swiper-container .swiper-pagination",slidesPerView:1,initialSlide:parseInt(s.planIdx),spaceBetween:0}):new Swiper(".plan-slider .swiper-container",{grabCursor:!0,observer:!0,nextButton:".plan-slider .swiper-container .swiper-button-next",prevButton:".plan-slider .swiper-container .swiper-button-prev",pagination:".plan-slider .swiper-container .swiper-pagination",initialSlide:parseInt(s.planIdx),breakpoints:{6e3:{slidesPerView:3.5,spaceBetween:10},1150:{slidesPerView:2.65,spaceBetween:10},860:{slidesPerView:2.25,spaceBetween:10},500:{slidesPerView:1,spaceBetween:10}}})}s.pageConfig&&(console.log("pageConfig",s.pageConfig),s.page=s.pageConfig.page.id,s.offerDiscount=s.pageConfig.page.discount.percent,s.dollarDiscount=s.pageConfig.page.discount.dollar),s.callback(),e("*[data-scrollto]").click(function(t){t.preventDefault();var a=e(this).data("scrollto");if($target=e('*[data-scrollto_target="'+a+'"]'),$target.length>0){e("html, body").animate({scrollTop:$target.offset().top-0},300)}}),e("#r-86").on("toggled",function(t,a){console.log("#r-86 toggled");var s=a.parent();e("html, body").animate({scrollTop:s.offset().top-0},350)}),e(document).foundation(),e(document).foundation("tab","reflow"),t.init(),e(document).on("opened.fndtn.reveal","[data-reveal]",function(){N=new Swiper(".fetch-channel-lightbox .swiper-container",{grabCursor:!0,nextButton:".fetch-channel-lightbox .swiper-button-next",prevButton:".fetch-channel-lightbox .swiper-button-prev",slidesPerView:1})})}else e.ajax({url:D,dataType:"json",success:function(a){e("#spinner").hide(),e("#hcpm").show(),console.log(" ---------------\x3e data <---------------"),console.log(a),console.log(a.handsets,s.heroHandsets);var o=y(a.handsets,s.heroHandsets);console.log(o),console.log(s.selectedSku.storage,s.selectedSku.colour,o[0]);var n=c(s.selectedSku.storage,s.selectedSku.colour,o[0])||o[0].skus[0];if(console.log(n),o[0].colours=v(n.storage,o[0]),console.log("initialSku initialSku initialSku initialSku initialSku initialSku initialSku initialSku initialSku initialSku "),console.log(n),console.log(o[0].skus[0]),console.log(s.selectedSku.storage,s.selectedSku.colour,o[0]),"prepaid-sim"==s.carousel){ractiveHandsetCarousel.set({plans:a});new Swiper(".plan-slider .swiper-container",{grabCursor:!0,observer:!0,centeredSlides:!0,nextButton:".plan-slider .swiper-container .swiper-button-next",prevButton:".plan-slider .swiper-container .swiper-button-prev",pagination:".plan-slider .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:3,spaceBetween:10},986:{slidesPerView:3,spaceBetween:10},860:{slidesPerView:2,spaceBetween:10},500:{slidesPerView:1,spaceBetween:10}}})}else if("prepaid-handset"==s.carousel)ractiveHandsetCarousel.set({handsets:a});else{if("new"==s.customerType?(e(".filter.customer_type").addClass("hide"),e(".filter-option.new_or_existing_new").addClass("active")):"existing"==s.customerType?(e(".filter.customer_type").removeClass("hide"),e(".filter-option.new_or_existing_new").removeClass("active"),e(".filter-option.new_or_existing_existing").addClass("active"),e(".ux-radio-button input[type=radio][value=existing]").prop("checked","checked")):"p2p"==s.customerType&&(e(".filter.customer_type").removeClass("hide"),e(".filter-option.new_or_existing_new").removeClass("active"),e(".filter-option.new_or_existing_existing").addClass("active"),e(".ux-radio-button input[type=radio][value=p2p]").prop("checked","checked")),
"mbb"!=s.carousel){var o=y(a.handsets,s.heroHandsets);"postpaid-mobile"!==s.carousel&&"postpaid-tablet"!==s.carousel&&"mbb-modems"!==s.carousel||(o=u(o,s.campaignHandsets)),o[0].skus=o[0].skus,o[0].storage=o[0].storage;var n=c(s.selectedSku.storage,s.selectedSku.colour,o[0])||o[0].skus[0];o[0].colours=v(n.storage,o[0]);var r=[];r="buy"==s.paymentType?T(o[0].buyPlanList,a.plans.postpaid):T(o[0].leasingPlanList,a.plans.leasing),console.log("------paymentType-----"),console.log(ractiveHandsetCarousel.get("paymentType"));var l={};""!=s.recommendPlan?(console.log(s.recommendPlan),l=B(s.recommendPlan,r),console.log("set remommend plan"),console.log(l)):(l=r[0],console.log("default remommend plan"),console.log(l)),ractiveHandsetCarousel.set({handsets:o,selectHandset:o[0],selectSku:n,plans:r,rawPlans:a.plans,rawBoltons:a.boltons,recommendPlan:l})}"byo"===s.carousel?(r=a.plans.byo,ractiveHandsetCarousel.set({plans:a.plans.byo,contractLengthFilter:s.contractLength,flybuysMapping:a.flybuysMapping})):"mbb"==s.carousel?(r=a.plans.mbb,ractiveHandsetCarousel.set({plans:a.plans.mbb,rawPlans:a.plans,rawBoltons:a.boltons,contractLengthFilter:s.contractLength})):"mbb-modems"==s.carousel&&ractiveHandsetCarousel.set({contractLengthFilter:24}),"buy"==s.paymentType?e(".leasing_copy").addClass("hide"):e(".leasing_copy").removeClass("hide"),console.log("------paymentType-----"),console.log(ractiveHandsetCarousel.get("paymentType")),"mbb"!=s.carousel&&ractiveHandsetCarousel.set("bannerOffers",S(r,o[0]));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1});if("postpaid-mobile"===s.carousel||"postpaid-tablet"===s.carousel||"mbb-modems"===s.carousel){new Swiper(".phone-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,onSlideChangeEnd:function(){e(window).width()<=500&&e(".swiper-slide.swiper-slide-active .carousel-option").click()},nextButton:".phone-slider .swiper-container .swiper-button-next",prevButton:".phone-slider .swiper-container .swiper-button-prev",pagination:".phone-slider .swiper-container .swiper-pagination",breakpoints:{6e3:{slidesPerView:4,spaceBetween:10,slidesPerGroup:4},860:{slidesPerView:3,spaceBetween:10,slidesPerGroup:2},500:{slidesPerView:1,spaceBetween:10,slidesPerGroup:1}}})}else"postpaid-single"===s.carousel&&(V=new Swiper(".product-image-main-gallery  .swiper-container",{spaceBetween:10,grabCursor:!0,observer:!0,onSlideChangeStart:function(t){console.log("Slide change START"),console.log(t),console.log(t.activeIndex);var a=ractiveHandsetCarousel.get("selectHandset"),s=ractiveHandsetCarousel.get("selectSku"),o=c(s.storage,a.colours[t.activeIndex].colour,a);a.storage=g(a.colours[t.activeIndex].colour,a),ractiveHandsetCarousel.set({selectHandset:a,selectSku:o}),C(),e(".summary").addClass("hide")}}),A=new Swiper(".product-image-nav-gallery .swiper-container",{centeredSlides:!0,grabCursor:!0,observer:!0,slideToClickedSlide:!0,breakpoints:{6e3:{slidesPerView:5,spaceBetween:12},860:{slidesPerView:4,spaceBetween:10},500:{slidesPerView:4,spaceBetween:10}}}),V.params.control=A,A.params.control=V,A.slideTo(n.colorIndex-1),e(window).scroll(function(){var t=e(".product-selector-sticky-header").height(),a=e(".sticky-holder").offset().top-100-t;e(window).scrollTop()>a?e(".product-selector-sticky-header").addClass("show"):e(".product-selector-sticky-header ").removeClass("show")}));if("epl"===s.page)M=new Swiper(".plan-slider .swiper-container",{grabCursor:!0,observer:!0,nextButton:".plan-slider .swiper-container .swiper-button-next",prevButton:".plan-slider .swiper-container .swiper-button-prev",pagination:".plan-slider .swiper-container .swiper-pagination",initialSlide:parseInt(s.planIdx),breakpoints:{6e3:{slidesPerView:2,spaceBetween:10},860:{slidesPerView:2,spaceBetween:10},500:{slidesPerView:1,spaceBetween:10}}});else if("aoss"===s.page||"spring"===s.page)M=new Swiper(".plan-slider .swiper-container",{grabCursor:!0,observer:!0,nextButton:".plan-slider .swiper-container .swiper-button-next",prevButton:".plan-slider .swiper-container .swiper-button-prev",pagination:".plan-slider .swiper-container .swiper-pagination",slidesPerView:1,initialSlide:parseInt(s.planIdx),spaceBetween:0});else{var i=!1;"39reginal"!=s.page&&"phonefest"!=s.page&&"201902promo"!=s.page||(i=!0),M=new Swiper(".plan-slider .swiper-container",{grabCursor:!0,observer:!0,centeredSlides:i,nextButton:".plan-slider .swiper-container .swiper-button-next",prevButton:".plan-slider .swiper-container .swiper-button-prev",pagination:".plan-slider .swiper-container .swiper-pagination",initialSlide:parseInt(s.planIdx),breakpoints:{6e3:{slidesPerView:3.5,spaceBetween:10},1150:{slidesPerView:2.65,spaceBetween:10},860:{slidesPerView:2.25,spaceBetween:10},500:{slidesPerView:1,spaceBetween:10}}})}}s.callback(),e("*[data-scrollto]").click(function(t){t.preventDefault();var a=e(this).data("scrollto");if($target=e('*[data-scrollto_target="'+a+'"]'),$target.length>0){$target.is(".accordion-item-caption")&&($target.closest("li").is(":not(.active)")&&$target.trigger("click"),console.log("this is an accordion title"));var o=0;"postpaid-single"==s.carousel&&(o=e(".product-selector-sticky-header").height()),e("html, body").animate({scrollTop:$target.offset().top-o},300)}}),e("#r-86").on("toggled",function(t,a){console.log("#r-86 toggled");var s=a.parent();e("html, body").animate({scrollTop:s.offset().top-0},350)}),e(document).foundation(),e(document).foundation("tab","reflow"),t.init(),e(document).on("opened.fndtn.reveal","[data-reveal]",function(){N=new Swiper(".fetch-channel-lightbox .swiper-container",{grabCursor:!0,nextButton:".fetch-channel-lightbox .swiper-button-next",prevButton:".fetch-channel-lightbox .swiper-button-prev",slidesPerView:1})})},error:function(){}});ractiveHandsetCarousel.on("change",function(){setTimeout(function(){i()},50)}),ractiveHandsetCarousel.on("selectHandset",function(a,o){console.log("selecet handset begin"),console.log(o),console.log("selecet handset begin"),e(".handset").removeClass("active"),e(a.node).addClass("active"),o.storage=p(o).sort(H),o.colours=v(o.skus[0].storage,o),o.leasing||ractiveHandsetCarousel.set("paymentType","buy"),"201902promo"==s.page&&("iphone-xs"==o.slug||"iphone-xs-max"==o.slug||"iphone-xr"==o.slug||"samsung-galaxy-note9"==o.slug?ractiveHandsetCarousel.set("paymentType","lease"):ractiveHandsetCarousel.set("paymentType","buy"));var n=ractiveHandsetCarousel.get("paymentType"),r=ractiveHandsetCarousel.get("rawPlans"),l=[];"buy"==n?(l=T(o.buyPlanList,r.postpaid),R=T(o.buyPlanList,r.postpaid)):l=T(o.leasingPlanList,r.leasing),ractiveHandsetCarousel.set({selectHandset:o,selectSku:o.skus[0],plans:l}),"buy"==n?e(".leasing_copy").addClass("hide"):e(".leasing_copy").removeClass("hide");var i=d(o),c="handsets["+i+"].imageUrl";ractiveHandsetCarousel.set(c,o.skus[0].listImage),console.log("select handset image + "+c+ractiveHandsetCarousel.get("selectHandset").imageUrl),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),ractiveHandsetCarousel.set("bannerOffers",S(l,o));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1});t.init()}),ractiveHandsetCarousel.on("selectStorage",function(t,a){console.log(R);var o=ractiveHandsetCarousel.get("selectHandset"),n=ractiveHandsetCarousel.get("selectSku"),r=g(n.colour,o);if(o.colours=v(a,o),r.indexOf(a)>-1)var l=c(a,n.colour,o);else l=c(a,o.colours[0].colour,o);if(console.log("selectedSku---------"),console.log(l),console.log(l.storage),ractiveHandsetCarousel.set({"selectHandset.colours":o.colours,selectSku:l}),"postpaid-single"===s.carousel){V.update(),A.update();var i=x(l,o);A.slideTo(i)}ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1)}),ractiveHandsetCarousel.on("selectColour",function(t,o,n){e("#gallery .colour, #skus .color").removeClass("active"),e(t.node).addClass("active"),e(".storage").css("display","inline-block");var r=ractiveHandsetCarousel.get("selectHandset"),l=ractiveHandsetCarousel.get("selectSku"),i=c(l.storage,o,r);r.storage=g(o,r);var u=d(r),p="handsets["+u+"].imageUrl";"samsung-galaxy-gs10-plus"==r.slug?ractiveHandsetCarousel.set({selectSku:i}):ractiveHandsetCarousel.set({"selectHandset.storage":r.storage,selectSku:i});var u=d(r),p="handsets["+u+"].imageUrl";if(ractiveHandsetCarousel.set(p,i.listImage),"byo"==s.carousel)var v="byo";else if("mbb"==s.carousel)var v="mbb";else if("postpaid-tablet"==s.carousel)var v="tablets";else var v="handsetplans";for(var f=s.pageConfig.plans[v].skus,C=0;C<f.length;C++)console.log(i.id+" "+f[C].id),f[C].id==i.id&&(f[C].location?(f[C].location.flex?a=f[C].location.flex:f[C].location.plus&&(a=f[C].location.plus),a=parseInt(a),M.slideTo(a)):(a=!1,console.log(a)));ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1)}),ractiveHandsetCarousel.on("toggleHandset",function(t,o){e(".toggle-btn").removeClass("active"),e(t.node).addClass("active"),o.storage=p(o).sort(H),o.colours=v(o.skus[0].storage,o),o.leasing||(ractiveHandsetCarousel.set("paymentType","buy"),e(".leasing_copy").addClass("hide"));var n=ractiveHandsetCarousel.get("paymentType"),r=ractiveHandsetCarousel.get("rawPlans"),l=[];if(l="buy"==n?T(o.buyPlanList,r.postpaid):T(o.leasingPlanList,r.leasing),ractiveHandsetCarousel.set({selectHandset:o,selectSku:o.skus[0],plans:l}),"postpaid-single"===s.carousel){V.update(),A.update();var i=x(o.skus[0],o);A.slideTo(i)}ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),ractiveHandsetCarousel.set("bannerOffers",S(l,o));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1});a&&M.slideTo(a)}),ractiveHandsetCarousel.on("changeColour",function(t,a,s){var o=ractiveHandsetCarousel.get("selectHandset"),n=ractiveHandsetCarousel.get("selectSku"),r=c(n.storage,a,o);o.storage=g(a,o),A.slideTo(s),ractiveHandsetCarousel.set({selectHandset:o,selectSku:r}),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1)}),ractiveHandsetCarousel.on("toggleStudent",function(t){e(t.node).closest("div").find(".student_code").toggleClass("hide");var a=ractiveHandsetCarousel.get("student");!1===a?a=!0:(a=!1,e(".email_error").hide()),ractiveHandsetCarousel.set("student",a)}),ractiveHandsetCarousel.on("studentAjax",function(t){var a=e("#emailAddr").val();e.ajax({type:"GET",url:"https://offer.optus.com.au/student/promocodesetup/",dataType:"jsonp",jsonpCallback:"emailCallback",data:{emailAddr:a},success:function(t){1==t.valid?(e(".student_code").hide(),e(".email_error").hide(),e(".email-address").html(a),e(".email_success").show(),e('#form label[for="students"]').click(function(e){e.preventDefault()})):2==t.valid?(e(".student_code").show(),e(".email_error").show(),e(".email_success").hide()):(e(".student_code").show(),e(".email_error").hide(),e(".email_success").hide()),console.log(t)},error:function(e){console.log(e),console.log("error")}})}),ractiveHandsetCarousel.on("customer-type",function(t,a){t.original.preventDefault(),ractiveHandsetCarousel.set("customerType",a);var o=ractiveHandsetCarousel.get("page");if("existing"===a?(e(".filter.customer_type").removeClass("hide"),e(".filter-option.new_or_existing_new").removeClass("active"),e(".filter-option.new_or_existing_existing").addClass("active"),"phonefest"==o?(e(".ux-radio-button input[type=radio][value=new]").prop("checked","checked"),e(".ux-radio-button input[type=radio][value=new]").click()):(e(".ux-radio-button input[type=radio][value=existing]").prop("checked","checked"),e(".ux-radio-button input[type=radio][value=existing]").click()),"byo"==s.carousel&&(ractiveHandsetCarousel.set("contractLengthFilter",12),e(".summary").addClass("hide"))):(e(".filter.customer_type").addClass("hide"),e(".filter-option.new_or_existing_new").addClass("active"),e(".filter-option.new_or_existing_existing").removeClass("active"),e("#10237").removeClass("hide")),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),"byo"==s.carousel)e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"),e(".cta .ux-button.disabled").removeClass("yellow").text("Not Available Online"),e(".summary").addClass("hide");else{var n=ractiveHandsetCarousel.get("selectSku"),r=ractiveHandsetCarousel.get("paymentType");"preorder"===n.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Pre-Order"):"backorder"===n.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Back order now"):"instock"===n.stockStatus&&("buy"==r?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Lease Now"))}var l=ractiveHandsetCarousel.get("plans"),i=ractiveHandsetCarousel.get("selectHandset");ractiveHandsetCarousel.set("bannerOffers",S(l,i));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1})}),ractiveHandsetCarousel.on("da-selected",function(t,a){if(ractiveHandsetCarousel.set("customerType",a),"existing"===a?"byo"==s.carousel?(ractiveHandsetCarousel.set("contractLengthFilter",12),e(".summary").addClass("hide")):e("#10237").addClass("hide"):"byo"!=s.carousel&&e("#10237").removeClass("hide"),setTimeout(function(){i()},120),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),"byo"==s.carousel)e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"),e(".cta .ux-button.disabled").removeClass("yellow").text("Not Available Online"),e(".summary").addClass("hide");else{var o=ractiveHandsetCarousel.get("selectSku"),n=ractiveHandsetCarousel.get("paymentType");"preorder"===o.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Pre-Order"):"backorder"===o.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Back order now"):"instock"===o.stockStatus&&("buy"==n?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Lease Now"))}var r=ractiveHandsetCarousel.get("plans"),l=ractiveHandsetCarousel.get("selectHandset");ractiveHandsetCarousel.set("bannerOffers",S(r,l));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1})}),ractiveHandsetCarousel.on("payment-type",function(t,a){t.original.preventDefault();var s=ractiveHandsetCarousel.get("rawPlans"),o=ractiveHandsetCarousel.get("selectHandset"),n=[];n="buy"==a?T(o.buyPlanList,s.postpaid):T(o.leasingPlanList,s.leasing),ractiveHandsetCarousel.set("paymentType",a),ractiveHandsetCarousel.set("plans",n),"lease"===a?e(".leasing_copy").removeClass("hide"):e(".leasing_copy").addClass("hide"),ractiveHandsetCarousel.set("selectPlan.plan",""),ractiveHandsetCarousel.set("student",!1),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1);var r=ractiveHandsetCarousel.get("selectSku"),l=ractiveHandsetCarousel.get("paymentType");"preorder"===r.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Pre-Order"):"backorder"===r.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Back order now"):"instock"===r.stockStatus&&("buy"==l?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Lease Now")),e(".summary").addClass("hide");var n=ractiveHandsetCarousel.get("plans"),i=ractiveHandsetCarousel.get("selectHandset");ractiveHandsetCarousel.set("bannerOffers",S(n,i));new Swiper(".banner-slider .swiper-container",{grabCursor:!1,observer:!0,autoHeight:!0,allowSwipeToPrev:!1,allowSwipeToNext:!1,nextButton:".banner-slider .swiper-container .swiper-button-next",prevButton:".banner-slider .swiper-container .swiper-button-prev",slidesPerView:1})}),ractiveHandsetCarousel.on("plan-more",function(t,a){t.original.preventDefault();var s=e(t.node).parents(".feature")[0].className;s="."+s.split(" ").join("."),e(s).find(".more-info").toggleClass("hide");var o=e(t.node).text(),n="more"===o?"less":"more";e(s).find(".more-link a").text(n),i()}),ractiveHandsetCarousel.on("selectPlan",function(t,a){var o=ractiveHandsetCarousel.get("selectSku"),n=ractiveHandsetCarousel.get("paymentType"),l=ractiveHandsetCarousel.get("page");"preorder"===o.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Pre-Order"):"backorder"===o.stockStatus?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Back order now"):"buy"==n?"epl"==l?e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Select"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"):e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Lease Now"),e(".cta .ux-button.disabled").removeClass("yellow").text("Not Available Online"),e(t.node).removeClass("yellow").addClass("blue selected").text("Selected");var i=ractiveHandsetCarousel.get("rawBoltons"),c=[];if(a.boltonID.length>0){var d=a.boltonID.split("|");for(var u in d){var p=_.findWhere(i,{id:d[u]});if(void 0!=p){var g=e.extend(!0,{},p);if(g.added=!1,g.dependency.length>0){var v=_.findWhere(i,{compID:g.dependency});void 0!=v&&(g.cost=g.cost+v.cost,g.compID=g.compID+","+v.compID)}c.push(g)}}}var f={};_.each(c,function(e){var t=e.id;f[t]=e});var m=_.groupBy(c,"group"),w=[];r(f,w),ractiveHandsetCarousel.set({"selectPlan.plan":a,"selectPlan.boltons":f,"selectPlan.boltonGroup":m,"selectPlan.selectedBoltons":w});var h=ractiveHandsetCarousel.get("selectPlan.plan");"rglop"==l&&O("event","Sales Campaign Tracking","Regional Handset Tracking",h.name+" "+o.id.replace("%20"," "),0),console.log("selectPlan.plan"),console.log(ractiveHandsetCarousel.get("selectPlan.plan")),console.log("selectPlan.boltons"),console.log(ractiveHandsetCarousel.get("selectPlan.boltons")),console.log("selectPlan.boltonGroup"),console.log(ractiveHandsetCarousel.get("selectPlan.boltonGroup")),console.log("selectPlan.selectedBoltons"),console.log(ractiveHandsetCarousel.get("selectPlan.selectedBoltons")),C(),e(".summary").addClass("hide"),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),b("#addons"),G=new Swiper(".fetch-swiper .swiper-container",{grabCursor:!0,nextButton:".fetch-swiper .swiper-button-next",prevButton:".fetch-swiper .swiper-button-prev",breakpoints:{6e3:{slidesPerView:4,spaceBetween:10},860:{slidesPerView:2,spaceBetween:10},500:{slidesPerView:1,spaceBetween:10}}}),"ptr"==s.pageConfig.page.id&&("existing"==ractiveHandsetCarousel.get("customerType")?ractiveHandsetCarousel.set("secondServiceAvailable",!0):ractiveHandsetCarousel.set("secondServiceAvailable",!1))}),ractiveHandsetCarousel.on("learn-more",function(t,a){t.original.preventDefault();var s="Show less"===e(t.node).text()?"Show more":"Show less";e(t.node).text(s),e(t.node).prev(".more-desc").toggleClass("hide")}),ractiveHandsetCarousel.on("next-section",function(t,a){t.original.preventDefault(),b(e(t.node).closest(".sections .section").removeClass("active").find(".controls").removeClass("hide").closest(".sections .section").next().addClass("active"))}),ractiveHandsetCarousel.on("edit-section",function(t,a){t.original.preventDefault(),e(".summary").addClass("hide"),e(".sections .section").removeClass("active");e(t.node).closest(".sections .section").addClass("active").find(".controls").addClass("hide");b(".sections .section.active")}),ractiveHandsetCarousel.on("toggleContractLength",function(t,a){t.original.preventDefault(),ractiveHandsetCarousel.set({contractLengthFilter:a}),ractiveHandsetCarousel.set("selectPlan.plan",""),e(".apple-watch").addClass("hide"),ractiveHandsetCarousel.set("isWatchAdded",!1),e(".cta .ux-button").addClass("yellow").removeClass("blue selected").text("Buy Now"),e(".cta .ux-button.disabled").removeClass("yellow").text("Not Available Online"),e(".summary").addClass("hide")}),ractiveHandsetCarousel.on("goToSvod",function(t,a){t.original.preventDefault(),e("#svod .tab_drawer_heading").is(":visible"),e("#svod .tab_drawer_heading[rel='"+a+"']").click(),b("#svod")}),ractiveHandsetCarousel.on("addGroupBolton",function(e,t){e.original.preventDefault();var a=ractiveHandsetCarousel.get("selectPlan.selectedBoltons"),s=ractiveHandsetCarousel.get("selectPlan.boltonGroup"),o=ractiveHandsetCarousel.get("selectPlan.boltons");if(!t.added){if(""!==t.group){var n=t.group,r=s[n];_.each(r,function(e){a=l(a,e)})}t.added=!0,a.push(t),ractiveHandsetCarousel.set("selectPlan.selectedBoltons",a),ractiveHandsetCarousel.set("selectPlan.boltonGroup",s),ractiveHandsetCarousel.set("selectPlan.boltons",o),console.log("------selectPlan--------"),console.log(ractiveHandsetCarousel.get("selectPlan")),C()}}),ractiveHandsetCarousel.on("addSS",function(e,t){ractiveHandsetCarousel.set("secondServiceAdded",!0),ractiveHandsetCarousel.set("secondService",t),C(),window.ga&&ga.create&&ga("optus.send",{hitType:"event",eventCategory:"Second service offer",eventAction:"Added",eventLabel:f()})}),ractiveHandsetCarousel.on("removeSS",function(e,t){ractiveHandsetCarousel.set("secondServiceAdded",!1),ractiveHandsetCarousel.set("secondService",{}),C(),window.ga&&ga.create&&ga("optus.send",{hitType:"event",eventCategory:"Second service offer",eventAction:"Removed",eventLabel:f()})}),ractiveHandsetCarousel.on("addBolton",function(e,t){e.original.preventDefault();var a=ractiveHandsetCarousel.get("selectPlan.selectedBoltons"),s=ractiveHandsetCarousel.get("selectPlan.boltonGroup"),o=ractiveHandsetCarousel.get("selectPlan.boltons");t.added||(t.added=!0,a.push(t),ractiveHandsetCarousel.set("selectPlan.selectedBoltons",a),ractiveHandsetCarousel.set("selectPlan.boltonGroup",s),ractiveHandsetCarousel.set("selectPlan.boltons",o),console.log("------selectPlan--------"),console.log(ractiveHandsetCarousel.get("selectPlan")),C())}),ractiveHandsetCarousel.on("removeBolton",function(e,t){e.original.preventDefault();var a=ractiveHandsetCarousel.get("selectPlan.selectedBoltons"),s=ractiveHandsetCarousel.get("selectPlan.boltonGroup"),o=ractiveHandsetCarousel.get("selectPlan.boltons");a=l(a,t),ractiveHandsetCarousel.set("selectPlan.selectedBoltons",a),ractiveHandsetCarousel.set("selectPlan.boltonGroup",s),ractiveHandsetCarousel.set("selectPlan.boltons",o),console.log("------selectPlan--------"),console.log(ractiveHandsetCarousel.get("selectPlan")),C()}),ractiveHandsetCarousel.on("addSkinnyPacks",function(e,t){e.original.preventDefault();var a=ractiveHandsetCarousel.get("selectPlan.selectedBoltons"),s=ractiveHandsetCarousel.get("selectPlan.boltonGroup"),o=ractiveHandsetCarousel.get("selectPlan.boltons");if(!t.added){if(""!==t.group){var n=t.group,r=s[n];if("ULTIMATE_PACK"===t.id)_.each(r,function(e){a=l(a,e)}),t.added=!0,a.push(t);else{_.size(_.where(a,{group:n}))<3?(t.added=!0,a.push(t)):(_.each(r,function(e){a=l(a,e)}),_.each(o,function(e){"ULTIMATE_PACK"===e.id&&(e.added=!0,a.push(e))}))}}ractiveHandsetCarousel.set("selectPlan.selectedBoltons",a),ractiveHandsetCarousel.set("selectPlan.boltonGroup",s),ractiveHandsetCarousel.set("selectPlan.boltons",o),console.log("------selectPlan--------"),console.log(ractiveHandsetCarousel.get("selectPlan")),C()}}),ractiveHandsetCarousel.on("goToegal",function(t,a){if(t.original.preventDefault(),$target=e('*[data-scrollto_target="'+a+'"]'),$target.length>0){$target.is(".accordion-item-caption")&&($target.closest("li").is(":not(.active)")&&$target.trigger("click"),console.log("this is an accordion title"));var o=0;"postpaid-single"==s.carousel&&(o=e(".product-selector-sticky-header").height()),e("html, body").animate({scrollTop:$target.offset().top-o},300)}}),ractiveHandsetCarousel.on("checkout",function(t){t.original.preventDefault(),e(t.node).closest(".add-on-section").removeClass("active").find(".controls").removeClass("hide"),e(".summary").removeClass("hide"),e(".apple-watch").addClass("hide"),b(".summary")}),ractiveHandsetCarousel.on("add-watch",function(e,t){e.original.preventDefault(),ractiveHandsetCarousel.set("isWatchAdded",!0),b(".summary"),C()}),ractiveHandsetCarousel.on("show-monthly-extras",function(t){t.original.preventDefault(),e("#monthlyFees").toggle()}),ractiveHandsetCarousel.on("show-monthly-extras-tablet",function(t){t.original.preventDefault(),e("#inclEnt").toggle()}),ractiveHandsetCarousel.on("buy-now",function(e){e.original.preventDefault();var t=(ractiveHandsetCarousel.get("page"),ractiveHandsetCarousel.get("selectSku"),ractiveHandsetCarousel.get("selectPlan"),"#"),a=ractiveHandsetCarousel.get("customerType"),o=ractiveHandsetCarousel.get("student"),n=ractiveHandsetCarousel.get("isWatchAdded");(t="p2p,p2p_c,stu,mnt,ptr,rpc,clickfrenzy,sec-srvce,fbdd,aoss,rglop,fbmetro,fbreg,augdeal,ss10dollar,hsale,39reginal,phonefest,mate,201902promo".indexOf(s.page)>-1||"p2p"==a||o||n?w():h())&&(window.location=t)}),ractiveHandsetCarousel.on("plan-type",function(e,t){e.original.preventDefault(),ractiveHandsetCarousel.set("prePlanType",t)}),ractiveHandsetCarousel.on("prepaid-checkout",function(e,t){e.original.preventDefault();var a="https://offer.optus.com.au/dev/prepaid/build-cart/?ordertype=prepaid&offer=ptr&handset="+t.id;s.development||(a="https://offer.optus.com.au/prepaid/build-cart/?ordertype=prepaid&offer=ptr&handset="+t.id),a&&(window.location=a)});var j=null;e(window).resize(function(){null!==j&&window.clearTimeout(j),j=setTimeout(function(){i()},120)}),onLoadTime=Date.now()}}(jQuery);