function parseUri(n){for(var t=parseUri.options,u=t.parser[t.strictMode?"strict":"loose"].exec(n),i={},r=14;r--;)i[t.key[r]]=u[r]||"";return i[t.q.name]={},i[t.key[12]].replace(t.q.parser,function(n,r,u){r&&(i[t.q.name][r]=u)}),i}var Tracker,Quote,EventBroker,App,UI;Array.prototype.find||(Array.prototype.find=function(n){var t;if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof n!="function")throw new TypeError("predicate must be a function");var i=Object(this),u=i.length>>>0,f=arguments[1],r;for(t=0;t<u;t++)if(r=i[t],n.call(f,r,t,i))return r;return undefined});Number.isNaN=Number.isNaN||function(n){return typeof n=="number"&&isNaN(n)};parseUri.options={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(n){var i,r,u,t,f;if(this==null)throw new TypeError('"this" is null or not defined');if(i=Object(this),r=i.length>>>0,typeof n!="function")throw new TypeError("predicate must be a function");for(u=arguments[1],t=0;t<r;){if(f=i[t],n.call(u,f,t,i))return t;t++}return-1},configurable:!0,writable:!0}),function(){var y=this,lt=y._,e={},r=Array.prototype,nt=Object.prototype,at=Function.prototype,p=r.push,t=r.slice,o=r.concat,f=nt.toString,vt=nt.hasOwnProperty,tt=r.forEach,it=r.map,rt=r.reduce,ut=r.reduceRight,ft=r.filter,et=r.every,ot=r.some,s=r.indexOf,st=r.lastIndexOf,yt=Array.isArray,pt=Object.keys,w=at.bind,n=function(t){return t instanceof n?t:this instanceof n?(this._wrapped=t,void 0):new n(t)},i,b,k,h,c,d,l,a,u,ht,ct,v;"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=n),exports._=n):y._=n;n.VERSION="1.5.2";i=n.each=n.forEach=function(t,i,r){var u,f;if(null!=t)if(tt&&t.forEach===tt)t.forEach(i,r);else if(t.length===+t.length){for(u=0,f=t.length;f>u;u++)if(i.call(r,t[u],u,t)===e)return}else for(var o=n.keys(t),u=0,f=o.length;f>u;u++)if(i.call(r,t[o[u]],o[u],t)===e)return};n.map=n.collect=function(n,t,r){var u=[];return null==n?u:it&&n.map===it?n.map(t,r):(i(n,function(n,i,f){u.push(t.call(r,n,i,f))}),u)};b="Reduce of empty array with no initial value";n.reduce=n.foldl=n.inject=function(t,r,u,f){var e=arguments.length>2;if(null==t&&(t=[]),rt&&t.reduce===rt)return f&&(r=n.bind(r,f)),e?t.reduce(r,u):t.reduce(r);if(i(t,function(n,t,i){e?u=r.call(f,u,n,t,i):(u=n,e=!0)}),!e)throw new TypeError(b);return u};n.reduceRight=n.foldr=function(t,r,u,f){var o=arguments.length>2,e,s;if(null==t&&(t=[]),ut&&t.reduceRight===ut)return f&&(r=n.bind(r,f)),o?t.reduceRight(r,u):t.reduceRight(r);if(e=t.length,e!==+e&&(s=n.keys(t),e=s.length),i(t,function(n,i,h){i=s?s[--e]:--e;o?u=r.call(f,u,t[i],i,h):(u=t[i],o=!0)}),!o)throw new TypeError(b);return u};n.find=n.detect=function(n,t,i){var r;return k(n,function(n,u,f){if(t.call(i,n,u,f))return(r=n,!0)}),r};n.filter=n.select=function(n,t,r){var u=[];return null==n?u:ft&&n.filter===ft?n.filter(t,r):(i(n,function(n,i,f){t.call(r,n,i,f)&&u.push(n)}),u)};n.reject=function(t,i,r){return n.filter(t,function(n,t,u){return!i.call(r,n,t,u)},r)};n.every=n.all=function(t,r,u){r||(r=n.identity);var f=!0;return null==t?f:et&&t.every===et?t.every(r,u):(i(t,function(n,t,i){if(!(f=f&&r.call(u,n,t,i)))return e}),!!f)};k=n.some=n.any=function(t,r,u){r||(r=n.identity);var f=!1;return null==t?f:ot&&t.some===ot?t.some(r,u):(i(t,function(n,t,i){if(f||(f=r.call(u,n,t,i)))return e}),!!f)};n.contains=n.include=function(n,t){return null==n?!1:s&&n.indexOf===s?n.indexOf(t)!=-1:k(n,function(n){return n===t})};n.invoke=function(i,r){var u=t.call(arguments,2),f=n.isFunction(r);return n.map(i,function(n){return(f?r:n[r]).apply(n,u)})};n.pluck=function(t,i){return n.map(t,function(n){return n[i]})};n.where=function(t,i,r){return n.isEmpty(i)?r?void 0:[]:n[r?"find":"filter"](t,function(n){for(var t in i)if(i[t]!==n[t])return!1;return!0})};n.findWhere=function(t,i){return n.where(t,i,!0)};n.max=function(t,r,u){if(!r&&n.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!r&&n.isEmpty(t))return-1/0;var f={computed:-1/0,value:-1/0};return i(t,function(n,t,i){var e=r?r.call(u,n,t,i):n;e>f.computed&&(f={value:n,computed:e})}),f.value};n.min=function(t,r,u){if(!r&&n.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!r&&n.isEmpty(t))return 1/0;var f={computed:1/0,value:1/0};return i(t,function(n,t,i){var e=r?r.call(u,n,t,i):n;e<f.computed&&(f={value:n,computed:e})}),f.value};n.shuffle=function(t){var u,f=0,r=[];return i(t,function(t){u=n.random(f++);r[f-1]=r[u];r[u]=t}),r};n.sample=function(t,i,r){return arguments.length<2||r?t[n.random(t.length-1)]:n.shuffle(t).slice(0,Math.max(0,i))};h=function(t){return n.isFunction(t)?t:function(n){return n[t]}};n.sortBy=function(t,i,r){var u=h(i);return n.pluck(n.map(t,function(n,t,i){return{value:n,index:t,criteria:u.call(r,n,t,i)}}).sort(function(n,t){var i=n.criteria,r=t.criteria;if(i!==r){if(i>r||i===void 0)return 1;if(r>i||r===void 0)return-1}return n.index-t.index}),"value")};c=function(t){return function(r,u,f){var e={},o=null==u?n.identity:h(u);return i(r,function(n,i){var u=o.call(f,n,i,r);t(e,u,n)}),e}};n.groupBy=c(function(t,i,r){(n.has(t,i)?t[i]:t[i]=[]).push(r)});n.indexBy=c(function(n,t,i){n[t]=i});n.countBy=c(function(t,i){n.has(t,i)?t[i]++:t[i]=1});n.sortedIndex=function(t,i,r,u){var e;r=null==r?n.identity:h(r);for(var s=r.call(u,i),f=0,o=t.length;o>f;)e=f+o>>>1,r.call(u,t[e])<s?f=e+1:o=e;return f};n.toArray=function(i){return i?n.isArray(i)?t.call(i):i.length===+i.length?n.map(i,n.identity):n.values(i):[]};n.size=function(t){return null==t?0:t.length===+t.length?t.length:n.keys(t).length};n.first=n.head=n.take=function(n,i,r){if(null!=n)return null==i||r?n[0]:t.call(n,0,i)};n.initial=function(n,i,r){return t.call(n,0,n.length-(null==i||r?1:i))};n.last=function(n,i,r){if(null!=n)return null==i||r?n[n.length-1]:t.call(n,Math.max(n.length-i,0))};n.rest=n.tail=n.drop=function(n,i,r){return t.call(n,null==i||r?1:i)};n.compact=function(t){return n.filter(t,n.identity)};d=function(t,r,u){return r&&n.every(t,n.isArray)?o.apply(u,t):(i(t,function(t){n.isArray(t)||n.isArguments(t)?r?p.apply(u,t):d(t,r,u):u.push(t)}),u)};n.flatten=function(n,t){return d(n,t,[])};n.without=function(i){return n.difference(i,t.call(arguments,1))};n.uniq=n.unique=function(t,r,u,f){n.isFunction(r)&&(f=u,u=r,r=!1);var s=u?n.map(t,u,f):t,o=[],e=[];return i(s,function(i,u){(r?u&&e[e.length-1]===i:n.contains(e,i))||(e.push(i),o.push(t[u]))}),o};n.union=function(){return n.uniq(n.flatten(arguments,!0))};n.intersection=function(i){var r=t.call(arguments,1);return n.filter(n.uniq(i),function(t){return n.every(r,function(i){return n.indexOf(i,t)>=0})})};n.difference=function(i){var u=o.apply(r,t.call(arguments,1));return n.filter(i,function(t){return!n.contains(u,t)})};n.zip=function(){for(var i=n.max(n.pluck(arguments,"length").concat(0)),r=new Array(i),t=0;i>t;t++)r[t]=n.pluck(arguments,""+t);return r};n.object=function(n,t){if(null==n)return{};for(var r={},i=0,u=n.length;u>i;i++)t?r[n[i]]=t[i]:r[n[i][0]]=n[i][1];return r};n.indexOf=function(t,i,r){if(null==t)return-1;var u=0,f=t.length;if(r){if("number"!=typeof r)return u=n.sortedIndex(t,i),t[u]===i?u:-1;u=0>r?Math.max(0,f+r):r}if(s&&t.indexOf===s)return t.indexOf(i,r);for(;f>u;u++)if(t[u]===i)return u;return-1};n.lastIndexOf=function(n,t,i){var u,r;if(null==n)return-1;if(u=null!=i,st&&n.lastIndexOf===st)return u?n.lastIndexOf(t,i):n.lastIndexOf(t);for(r=u?i:n.length;r--;)if(n[r]===t)return r;return-1};n.range=function(n,t,i){arguments.length<=1&&(t=n||0,n=0);i=arguments[2]||1;for(var r=Math.max(Math.ceil((t-n)/i),0),u=0,f=new Array(r);r>u;)f[u++]=n,n+=i;return f};l=function(){};n.bind=function(i,r){var u,f;if(w&&i.bind===w)return w.apply(i,t.call(arguments,1));if(!n.isFunction(i))throw new TypeError;return u=t.call(arguments,2),f=function(){var e,n;return(this instanceof f)?(l.prototype=i.prototype,e=new l,l.prototype=null,n=i.apply(e,u.concat(t.call(arguments))),Object(n)===n?n:e):i.apply(r,u.concat(t.call(arguments)))}};n.partial=function(n){var i=t.call(arguments,1);return function(){return n.apply(this,i.concat(t.call(arguments)))}};n.bindAll=function(r){var u=t.call(arguments,1);if(0===u.length)throw new Error("bindAll must be passed function names");return i(u,function(t){r[t]=n.bind(r[t],r)}),r};n.memoize=function(t,i){var r={};return i||(i=n.identity),function(){var u=i.apply(this,arguments);return n.has(r,u)?r[u]:r[u]=t.apply(this,arguments)}};n.delay=function(n,i){var r=t.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},i)};n.defer=function(i){return n.delay.apply(n,[i,1].concat(t.call(arguments,1)))};n.throttle=function(n,t,i){var f,e,o,r=null,u=0,s;return i||(i={}),s=function(){u=i.leading===!1?0:new Date;r=null;o=n.apply(f,e)},function(){var h=new Date,c;return u||i.leading!==!1||(u=h),c=t-(h-u),f=this,e=arguments,0>=c?(clearTimeout(r),r=null,u=h,o=n.apply(f,e)):r||i.trailing===!1||(r=setTimeout(s,c)),o}};n.debounce=function(n,t,i){var r,u,f,o,e;return function(){f=this;u=arguments;o=new Date;var s=function(){var h=new Date-o;t>h?r=setTimeout(s,t-h):(r=null,i||(e=n.apply(f,u)))},h=i&&!r;return r||(r=setTimeout(s,t)),h&&(e=n.apply(f,u)),e}};n.once=function(n){var t,i=!1;return function(){return i?t:(i=!0,t=n.apply(this,arguments),n=null,t)}};n.wrap=function(n,t){return function(){var i=[n];return p.apply(i,arguments),t.apply(this,i)}};n.compose=function(){var n=arguments;return function(){for(var t=arguments,i=n.length-1;i>=0;i--)t=[n[i].apply(this,t)];return t[0]}};n.after=function(n,t){return function(){if(--n<1)return t.apply(this,arguments)}};n.keys=pt||function(t){var i,r;if(t!==Object(t))throw new TypeError("Invalid object");i=[];for(r in t)n.has(t,r)&&i.push(r);return i};n.values=function(t){for(var r=n.keys(t),u=r.length,f=new Array(u),i=0;u>i;i++)f[i]=t[r[i]];return f};n.pairs=function(t){for(var r=n.keys(t),u=r.length,f=new Array(u),i=0;u>i;i++)f[i]=[r[i],t[r[i]]];return f};n.invert=function(t){for(var u={},r=n.keys(t),i=0,f=r.length;f>i;i++)u[t[r[i]]]=r[i];return u};n.functions=n.methods=function(t){var r=[],i;for(i in t)n.isFunction(t[i])&&r.push(i);return r.sort()};n.extend=function(n){return i(t.call(arguments,1),function(t){if(t)for(var i in t)n[i]=t[i]}),n};n.pick=function(n){var u={},f=o.apply(r,t.call(arguments,1));return i(f,function(t){t in n&&(u[t]=n[t])}),u};n.omit=function(i){var f={},e=o.apply(r,t.call(arguments,1)),u;for(u in i)n.contains(e,u)||(f[u]=i[u]);return f};n.defaults=function(n){return i(t.call(arguments,1),function(t){if(t)for(var i in t)n[i]===void 0&&(n[i]=t[i])}),n};n.clone=function(t){return n.isObject(t)?n.isArray(t)?t.slice():n.extend({},t):t};n.tap=function(n,t){return t(n),n};a=function(t,i,r,u){var l,v,h,c,e,o,s;if(t===i)return 0!==t||1/t==1/i;if(null==t||null==i)return t===i;if(t instanceof n&&(t=t._wrapped),i instanceof n&&(i=i._wrapped),l=f.call(t),l!=f.call(i))return!1;switch(l){case"[object String]":return t==String(i);case"[object Number]":return t!=+t?i!=+i:0==t?1/t==1/i:t==+i;case"[object Date]":case"[object Boolean]":return+t==+i;case"[object RegExp]":return t.source==i.source&&t.global==i.global&&t.multiline==i.multiline&&t.ignoreCase==i.ignoreCase}if("object"!=typeof t||"object"!=typeof i)return!1;for(v=r.length;v--;)if(r[v]==t)return u[v]==i;if(h=t.constructor,c=i.constructor,h!==c&&!(n.isFunction(h)&&h instanceof h&&n.isFunction(c)&&c instanceof c))return!1;if(r.push(t),u.push(i),e=0,o=!0,"[object Array]"==l){if(e=t.length,o=e==i.length)for(;e--&&(o=a(t[e],i[e],r,u)););}else{for(s in t)if(n.has(t,s)&&(e++,!(o=n.has(i,s)&&a(t[s],i[s],r,u))))break;if(o){for(s in i)if(n.has(i,s)&&!e--)break;o=!e}}return r.pop(),u.pop(),o};n.isEqual=function(n,t){return a(n,t,[],[])};n.isEmpty=function(t){if(null==t)return!0;if(n.isArray(t)||n.isString(t))return 0===t.length;for(var i in t)if(n.has(t,i))return!1;return!0};n.isElement=function(n){return!(!n||1!==n.nodeType)};n.isArray=yt||function(n){return"[object Array]"==f.call(n)};n.isObject=function(n){return n===Object(n)};i(["Arguments","Function","String","Number","Date","RegExp"],function(t){n["is"+t]=function(n){return f.call(n)=="[object "+t+"]"}});n.isArguments(arguments)||(n.isArguments=function(t){return!(!t||!n.has(t,"callee"))});"function"!=typeof/./&&(n.isFunction=function(n){return"function"==typeof n});n.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))};n.isNaN=function(t){return n.isNumber(t)&&t!=+t};n.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==f.call(n)};n.isNull=function(n){return null===n};n.isUndefined=function(n){return n===void 0};n.has=function(n,t){return vt.call(n,t)};n.noConflict=function(){return y._=lt,this};n.identity=function(n){return n};n.times=function(n,t,i){for(var u=Array(Math.max(0,n)),r=0;n>r;r++)u[r]=t.call(i,r);return u};n.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};u={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};u.unescape=n.invert(u.escape);ht={escape:new RegExp("["+n.keys(u.escape).join("")+"]","g"),unescape:new RegExp("("+n.keys(u.unescape).join("|")+")","g")};n.each(["escape","unescape"],function(t){n[t]=function(n){return null==n?"":(""+n).replace(ht[t],function(n){return u[t][n]})}});n.result=function(t,i){if(null==t)return void 0;var r=t[i];return n.isFunction(r)?r.call(t):r};n.mixin=function(t){i(n.functions(t),function(i){var r=n[i]=t[i];n.prototype[i]=function(){var t=[this._wrapped];return p.apply(t,arguments),v.call(this,r.apply(n,t))}})};ct=0;n.uniqueId=function(n){var t=++ct+"";return n?n+t:t};n.templateSettings={interpolate:/\<\@\=(.+?)\@\>/g,evaluate:/\<\@(.+?)\@\>/g,escape:/<%-([\s\S]+?)%>/g};var g=/(.)^/,wt={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},bt=/\\|'|\r|\n|\t|\u2028|\u2029/g;n.template=function(t,i,r){var f,e;r=n.defaults({},r,n.templateSettings);var h=new RegExp([(r.escape||g).source,(r.interpolate||g).source,(r.evaluate||g).source].join("|")+"|$","g"),o=0,u="__p+='";t.replace(h,function(n,i,r,f,e){return u+=t.slice(o,e).replace(bt,function(n){return"\\"+wt[n]}),i&&(u+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'"),r&&(u+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),f&&(u+="';\n"+f+"\n__p+='"),o=e+n.length,n});u+="';\n";r.variable||(u="with(obj||{}){\n"+u+"}\n");u="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+u+"return __p;\n";try{f=new Function(r.variable||"obj","_",u)}catch(s){throw s.source=u,s;}return i?f(i,n):(e=function(t){return f.call(this,t,n)},e.source="function("+(r.variable||"obj")+"){\n"+u+"}",e)};n.chain=function(t){return n(t).chain()};v=function(t){return this._chain?n(t).chain():t};n.mixin(n);i(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var i=r[t];n.prototype[t]=function(){var n=this._wrapped;return i.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],v.call(this,n)}});i(["concat","join","slice"],function(t){var i=r[t];n.prototype[t]=function(){return v.call(this,i.apply(this._wrapped,arguments))}});n.extend(n.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(){var r=this,it=r.Backbone,h=[],rt=h.push,c=h.slice,ut=h.splice,t,n,f,y,p,w,b,d,tt,l,e;t=typeof exports!="undefined"?exports:r.Backbone={};t.VERSION="1.0.0";n=r._;n||typeof require=="undefined"||(n=require("underscore"));t.$=r.jQuery||r.Zepto||r.ender||r.$;t.noConflict=function(){return r.Backbone=it,this};t.emulateHTTP=!1;t.emulateJSON=!1;var i=t.Events={on:function(n,t,i){if(!o(this,"on",n,[t,i])||!t)return this;this._events||(this._events={});var r=this._events[n]||(this._events[n]=[]);return r.push({callback:t,context:i,ctx:i||this}),this},once:function(t,i,r){if(!o(this,"once",t,[i,r])||!i)return this;var f=this,u=n.once(function(){f.off(t,u);i.apply(this,arguments)});u._callback=i;return this.on(t,u,r)},off:function(t,i,r){var s,u,h,c,f,l,e,a;if(!this._events||!o(this,"off",t,[i,r]))return this;if(!t&&!i&&!r)return this._events={},this;for(c=t?[t]:n.keys(this._events),f=0,l=c.length;f<l;f++)if(t=c[f],h=this._events[t]){if(this._events[t]=s=[],i||r)for(e=0,a=h.length;e<a;e++)u=h[e],(i&&i!==u.callback&&i!==u.callback._callback||r&&r!==u.context)&&s.push(u);s.length||delete this._events[t]}return this},trigger:function(n){var t,i,r;return this._events?(t=c.call(arguments,1),!o(this,"trigger",n,t))?this:(i=this._events[n],r=this._events.all,i&&v(i,t),r&&v(r,arguments),this):this},stopListening:function(n,t,i){var r=this._listeners,f,u;if(!r)return this;f=!t&&!i;typeof t=="object"&&(i=this);n&&((r={})[n._listenerId]=n);for(u in r)r[u].off(t,i,this),f&&delete this._listeners[u];return this}},a=/\s+/,o=function(n,t,i,r){var f,e,u,o;if(!i)return!0;if(typeof i=="object"){for(f in i)n[t].apply(n,[f,i[f]].concat(r));return!1}if(a.test(i)){for(e=i.split(a),u=0,o=e.length;u<o;u++)n[t].apply(n,[e[u]].concat(r));return!1}return!0},v=function(n,t){var i,r=-1,u=n.length,f=t[0],e=t[1],o=t[2];switch(t.length){case 0:while(++r<u)(i=n[r]).callback.call(i.ctx);return;case 1:while(++r<u)(i=n[r]).callback.call(i.ctx,f);return;case 2:while(++r<u)(i=n[r]).callback.call(i.ctx,f,e);return;case 3:while(++r<u)(i=n[r]).callback.call(i.ctx,f,e,o);return;default:while(++r<u)(i=n[r]).callback.apply(i.ctx,t)}};n.each({listenTo:"on",listenToOnce:"once"},function(t,r){i[r]=function(i,r,u){var f=this._listeners||(this._listeners={}),e=i._listenerId||(i._listenerId=n.uniqueId("l"));return f[e]=i,typeof r=="object"&&(u=this),i[t](r,u,this),this}});i.bind=i.on;i.unbind=i.off;n.extend(t,i);f=t.Model=function(t,i){var u,r=t||{};i||(i={});this.cid=n.uniqueId("c");this.attributes={};n.extend(this,n.pick(i,y));i.parse&&(r=this.parse(r,i)||{});(u=n.result(this,"defaults"))&&(r=n.defaults({},r,u));this.set(r,i);this.changed={};this.initialize.apply(this,arguments)};y=["url","urlRoot","collection"];n.extend(f.prototype,i,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(){return n.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(n){return this.attributes[n]},escape:function(t){return n.escape(this.get(t))},has:function(n){return this.get(n)!=null},set:function(t,i,r){var u,f,l,e,h,c,a,o,s,v;if(t==null)return this;if(typeof t=="object"?(f=t,r=i):(f={})[t]=i,r||(r={}),!this._validate(f,r))return!1;l=r.unset;h=r.silent;e=[];c=this._changing;this._changing=!0;c||(this._previousAttributes=n.clone(this.attributes),this.changed={});o=this.attributes;a=this._previousAttributes;this.idAttribute in f&&(this.id=f[this.idAttribute]);for(u in f)i=f[u],n.isEqual(o[u],i)||e.push(u),n.isEqual(a[u],i)?delete this.changed[u]:this.changed[u]=i,l?delete o[u]:o[u]=i;if(!h)for(e.length&&(this._pending=!0),s=0,v=e.length;s<v;s++)this.trigger("change:"+e[s],this,o[e[s]],r);if(c)return this;if(!h)while(this._pending)this._pending=!1,this.trigger("change",this,r);return this._pending=!1,this._changing=!1,this},unset:function(t,i){return this.set(t,void 0,n.extend({},i,{unset:!0}))},clear:function(t){var i={},r;for(r in this.attributes)i[r]=void 0;return this.set(i,n.extend({},t,{unset:!0}))},hasChanged:function(t){return t==null?!n.isEmpty(this.changed):n.has(this.changed,t)},changedAttributes:function(t){var u,i,f,r;if(!t)return this.hasChanged()?n.clone(this.changed):!1;i=!1;f=this._changing?this._previousAttributes:this.attributes;for(r in t)n.isEqual(f[r],u=t[r])||((i||(i={}))[r]=u);return i},previous:function(n){return n==null||!this._previousAttributes?null:this._previousAttributes[n]},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(t){t=t?n.clone(t):{};t.parse===void 0&&(t.parse=!0);var i=this,r=t.success;return t.success=function(n){if(!i.set(i.parse(n,t),t))return!1;r&&r(i,n,t);i.trigger("sync",i,n,t)},e(this,t),this.sync("read",this,t)},save:function(t,i,r){var u,o,c,s=this.attributes,f,h;return(t==null||typeof t=="object"?(u=t,r=i):(u={})[t]=i,u&&(!r||!r.wait)&&!this.set(u,r))?!1:(r=n.extend({validate:!0},r),!this._validate(u,r))?!1:(u&&r.wait&&(this.attributes=n.extend({},s,u)),r.parse===void 0&&(r.parse=!0),f=this,h=r.success,r.success=function(t){f.attributes=s;var i=f.parse(t,r);if(r.wait&&(i=n.extend(u||{},i)),n.isObject(i)&&!f.set(i,r))return!1;h&&h(f,t,r);f.trigger("sync",f,t,r)},e(this,r),o=this.isNew()?"create":r.patch?"patch":"update",o==="patch"&&(r.attrs=u),c=this.sync(o,this,r),u&&r.wait&&(this.attributes=s),c)},destroy:function(t){var f;t=t?n.clone(t):{};var i=this,r=t.success,u=function(){i.trigger("destroy",i,i.collection,t)};return(t.success=function(n){(t.wait||i.isNew())&&u();r&&r(i,n,t);i.isNew()||i.trigger("sync",i,n,t)},this.isNew())?(t.success(),!1):(e(this,t),f=this.sync("delete",this,t),t.wait||u(),f)},url:function(){var t=n.result(this,"urlRoot")||n.result(this.collection,"url")||l();return this.isNew()?t:t+(t.charAt(t.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(n){return n},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},isValid:function(t){return this._validate({},n.extend(t||{},{validate:!0}))},_validate:function(t,i){if(!i.validate||!this.validate)return!0;t=n.extend({},this.attributes,t);var r=this.validationError=this.validate(t,i)||null;return r?(this.trigger("invalid",this,r,n.extend(i||{},{validationError:r})),!1):!0}});p=["keys","values","pairs","invert","pick","omit"];n.each(p,function(t){f.prototype[t]=function(){var i=c.call(arguments);return i.unshift(this.attributes),n[t].apply(n,i)}});var s=t.Collection=function(t,i){i||(i={});i.url&&(this.url=i.url);i.model&&(this.model=i.model);i.comparator!==void 0&&(this.comparator=i.comparator);this._reset();this.initialize.apply(this,arguments);t&&this.reset(t,n.extend({silent:!0},i))},ft={add:!0,remove:!0,merge:!0},et={add:!0,merge:!1,remove:!1};n.extend(s.prototype,i,{model:f,initialize:function(){},toJSON:function(n){return this.map(function(t){return t.toJSON(n)})},sync:function(){return t.sync.apply(this,arguments)},add:function(t,i){return this.set(t,n.defaults(i||{},et))},remove:function(t,i){t=n.isArray(t)?t.slice():[t];i||(i={});for(var f,r,u=0,e=t.length;u<e;u++)(r=this.get(t[u]),r)&&(delete this._byId[r.id],delete this._byId[r.cid],f=this.indexOf(r),this.models.splice(f,1),this.length--,i.silent||(i.index=f,r.trigger("remove",r,this,i)),this._removeReference(r));return this},set:function(t,i){i=n.defaults(i||{},ft);i.parse&&(t=this.parse(t,i));n.isArray(t)||(t=t?[t]:[]);for(var r,s,o,h=i.at,l=this.comparator&&h==null&&i.sort!==!1,v=n.isString(this.comparator)?this.comparator:null,f=[],c=[],a={},u=0,e=t.length;u<e;u++)if(r=this._prepareModel(t[u],i))if(s=this.get(r))i.remove&&(a[s.cid]=!0),i.merge&&(s.set(r.attributes,i),l&&!o&&s.hasChanged(v)&&(o=!0));else if(i.add){f.push(r);r.on("all",this._onModelEvent,this);this._byId[r.cid]=r;r.id!=null&&(this._byId[r.id]=r)}if(i.remove){for(u=0,e=this.length;u<e;++u)a[(r=this.models[u]).cid]||c.push(r);c.length&&this.remove(c,i)}if(f.length&&(l&&(o=!0),this.length+=f.length,h!=null?ut.apply(this.models,[h,0].concat(f)):rt.apply(this.models,f)),o&&this.sort({silent:!0}),i.silent)return this;for(u=0,e=f.length;u<e;u++)(r=f[u]).trigger("add",r,this,i);return o&&this.trigger("sort",this,i),this},reset:function(t,i){i||(i={});for(var r=0,u=this.models.length;r<u;r++)this._removeReference(this.models[r]);return i.previousModels=this.models,this._reset(),this.add(t,n.extend({silent:!0},i)),i.silent||this.trigger("reset",this,i),this},push:function(t,i){return t=this._prepareModel(t,i),this.add(t,n.extend({at:this.length},i)),t},pop:function(n){var t=this.at(this.length-1);return this.remove(t,n),t},unshift:function(t,i){return t=this._prepareModel(t,i),this.add(t,n.extend({at:0},i)),t},shift:function(n){var t=this.at(0);return this.remove(t,n),t},slice:function(n,t){return this.models.slice(n,t)},get:function(n){if(n!=null)return this._byId[n.id!=null?n.id:n.cid||n]},at:function(n){return this.models[n]},where:function(t,i){return n.isEmpty(t)?i?void 0:[]:this[i?"find":"filter"](function(n){for(var i in t)if(t[i]!==n.get(i))return!1;return!0})},findWhere:function(n){return this.where(n,!0)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return t||(t={}),n.isString(this.comparator)||this.comparator.length===1?this.models=this.sortBy(this.comparator,this):this.models.sort(n.bind(this.comparator,this)),t.silent||this.trigger("sort",this,t),this},sortedIndex:function(t,i,r){i||(i=this.comparator);var u=n.isFunction(i)?i:function(n){return n.get(i)};return n.sortedIndex(this.models,t,u,r)},pluck:function(t){return n.invoke(this.models,"get",t)},fetch:function(t){t=t?n.clone(t):{};t.parse===void 0&&(t.parse=!0);var r=t.success,i=this;return t.success=function(n){var u=t.reset?"reset":"set";i[u](n,t);r&&r(i,n,t);i.trigger("sync",i,n,t)},e(this,t),this.sync("read",this,t)},create:function(t,i){if(i=i?n.clone(i):{},!(t=this._prepareModel(t,i)))return!1;i.wait||this.add(t,i);var u=this,r=i.success;return i.success=function(n){i.wait&&u.add(t,i);r&&r(t,n,i)},t.save(null,i),t},parse:function(n){return n},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(n,t){if(n instanceof f)return n.collection||(n.collection=this),n;t||(t={});t.collection=this;var i=new this.model(n,t);return i._validate(n,t)?i:(this.trigger("invalid",this,n,t),!1)},_removeReference:function(n){this===n.collection&&delete n.collection;n.off("all",this._onModelEvent,this)},_onModelEvent:function(n,t,i,r){(n!=="add"&&n!=="remove"||i===this)&&(n==="destroy"&&this.remove(t,r),t&&n==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments))}});w=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","indexOf","shuffle","lastIndexOf","isEmpty","chain"];n.each(w,function(t){s.prototype[t]=function(){var i=c.call(arguments);return i.unshift(this.models),n[t].apply(n,i)}});b=["groupBy","countBy","sortBy"];n.each(b,function(t){s.prototype[t]=function(i,r){var u=n.isFunction(i)?i:function(n){return n.get(i)};return n[t](this.models,u,r)}});var k=t.View=function(t){this.cid=n.uniqueId("view");this._configure(t||{});this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()},ot=/^(\S+)\s*(.*)$/,st=["model","collection","el","id","attributes","className","tagName","events"];n.extend(k.prototype,i,{tagName:"div",$:function(n){return this.$el.find(n)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(n,i){return this.$el&&this.undelegateEvents(),this.$el=n instanceof t.$?n:t.$(n),this.el=this.$el[0],i!==!1&&this.delegateEvents(),this},delegateEvents:function(t){var r,i;if(!(t||(t=n.result(this,"events"))))return this;this.undelegateEvents();for(r in t)if(i=t[r],n.isFunction(i)||(i=this[t[r]]),i){var f=r.match(ot),u=f[1],e=f[2];if(i=n.bind(i,this),u+=".delegateEvents"+this.cid,e==="")this.$el.on(u,i);else this.$el.on(u,e,i)}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_configure:function(t){this.options&&(t=n.extend({},n.result(this,"options"),t));n.extend(this,n.pick(t,st));this.options=t},_ensureElement:function(){var i,r;this.el?this.setElement(n.result(this,"el"),!1):(i=n.extend({},n.result(this,"attributes")),this.id&&(i.id=n.result(this,"id")),this.className&&(i["class"]=n.result(this,"className")),r=t.$("<"+n.result(this,"tagName")+">").attr(i),this.setElement(r,!1))}});t.sync=function(i,r,u){var e=d[i],f,o,s;return n.defaults(u||(u={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON}),f={type:e,dataType:"json"},u.url||(f.url=n.result(r,"url")||l()),u.data==null&&r&&(i==="create"||i==="update"||i==="patch")&&(f.contentType="application/json",f.data=JSON.stringify(u.attrs||r.toJSON(u))),u.emulateJSON&&(f.contentType="application/x-www-form-urlencoded",f.data=f.data?{model:f.data}:{}),u.emulateHTTP&&(e==="PUT"||e==="DELETE"||e==="PATCH")&&(f.type="POST",u.emulateJSON&&(f.data._method=e),o=u.beforeSend,u.beforeSend=function(n){return n.setRequestHeader("X-HTTP-Method-Override",e),o?o.apply(this,arguments):void 0}),f.type==="GET"||u.emulateJSON||(f.processData=!1),f.type!=="PATCH"||!window.ActiveXObject||window.external&&window.external.msActiveXFilteringEnabled||(f.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}),s=u.xhr=t.ajax(n.extend(f,u)),r.trigger("request",r,s,u),s};d={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var g=t.Router=function(n){n||(n={});n.routes&&(this.routes=n.routes);this._bindRoutes();this.initialize.apply(this,arguments)},ht=/\((.*?)\)/g,ct=/(\(\?)?:\w+/g,lt=/\*\w+/g,at=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(g.prototype,i,{initialize:function(){},route:function(i,r,u){n.isRegExp(i)||(i=this._routeToRegExp(i));n.isFunction(r)&&(u=r,r="");u||(u=this[r]);var f=this;return t.history.route(i,function(n){var e=f._extractParameters(i,n);u&&u.apply(f,e);f.trigger.apply(f,["route:"+r].concat(e));f.trigger("route",r,e);t.history.trigger("route",f,r,e)}),this},navigate:function(n,i){return t.history.navigate(n,i),this},_bindRoutes:function(){if(this.routes){this.routes=n.result(this,"routes");for(var t,i=n.keys(this.routes);(t=i.pop())!=null;)this.route(t,this.routes[t])}},_routeToRegExp:function(n){return n=n.replace(at,"\\$&").replace(ht,"(?:$1)?").replace(ct,function(n,t){return t?n:"([^/]+)"}).replace(lt,"(.*?)"),new RegExp("^"+n+"$")},_extractParameters:function(t,i){var r=t.exec(i).slice(1);return n.map(r,function(n){return n?decodeURIComponent(n):null})}});var u=t.History=function(){this.handlers=[];n.bindAll(this,"checkUrl");typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},nt=/^[#\/]|\s+$/g,vt=/^\/+|\/+$/g,yt=/msie [\w.]+/,pt=/\/$/;u.started=!1;n.extend(u.prototype,i,{interval:50,getHash:function(n){var t=(n||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(n,t){if(n==null)if(this._hasPushState||!this._wantsHashChange||t){n=this.location.pathname;var i=this.root.replace(pt,"");n.indexOf(i)||(n=n.substr(i.length))}else n=this.getHash();return n.replace(nt,"")},start:function(i){var r,f;if(u.started)throw new Error("Backbone.history has already been started");u.started=!0;this.options=n.extend({},{root:"/"},this.options,i);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==!1;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var e=this.getFragment(),o=document.documentMode,s=yt.exec(navigator.userAgent.toLowerCase())&&(!o||o<=7);if(this.root=("/"+this.root+"/").replace(vt,"/"),s&&this._wantsHashChange&&(this.iframe=t.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(e)),this._hasPushState)t.$(window).on("popstate",this.checkUrl);else if(this._wantsHashChange&&"onhashchange"in window&&!s)t.$(window).on("hashchange",this.checkUrl);else this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval));return(this.fragment=e,r=this.location,f=r.pathname.replace(/[^\/]$/,"$&/")===this.root,this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!f)?(this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0):(this._wantsPushState&&this._hasPushState&&f&&r.hash&&(this.fragment=this.getHash().replace(nt,""),this.history.replaceState({},document.title,this.root+this.fragment+r.search)),this.options.silent?void 0:this.loadUrl())},stop:function(){t.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);clearInterval(this._checkUrlInterval);u.started=!1},route:function(n,t){this.handlers.unshift({route:n,callback:t})},checkUrl:function(){var n=this.getFragment();if(n===this.fragment&&this.iframe&&(n=this.getFragment(this.getHash(this.iframe))),n===this.fragment)return!1;this.iframe&&this.navigate(n);this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(t){var i=this.fragment=this.getFragment(t);return n.any(this.handlers,function(n){if(n.route.test(i))return n.callback(i),!0})},navigate:function(n,t){if(!u.started)return!1;if(t&&t!==!0||(t={trigger:t}),n=this.getFragment(n||""),this.fragment!==n){this.fragment=n;var i=this.root+n;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,i);else if(this._wantsHashChange)this._updateHash(this.location,n,t.replace),this.iframe&&n!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,n,t.replace));else return this.location.assign(i);t.trigger&&this.loadUrl(n)}},_updateHash:function(n,t,i){if(i){var r=n.href.replace(/(javascript:|#).*$/,"");n.replace(r+"#"+t)}else n.hash="#"+t}});t.history=new u;tt=function(t,i){var u=this,r,f;return r=t&&n.has(t,"constructor")?t.constructor:function(){return u.apply(this,arguments)},n.extend(r,u,i),f=function(){this.constructor=r},f.prototype=u.prototype,r.prototype=new f,t&&n.extend(r.prototype,t),r.__super__=u.prototype,r};f.extend=s.extend=g.extend=k.extend=u.extend=tt;l=function(){throw new Error('A "url" property or function must be specified');};e=function(n,t){var i=t.error;t.error=function(r){i&&i(n,r,t);n.trigger("error",n,r,t)}}}.call(this);!function(n,t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):n.bootbox=t(n.jQuery)}(this,function a(n,t){"use strict";function a(n){var t=f[o.locale];return t?t[n]:f.en[n]}function e(t,i,r){t.stopPropagation();t.preventDefault();var u=n.isFunction(r)&&r.call(i,t)===!1;u||i.modal("hide")}function v(n){var i,t=0;for(i in n)t++;return t}function r(t,i){var r=0;n.each(t,function(n,t){i(n,t,r++)})}function y(t){var i,u;if("object"!=typeof t)throw new Error("Please supply an object of options");if(!t.message)throw new Error("Please specify a message");return t=n.extend({},o,t),t.buttons||(t.buttons={}),i=t.buttons,u=v(i),r(i,function(t,r,f){if(n.isFunction(r)&&(r=i[t]={callback:r}),"object"!==n.type(r))throw new Error("button with key "+t+" must be an object");r.label||(r.label=t);r.className||(r.className=2>=u&&f===u-1?"btn-primary":"btn-default")}),t}function p(n,t){var r=n.length,i={};if(1>r||r>2)throw new Error("Invalid argument length");return 2===r||"string"==typeof n[0]?(i[t[0]]=n[0],i[t[1]]=n[1]):i=n[0],i}function s(t,i,r){return n.extend(!0,{},t,p(i,r))}function h(n,t,i,r){var u={className:"bootbox-"+n,buttons:c.apply(null,t)};return l(s(u,r,i),t)}function c(){for(var t={},n=0,r=arguments.length;r>n;n++){var i=arguments[n],u=i.toLowerCase(),f=i.toUpperCase();t[u]={label:a(f)}}return t}function l(n,i){var u={};return r(i,function(n,t){u[t]=!0}),r(n.buttons,function(n){if(u[n]===t)throw new Error("button key "+n+" is not allowed (options are "+i.join("\n")+")");}),n}var u={dialog:"<div class='bootbox modal' tabindex='-1' role='dialog'><div class='modal-dialog'><div class='modal-content'><div class='modal-body'><div class='bootbox-body'><\/div><\/div><\/div><\/div><\/div>",header:"<div class='modal-header'><h4 class='modal-title'><\/h4><\/div>",footer:"<div class='modal-footer'><\/div>",closeButton:"<button type='button' class='bootbox-close-button close' data-dismiss='modal' aria-hidden='true'>&times;<\/button>",form:"<form class='bootbox-form'><\/form>",inputs:{text:"<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",textarea:"<textarea class='bootbox-input bootbox-input-textarea form-control'><\/textarea>",email:"<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",select:"<select class='bootbox-input bootbox-input-select form-control'><\/select>",checkbox:"<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /><\/label><\/div>",date:"<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />",time:"<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />",number:"<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />",password:"<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />"}},o={locale:"en",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body"},i={},f;return i.alert=function(){var t;if(t=h("alert",["ok"],["message","callback"],arguments),t.callback&&!n.isFunction(t.callback))throw new Error("alert requires callback property to be a function when provided");return t.buttons.ok.callback=t.onEscape=function(){return n.isFunction(t.callback)?t.callback.call(this):!0},i.dialog(t)},i.confirm=function(){var t;if(t=h("confirm",["cancel","confirm"],["message","callback"],arguments),t.buttons.cancel.callback=t.onEscape=function(){return t.callback.call(this,!1)},t.buttons.confirm.callback=function(){return t.callback.call(this,!0)},!n.isFunction(t.callback))throw new Error("confirm requires a callback");return i.dialog(t)},i.prompt=function(){var f,y,h,v,e,p,o,a,w;if(v=n(u.form),y={className:"bootbox-prompt",buttons:c("cancel","confirm"),value:"",inputType:"text"},f=l(s(y,arguments,["title","callback"]),["cancel","confirm"]),p=f.show===t?!0:f.show,f.message=v,f.buttons.cancel.callback=f.onEscape=function(){return f.callback.call(this,null)},f.buttons.confirm.callback=function(){var t,i;switch(f.inputType){case"text":case"textarea":case"email":case"select":case"date":case"time":case"number":case"password":t=e.val();break;case"checkbox":i=e.find("input:checked");t=[];r(i,function(i,r){t.push(n(r).val())})}return f.callback.call(this,t)},f.show=!1,!f.title)throw new Error("prompt requires a title");if(!n.isFunction(f.callback))throw new Error("prompt requires a callback");if(!u.inputs[f.inputType])throw new Error("invalid prompt type");switch(e=n(u.inputs[f.inputType]),f.inputType){case"text":case"textarea":case"email":case"date":case"time":case"number":case"password":e.val(f.value);break;case"select":if(a={},o=f.inputOptions||[],!n.isArray(o))throw new Error("Please pass an array of input options");if(!o.length)throw new Error("prompt with select requires options");r(o,function(i,r){var u=e;if(r.value===t||r.text===t)throw new Error("given options in wrong format");r.group&&(a[r.group]||(a[r.group]=n("<optgroup/>").attr("label",r.group)),u=a[r.group]);u.append("<option value='"+r.value+"'>"+r.text+"<\/option>")});r(a,function(n,t){e.append(t)});e.val(f.value);break;case"checkbox":if(w=n.isArray(f.value)?f.value:[f.value],o=f.inputOptions||[],!o.length)throw new Error("prompt with checkbox requires options");if(!o[0].value||!o[0].text)throw new Error("given options in wrong format");e=n("<div/>");r(o,function(t,i){var o=n(u.inputs[f.inputType]);o.find("input").attr("value",i.value);o.find("label").append(i.text);r(w,function(n,t){t===i.value&&o.find("input").prop("checked",!0)});e.append(o)})}return f.placeholder&&e.attr("placeholder",f.placeholder),f.pattern&&e.attr("pattern",f.pattern),f.maxlength&&e.attr("maxlength",f.maxlength),v.append(e),v.on("submit",function(n){n.preventDefault();n.stopPropagation();h.find(".btn-primary").click()}),h=i.dialog(f),h.off("shown.bs.modal"),h.on("shown.bs.modal",function(){e.focus()}),p===!0&&h.modal("show"),h},i.dialog=function(i){var c;i=y(i);var f=n(u.dialog),l=f.find(".modal-dialog"),s=f.find(".modal-body"),a=i.buttons,h="",o={onEscape:i.onEscape};if(n.fn.modal===t)throw new Error("$.fn.modal is not defined; please double check you have included the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ for more details.");return(r(a,function(n,t){h+="<button data-bb-handler='"+n+"' type='button' class='btn "+t.className+"'>"+t.label+"<\/button>";o[n]=t.callback}),s.find(".bootbox-body").html(i.message),i.animate===!0&&f.addClass("fade"),i.className&&f.addClass(i.className),"large"===i.size?l.addClass("modal-lg"):"small"===i.size&&l.addClass("modal-sm"),i.title&&s.before(u.header),i.closeButton)&&(c=n(u.closeButton),i.title?f.find(".modal-header").prepend(c):c.css("margin-top","-10px").prependTo(s)),i.title&&f.find(".modal-title").html(i.title),h.length&&(s.after(u.footer),f.find(".modal-footer").html(h)),f.on("hidden.bs.modal",function(n){n.target===this&&f.remove()}),f.on("shown.bs.modal",function(){f.find(".btn-primary:first").focus()}),"static"!==i.backdrop&&f.on("click.dismiss.bs.modal",function(n){f.children(".modal-backdrop").length&&(n.currentTarget=f.children(".modal-backdrop").get(0));n.target===n.currentTarget&&f.trigger("escape.close.bb")}),f.on("escape.close.bb",function(n){o.onEscape&&e(n,f,o.onEscape)}),f.on("click",".modal-footer button",function(t){var i=n(this).data("bb-handler");e(t,f,o[i])}),f.on("click",".bootbox-close-button",function(n){e(n,f,o.onEscape)}),f.on("keyup",function(n){27===n.which&&f.trigger("escape.close.bb")}),n(i.container).append(f),f.modal({backdrop:i.backdrop?"static":!1,keyboard:!1,show:!1}),i.show&&f.modal("show"),f},i.setDefaults=function(){var t={};2===arguments.length?t[arguments[0]]=arguments[1]:t=arguments[0];n.extend(o,t)},i.hideAll=function(){return n(".bootbox").modal("hide"),i},f={bg_BG:{OK:"Ок",CANCEL:"Отказ",CONFIRM:"Потвърждавам"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},cs:{OK:"OK",CANCEL:"Zrušit",CONFIRM:"Potvrdit"},da:{OK:"OK",CANCEL:"Annuller",CONFIRM:"Accepter"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},el:{OK:"Εντάξει",CANCEL:"Ακύρωση",CONFIRM:"Επιβεβαίωση"},en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},et:{OK:"OK",CANCEL:"Katkesta",CONFIRM:"OK"},fa:{OK:"قبول",CANCEL:"لغو",CONFIRM:"تایید"},fi:{OK:"OK",CANCEL:"Peruuta",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},he:{OK:"אישור",CANCEL:"ביטול",CONFIRM:"אישור"},hu:{OK:"OK",CANCEL:"Mégsem",CONFIRM:"Megerősít"},hr:{OK:"OK",CANCEL:"Odustani",CONFIRM:"Potvrdi"},id:{OK:"OK",CANCEL:"Batal",CONFIRM:"OK"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"},ja:{OK:"OK",CANCEL:"キャンセル",CONFIRM:"確認"},lt:{OK:"Gerai",CANCEL:"Atšaukti",CONFIRM:"Patvirtinti"},lv:{OK:"Labi",CANCEL:"Atcelt",CONFIRM:"Apstiprināt"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},no:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},pl:{OK:"OK",CANCEL:"Anuluj",CONFIRM:"Potwierdź"},pt:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Confirmar"},ru:{OK:"OK",CANCEL:"Отмена",CONFIRM:"Применить"},sq:{OK:"OK",CANCEL:"Anulo",CONFIRM:"Prano"},sv:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},th:{OK:"ตกลง",CANCEL:"ยกเลิก",CONFIRM:"ยืนยัน"},tr:{OK:"Tamam",CANCEL:"İptal",CONFIRM:"Onayla"},zh_CN:{OK:"OK",CANCEL:"取消",CONFIRM:"确认"},zh_TW:{OK:"OK",CANCEL:"取消",CONFIRM:"確認"}},i.addLocale=function(t,r){return n.each(["OK","CANCEL","CONFIRM"],function(n,t){if(!r[t])throw new Error("Please supply a translation for '"+t+"'");}),f[t]={OK:r.OK,CANCEL:r.CANCEL,CONFIRM:r.CONFIRM},i},i.removeLocale=function(n){return delete f[n],i},i.setLocale=function(n){return i.setDefaults("locale",n)},i.init=function(t){return a(t||n)},i}),function(n,t){var i=function(n,t,i){var r;return function(){function e(){i||n.apply(u,f);r=null}var u=this,f=arguments;r?clearTimeout(r):i&&n.apply(u,f);r=setTimeout(e,t||100)}};jQuery.fn[t]=function(n){return n?this.bind("resize",i(n)):this.trigger(t)}}(jQuery,"smartresize");!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this;t.Raven=n()}}(function(){return function n(t,i,r){function u(f,o){var h,c,s;if(!i[f]){if(!t[f]){if(h="function"==typeof require&&require,!o&&h)return h(f,!0);if(e)return e(f,!0);c=new Error("Cannot find module '"+f+"'");throw c.code="MODULE_NOT_FOUND",c;}s=i[f]={exports:{}};t[f][0].call(s.exports,function(n){var i=t[f][1][n];return u(i?i:n)},s,s.exports,n,t,i,r)}return i[f].exports}for(var e="function"==typeof require&&require,f=0;f<r.length;f++)u(r[f]);return u}({1:[function(n,t){"use strict";function i(n){this.name="RavenConfigError";this.message=n}i.prototype=new Error;i.prototype.constructor=i;t.exports=i},{}],2:[function(n,t){"use strict";var i=function(n,t,i){var r=n[t],f=n,u;t in n&&(u="warn"===t?"warning":t,n[t]=function(){var n=[].slice.call(arguments),t=""+n.join(" "),e={level:u,logger:"console",extra:{arguments:n}};i&&i(t,e);r&&Function.prototype.apply.call(r,f,n)})};t.exports={wrapMethod:i}},{}],3:[function(n,t){(function(i){"use strict";function a(){return+new Date}function w(n,t){return e(t)?function(i){return t(i,n)}:t}function s(){this.a=!("object"!=typeof JSON||!JSON.stringify);this.b=!h(u);this.c=!h(et);this.d=null;this.e=null;this.f=null;this.g=null;this.h=null;this.i=null;this.j={};this.k={logger:"javascript",ignoreErrors:[],ignoreUrls:[],whitelistUrls:[],includePaths:[],crossOrigin:"anonymous",collectWindowErrors:!0,maxMessageLength:0,maxUrlLength:250,stackTraceLimit:50,autoBreadcrumbs:!0,instrument:!0,sampleRate:1};this.l=0;this.m=!1;this.n=Error.stackTraceLimit;this.o=r.console||{};this.p={};this.q=[];this.r=a();this.s=[];this.t=[];this.u=null;this.v=r.location;this.w=this.v&&this.v.href;this.x();for(var n in this.o)this.p[n]=this.o[n]}function h(n){return void 0===n}function e(n){return"function"==typeof n}function b(n){return"[object String]"===nt.toString.call(n)}function k(n){for(var t in n)return!1;return!0}function c(n,t){var i,r;if(h(n.length))for(i in n)d(n,i)&&t.call(null,i,n[i]);else if(r=n.length)for(i=0;i<r;i++)t.call(null,i,n[i])}function f(n,t){return t?(c(t,function(t,i){n[t]=i}),n):n}function ot(n){return!!Object.isFrozen&&Object.isFrozen(n)}function v(n,t){return!t||n.length<=t?n:n.substr(0,t)+"…"}function d(n,t){return nt.hasOwnProperty.call(n,t)}function y(n){for(var t,i=[],r=0,u=n.length;r<u;r++)t=n[r],b(t)?i.push(t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):t&&t.source&&i.push(t.source);return new RegExp(i.join("|"),"i")}function st(n){var t=[];return c(n,function(n,i){t.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}),t.join("&")}function g(n){var t=n.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/),i,r;return t?(i=t[6]||"",r=t[8]||"",{protocol:t[2],host:t[4],path:t[5],relative:t[5]+i+r}):{}}function ht(){var i=r.crypto||r.msCrypto,n,t;return!h(i)&&i.getRandomValues?(n=new Uint16Array(8),i.getRandomValues(n),n[3]=4095&n[3]|16384,n[4]=16383&n[4]|32768,t=function(n){for(var t=n.toString(16);t.length<4;)t="0"+t;return t},t(n[0])+t(n[1])+t(n[2])+t(n[3])+t(n[4])+t(n[5])+t(n[6])+t(n[7])):"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=16*Math.random()|0,i="x"===n?t:3&t|8;return i.toString(16)})}function ct(n){for(var t,i=[],r=0,u=0,f=" > ",e=f.length;n&&r++<5&&(t=lt(n),!("html"===t||r>1&&u+i.length*e+t.length>=80));)i.push(t),u+=t.length,n=n.parentNode;return i.reverse().join(f)}function lt(n){var r,u,f,e,t,i=[],o;if(!n||!n.tagName)return"";if(i.push(n.tagName.toLowerCase()),n.id&&i.push("#"+n.id),r=n.className,r&&b(r))for(u=r.split(/\s+/),t=0;t<u.length;t++)i.push("."+u[t]);for(o=["type","name","title","alt"],t=0;t<o.length;t++)f=o[t],e=n.getAttribute(f),e&&i.push("["+f+'="'+e+'"]');return i.join("")}function tt(n,t){return!!(!!n^!!t)}function at(n,t){return!tt(n,t)&&(n=n.values[0],t=t.values[0],n.type===t.type&&n.value===t.value&&it(n.stacktrace,t.stacktrace))}function it(n,t){var f,e,i,r,u;if(tt(n,t)||(f=n.frames,e=t.frames,f.length!==e.length))return!1;for(u=0;u<f.length;u++)if(i=f[u],r=e[u],i.filename!==r.filename||i.lineno!==r.lineno||i.colno!==r.colno||i["function"]!==r["function"])return!1;return!0}function o(n,t,i,r){var u=n[t];n[t]=i(u);r&&r.push([n,t,u])}var l=n(6),rt=n(7),p=n(1),ut=n(5),vt=ut.isError,ft=ut.isObject,yt=n(2).wrapMethod,pt="source protocol user pass host port path".split(" "),wt=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/,r="undefined"!=typeof window?window:"undefined"!=typeof i?i:"undefined"!=typeof self?self:{},u=r.document,et=r.navigator,nt;s.prototype={VERSION:"3.16.0",debug:!1,TraceKit:l,config:function(n,t){var r=this,i,o,u,s,e;return r.g?(this.y("error","Error: Raven has already been configured"),r):n?(i=r.k,t&&c(t,function(n,t){"tags"===n||"extra"===n||"user"===n?r.j[n]=t:i[n]=t}),r.setDSN(n),i.ignoreErrors.push(/^Script error\.?$/),i.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),i.ignoreErrors=y(i.ignoreErrors),i.ignoreUrls=!!i.ignoreUrls.length&&y(i.ignoreUrls),i.whitelistUrls=!!i.whitelistUrls.length&&y(i.whitelistUrls),i.includePaths=y(i.includePaths),i.maxBreadcrumbs=Math.max(0,Math.min(i.maxBreadcrumbs||100,100)),o={xhr:!0,console:!0,dom:!0,location:!0},u=i.autoBreadcrumbs,"[object Object]"==={}.toString.call(u)?u=f(o,u):u!==!1&&(u=o),i.autoBreadcrumbs=u,s={tryCatch:!0},e=i.instrument,"[object Object]"==={}.toString.call(e)?e=f(s,e):e!==!1&&(e=s),i.instrument=e,l.collectWindowErrors=!!i.collectWindowErrors,r):r},install:function(){var n=this;return n.isSetup()&&!n.m&&(l.report.subscribe(function(){n.z.apply(n,arguments)}),n.k.instrument&&n.k.instrument.tryCatch&&n.A(),n.k.autoBreadcrumbs&&n.B(),n.C(),n.m=!0),Error.stackTraceLimit=n.k.stackTraceLimit,this},setDSN:function(n){var t=this,i=t.D(n),r=i.path.lastIndexOf("/"),u=i.path.substr(1,r);t.E=n;t.h=i.user;t.F=i.pass&&i.pass.substr(1);t.i=i.path.substr(r+1);t.g=t.G(i);t.H=t.g+"/"+u+"api/"+t.i+"/store/";this.x()},context:function(n,t,i){return e(n)&&(i=t||[],t=n,n=void 0),this.wrap(n,t).apply(this,i)},wrap:function(n,t,i){function r(){var u=[],r=arguments.length,s=!n||n&&n.deep!==!1;for(i&&e(i)&&i.apply(this,arguments);r--;)u[r]=s?f.wrap(n,arguments[r]):arguments[r];try{return t.apply(this,u)}catch(o){throw f.I(),f.captureException(o,n),o;}}var f=this,u;if(h(t)&&!e(n))return n;if(e(n)&&(t=n,n=void 0),!e(t))return t;try{if(t.J)return t;if(t.K)return t.K}catch(o){return t}for(u in t)d(t,u)&&(r[u]=t[u]);return r.prototype=t.prototype,t.K=r,r.J=!0,r.L=t,r},uninstall:function(){return l.report.uninstall(),this.M(),Error.stackTraceLimit=this.n,this.m=!1,this},captureException:function(n,t){if(!vt(n))return this.captureMessage(n,f({trimHeadFrames:1,stacktrace:!0},t));this.d=n;try{var r=l.computeStackTrace(n);this.N(r,t)}catch(i){if(n!==i)throw i;}return this},captureMessage:function(n,t){var i,r,u,e;if(!this.k.ignoreErrors.test||!this.k.ignoreErrors.test(n)){if(t=t||{},i=f({message:n+""},t),this.k.stacktrace||t&&t.stacktrace){try{throw new Error(n);}catch(o){r=o}r.name=null;t=f({fingerprint:n,trimHeadFrames:(t.trimHeadFrames||0)+1},t);u=l.computeStackTrace(r);e=this.O(u,t);i.stacktrace={frames:e.reverse()}}return this.P(i),this}},captureBreadcrumb:function(n){var i=f({timestamp:a()/1e3},n),t;if(e(this.k.breadcrumbCallback))if(t=this.k.breadcrumbCallback(i),ft(t)&&!k(t))i=t;else if(t===!1)return this;return this.t.push(i),this.t.length>this.k.maxBreadcrumbs&&this.t.shift(),this},addPlugin:function(n){var t=[].slice.call(arguments,1);return this.q.push([n,t]),this.m&&this.C(),this},setUserContext:function(n){return this.j.user=n,this},setExtraContext:function(n){return this.Q("extra",n),this},setTagsContext:function(n){return this.Q("tags",n),this},clearContext:function(){return this.j={},this},getContext:function(){return JSON.parse(rt(this.j))},setEnvironment:function(n){return this.k.environment=n,this},setRelease:function(n){return this.k.release=n,this},setDataCallback:function(n){var t=this.k.dataCallback;return this.k.dataCallback=w(t,n),this},setBreadcrumbCallback:function(n){var t=this.k.breadcrumbCallback;return this.k.breadcrumbCallback=w(t,n),this},setShouldSendCallback:function(n){var t=this.k.shouldSendCallback;return this.k.shouldSendCallback=w(t,n),this},setTransport:function(n){return this.k.transport=n,this},lastException:function(){return this.d},lastEventId:function(){return this.f},isSetup:function(){return!!this.a&&(!!this.g||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this.y("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var n=r.RavenConfig;n&&this.config(n.dsn,n.config).install()},showReportDialog:function(n){var o,f,r,t,i,s,e;if(u){if(n=n||{},o=n.eventId||this.lastEventId(),!o)throw new p("Missing eventId");if(f=n.dsn||this.E,!f)throw new p("Missing DSN");r=encodeURIComponent;t="";t+="?eventId="+r(o);t+="&dsn="+r(f);i=n.user||this.j.user;i&&(i.name&&(t+="&name="+r(i.name)),i.email&&(t+="&email="+r(i.email)));s=this.G(this.D(f));e=u.createElement("script");e.async=!0;e.src=s+"/api/embed/error-page/"+t;(u.head||u.body).appendChild(e)}},I:function(){var n=this;this.l+=1;setTimeout(function(){n.l-=1})},R:function(n,t){var i,r;if(this.b){t=t||{};n="raven"+n.substr(0,1).toUpperCase()+n.substr(1);u.createEvent?(i=u.createEvent("HTMLEvents"),i.initEvent(n,!0,!0)):(i=u.createEventObject(),i.eventType=n);for(r in t)d(t,r)&&(i[r]=t[r]);if(u.createEvent)u.dispatchEvent(i);else try{u.fireEvent("on"+i.eventType.toLowerCase(),i)}catch(f){}}},S:function(n){var t=this;return function(i){if(t.T=null,t.u!==i){t.u=i;var r;try{r=ct(i.target)}catch(u){r="<unknown>"}t.captureBreadcrumb({category:"ui."+n,message:r})}}},U:function(){var n=this,t=1e3;return function(i){var r,u,f;try{r=i.target}catch(e){return}u=r&&r.tagName;u&&("INPUT"===u||"TEXTAREA"===u||r.isContentEditable)&&(f=n.T,f||n.S("input")(i),clearTimeout(f),n.T=setTimeout(function(){n.T=null},t))}},V:function(n,t){var i=g(this.v.href),r=g(t),u=g(n);this.w=t;i.protocol===r.protocol&&i.host===r.host&&(t=r.relative);i.protocol===u.protocol&&i.host===u.host&&(n=u.relative);this.captureBreadcrumb({category:"navigation",data:{to:t,from:n}})},A:function(){function f(t){return function(){for(var u,i=new Array(arguments.length),r=0;r<i.length;++r)i[r]=arguments[r];return u=i[0],e(u)&&(i[0]=n.wrap(u)),t.apply?t.apply(this,i):t(i[0],i[1])}}function h(i){var u=r[i]&&r[i].prototype;u&&u.hasOwnProperty&&u.hasOwnProperty("addEventListener")&&(o(u,"addEventListener",function(t){return function(r,u,f,e){try{u&&u.handleEvent&&(u.handleEvent=n.wrap(u.handleEvent))}catch(l){}var o,h,c;return s&&s.dom&&("EventTarget"===i||"Node"===i)&&(h=n.S("click"),c=n.U(),o=function(n){if(n){var t;try{t=n.type}catch(i){return}return"click"===t?h(n):"keypress"===t?c(n):void 0}}),t.call(this,r,n.wrap(u,void 0,o),f,e)}},t),o(u,"removeEventListener",function(n){return function(t,i,r,u){try{i=i&&(i.K?i.K:i)}catch(f){}return n.call(this,t,i,r,u)}},t))}var n=this,t=n.s,s=this.k.autoBreadcrumbs,u,i;for(o(r,"setTimeout",f,t),o(r,"setInterval",f,t),r.requestAnimationFrame&&o(r,"requestAnimationFrame",function(t){return function(i){return t(n.wrap(i))}},t),u=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],i=0;i<u.length;i++)h(u[i])},B:function(){function a(t,i){t in i&&e(i[t])&&o(i,t,function(t){return n.wrap(t)})}var n=this,t=this.k.autoBreadcrumbs,i=n.s,f,h,l;t.xhr&&"XMLHttpRequest"in r&&(f=XMLHttpRequest.prototype,o(f,"open",function(t){return function(i,r){return b(r)&&r.indexOf(n.h)===-1&&(this.W={method:i,url:r,status_code:null}),t.apply(this,arguments)}},i),o(f,"send",function(t){return function(){function u(){if(i.W&&(1===i.readyState||4===i.readyState)){try{i.W.status_code=i.status}catch(t){}n.captureBreadcrumb({type:"http",category:"xhr",data:i.W})}}for(var i=this,f=["onload","onerror","onprogress"],r=0;r<f.length;r++)a(f[r],i);return"onreadystatechange"in i&&e(i.onreadystatechange)?o(i,"onreadystatechange",function(t){return n.wrap(t,void 0,u)}):i.onreadystatechange=u,t.apply(this,arguments)}},i));t.xhr&&"fetch"in r&&o(r,"fetch",function(t){return function(){for(var e,r,f,o,i=new Array(arguments.length),u=0;u<i.length;++u)i[u]=arguments[u];return r=i[0],f="GET","string"==typeof r?e=r:(e=r.url,r.method&&(f=r.method)),i[1]&&i[1].method&&(f=i[1].method),o={method:f,url:e,status_code:null},n.captureBreadcrumb({type:"http",category:"fetch",data:o}),t.apply(this,i).then(function(n){return o.status_code=n.status,n})}},i);t.dom&&this.b&&(u.addEventListener?(u.addEventListener("click",n.S("click"),!1),u.addEventListener("keypress",n.U(),!1)):(u.attachEvent("onclick",n.S("click")),u.attachEvent("onkeypress",n.U())));var s=r.chrome,v=s&&s.app&&s.app.runtime,y=!v&&r.history&&history.pushState;t.location&&y&&(h=r.onpopstate,r.onpopstate=function(){var t=n.v.href;if(n.V(n.w,t),h)return h.apply(this,arguments)},o(history,"pushState",function(t){return function(){var i=arguments.length>2?arguments[2]:void 0;return i&&n.V(n.w,i+""),t.apply(this,arguments)}},i));t.console&&"console"in r&&console.log&&(l=function(t,i){n.captureBreadcrumb({message:t,level:i.level,category:"console"})},c(["debug","info","warn","error","log"],function(n,t){yt(console,t,l)}))},M:function(){for(var n;this.s.length;){n=this.s.shift();var t=n[0],i=n[1],r=n[2];t[i]=r}},C:function(){var n=this;c(this.q,function(t,i){var r=i[0],u=i[1];r.apply(n,[n].concat(u))})},D:function(n){var r=wt.exec(n),t={},i=7;try{for(;i--;)t[pt[i]]=r[i]||""}catch(u){throw new p("Invalid DSN: "+n);}if(t.pass&&!this.k.allowSecretKey)throw new p("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return t},G:function(n){var t="//"+n.host+(n.port?":"+n.port:"");return n.protocol&&(t=n.protocol+":"+t),t},z:function(){this.l||this.N.apply(this,arguments)},N:function(n,t){var i=this.O(n,t);this.R("handle",{stackInfo:n,options:t});this.X(n.name,n.message,n.url,n.lineno,i,t)},O:function(n,t){var u=this,i=[],r;if(n.stack&&n.stack.length&&(c(n.stack,function(n,t){var r=u.Y(t);r&&i.push(r)}),t&&t.trimHeadFrames))for(r=0;r<t.trimHeadFrames&&r<i.length;r++)i[r].in_app=!1;return i=i.slice(0,this.k.stackTraceLimit)},Y:function(n){if(n.url){var t={filename:n.url,lineno:n.line,colno:n.column,"function":n.func||"?"};return t.in_app=!(this.k.includePaths.test&&!this.k.includePaths.test(t.filename)||/(Raven|TraceKit)\./.test(t["function"])||/raven\.(min\.)?js$/.test(t.filename)),t}},X:function(n,t,i,r,u,e){var o,s;this.k.ignoreErrors.test&&this.k.ignoreErrors.test(t)||(t+="",u&&u.length?(i=u[0].filename||i,u.reverse(),o={frames:u}):i&&(o={frames:[{filename:i,lineno:r,in_app:!0}]}),this.k.ignoreUrls.test&&this.k.ignoreUrls.test(i)||this.k.whitelistUrls.test&&!this.k.whitelistUrls.test(i))||(s=f({exception:{values:[{type:n,value:t,stacktrace:o}]},culprit:i},e),this.P(s))},Z:function(n){var r=this.k.maxMessageLength,i,t;return(n.message&&(n.message=v(n.message,r)),n.exception)&&(i=n.exception.values[0],i.value=v(i.value,r)),t=n.request,t&&(t.url&&(t.url=v(t.url,this.k.maxUrlLength)),t.Referer&&(t.Referer=v(t.Referer,this.k.maxUrlLength))),n.breadcrumbs&&n.breadcrumbs.values&&this.$(n.breadcrumbs),n},$:function(n){for(var u,t,i,e,o=["to","from","url"],r=0;r<n.values.length;++r)if(t=n.values[r],t.hasOwnProperty("data")&&ft(t.data)&&!ot(t.data)){for(i=f({},t.data),e=0;e<o.length;++e)u=o[e],i.hasOwnProperty(u)&&(i[u]=v(i[u],this.k.maxUrlLength));n.values[r].data=i}},_:function(){if(this.c||this.b){var n={};return this.c&&et.userAgent&&(n.headers={"User-Agent":navigator.userAgent}),this.b&&(u.location&&u.location.href&&(n.url=u.location.href),u.referrer&&(n.headers||(n.headers={}),n.headers.Referer=u.referrer)),n}},x:function(){this.aa=0;this.ba=null},ca:function(){return this.aa&&a()-this.ba<this.aa},da:function(n){var t=this.e;return!(!t||n.message!==t.message||n.culprit!==t.culprit)&&(n.stacktrace||t.stacktrace?it(n.stacktrace,t.stacktrace):!n.exception&&!t.exception||at(n.exception,t.exception))},ea:function(n){var i,t;if(!this.ca()&&(i=n.status,400===i||401===i||429===i)){try{t=n.getResponseHeader("Retry-After");t=1e3*parseInt(t,10)}catch(r){}this.aa=t?t:2*this.aa||1e3;this.ba=a()}},P:function(n){var t=this.k,i={project:this.i,logger:t.logger,platform:"javascript"},r=this._();if(r&&(i.request=r),n.trimHeadFrames&&delete n.trimHeadFrames,n=f(i,n),n.tags=f(f({},this.j.tags),n.tags),n.extra=f(f({},this.j.extra),n.extra),n.extra["session:duration"]=a()-this.r,this.t&&this.t.length>0&&(n.breadcrumbs={values:[].slice.call(this.t,0)}),k(n.tags)&&delete n.tags,this.j.user&&(n.user=this.j.user),t.environment&&(n.environment=t.environment),t.release&&(n.release=t.release),t.serverName&&(n.server_name=t.serverName),e(t.dataCallback)&&(n=t.dataCallback(n)||n),n&&!k(n)&&(!e(t.shouldSendCallback)||t.shouldSendCallback(n)))return this.ca()?void this.y("warn","Raven dropped error due to backoff: ",n):void("number"==typeof t.sampleRate?Math.random()<t.sampleRate&&this.fa(n):this.fa(n))},ga:function(){return ht()},fa:function(n,t){var i=this,e=this.k,f,r,u;if(this.isSetup()){if(this.f=n.event_id||(n.event_id=this.ga()),n=this.Z(n),!this.k.allowDuplicates&&this.da(n))return void this.y("warn","Raven dropped repeat event: ",n);this.e=n;this.y("debug","Raven about to send:",n);f={sentry_version:"7",sentry_client:"raven-js/"+this.VERSION,sentry_key:this.h};this.F&&(f.sentry_secret=this.F);r=n.exception&&n.exception.values[0];this.captureBreadcrumb({category:"sentry",message:r?(r.type?r.type+": ":"")+r.value:n.message,event_id:n.event_id,level:n.level||"error"});u=this.H;(e.transport||this.ha).call(this,{url:u,auth:f,data:n,options:e,onSuccess:function(){i.x();i.R("success",{data:n,src:u});t&&t()},onError:function(r){i.y("error","Raven transport failed to send: ",r);r.request&&i.ea(r.request);i.R("failure",{data:n,src:u});r=r||new Error("Raven send failed (no additional details provided)");t&&t(r)}})}},ha:function(n){var t=new XMLHttpRequest,r="withCredentials"in t||"undefined"!=typeof XDomainRequest,i;r&&(i=n.url,"withCredentials"in t?t.onreadystatechange=function(){if(4===t.readyState)if(200===t.status)n.onSuccess&&n.onSuccess();else if(n.onError){var i=new Error("Sentry error code: "+t.status);i.request=t;n.onError(i)}}:(t=new XDomainRequest,i=i.replace(/^https?:/,""),n.onSuccess&&(t.onload=n.onSuccess),n.onError&&(t.onerror=function(){var i=new Error("Sentry error code: XDomainRequest");i.request=t;n.onError(i)})),t.open("POST",i+"?"+st(n.auth)),t.send(rt(n.data)))},y:function(n){this.p[n]&&this.debug&&Function.prototype.apply.call(this.p[n],this.o,[].slice.call(arguments,1))},Q:function(n,t){h(t)?delete this.j[n]:this.j[n]=f(this.j[n]||{},t)}};nt=Object.prototype;s.prototype.setUser=s.prototype.setUserContext;s.prototype.setReleaseContext=s.prototype.setRelease;t.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{1:1,2:2,5:5,6:6,7:7}],4:[function(n,t){(function(i){"use strict";var f=n(3),u="undefined"!=typeof window?window:"undefined"!=typeof i?i:"undefined"!=typeof self?self:{},e=u.Raven,r=new f;r.noConflict=function(){return u.Raven=e,r};r.afterLoad();t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{3:3}],5:[function(n,t){"use strict";function i(n){return"object"==typeof n&&null!==n}function r(n){switch({}.toString.call(n)){case"[object Error]":return!0;case"[object Exception]":return!0;case"[object DOMException]":return!0;default:return n instanceof Error}}function u(n){function t(t,i){var r=n(t)||t;return i?i(r)||r:r}return t}t.exports={isObject:i,isError:r,wrappedCallback:u}},{}],6:[function(n,t){(function(i){"use strict";function f(){return"undefined"==typeof document||"undefined"==typeof document.location?"":document.location.href}var s=n(5),r={collectWindowErrors:!0,debug:!1},e="undefined"!=typeof window?window:"undefined"!=typeof i?i:"undefined"!=typeof self?self:{},o=[].slice,u="?",h=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;r.report=function(){function w(t){g();n.push(t)}function b(t){for(var i=n.length-1;i>=0;--i)n[i]===t&&n.splice(i,1)}function k(){nt();n=[]}function v(t,i){var u=null,f;if(!i||r.collectWindowErrors){for(f in n)if(n.hasOwnProperty(f))try{n[f].apply(null,[t].concat(o.call(arguments,2)))}catch(e){u=e}if(u)throw u;}}function d(n,e,o,c,l){var p=null,a;if(t)r.computeStackTrace.augmentStackTraceWithInitialElement(t,e,o,n),y();else if(l&&s.isError(l))p=r.computeStackTrace(l),v(p,!0);else{var a,w={url:e,line:o,column:c},b=void 0,k=n;"[object String]"==={}.toString.call(n)&&(a=n.match(h),a&&(b=a[1],k=a[2]));w.func=u;p={name:b,message:k,url:f(),stack:[w]};v(p,!0)}return!!i&&i.apply(this,arguments)}function g(){l||(i=e.onerror,e.onerror=d,l=!0)}function nt(){l&&(e.onerror=i,l=!1,i=void 0)}function y(){var n=t,i=p;p=null;t=null;a=null;v.apply(null,[n,!1].concat(i))}function c(n,i){var f=o.call(arguments,1),u;if(t){if(a===n)return;y()}if(u=r.computeStackTrace(n),t=u,a=n,p=f,setTimeout(function(){a===n&&y()},u.incomplete?2e3:0),i!==!1)throw n;}var i,l,n=[],p=null,a=null,t=null;return c.subscribe=w,c.unsubscribe=b,c.uninstall=k,c}();r.computeStackTrace=function(){function t(n){var c,o;if("undefined"!=typeof n.stack&&n.stack){for(var i,t,r,s=n.stack.split("\n"),h=[],e=(/^(.*) is undefined$/.exec(n.message),0),l=s.length;e<l;++e){if(t=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i.exec(s[e]))c=t[2]&&0===t[2].indexOf("native"),o=t[2]&&0===t[2].indexOf("eval"),o&&(i=/\((\S*)(?::(\d+))(?::(\d+))\)/.exec(t[2]))&&(t[2]=i[1],t[3]=i[2],t[4]=i[3]),r={url:c?null:t[2],func:t[1]||u,args:c?[t[2]]:[],line:t[3]?+t[3]:null,column:t[4]?+t[4]:null};else if(t=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i.exec(s[e]))r={url:t[2],func:t[1]||u,args:[],line:+t[3],column:t[4]?+t[4]:null};else{if(!(t=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?)(?::(\d+))?(?::(\d+))?\s*$/i.exec(s[e])))continue;o=t[3]&&t[3].indexOf(" > eval")>-1;o&&(i=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i.exec(t[3]))?(t[3]=i[1],t[4]=i[2],t[5]=null):0!==e||t[5]||"undefined"==typeof n.columnNumber||(h[0].column=n.columnNumber+1);r={url:t[3],func:t[1]||u,args:t[2]?t[2].split(","):[],line:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}!r.func&&r.line&&(r.func=u);h.push(r)}return h.length?{name:n.name,message:n.message,url:f(),stack:h}:null}}function i(n,t,i){var r={url:t,line:i};if(r.url&&r.line){if(n.incomplete=!1,r.func||(r.func=u),n.stack.length>0&&n.stack[0].url===r.url){if(n.stack[0].line===r.line)return!1;if(!n.stack[0].line&&n.stack[0].func===r.func)return n.stack[0].line=r.line,!1}return n.stack.unshift(r),n.partial=!0,!0}return n.incomplete=!0,!1}function e(t,o){for(var a,c,h,l=[],v={},y=!1,s=e.caller;s&&!y;s=s.caller)if(s!==n&&s!==r.report){if(h={url:null,func:u,line:null,column:null},s.name?h.func=s.name:(c=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i.exec(s.toString()))&&(h.func=c[1]),"undefined"==typeof h.func)try{h.func=c.input.substring(0,c.input.indexOf("{"))}catch(p){}v[""+s]?y=!0:v[""+s]=!0;l.push(h)}return o&&l.splice(0,o),a={name:t.name,message:t.message,url:f(),stack:l},i(a,t.sourceURL||t.fileName,t.line||t.lineNumber,t.message||t.description),a}function n(n,i){var u=null;i=null==i?0:+i;try{if(u=t(n))return u}catch(o){if(r.debug)throw o;}try{if(u=e(n,i+1))return u}catch(o){if(r.debug)throw o;}return{name:n.name,message:n.message,url:f()}}return n.augmentStackTraceWithInitialElement=i,n.computeStackTraceFromStackProp=t,n}();t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{5:5}],7:[function(n,t,i){"use strict";function r(n,t){for(var i=0;i<n.length;++i)if(n[i]===t)return i;return-1}function f(n,t,i,r){return JSON.stringify(n,u(t,r),i)}function u(n,t){var i=[],u=[];return null==t&&(t=function(n,t){return i[0]===t?"[Circular ~]":"[Circular ~."+u.slice(0,r(i,t)).join(".")+"]"}),function(f,e){if(i.length>0){var o=r(i,this);~o?i.splice(o+1):i.push(this);~o?u.splice(o,1/0,f):u.push(f);~r(i,e)&&(e=t.call(this,f,e))}else i.push(e);return null==n?e:n.call(this,f,e)}}i=t.exports=f;i.getSerialize=u},{}]},{},[4])(4)});$(function(){Tracker.init()});Tracker={init:function(){Raven.debug=!1;Raven.isSetup()||(this.ClientDsnKey=$("#TrackerClientDsnKey").val(),this.Enabled=$("#TrackerIsEnabled").val()==="True",this.LoggerID=$("#TrackerClientLogger").val(),this.DataPath=$("#TrackerDataPath").val(),this.Enabled==!0&&this.TryLoadData())},LoggerID:null,ClientDsnKey:null,IgnoreErrors:[],IgnoreUrls:[],WhitelistUrls:[],IncludePaths:[],IsInstalled:!1,DataPath:null,Enabled:!1,InstallRaven:function(){this.IsInstalled!=!0&&(this.IsInstalled=!0,Raven.config(this.ClientDsnKey,{logger:this.LoggerID,whitelistUrls:this.WhitelistUrls,ignoreErrors:this.IgnoreErrors,ignoreUrls:this.IgnoreUrls,includePaths:this.IncludePaths}).install())},TryLoadData:function(){var n=this;try{if(n.DataPath==null){n.InstallRaven();return}$.getJSON(n.DataPath,function(t){if(t==null){n.IsInstalled=!0;return}n.IgnoreErrors=t.ignoreErrors;n.IgnoreUrls=t.ignoreUrls;n.WhitelistUrls=t.whitelistUrls;n.IncludePaths=t.includePaths}).always(function(){n.InstallRaven()})}catch(t){n.InstallRaven()}},SendError:function(n,t,i,r){if(!this.Enabled!=!0){var u={};typeof i!="undefined"&&i!=""&&(u.level=i);typeof r!="undefined"&&r!=null&&(u.tags=r);typeof t!="undefined"&&t!=null&&(u.extra=t);Raven.captureException(n,u)}},SendMessage:function(n,t,i){if(!this.Enabled!=!0){var r={level:"info"};typeof i!="undefined"&&i!=null&&(r.tags=i);typeof t!="undefined"&&t!=null&&(r.extra=t);Raven.captureMessage(n,r)}}};Quote={Models:{ProductToggle:{Hospital:["BPH","SPH","VBE","VBp","VMp","GSFp","GEFp","GEFpN"],Extras:["BS","B55","GS","G75","SS","S65","VE","VC","VP","VBp","VMp","GSFp","GEFp","GPFp","GEFpN","GPFpN"]}},Views:{Helpers:{formatString:function(n){var t=Array.prototype.slice.call(arguments,1);return n.replace(/{(\d+)}/g,function(n,i){return typeof t[i]!="undefined"?t[i]:n})},determineCoverageIcon:function(n){var t="";switch(n.Coverage){case"co":t="ss-check";break;case"nc":t="ss-delete";break;case"pp":t="ss-check color-orange";break;case"pc":t="ss-check gmh-icon-co-payments color-blue";break;case"cb":t="ss-check gmh-icon-blp color-blue";break;case"lc":t="ss-check color-blue"}return t},productGetOption:function(n,t){return n==null?null:n.Options.find(function(n){return n.Type===t})},productHasOption:function(n,t){if(n==null)return!1;switch(t){case"Obstetrics":return n.Obstetrics;case"MedicalGap":return n.MedicalGap;case"SomePrivate":return n.SomePrivate;case"ExtrasBenefit":return n.ExtrasBenefit.length>0;case"ShowObstetrics":return n.ShowObstetrics;default:return!1}},productGetExtrasOption1Value:function(n){if(n==null)return"";switch(n.CoverLevel.toLowerCase()){case"bronze":return"BS";case"silver":return"SS";case"gold":return"GS";case"basic":return"BBE5";case"top":return"BTE5";case"some":return"fSE5";case"lots":return"fLE5";default:return""}},productGetExtrasOption2Value:function(n){if(n==null)return"";switch(n.CoverLevel.toLowerCase()){case"bronze":return"B55";case"silver":return"S65";case"gold":return"G75";case"basic":return"BBE8";case"top":return"BTE8";case"some":return"fSE8";case"lots":return"fLE8";default:return""}},productGetCoverLevel:function(n,t){var i=Quote.Views.Helpers.productGetOption(n,t);return i&&i.CoverLevel.length>0?i.CoverLevel:""},productGetFactsheet:function(n,t){var i="";return i=n.IsPackage||!n.IsCombo?n.Code:t=="Hos"?n.HospitalComponentCode:t=="Anc"?n.ExtrasComponentCode:n.Code,"/Documents/FactSheets/{0}-FactSheet-{1}.pdf".replace("{0}",App.Settings.Brand).replace("{1}",i)},productGet2019Factsheet:function(n){return"/Documents/FactSheets/2019/{0}-FactSheet-Apr01-{1}.pdf".replace("{0}",App.Settings.Brand).replace("{1}",n)},productGetSelectedExcess:function(n,t){var i=t?"":"$";switch(parseInt(n)){case 0:return i+"0";case 1:return i+"250";case 2:return i+"500";case 3:return i+"450";default:return i+"450"}},productGetSelectedFrequency:function(n){switch(parseInt(n)){case 1:return"year";case 12:return"month";case 26:return"fortnight";case 52:return"week"}return""},productGetCoverType:function(n){return n.IsPackage||n.IsCombo?"2":n.Type=="Hos"?"0":n.Type=="Anc"?"1":""},productGetNextUrl:function(n,t,i){var f=Quote.Views.Helpers.productGetCoverType(n),r="hid=",u="&eid=",e,o,s,h;switch(f){case"1":u+=n.Code;break;case"0":r+=n.Code;break;default:r+=n.IsPackage?n.Code:n.HospitalComponentCode;u+=n.IsPackage?"":n.ExtrasComponentCode}return(e=typeof t==undefined||t==null?"":"&need="+t,o=typeof i==undefined||i==null?"":"&stage="+i,n.IsFitProduct==!0)?Quote.Views.Helpers.formatString("{0}?{1}{2}{3}{4}&ctype={5}#qreentry",App.Settings.Quote.Url,r,u,e,o,f):(s="",h="",n.HospitalCoverLevelCatergory&&n.HospitalCoverLevelCatergory.length>0&&(s="&hcl="+n.HospitalCoverLevelCatergory),n.ExtrasCoverLevelCategory&&n.ExtrasCoverLevelCategory.length>0&&(h="&ecl="+n.ExtrasCoverLevelCategory),Quote.Views.Helpers.formatString("{0}?{1}{2}{3}{4}{5}{6}&ctype={7}#compare",App.Settings.Quote.Url,r,u,e,o,s,h,f))},getFrequencyLabel:function(n){switch(n){case 52:return"week";case 26:return"fortnight";case 12:return"month";case 4:return"quarter";case 2:return"half-year";case 1:return"year"}},getLifeStageLabel:function(n){switch(n.toLowerCase()){case"s":return"Single";case"c":return"Couple";case"f":return"Family";case"p":return"Single parent"}},getNeedLabel:function(n){var t=(n||"").toUpperCase();switch(t){case"MT":t="Minimising Tax";break;case"PM":t="Peace of Mind";break;case"CC":t="Comprehensive Cover";break;case"TL":t="Top Level Cover";break;case"PF":t="Planning a Family";break;case"SF":t="Sports and Fitness";break;case"LC":t="Low Cost Cover";break;case"LL":t="Low Level Cover";break;case"ML":t="Mid Level Cover"}return t},getCoverLabel:function(n){n=""+(n||0);switch(n){case"0":n="hospital only";break;case"1":n="extras only";break;case"2":n="hospital and extras"}return n},getIncomeRangeLabel:function(n,t){var i=n=="F"||n=="C";switch(t){case 0:return i?"under $180,000":"under $90,000";case 1:return i?"between $180,000 - $210,000":"between $90,000 - $105,000";case 2:return i?"between $210,001 - $280,000":"between $105,001 - $140,000";case 3:return i?"over $280,000":"over $140,000";case 4:return"no income specified";default:return""}},getAgeLabel:function(n,t,i){var u=Quote.Helpers.getAge(n),f=Quote.Helpers.getAge(t),r="";return Number.isNaN(u)||(r+=u,i&&!Number.isNaN(f)&&(r+=" and "+f)),r},productGetExtrasOptionLabel:function(n){if(n==null)return"";switch(n.CoverLevel.toLowerCase()){case"bronze":return"55";case"silver":return"65";case"gold":return"75";default:return""}},getABCSettingID:function(){return Quote.Helpers.getCookie(App.Settigns.ABC.Key)}}},Helpers:{isValidDate:function(n,t){return Quote.Helpers.isValidDateCore(n,t,!1)},isValidAdultDate:function(n,t){return Quote.Helpers.isValidDateCore(n,t,!0)},isValidDateCore:function(n,t,i){var t=t||"mm/dd/yyyy",r=/[^mdy]/.exec(t)[0],u=t.split(r),f=n.split(r),e=function(n,t){for(var f,e,r,s,u=0,o=t.length;u<o;u++)/m/.test(t[u])&&(f=n[u]),/d/.test(t[u])&&(e=n[u]),/y/.test(t[u])&&(r=n[u]);return i?(s=(new Date).getFullYear()-18,f>0&&f<13&&r&&r.length===4&&r>1900&&r<=s&&e>0&&e<=new Date(r,f,0).getDate()):f>0&&f<13&&r&&r.length===4&&r>1900&&e>0&&e<=new Date(r,f,0).getDate()};return e(f,u)},getYear:function(n){var t=Quote.Helpers.getDob(n);return t?t.getFullYear():""},calculateLhcYears:function(n,t){var i,u,f,r;if(t||t===null)return 0;i=0;u=Quote.Helpers.getDob(n);u&&(f=new Date,r=new Date(f.getFullYear(),6,1),f<=r&&r.setFullYear(r.getFullYear()-1),i=Quote.Helpers.getAgeOn(u,r));var e=0,o=new Date(1934,6,1),s=Quote.Helpers.getAge(o);return i>s?e:i<=30?e:i-30},calculateLhcByDate:function(n){n=this.getDob(n);var t=this.calculateLhcYears(n);return Math.min(t*.02,.7)},calculateLhcCombined:function(n,t,i,r,u){var f=0,e=0,o=t||t===null?0:this.calculateLhcByDate(this.getDob(n));return f=o,i&&(e=u||u===null?0:this.calculateLhcByDate(this.getDob(r)),f=(f+e)/2),{combined:f,primary:o,partner:e}},getDob:function(n){if(n instanceof Date)return n;n=n||"";try{var t=n.split("/",3);return t.length<2&&(t=n.split("-",3)),new Date(t[2],parseInt(t[1])-1,t[0])}catch(i){console.log("Couldn't parse date of birth!");Tracker.SendError(i,{message:"Couldn't parse date of birth!",func:"getDob",dob:n})}return null},getDobByAge:function(n){var t=new Date;n==null&&(n=35);t.setYear(t.getFullYear()-n);var u=t.getFullYear().toString(),i=(t.getMonth()+1).toString(),r=t.getDate().toString();return(r[1]?r:"0"+r[0])+"/"+(i[1]?i:"0"+i[0])+"/"+u},getAge:function(n){var t=new Date,f=t.getFullYear(),r=t.getMonth(),e=t.getDate();try{var i=this.getDob(n),o=i.getDate(),u=i.getMonth(),s=i.getFullYear();return age=f-s,r<u&&age--,u==r&&e<o&&age--,age}catch(h){console.log("Couldn't parse date of birth!");Tracker.SendError(h,{message:"Couldn't parse date of birth!",func:"getAge",dob:n})}return 0},getAgeOn:function(n,t){var i=t.getFullYear()-n.getFullYear();return(t.getMonth()<n.getMonth()||t.getMonth()==n.getMonth()&&t.getDate()<n.getDate())&&i--,i},getRateRequestParams:function(n,t){t&&t==!1||Quote.Helpers.saveProspectData(n);return{dob:n.attributes.dob,partnerdob:n.attributes.partnerdob,lifeStage:n.attributes.lifestage,state:n.attributes.state,postcode:n.attributes.postcode,rebateTier:parseInt(n.attributes.rebatetier),coverType:"",paymentFrequency:n.attributes.paymentfrequency,groupDiscount:n.attributes.groupDiscount,getProductBy:3,brand:App.Settings.Brand,effectiveFrom:n.attributes.effectivefrom,hospitalCoverLevel:"",obstetricsCover:!1,medicalGap:!1,somePrivate:!1,extrasCoverLevel:"",extrasBenefit:"",useHAMBSCombinedRate:!0,abcSettingID:n.attributes.abcSettingID,discountOverride:n.attributes.discountOverride}},getProductByNeedRequestParams:function(n,t){return{dob:n.attributes.dob,partnerdob:n.attributes.partnerdob,lifeStage:n.attributes.lifestage,state:n.attributes.state,rebateTier:parseInt(n.attributes.rebatetier),paymentFrequency:n.attributes.paymentfrequency,need:n.attributes.need,groupDiscount:n.attributes.groupDiscount,brand:App.Settings.Brand,coverType:t,effectiveFrom:n.attributes.effectivefrom,abcSettingID:n.attributes.abcSettingID,pageCustomContentID:n.attributes.pageCustomContentID,isSalesPortal:App.Settings.SalesPortal.IsActive,discountOverride:n.attributes.discountOverride}},getProductByCoverLevelRequestParams:function(n,t){return{dob:n.attributes.dob,partnerdob:n.attributes.partnerdob,lifeStage:n.attributes.lifestage,state:n.attributes.state,rebateTier:parseInt(n.attributes.rebatetier),paymentFrequency:n.attributes.paymentfrequency,need:"XX",groupDiscount:n.attributes.groupDiscount,brand:App.Settings.Brand,coverType:t,effectiveFrom:n.attributes.effectivefrom,hospitalCoverLevel:n.attributes.hospitalCoverLevel,extrasCoverLevel:n.attributes.extrasCoverLevel,abcSettingID:n.attributes.abcSettingID,pageCustomContentID:n.attributes.pageCustomContentID,isSalesPortal:App.Settings.SalesPortal.IsActive,discountOverride:n.attributes.discountOverride}},getFinalProductRequestParams:function(n){return request={dob:n.attributes.dob,partnerdob:n.attributes.partnerdob,lifeStage:n.attributes.lifestage,state:n.attributes.state,rebateTier:parseInt(n.attributes.rebatetier),paymentFrequency:n.attributes.paymentfrequency,need:n.attributes.need,effectiveFrom:n.attributes.effectivefrom,postcode:n.attributes.postcode,coverType:n.attributes.coverType,getProductBy:3,brand:App.Settings.Brand,groupDiscount:n.attributes.groupDiscount,useHAMBSCombinedRate:!0,abcSettingID:n.attributes.abcSettingID,isSalesPortal:App.Settings.SalesPortal.IsActive,discountOverride:n.attributes.discountOverride}},getProductDetailRequestParams:function(n){return{dob:n.attributes.dob,partnerdob:n.attributes.partnerdob,lifeStage:n.attributes.lifestage,state:n.attributes.state,rebateTier:parseInt(n.attributes.rebatetier),paymentFrequency:n.attributes.paymentfrequency,need:n.attributes.need,groupDiscount:n.attributes.groupDiscount,brand:App.Settings.Brand,coverType:n.attributes.coverType,effectiveFrom:n.attributes.effectivefrom,useHAMBSCombinedRate:!0,abcSettingID:n.attributes.abcSettingID,pageCustomContentID:n.attributes.pageCustomContentID,isSalesPortal:App.Settings.SalesPortal.IsActive}},getEmailQuoteRequestParams:function(n){return request={dob:n.attributes.dob,partnerdob:n.attributes.partnerdob,lifeStage:n.attributes.lifestage,state:n.attributes.state,rebateTier:parseInt(n.attributes.rebatetier),paymentFrequency:n.attributes.paymentfrequency,need:n.attributes.need,effectiveFrom:n.attributes.effectivefrom,postcode:n.attributes.postcode,coverType:n.attributes.coverType,brand:App.Settings.Brand,groupDiscount:n.attributes.groupDiscount,useHAMBSCombinedRate:!0,getProductBy:3,hospitalCode:n.attributes.hospitalcode,extrasCode:n.attributes.extrascode,abcSettingID:n.attributes.abcSettingID,pageCustomContentID:n.attributes.pageCustomContentID,discountOverride:n.attributes.discountOverride,reference:"qreentry"}},getQuote:function(n,t){var u=App.Settigns.API.Url+"Rate",i=Quote.Helpers.getRateRequestParams(n),r,f;n.attributes.stateconfirmed&&n.attributes.state.length>0?(r=[],r[0]=i,f=JSON.stringify(r),$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:u,data:f,dataType:"json",success:function(n){t(n)},error:function(n){Tracker.SendError("Error in getQuote",{response:n,url:this.url,data:this.data})}})):Quote.Helpers.getRealState(i.postcode,function(r){var r,f;n.attributes.stateconfirmed=!0;n.attributes.state=r.state;i.state=r.state;r=[];r[0]=i;f=JSON.stringify(r);$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:u,data:f,dataType:"json",success:function(n){t(n)},error:function(n){Tracker.SendError("Error in getRealState",{response:n,url:this.url,data:this.data})}})})},getRateValue:function(n){return n[0].combinedNetAmount},getRate:function(n,t,i,r){var u=JSON.stringify(n),f=JSON.stringify({command:"/rate",parameters:u});$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"/Handlers/APIProxy.ashx",data:f,dataType:"json",success:function(n){i.call(t,n)},error:function(n){r.call(t,n);Tracker.SendError("Error in getRate",{response:n,url:this.url,data:this.data})}})},sendQuoteEmail:function(n,t,i,r,u,f){var e=JSON.stringify({raterequests:i,emailAddress:t.EmailAddress,firstName:t.FirstName,lastName:t.LastName,mobileNo:t.MobileNo,sessionID:n}),o=JSON.stringify({command:"/quote/emailme",parameters:e});$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"/Handlers/APIProxy.ashx",data:o,dataType:"json",success:function(n){u.call(r,n)},error:function(n){(f.call(r,n),n!=null&&n.status!=0)&&Tracker.SendError("Error in sendQuoteEmail",{response:n,url:this.url,data:this.data})}})},getQuoteLink:function(n,t,i,r,u){var f=JSON.stringify({raterequests:i,emailAddress:t,sessionID:n}),e=JSON.stringify({command:"/quote/link",parameters:f});$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"/Handlers/APIProxy.ashx",data:e,dataType:"json",success:function(n){r(n)},error:function(n){(u(n),n!=null&&n.status!=0)&&Tracker.SendError("Error in getQuoteLink AJAX result",{response:n,url:this.url,data:this.data})}})},sendProspect:function(n,t){try{var i=JSON.stringify(n),r=JSON.stringify({command:"/prospect/process",parameters:i});$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"/Handlers/APIProxy.ashx",data:r,dataType:"json",success:function(n){t(n)},error:function(n){n!=null&&n.status!=0&&Tracker.SendError("Error in sendProspect AJAX result",{response:n,url:this.url,data:this.data})}})}catch(u){Tracker.SendError("Error in sendProspect",{response:result,url:this.url,data:this.data})}},getProductsByNeed:function(n,t,i,r){var u=JSON.stringify(n),f=JSON.stringify({command:"/product/detail",parameters:u});$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"/Handlers/APIProxy.ashx",data:f,dataType:"json",success:function(n){i.call(t,n)},error:function(n){(r.call(t,n),n!=null&&n.status!=0)&&Tracker.SendError("Error in getProductsByNeed",{response:n,url:this.url,data:this.data})}})},getProductDetail:function(n,t,i,r){var u=JSON.stringify(n),f=JSON.stringify({command:"/product/detail",parameters:u});$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"/Handlers/APIProxy.ashx",data:f,dataType:"json",success:function(n){i.call(t,n)},error:function(n){(r.call(t,n),n!=null&&n.status!=0)&&Tracker.SendError("Error in getProductDetail",{response:n,url:this.url,data:this.data})}})},loadProspectData:function(){var t={dobIsDefault:!0,dob:this.getDobByAge(35),partnerdob:"",lifestage:"S",state:"VIC",postcode:"",rebatetier:0,hospitalcode:"",extrascode:"",extrasId:0,paymentfrequency:52,excessLevel:"2",effectivefrom:"NOW",obstetricsCover:!0,medicalGap:!1,somePrivate:!1,extrasBenefit:"50",need:"LC",taxIncomePurpose:"S",primaryLhcContinuousCover:null,partnerLhcContinuousCover:null,primaryLhcLoading:0,partnerLhcLoading:0,lhcLoading:0,hospitalCoverLevel:"low",extrasCoverLevel:"low",version:"2"},n={},i=Quote.Helpers.getCookie((((App||{}).Settings||{}).Quote||{}).ProspectCookieName||"quote-prospect");try{n=JSON.parse(i);n=_.extend(t,n)}catch(r){return Tracker.SendError(r,{message:"Error parsing prospect data",func:"loadProspectData",cookie:i}),t}return n},saveProspectData:function(n){n.hasChanged(["dob"])&&n.set("dobIsDefault",!1);Quote.Helpers.setCookie((((App||{}).Settings||{}).Quote||{}).ProspectCookieName||"quote-prospect",JSON.stringify(n))},loadCartData:function(){var t={className:"cart",hospitalProduct:null,extrasProduct:null,paymentFrequency:"",isPackage:!1,coverTypeCode:"0",coverType:"hospital"},n={},i=Quote.Helpers.getCookie("quote-cart");try{n=JSON.parse(i);n=_.extend(t,n)}catch(r){return Tracker.SendError(r,{message:"Error parsing cart data",func:"loadCartData",cookie:i}),t}return n},saveCartData:function(n){Quote.Helpers.setCookie("quote-cart",JSON.stringify(n))},setCookie:function(n,t,i){if(!n||/^(?:expires|max\-age|path|domain|secure)$/i.test(n))return!1;var r=new Date;r.setFullYear(r.getFullYear()+1);i=i||(((App||{}).Settings||{}).Quote||{}).ProspectCookieDomain||"";document.cookie=escape(n)+"="+escape(t)+"; domain="+i+"; path=/; expires="+r.toGMTString()},getCookie:function(n){return unescape(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+escape(n).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},removeCookie:function(n){var t=(((App||{}).Settings||{}).Quote||{}).ProspectCookieDomain||"";document.cookie=n+"=; domain="+t+"; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;"},formatPrice:function(n){var r=n,t=isNaN(t=Math.abs(t))?2:t,e=e==undefined?".":e,u=u==undefined?",":u,o=r<0?"-":"",f=parseInt(r=Math.abs(+r||0).toFixed(t))+"",i=(i=f.length)>3?i%3:0;return o+(i?f.substr(0,i)+u:"")+f.substr(i).replace(/(\d{3})(?=\d)/g,"$1"+u)+(t?e+Math.abs(r-f).toFixed(t).slice(2):"")},formatCurrency:function(n,t,i){n=n.toString().replace(/\$|\,/g,"");isNaN(n)&&(n="0");sign=n==(n=Math.abs(n));n=Math.floor(n*100+.50000000001);cents=n%100;n=Math.floor(n/100).toString();cents<10&&(cents="0"+cents);for(var r=0;r<Math.floor((n.length-(1+r))/3);r++)n=n.substring(0,n.length-(4*r+3))+","+n.substring(n.length-(4*r+3));return(sign?"":"-")+(t?"":"$")+n+(i?"<sup>":"")+"."+cents+(i?"<\/sup>":"")},getRealState:function(n,t){return $.ajax({type:"GET",contentType:"application/json; charset=utf-8",url:"https://staging.api.gmhba.com.au/rest/location/search?postcode="+n,dataType:"json",success:function(i){t&&t({postcode:n,state:i.Name})},error:function(n){n!=null&&n.status!=0&&Tracker.SendError("Error in getRealState",{response:n,url:this.url,data:this.data})}})},checkForValidPostCode:function(n){var i=!1,r="",t=$.Deferred();return n&&n.length>0?$.when(Quote.Helpers.getRealState(n)).done(function(u){i=u.Name&&u.Name.length>0?!0:!1;r=i?u.Name:"";t.resolve({postcode:n,isValid:i,state:r})}).fail(function(){t.resolve({postcode:n,isValid:!1,state:""})}):t.resolve({postcode:n,isValid:!1,state:""}),t.promise()},isBrowserIE:function(){return navigator.userAgent.indexOf("MSIE")!=-1},detectIE:function(){var n=window.navigator.userAgent,i=n.indexOf("MSIE "),u,r,t;return i>0?parseInt(n.substring(i+5,n.indexOf(".",i)),10):(u=n.indexOf("Trident/"),u>0)?(r=n.indexOf("rv:"),parseInt(n.substring(r+3,n.indexOf(".",r)),10)):(t=n.indexOf("Edge/"),t>0)?parseInt(n.substring(t+5,n.indexOf(".",t)),10):!1},mobileThreshold:function(){return 992},isMobile:function(){var n=Quote.Helpers.mobileThreshold();return $(window).width()>n?!1:$(window).width()<n?!0:void 0},getScrollBarWidth:function(){var t=document.createElement("p"),n,r,i;return t.style.width="100%",t.style.height="200px",n=document.createElement("div"),n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.style.visibility="hidden",n.style.width="200px",n.style.height="150px",n.style.overflow="hidden",n.appendChild(t),document.body.appendChild(n),r=t.offsetWidth,n.style.overflow="scroll",i=t.offsetWidth,r==i&&(i=n.clientWidth),document.body.removeChild(n),r-i},wait:function(n){var t=$.Deferred();return setTimeout(function(){t.resolve()},n),t.promise()},getQueryStrings:function(){return(parseUri(window.location)||{}).queryKey},mapQueryStringsToProspect:function(n){var r=$.Deferred(),t={found:!1,qreentry:!1},i=Quote.Helpers.getQueryStrings();return i?(window.location.hash=="#qreentry"&&(t.qreentry=!0),i.hid?(t.found=!0,t.hospitalcode=decodeURIComponent(i.hid),t.qreentry&&n.set("hospitalcode",t.hospitalcode,{silent:!0})):(t.hospitalcode="",t.qreentry&&n.set("hospitalcode","",{silent:!0})),i.eid?(t.found=!0,t.extrascode=decodeURIComponent(i.eid),t.qreentry&&n.set("extrascode",t.extrascode,{silent:!0})):(t.extrascode="",t.qreentry&&n.set("extrascode","",{silent:!0})),t.qreentry&&(t.hospitalcode||t.extrascode)&&n.set("selectedProduct",{ID:0,Code:t.hospitalcode+t.extrascode,Name:"",Rate:null,IsPackage:!1,IsFitProduct:!1,IsCombo:!1}),i.need&&(t.found=!0,t.need=decodeURIComponent(i.need),n.set("need",t.need,{silent:!0})),i.ctype&&(t.found=!0,t.covertype=decodeURIComponent(i.ctype),n.set("coverType",t.covertype,{silent:!0})),i.stage&&(t.found=!0,t.lifestage=decodeURIComponent(i.stage),n.set("lifestage",t.lifestage,{silent:!0}),n.set("taxIncomePurpose",t.lifestage=="S"?"S":"F",{silent:!0})),i.state&&(t.found=!0,t.state=decodeURIComponent(i.state),n.set("state",t.state,{silent:!0})),i.dob&&(t.found=!0,i.dob.length==8&&(t.dob=decodeURIComponent(i.dob),t.dob=t.dob.slice(0,2)+"/"+t.dob.slice(2,4)+"/"+t.dob.slice(4),Quote.Helpers.isValidDate(t.dob,"dd/mm/yyyy")&&n.set("dob",t.dob,{silent:!0}))),i.pdob&&(t.found=!0,i.pdob.length==8&&(t.pdob=decodeURIComponent(i.pdob),t.pdob=t.pdob.slice(0,2)+"/"+t.pdob.slice(2,4)+"/"+t.pdob.slice(4),Quote.Helpers.isValidDate(t.pdob,"dd/mm/yyyy")&&n.set("partnerdob",t.pdob,{silent:!0}))),i.rbtier&&(t.found=!0,t.rbtier=decodeURIComponent(i.rbtier),n.set("rebatetier",parseInt(t.rbtier),{silent:!0})),i.pfreq&&(t.found=!0,t.paymentFrequency=decodeURIComponent(i.pfreq),n.set("paymentfrequency",parseInt(t.paymentFrequency),{silent:!0})),i.excess&&(t.found=!0,t.excessLevel=decodeURIComponent(i.excess),n.set("excessLevel",t.excessLevel,{silent:!0})),i.gdisc&&(t.found=!0,t.groupDiscount=decodeURIComponent(i.gdisc),n.set("groupDiscount",t.groupDiscount,{silent:!0})),i.effrate&&(t.found=!0,t.effectiveRate=decodeURIComponent(i.effrate),n.set("effectivefrom",t.effectiveRate,{silent:!0})),i.exben&&(t.found=!0,t.extrasBenefit=decodeURIComponent(i.exben),n.set("extrasBenefit",t.extrasBenefit,{silent:!0})),i.obs&&(t.found=!0,t.obstetrics=decodeURIComponent(i.obs),n.set("obstetricsCover",t.obstetrics=="1"?!0:!1,{silent:!0})),i.mgap&&(t.found=!0,t.medicalGap=decodeURIComponent(i.mgap),n.set("medicalGap",t.medicalGap=="1"?!0:!1,{silent:!0})),i.somep&&(t.found=!0,t.somePrivate=decodeURIComponent(i.somep),n.set("somePrivate",t.somePrivate=="1"?!0:!1,{silent:!0})),i.ver?(t.found=!0,t.version=decodeURIComponent(i.ver),n.set("version",t.version,{silent:!0}),n.set("hospitalCoverLevel","low",{silent:!0}),n.set("extrasCoverLevel","low",{silent:!0})):(t.found=!0,n.set("version","2",{silent:!0}),n.set("hospitalCoverLevel","low",{silent:!0}),n.set("extrasCoverLevel","low",{silent:!0})),i.hcl&&(t.found=!0,t.hospitalCoverLevel=decodeURIComponent(i.hcl),n.set("hospitalCoverLevel",t.hospitalCoverLevel,{silent:!0})),i.ecl&&(t.found=!0,t.extrasCoverLevel=decodeURIComponent(i.ecl),n.set("extrasCoverLevel",t.extrasCoverLevel,{silent:!0})),t.found?n.save(function(){r.resolve(t)}):r.resolve(t)):r.resolve(t),r.promise()},newWindow:function(n,t,i,r,u,f,e,o,s,h,c,l){var p=(screen.width-i)/2,a,v,y;a=u==0?(screen.height-r)/2:u;v="height="+r+",width="+i+",top="+a+",left="+p+",scrollbars="+f+",resizable="+e+",menubar="+o+",toolbar="+s+",location="+h+",statusbar="+c+",fullscreen="+l+"";y=window.open(n,t,v);try{parseInt(navigator.appVersion)>=4&&y.focus()}catch(w){}return!1},openWebChat:function(n){n&&n.preventDefault&&n.preventDefault();var t=App.Settings.WebChat.Url;return this.newWindow(t,"webchatwin",580,800,100,!1,!0,!1,!1,!1,!0,!1),window.EventBroker&&EventBroker.trigger("ui.action.webchat",{url:t,action:"open"}),!1},getViewport:function(){var n=$(window);return{l:n.scrollLeft(),t:n.scrollTop(),w:n.width(),h:n.height()}},constructPayload:function(n,t){var i=[];return $.each(n,function(n,r){var u={},f,e;t!=null&&$.extend(u,t);u.reference=r.UniqueRefID;u.excessLevel=r.ExcessLevel;u.coverType=Quote.Views.Helpers.productGetCoverType(r);f=Quote.Views.Helpers.productGetOption(r,"Hos");f&&(u.hospitalCoverLevel=f.CoverLevel,u.obstetricsCover=f.Obstetrics,u.medicalGap=f.MedicalGap,u.somePrivate=f.SomePrivate);e=Quote.Views.Helpers.productGetOption(r,"Anc");e&&(u.extrasCoverLevel=e.CoverLevel,u.extrasBenefit=e.ExtrasBenefit);u.isPackage=r.IsPackage;i.push(u)}),i},GetData:function(n){var i=n.get("hospitalcode"),r=n.get("extrascode"),t=n.get("selectedProduct"),f=t.Name;t.IsFitProduct&&(i=t.Code,r=t.Code);var e=n.get("coverType"),u=n.get("extrasBenefit"),o=n.attributes.lhc||{};return[{key:"LifeStage",val:n.attributes.lifestage},{key:"SelectedProduct",val:t.Code},{key:"postcode",val:n.attributes.postcode},{key:"PrimaryDOB",val:n.attributes.dob},{key:"PartnerDOB",val:n.attributes.partnerdob},{key:"HospitalCode",val:i},{key:"ExtrasCode",val:r},{key:"HospitalID",val:n.attributes.hospitalId},{key:"ExtrasID",val:n.attributes.extrasId},{key:"ExtrasBenefit",val:u},{key:"PayFrequency",val:n.attributes.paymentfrequency},{key:"ExcessLevel",val:n.attributes.excessLevel},{key:"CoverType",val:n.attributes.coverType},{key:"RebateTier",val:n.attributes.rebatetier},{key:"GroupDisc",val:n.attributes.groupDiscount},{key:"StateCode",val:n.attributes.state},{key:"ABCSettingID",val:n.attributes.abcSettingID},{key:"PrimaryHasContinuousCover",val:n.attributes.primaryLhcContinuousCover},{key:"PartnerHasContinuousCover",val:n.attributes.partnerLhcContinuousCover},{key:"CombinedLhc",val:0},{key:"PrimaryLhc",val:0},{key:"PartnerLhc",val:0},{key:"NeedType",val:n.attributes.need},{key:"EffectiveFrom",val:n.attributes.effectivefrom}]},Validation:function(n,t){var f=["LifeStage","PrimaryDOB","PayFrequency","ExcessLevel","CoverType","RebateTier","StateCode","SelectedProduct"],e=["HospitalCode","ExtrasCode"],o=!1,r=!1,s=0,u=!1,i;for(userdata="Quote Error: modal was displayed to the user\n",i=0;i<n.length;i++)jQuery.inArray(n[i].key,f)!==-1&&(n[i].val.toString()!=""&&n[i].val.toString()!=null?(userdata+=n[i].key+" is a required field and exists in the data with a value of: "+n[i].val+"\n",n[i].key=="SelectedProduct"&&(o=!0),s++):userdata+=n[i].key+" is a required field but has no data "+n[i].val+"\n"),(n[i].key==e[0].toString()||n[i].key==e[1].toString())&&(n[i].val.toString()!=""&&n[i].val.toString()!=null?(userdata+=n[i].key+" is a required field and exists in the data with a value of: "+n[i].val+"\n",u=!0):userdata+=n[i].key+" is a required field but has no data "+n[i].val+"\n");if(s==f.length&&(r=!0),t==!0&&(r=!1),userdata+="validatedFormRequiredFields: "+r+"\n",userdata+="validatedFormORfields: "+u+"\n",r==!0&&u==!0)return!0;o==!1?bootbox.alert("You haven't selected a product.<br><br>This may have been due to a website error, but you'll need to select a product in order to continue.<br><br>Clicking OK will return you to the product selection page.",function(){window.location.hash="#step/compare"}):bootbox.alert('Unfortunately there\'s been a problem processing your request. <br><br>Call GMHBA on 1300 304 236 (8.00am - 6.00pm Mon-Fri AEST) for assistance.<br><br>Alternatively you can <a href="/">return to the home page<\/a> to continue browsing.');function h(){sentryLogged==!1?(Tracker.SendError(userdata,{userdata:n,datalayer:dataLayer},"",{ModalType:"QuoteError"}),sentryLogged=!0):sentryLogged==!0}return h(),dataLayer.push({event:"createEvent",eventCategory:"quote",eventAction:"errorModal",eventLabel:"activated"}),!1},DateLeading0s:function(n){var t=parseInt(n.val());return t<10?(n.val("0"+parseInt(t)),"0"+parseInt(t)):t},hasProductReform:function(n,t){return n===""?!1:t=="Hos"?Quote.Models.ProductToggle.Hospital.findIndex(function(t){return t.toLowerCase()===n.toLowerCase()})>-1:t=="Anc"?Quote.Models.ProductToggle.Extras.findIndex(function(t){return t.toLowerCase()===n.toLowerCase()})>-1:!1}}};Quote.PriceAnimation={CurrentPrice:0,Counterinterval:0,Show:function(t,i,r){var u,f,e;if(this.CurrentPrice=i,clearInterval(this.Counterinterval),u=this.FormatPrice(this.CurrentPrice).split("").reverse(),f=this.FormatPrice(r).split("").reverse(),u.length>f.length)u=u.slice(0,f.length);else if(u.length<f.length)for(e=u.length;e<f.length;e++)u.push("0");that=this;this.Counterinterval=setInterval(function(){for(var h='<span class="s curr">$<\/span>',o=!0,c,e,s,i=u.length-1;i>=0;i--)c=i<=2?"s c":"d",isNaN(parseInt(f[i]))?n=f[i]:(e=parseInt(u[i]),isNaN(parseInt(u[i]))&&(e=0),s=parseInt(f[i]),e<s?(e=e+1,o=!1):e>s&&(e=e-1,o=!1),u[i]=e,n=""+e),h+='<span class="'+c+'">'+n+"<\/span>";$(t).empty().html(h);o==!0&&($(t).data("price-value",r),that.CurrentPrice=r,clearInterval(that.Counterinterval))},65)},FormatPrice:function(n){var r=n,t=isNaN(t=Math.abs(t))?2:t,e=e==undefined?".":e,u=u==undefined?",":u,o=r<0?"-":"",f=parseInt(r=Math.abs(+r||0).toFixed(t))+"",i=(i=f.length)>3?i%3:0;return o+(i?f.substr(0,i)+u:"")+f.substr(i).replace(/(\d{3})(?=\d)/g,"$1"+u)+(t?e+Math.abs(r-f).toFixed(t).slice(2):"")}};EventBroker=function(n){return _.clone(n.Events)}(Backbone);Quote.NavigatorState=function(){var n={},t={id:0},i="";return n.setState=function(n,r){t=n;i=r},n.getState=function(){return{step:t,stepName:i}},n}(jQuery);Array.prototype.move=function(n,t){this.splice(t,0,this.splice(n,1)[0])};String.prototype.firstLetterUpperCase=function(){return this.charAt(0).toUpperCase()+this.substr(1)},function(){Quote.Models.Prospect=Backbone.Model.extend({defaults:{className:"prospect",dobIsDefault:!0,dob:"01/01/1982",partnerdob:"",lifestage:"S",state:"VIC",postcode:"",rebatetier:0,hospitalcode:"",hospitalId:0,extrascode:"",extrasId:0,paymentfrequency:52,excessLevel:"2",groupDiscount:"DISC-02",abcSettingID:0,discountOverride:!1,pageCustomContentID:0,effectivefrom:"NOW",obstetricsCover:!0,medicalGap:!1,somePrivate:!1,extrasBenefit:"50",need:"LC",taxIncomePurpose:"S",primaryLhcContinuousCover:null,partnerLhcContinuousCover:null,lhc:{loading:0,primary:{loading:0},partner:{loading:0}},coverType:2,selectedProduct:{ID:0,Code:"",Name:"",Rate:null,IsPackage:!1,IsFitProduct:!1,IsCombo:!1},hospitalCoverLevel:"low",extrasCoverLevel:"low",version:"2"},initialize:function(){this.fetch()},id:"prospectID",localStorage:null,fetch:function(n){var t=Quote.Helpers.loadProspectData();this.set(t);n&&n()},save:function(n){Quote.Helpers.saveProspectData(this);n&&n()},addProduct:function(n){this.set("selectedProduct",n?{ID:n.ID,Code:n.Code,Name:n.Name,Rate:n.Rate,IsPackage:n.IsPackage,IsFitProduct:n.IsFitProduct,IsCombo:n.IsCombo}:{ID:0,Code:"",Name:"",Rate:null,IsPackage:!1,IsFitProduct:!1,IsCombo:!1})},paymentfrequencyText:function(){var n="week";switch(this.attributes.paymentfrequency){case 52:n="week";break;case 26:n="fortnight";break;case 12:n="month";break;case 1:n="year"}return n},hasPartner:function(){return this.attributes.lifestage=="C"||this.attributes.lifestage=="F"}});Quote.Models.Product=Backbone.Model.extend({defaults:{ID:""},initialize:function(){},idAttribute:"ID",getProductTestFunc:function(){return"<p>jk test func run<\/p>"}});Quote.Models.Products=Backbone.Collection.extend({defaults:{},initialize:function(){},model:Quote.Models.Product});Quote.Models.ProductInfo=Backbone.Model.extend({defaults:{ID:""},initialize:function(){},idAttribute:"ID"});Quote.Models.ProductInfoList=Backbone.Collection.extend({defaults:{},initialize:function(){},model:Quote.Models.ProductInfo});Quote.Models.ProductDetail=Backbone.Model.extend({defaults:{IsDirty:!1,Version:"2",Products:null,ProductInfoList:null},id:"productDetailID",initialize:function(){},getProductByID:function(n){var t=null,i=this.get("Products");return $.each(i,function(i,r){if(r.ID==n)return t=r,!1}),t},getProductByUniqueRefID:function(n){var t=null,i=this.get("Products");return $.each(i,function(i,r){if(r.UniqueRefID==n)return t=r,!1}),t},getProductByCode:function(n){var t=this.get("Products");return t==null?null:t.find(function(t){return t.Code===n})},getRecommendedProduct:function(){var n=null,t=this.get("Products");return t.length>0&&(n=t[0],n.IsRecommended=!0),new Array(n)},getCompareProducts:function(){var t=this.get("Products"),n=$.extend(!0,[],t);return n.shift(),n}});Quote.Models.Navigation=Backbone.Model.extend({defaults:{className:"Navigation",steps:[],stepsSet:[],currentStep:null,firstStep:null,inProgress:!1},initialize:function(){},id:"stepNavigationID",getStepById:function(n){return this.get("steps").find(function(t){return t.id==n})},getStepByIndex:function(n){return this.get("steps").find(function(t){return t.index==n})},firstStep:function(){return this.get("steps").length>0?this.get("steps")[0]:null},isValidStep:function(n){var t=this.get("stepsSet").find(function(t){return t.id==n});return t?!0:!1}})}();App=App||{UI:{}};App.UI={};UI={Core:{},Component:{},Utils:{}};UI.Component.Spinner=function(n){var t={},i=null;return t.init=function(){var t=n("body");n(document).on({ajaxStart:function(){var n=Quote.NavigatorState.getState();(n.step.id=="compare"||n.step.id=="review")&&(i=setTimeout(function(){t.addClass("loading")},150))},ajaxStop:function(){clearTimeout(i);t.removeClass("loading")}})},t}(jQuery);UI.Component.ProductTypeDropdown=function(n){function e(){r=n(".js-product-type");i=n(".js-product-type-chosen");f=n(".product-type-dropdown");u=n(".product-type-option")}function o(){f.slideToggle(0)}var t={},r=null,i=null,u=null,f=null;return t.set=function(n,t){if(t===undefined&&(t=r.find('*[data-value="'+n+'"]')),t.length>0){var e=t.text(),o=i.text(),u=t.attr("data-value"),f=i.attr("data-value");u!=f&&(t.text(o).attr("data-value",f),i.text(e).attr("data-value",u))}},t.init=function(i){e();i&&t.set(i);r.on("click",o);u.on("click",function(){var i=n(this);t.set(i.attr("data-value"),i)})},t}(jQuery);UI.Component.FlowButtons=function(){function i(){t=document.querySelectorAll(".flow-button")}var n={},t=null;return n.init=function(){i()},n}(jQuery);UI.Component.FormDate=function(n){function s(){r=n(".form-date");o=n(".js-form-date-submit");i=n(".touch .form-date__full .form-date__inputs")}function h(n,t){t.preventDefault();EventBroker.trigger("quote.step.next")}function f(n,t){for(var i in t)n.find('[name="'+i+'"]').rules("add",t[i])}function e(n,t){for(var i in t)n.find('[name="'+i+'"]').rules("remove")}var t={},r=null,o=null,u=!1,i=null;return n(".form-date").keyup(function(t){t.keyCode==13&&(n(".frame.is-active").attr("id")=="your-age"?EventBroker.trigger("quote.your-age.submit"):n(".frame.is-active").attr("id")=="partners-age"&&EventBroker.trigger("quote.partners-age.submit"))}),t.loadForm=function(){var t={"date-full":{required:!0,date:!0}},i={"date-day":{required:!0,number:!0,max:31,min:1},"date-month":{required:!0,number:!0,max:12,min:1},"date-year":{required:!0,number:!0,min:(new Date).getFullYear()-200,max:(new Date).getFullYear()}};r.each(function(){var r=n(this),u;r.data("validator")?App.UI.aboveMd?(e(r,t),f(r,i)):(e(r,i),f(r,t)):(u={rules:{},submitHandler:h},r.validate(u))})},t.init=function(){s();t.loadForm();u||i.length&&i.each(function(){console.log("init date shim");var t=n(this);t.addClass("fake-placeholder").attr("type","text").attr("value","Enter date");t.on("touchstart touchend",function(){t.removeClass("fake-placeholder").attr("type","date").attr("value","");setTimeout(function(){t.trigger("focus")},50)}).on("blur",function(){(this.value==""||this.value=="Enter date")&&n(".android").length==0&&setTimeout(function(){t.addClass("fake-placeholder").attr("type","text").attr("value","Enter date")},50)})});u=!0},t}(jQuery);UI.Component.FilterToggleButtons=function(n){function r(){t=n(".bulge-button__list")}function u(){t.on("click",".js-filter-toggle",function(i){i.preventDefault();t.find(".js-filter-toggle").removeClass("is-active");n(this).addClass("is-active")})}var i={},t;return i.init=function(){r();u()},i}(jQuery);UI.Component.SlimCollapse=function(n){function r(){t=375}function u(i,r,u){fastdom.read(function(){var i=n("[data-row="+r+"]"),f=i.find(".slim-collapse-content"),e=f.find(".collapse-legend");fastdom.write(function(){App.UI.aboveMd&&f.slideToggle(t);i.toggleClass("is-open");u.hasClass("is-open")&&(UI.Component.MatchHeight.updateBySelector(e),UI.Component.MatchHeight.updateGroupHeightByGroupSelector("inner-header-"+r,50),UI.Component.MatchHeight.updateGroupHeightByGroupSelector("inner-header-lead-"+r))})})}function f(t,i){var r=n(t.target).closest(".inner-collapse");fastdom.read(function(){var t=n("[data-row="+i+"]"),u=t.find(".inner-collapse-content__container");fastdom.write(function(){t.toggleClass("is-open");r.hasClass("is-open")&&UI.Component.MatchHeight.updateBySelector(u)})})}var t=null,i={};return i.init=function(){r();n(document).on("click",".slim-collapse-header, .slim-collapse-header .ss-icon",function(t){t.stopPropagation();var i=n(this).closest(".slim-collapse"),r=i.attr("data-row");u(t,r,i)});n(document).on("click",".inner-collapse-wrapper",function(t){var i=n(this).closest(".inner-collapse").attr("data-row");f(t,i)})},i}(jQuery);UI.Component.ProductCarousel=function(){"use strict";function f(f){(i=$(window),n=$(".slides"),t=$(".compare"),r=!1,u="",n.length===1)&&(h(),o(),f&&c(f))}function e(){$(".compare .price-nav").waypoint(function(n){n=="up"?t.removeClass("arrows-active"):t.addClass("arrows-active")},{offset:"bottom-in-view"});$(".compare .btn-back-top").waypoint(function(n){n=="up"?t.addClass("arrows-active"):t.removeClass("arrows-active")},{offset:"bottom-in-view"})}function o(){$(document).on("slick:refresh",function(){s()})}function s(){n&&(n.css("opacity",0),setTimeout(function(){n.slick("setPosition");n.css("opacity",1);UI.Component.MatchHeight.updateHeights()},1250))}function h(){n.each(function(){var n=$(this);n.on("init",function(n,t){$(".slick-counter__position").text("1/"+Math.floor(t.slideCount/t.options.slidesToShow+1))}).slick({touchThreshold:4,touchMove:!1,accessibility:!1,draggable:!1,slidesToShow:3,slidesToScroll:1,dots:!1,infinite:!1,centerMode:!1,centerPadding:"0px",responsive:[{breakpoint:620,settings:{slidesToShow:1,dots:!0,centerMode:!0,centerPadding:"40px",touchMove:!1,draggable:!1}}],prevArrow:'<span class="slick-prev"><span class="ss-icon ss-navigateleft"><\/span> <span class="slick__nav-text">Previous<\/span><\/span>',nextArrow:'<span class="slick-next"><span class="slick__nav-text">Next<\/span> <span class="ss-icon ss-navigateright"><\/span><\/span>',appendArrows:".slick-nav"}).on("afterChange",function(n,t,i){console.log("after change");$(".slick-counter__position").text(i+1+"/"+Math.floor(t.slideCount/t.options.slidesToShow+1));EventBroker.trigger("quote.stickyHeader.slideChange",t);Quote.Helpers.isMobile()&&EventBroker.trigger("quote.stickyHeader.show",!1)}).on("swipe",function(n,t,i){EventBroker.trigger("ui.event",{eventAction:"Product Swipe",eventLabel:i==="left"?"right":"left"})}).on("beforeChange",function(n,t,i,r){console.log("before change");i!==r&&(EventBroker.trigger("ui.event",{eventAction:"Product Scroll",eventLabel:i>r?"left":"right"}),Quote.Helpers.isMobile()&&EventBroker.trigger("quote.stickyHeader.hide",!1))})});e()}function c(t){var i=n.slick("getSlick");if(i&&i.options.slidesToShow<2){setTimeout(function(){n.slick("slickGoTo",t,!0)},500);return}n.slick("slickGoTo",t,!0)}var i=null,n=null,r=!1,u="",t=null;return{init:f}}();UI.Component.FilterTouchScroll=function(){"use strict";function a(){u.on("resize",function(){clearTimeout(o);o=setTimeout(function(){s()},200)});$(document).on("frame:change",function(){setTimeout(h,750)})}function s(){var n=u.width();n>l?y():(v(),h())}function v(){i||(t.css({width:c(),margin:0}),r=new IScroll(n[0],{scrollX:!0,scrollY:!1,click:!0}),i=!0)}function h(){i&&(t.css({width:c()}),r.refresh())}function y(){i&&(r.destroy(),r=null,n.css("overflow","visible"),t.css({width:"100%",transform:"none"}),i=!1)}function c(){var n=0;return e.each(function(){n+=$(this).outerWidth(!0)}),n*1.1}var f={},n,t,e,u,l=991,o,r,i=!1;return f.init=function(){(n=$(".button-scroll-container .inner"),n.length===1)&&(n.css("overflow","hidden"),t=n.find("ul"),e=t.find("li"),u=$(window),s(),a())},f}();UI.Component.FauxSelect=function(){"use strict";function n(){t()}function t(){$(document).on("change",".faux-select select",function(){i(this)})}function i(n){var t=$(n),i=t.parent(".faux-select"),r=t.find("option:selected").html();i.length===1&&i.find(".faux-select-value").html(r)}return{init:n}}();UI.Component.DatePicker=function(n){function t(){var r=n(".form-control_date"),t,i;r.datepicker({todayHighlight:!0,toggleActive:!0,container:".special-panel"});t=n(".form-control_date-year");t.datepicker({format:"yyyy",startView:2,minViewMode:2});i=n(".form-control_date-month");i.datepicker({format:"MM",startView:2,minViewMode:1})}return{init:t}}(jQuery);UI.Component.MatchHeight=function(n){function i(t,i){if(t.length>1){var r=[];i&&i>0&&r.push(i);fastdom.write(function(){t.css("height","");fastdom.read(function(){t.each(function(){r.push(n(this)[0].getBoundingClientRect().height.toFixed(2))});var i=Math.max.apply(Math,r);i>0&&fastdom.write(function(){t.css("height",i)})})})}}function f(){var i=n(window).width();i!==r&&(t.updateHeights(),r=i)}function u(i){var r=i.data("mh");t.groups.hasOwnProperty(r)||(t.groups[r]=n([]));t.groups[r]=t.groups[r].add(i)}var t={groups:{}},r=n(window).width();return t.updateGroups=function(){t.groups={};n("[data-mh]").each(function(){var t=n(this);u(t)})},t.updateHeights=function(){n.each(t.groups,function(n,t){i(t)})},t.updateGroupHeightById=function(r,f){t.groups.hasOwnProperty(r)&&(f&&(t.groups[r]=n([]),n('[data-mh="'+r+'"]').each(function(){u(n(this))})),i(t.groups[r]))},t.updateGroupHeightByGroupSelector=function(r,u){var f=Object.keys(t.groups).filter(function(n){return n.indexOf(r)===0});n.each(f,function(n,r){i(t.groups[r],u)})},t.updateBySelector=function(n){i(n)},t.init=function(){n(window).resize(n.debounce(500,f))},t}(jQuery);UI.Component.Alert=function(){"use strict";function r(){n=$(".js-add-extras");t=$(".js-add-extras-alert");i=$(".js-extras-added-alert");u()}function u(){n.on("click",function(){t.hide();i.show()})}var n=null,t=null,i=null;return{init:r}}(jQuery);UI.Component.Modal=function(){var t={},n=$("#modalMain");return t.init=function(){n.on("show.bs.modal",function(){App.UI.aboveMd&&n.css("display","flex")});n.on("hide.bs.modal",function(){$("#modalMain .modal-title").text("");$("#modalMain .modal-body").html("")})},t.show=function(t){$("#modalMain .modal-title").text(t.title);$("#modalMain .modal-body").html(t.content);n.modal("show")},t}(jQuery);UI.Utils=function(n){function u(){t.$framePosition=n(".step-frame__position");t.$stepFrame=n(".step-frame");i=n(".products__item");r=n(".products__scroll-x")}function f(){var n=document.querySelectorAll("img.inject-me");SVGInjector(n)}var i=null,r=null,t={$framePosition:null,$stepFrame:null,framePosHeight:0,frmHeight:0,step:0};return t.checkFramePosHeight=function(){t.framePosHeight=Math.round(t.$framePosition.outerHeight())},t.checkFrmHeight=function(){t.frmHeight=t.$stepFrame.outerHeight(!0)},t.disableTransitions=function(n){t.$framePosition.css("transition","none");setTimeout(function(){t.$framePosition.css("transition","");n()},100)},t.applyProductScrollWidth=function(){var n=(i.length-0)*100;r.css("width",n+"%")},t.removeDuplicates=function(n){var t={};return n.filter(function(n){return t.hasOwnProperty(n)?!1:t[n]=!0})},t.init=function(){n.fn.swap=function(n){n=jQuery(n)[0];var i=this[0],t=i.parentNode.insertBefore(document.createTextNode(""),i);return n.parentNode.insertBefore(i,n),t.parentNode.insertBefore(n,t),t.parentNode.removeChild(t),this};u();t.checkFramePosHeight();t.checkFrmHeight();f()},t}(jQuery);UI.Core=function(n){function p(){i=document.documentElement;l=n(".toggle");e=n(".form-radio-buttons");r=n(".js-compare");u=n('[data-toggle="tooltip"]');o=n(".product-container_fixed");s=n(".product-container_swipe .swipeshow");f=n(".product-container_reveal");h=n(".nav-tabs a");v=n(".step-frame__position");y=n(".js-multi");c=n(".slides .compare__item")}function w(){UI.Component.Spinner.init();UI.Component.FlowButtons.init();UI.Component.ProductTypeDropdown.init();UI.Component.SlimCollapse.init();UI.Component.FilterToggleButtons.init();UI.Component.FilterTouchScroll.init();UI.Component.FauxSelect.init();UI.Component.MatchHeight.init();UI.Component.Alert.init();UI.Component.DatePicker.init();UI.Component.Modal.init()}function b(){fastdom.read(function(){n(".content_products").waypoint(function(t){fastdom.write(function(){t==="up"?n(".site-header__prev").slideDown("fast"):n(".site-header__prev").slideUp("fast")})},{context:"#compare",offset:30})})}function k(){function t(){n(i).addClass("browserupgrade-hidden");n(".browserupgrade").hide()}if(n(i).hasClass("lte-ie9")){n(".browserupgrade__close").on("click",function(){t()});setTimeout(function(){t()},15e3)}}function d(){n(window).on("load",function(){var t=n(".gsib_a .gsc-input");t.length&&t.attr("placeholder","Search")})}var t={},e=null,r=null,u=null,o=null,s=null,f=null,h=null,v=null,y=null,c=null,i=null,l=null,a=n(window).width();return t.updateBtnNext=function(n,t){n.addClass("is-active").contents().filter(function(){return this.nodeType==3}).replaceWith(t)},t.matchProductHeight=function(){var n=o.outerHeight();s.css({height:n})},t.handleRezise=function(){var t=n(window).width();t!==a&&(UI.Utils.checkFramePosHeight(),UI.Utils.checkFrmHeight(),EventBroker.trigger("quote.step.reload"),a=t)},t.onResizeToDesktop=function(){c.attr("style","")},t.initializeTooltips=function(t){t&&(u=n('[data-toggle="tooltip"]'));u.tooltip({container:"body",html:!0,delay:{show:250,hide:0}})},t.init=function(){p();w();n(i).toggleClass("ready");l.on("click",function(){n(this).toggleClass("is-first").toggleClass("is-second")});k();d();var u=navigator.userAgent.toLowerCase(),o=u.indexOf("android")>-1;o&&(i.className+=" android");f.find("a").on("click",function(n){n.preventDefault();f.addClass("is-hidden")});e.find("a").on("click",function(t){t.preventDefault();n(this).addClass("active");n(this).siblings("a").removeClass("active")});r.on("click",function(t){t.preventDefault();var i=n(this);r.not(i).addClass("is-inactive");i.removeClass("is-inactive")});n('.compare a[data-toggle="tab"]').on("shown.bs.tab",function(t){var i=n(t.target).data("target");n('.compare a[data-toggle="tab"]').parent().removeClass("active");n('.compare a[data-target="'+i+'"]').parent().addClass("active")});n(".js-switch-content-link").click(function(t){t.preventDefault();var i=n(this);n(i.data("target-hide")).hide();n(i.data("target")).show();n("a."+i.attr("class").replace(" ",".")+'[data-target="'+i.data("target")+'"]').addClass("active");n("a."+i.attr("class").replace(" ",".")+'[data-target="'+i.data("target-hide")+'"]').removeClass("active")});n('a[data-toggle="extra"]').click(function(t){t.preventDefault();var i=n(this).data("extra");n('a.active[data-toggle="extra"]').removeClass("active");n('a[data-toggle="extra"][data-extra="'+i+'"]').addClass("active")});n("ul.nav.nav-pills li a").click(function(){n(this).parent().addClass("active").siblings().removeClass("active")});h.on("click",function(i){i.preventDefault();n(this).tab("show");t.matchProductHeight()});t.initializeTooltips(!1);n(window).resize(t.handleRezise);t.handleRezise();b()},t}(jQuery);App.UI=function(n){"use strict";function f(){t.$comparePage=n("#compare");t.$compareSlide=n(".compare__slide");t.$dots=n(".dots");t.$compareItem=n(".compare__item:not(.special-panel)");t.$body=n("body");t.$compare=n(".compare");t.stepCount=n(".frame").length-1}function e(){UI.Utils.init();UI.Core.init()}function i(){UI.Component.FormDate.init()}function o(){t.aboveMd?n(".more-info").unbind("click").bind("click",function(t){t.preventDefault();n("a[data-section='"+n(this).data("section")+"']").each(function(t,i){var r=n(i);r.find("span").toggleClass("ss-navigatedown ss-navigateup");r.parent(".panel-body").toggleClass("show-less")});UI.matchProductHeight()}):(n(".panel-body").removeClass("show-less"),n(".more-info").addClass("hidden"),n(".panel-collapse").collapse("hide"))}var t={aboveMd:!1,stepCount:0,navigateNow:!1,single:!0,income:!1,stepping:!1,nextEventsBound:!1,$window:n(window),$body:null,$comparePage:null,$compareSlide:null,$dots:null,$compareItem:null,$compare:null,$grid:null},r="screen and (min-width: 992px)",u="screen and (max-width: 991px)";return t.init=function(){f();e();enquire.register(r,{deferSetup:!0,setup:function(){t.aboveMd=!0;t.income=!0;i()},match:function(){t.aboveMd=!0;UI.Utils.checkFramePosHeight();UI.Utils.checkFrmHeight();i()},unmatch:function(){UI.Utils.applyProductScrollWidth()}}).register(u,{deferSetup:!0,setup:function(){t.aboveMd=!1;i()},match:function(){t.aboveMd=!1;i()},unmatch:function(){UI.Core.onResizeToDesktop();UI.Utils.applyProductScrollWidth()}});UI.Utils.applyProductScrollWidth();o()},t}(jQuery);Quote.Views.Router=Backbone.Router.extend({routes:{"step/:id":"goToStep",compare:"compare","your-age":"your-age",product:"product","stage/:stage":"lifestage","need/:need":"need",review:"review",qreentry:"qreentry","*path":"defaultRoute"},initialize:function(){},defaultRoute:function(){this.navigate("step/about-you",{trigger:!0,replace:!0})}});Quote.Views.BackButton=Backbone.View.extend({el:"header",initialize:function(){this.model.on("quote.isfitproduct",this.toggleButton,this)},events:{"click .js-back, .js-btn-back":"goBackStep"},goBackStep:function(n){n.preventDefault();this.model.trigger("quote.step.back")},toggleButton:function(n){n&&(n.IsFitProduct&&this.options.queryStringData.qreentry?$(this.el).find(".js-btn-back").addClass("hidden"):$(this.el).find(".js-btn-back").removeClass("hidden"))}});Quote.Views.StepsViewNavigator=Backbone.View.extend({el:".step-frame",router:null,$body:null,framePosHeight:0,frmHeight:0,initialize:function(){this.queryStringData=this.options.queryStringData||{found:!1};this.router=new Quote.Views.Router;this.navigation=new Quote.Models.Navigation;this.backbutton=new Quote.Views.BackButton({model:this.model,queryStringData:this.queryStringData});this.router.on("route:goToStep",this.goToStep,this);this.router.on("route:compare",this.routeCompare,this);this.router.on("route:your-age",this.routeLandingPage,this);this.router.on("route:lifestage",this.routeLifestage,this);this.router.on("route:need",this.routeNeed,this);this.router.on("route:review",this.routeReview,this);this.router.on("route:qreentry",this.routeQuoteReviewReentry,this);this.model.on("quote.step.back",this.activateBackStep,this);this.model.on("quote.step.next",this.activateNextStep,this);this.model.on("quote.step.byname",this.activateStepByName,this);EventBroker.on("quote.step.next",this.activateNextStep,this);EventBroker.on("quote.step.reload",this.reloadCurrentStep,this);this.model.on("quote.step.reload",this.reloadCurrentStep,this);this.model.on("change:coverType",this.determineStepOrder,this);this.model.on("change:dob",this.determineStepOrder,this);this.model.on("change:partnerdob",this.determineStepOrder,this);this.$body=$("body");this.$framePosition=$(".step-frame__position",this.el);this.$stepFrame=this.$el;this.determineCompleteStepSet();this.determineStepOrder()},events:{"click .overlay":"hideProfile"},hideProfile:function(){this.model.trigger("profile.view.hide")},routeCompare:function(){var n=this;this.queryStringData.found&&this.showProductCompareFirst()},routeLandingPage:function(){console.log("routeLandingPage");var n=this;this.$framePosition.children("#about-you").addClass("hidden");this.$framePosition.children("#needs").addClass("hidden");this.$framePosition.children("#compare").addClass("hidden");this.model.trigger("quote.products.load",this.queryStringData);this.activateStepByName("your-age")},showProductCompareFirst:function(){var i=this,n=!1,t=this.$framePosition.children("#compare");return t&&(t.insertBefore(this.$framePosition.children(":first-child")),this.$framePosition.children("#needs").addClass("hidden"),this.$framePosition.children("#about-you").addClass("hidden"),EventBroker.trigger("quote.lifestage.selected",this.model.attributes.lifestage,""),this.model.trigger("quote.products.load",this.queryStringData),this.goToStep("compare"),this.model.trigger("quote.menu.swap.first",this.navigation.attributes.currentStep,this.navigation.attributes.steps),n=!0),n},routeLifestage:function(n){n||this.router.defaultRoute();this.model.set("lifestage",n.trim().substr(0,1).toUpperCase());this.model.save();this.activateStepByName("your-age")},routeNeed:function(n){n||this.router.defaultRoute();this.model.set("need",n.trim().substr(0,4).toUpperCase());this.showProductCompareFirst()},routeReview:function(){this.activateStepByName("review")},routeQuoteReviewReentry:function(){this.activateStepByName("review")},checkIfPartnerAgeStepRequired:function(){this.model.attributes.lifestage=="C"||this.model.attributes.lifestage=="F"?$("#partners-age",this.el).removeClass("hidden"):($("#partners-age",this.el).addClass("hidden"),$("#partner-lhc",this.el).addClass("hidden"))},checkIfIncomeStepRequired:function(){App.UI.aboveMd||$("#income",this.el).removeClass("hidden")},checkIfNeedStepRequired:function(){this.model.attributes.version=="2"&&$("#needs",this.el).addClass("hidden")},setLhcVisibility:function(n,t,i,r){$("#your-lhc").toggleClass("hidden",Quote.Helpers.calculateLhcYears(i)===0);$("#partner-lhc").toggleClass("hidden",t&&Quote.Helpers.calculateLhcYears(r)===0);$("#lhc").toggleClass("hidden",!(this.model.attributes.lhc||{}).loading)},determineCompleteStepSet:function(){var n=[];$.each(this.$framePosition.children(),function(t,i){n.push({id:$(i).attr("id"),index:t})});this.navigation.set("stepsSet",n)},determineStepOrder:function(){var t=this,n;App.Settings.SalesPortal.IsActive&&this.setLhcVisibility(this.model.attributes.coverType,this.model.hasPartner(),this.model.attributes.dob,this.model.attributes.partnerdob);this.checkIfPartnerAgeStepRequired();this.checkIfIncomeStepRequired();this.checkIfNeedStepRequired();n=[];$.each(this.$framePosition.children(":not(.hidden)"),function(t,i){n.push({id:$(i).attr("id"),index:t})});this.navigation.set("steps",n)},calcTransform:function(){var t=0,n;for(this.framePosHeight=Math.round(this.$framePosition.outerHeight()),this.frmHeight=this.$stepFrame.outerHeight(!0),n=0;n<this.step.index;n++)this.navigation.attributes.steps[n+1]&&(t-=1);return Math.round(t*this.frmHeight)/this.framePosHeight*100+"%"},calcTransformString:function(){return"translateY("+this.calcTransform()+")"},applyStepTransform:function(n){var t=this.calcTransformString();this.$framePosition.css({"-webkit-transform":t,"-moz-transform":t,"-ms-transform":t,transform:t});n&&setTimeout(n,1e3)},velocityTranslate:function(n){var t=this,i=this.calcTransform();this.$framePosition.velocity({translateY:i},{easing:"easeInOutCubic",duration:1e3,complete:function(){t.$body.removeClass("step-"+t.step.index+"-changing");n&&n()}})},reloadCurrentStep:function(){this.navigation.attributes.currentStep?this.goToStep(this.navigation.attributes.currentStep.id):this.goToStep(this.navigation.attributes.firstStep.id)},activateNextStep:function(){this.activateStep("forward")},activateBackStep:function(){this.activateStep("backward")},activateStepByName:function(n){var i=this,t,r;this.navigation.get("inProgress")||(t=this.$el.find("#"+n),t&&(r=t.hasClass("hidden"),t.removeClass("hidden"),i.router.navigate("step/"+n,{trigger:!0})))},activateStep:function(n,t){var i=this,r=null,u=0,f=1;this.navigation.get("inProgress")||(this.determineStepOrder(),t&&(f=t),n=="forward"?u=i.navigation.attributes.currentStep?i.navigation.attributes.currentStep.index+f:-1:n=="backward"&&(u=i.navigation.attributes.currentStep?i.navigation.attributes.currentStep.index-f:-1),r=this.navigation.getStepByIndex(u),r)&&i.router.navigate("step/"+r.id,{trigger:!0})},goToStep:function(n){EventBroker.trigger("quote.stickyHeader.hide");this.model.trigger("profile.view.hide");var t=this;if(!this.navigation.get("inProgress"))try{if(this.navigation.set("inProgress",!0),this.determineStepOrder(),this.step=this.navigation.getStepById(n),!this.step){this.navigation.set("inProgress",!1);return}console.log("gotoStep: "+this.step.id);this.doStepNavigate(function(){t.navigation.set("inProgress",!1)})}catch(i){console.log("goToStep Error : "+i);this.navigation.set("inProgress",!1)}},doStepNavigate:function(n){var t=this;this.model.trigger("quote.step.start",this.step);this.$body.removeClass("loading");this.$body.addClass("step-"+this.step.index+"-changing");!$(".site-header__prev").is(":visible")&&this.step.index>0&&(App.UI.aboveMd?$(".site-header__prev").slideDown():$(".site-header__prev").show());this.step.index<=0&&(App.UI.aboveMd?$(".site-header__prev").slideUp():$(".site-header__prev").hide());this.$framePosition.addClass("is-animating");setTimeout(function(){var i,r;Modernizr.csstransitions||!App.UI.aboveMd?(t.$body.addClass("step-"+t.step.index+"-changing"),t.$body.removeClass(function(n,t){return(t.match(/(^|\s)step-\S+\-done/g)||[]).join(" ")}).removeClass("step-"+t.step.index+"-changing").addClass("step-"+t.step.index+"-done"),App.UI.aboveMd?t.applyStepTransform(function(){t.animationCompletedCallback&&(t.animationCompletedCallback(),n())}):(i=t.$el.find("#"+t.navigation.attributes.currentStep.id),i&&(r=t.$el.find(".step-frame__position").children().index(i),t.$body.removeClass(function(n,t){return(t.match(/(^|\s)step-\S+\-done/g)||[]).join(" ")}),t.$body.addClass("step-"+r+"-done")),$(".frame .well.is-active",this.el).addClass("is-active-minimal"),t.step.id=="compare"&&($(document).trigger("slick:refresh"),$(document).trigger("frame:change")),t.animationCompletedCallback&&(t.animationCompletedCallback(),n()))):t.velocityTranslate(function(){t.animationCompletedCallback&&(t.animationCompletedCallback(),n())});t.step.id=="compare"&&UI.Component.FilterTouchScroll.init();$(window).scrollTop(0)},750);this.navigation.set("currentStep",this.step)},animationCompletedCallback:function(){var n=this.$framePosition.children(".frame:not(.hidden)");n.removeClass("is-active");n.eq(this.navigation.attributes.currentStep.index).addClass("is-active");this.$framePosition.removeClass("is-animating");Quote.NavigatorState.setState(this.navigation.attributes.currentStep);this.model.trigger("quote.step.complete",this.navigation.attributes.currentStep,this.navigation.attributes.steps)}});Quote.Views.NavMenu=Backbone.View.extend({el:"nav.progress",initialize:function(){this.model.on("quote.step.complete",this.render,this);this.model.on("quote.menu.swap.first",this.swapMenuItemToFirstMenuPosition,this);this.model.on("quote.isfitproduct",this.toggleNavMenu,this);this.$progressList=$(".progress__list",this.el);this.$progressSubList=$(".progress__sub-list",this.el)},events:{"click a":"menuItemClick"},menuItemClick:function(n){if(n.preventDefault(),$(n.target).parent().hasClass("visited")||$(n.target).parent().hasClass("active")){var t=$(n.currentTarget).data("menu-ref");t&&this.model.trigger("quote.step.byname",t)}},swapMenuItemToFirstMenuPosition:function(n,t){var i=this.$progressList.find("li a[data-menu-ref="+n.id+"]");i&&(i.parent().insertBefore(this.$progressList.children(":first-child")),this.render(n,t))},toggleNavMenu:function(n){n&&(n.IsFitProduct&&this.options.queryStringData.qreentry?$(this.el).children().addClass("hidden"):$(this.el).children().removeClass("hidden"))},render:function(n,t){$.each(this.$progressList.find("li a"),function(i,r){var u=$(r),f=t.find(function(n){return n.id==u.data("menu-ref")});f?f.index==n.index?u.parent().addClass("active"):f.index<n.index&&u.parent().hasClass("progress__sub-item")?u.parent().removeClass("active").addClass("visited"):f.index<n.index&&u.parent().hasClass("progress__item")?u.parent().addClass("visited"):f.index>n.index&&u.parent().hasClass("progress__sub-item")&&u.parent().removeClass("active"):u.parent().addClass("hidden")});$.each(this.$progressList.find(".progress__item"),function(n,t){var i=$(t).find(".progress__sub-item:not(.hidden)").length});$.each(this.$progressSubList,function(n,t){$(t).children(":not(.hidden)").removeClass("last").last().addClass("last")})}});Quote.Views.AboutYou=Backbone.View.extend({el:".step-frame #about-you",initialize:function(){this.showModelValue();this.model.on("change:lifestage",this.showModelValue,this);this.model.on("quote.lifestage.set",this.showModelValue,this)},events:{"click .js-about-you-toggle":"setLifeStage"},setLifeStage:function(n){n.preventDefault();var t=this.model.attributes.lifestage,i=$(n.currentTarget).data("value");this.model.set("lifestage",i);this.model.save();EventBroker.trigger("quote.lifestage.selected",this.model.attributes.lifestage,t);this.model.trigger("quote.step.next")},showModelValue:function(){this.$el.find("a").removeClass("is-active");this.$el.find("a[data-value='"+this.model.get("lifestage")+"']").addClass("is-active")}});Quote.Views.YourAge=Backbone.View.extend({el:".step-frame #your-age",initialize:function(){this.model.on("quote.step.start",this.onload,this);this.model.on("change:dob quote.dob.change",this.showModelValue,this);EventBroker.on("quote.your-age.submit",this.setYourAge,this);$("#your-age .autotab").autotab();this.showModelValue()},events:{"click .js-form-date-submit":"setYourAge"},onload:function(n){if(n.index==1){var t=this.$el.find("input[name=date-day]");this.$el.is(":visible")&&t.length===1&&t.focus()}},setYourAge:function(){var e=this.model.attributes.dob,t=Quote.Helpers.DateLeading0s($("input[name='date-day']",this.el)),i=Quote.Helpers.DateLeading0s($("input[name='date-month']",this.el)),r=$("input[name='date-year']",this.el).val(),u=$("input[name='date-full']"),f,n;u.is(":visible")&&(f=u.val(),n=f.split("-",3),r=n[0],i=n[1],t=n[2]);dobValue=t+"/"+i+"/"+r;t&&i&&r>1900&&(this.model.set("dob",dobValue),this.model.save());$(this.el).children("form").submit();EventBroker.trigger("quote.primary.dob.selected",this.model.attributes.dob,e)},showModelValue:function(){var t;if(!this.model.attributes.dobIsDefault){var i=this.model.attributes.dob||" / / ",n=i.split("/",3);$("input[name='date-day']",this.el).val(n[0]);$("input[name='date-month']",this.el).val(n[1]);$("input[name='date-year']",this.el).val(n[2]);t=""+n[2]+"-"+n[1]+"-"+n[0];$("input[name='date-full']",this.el).val(t)}}});Quote.Views.YourPartnersAge=Backbone.View.extend({el:".step-frame #partners-age",initialize:function(){this.model.on("quote.step.start",this.onload,this);this.model.on("change:partnerdob quote.partnerdob.change",this.showModelValue,this);EventBroker.on("quote.partners-age.submit",this.setYourPartnersAge,this);$("#partners-age .autotab").autotab();this.showModelValue()},events:{"click .js-form-date-submit":"setYourPartnersAge"},onload:function(n){if(n.id=="partners-age"){var t=this.$el.find("input[name=date-day]");this.$el.is(":visible")&&t.length===1&&t.focus()}},setYourPartnersAge:function(){var o=this.model.attributes.partnerdob,t=Quote.Helpers.DateLeading0s($("input[name='date-day']",this.el)),i=Quote.Helpers.DateLeading0s($("input[name='date-month']",this.el)),r=$("input[name='date-year']",this.el).val(),u=$("input[name='date-full']",this.el),f,n,e;u.is(":visible")&&(f=u.val(),n=f.split("-",3),r=n[0],i=n[1],t=n[2]);e=t+"/"+i+"/"+r;t&&i&&r>1900&&(this.model.set("partnerdob",e),this.model.save());$(this.el).children("form").submit();EventBroker.trigger("quote.partner.dob.selected",this.model.attributes.partnerdob,o)},showModelValue:function(){var i=this.model.attributes.partnerdob||"//",n=i.split("/",3),t;$("input[name='date-day']",this.el).val(n[0]);$("input[name='date-month']",this.el).val(n[1]);$("input[name='date-year']",this.el).val(n[2]);t=""+n[2]+"-"+n[1]+"-"+n[0];$("input[name='date-full']",this.el).val(t)}});Quote.Views.YourNeeds=Backbone.View.extend({el:".step-frame #needs",initialize:function(){this.showModelValue();this.model.on("change:need",this.showModelValue,this)},events:{"click .link-grid a":"setYourNeed"},setYourNeed:function(n){var i=this.model.attributes.need,t;n.preventDefault();t=$(n.currentTarget).data("value");this.model.set("need",t);this.model.save();this.model.trigger("quote.needs.set",t,i,!0);this.model.trigger("quote.step.next")},showModelValue:function(){this.$el.find("a").removeClass("is-active");this.$el.find("a[data-value='"+this.model.get("need")+"']").addClass("is-active")}});Quote.Views.YourIncome=Backbone.View.extend({el:".step-frame #income",initialize:function(){this.model.on("change:lifestage",this.setTaxableIncomeLabels,this);this.model.on("change:rebatetier quote.rebatetier.change",this.showModelValue,this);this.$el.addClass("hidden");this.render();this.showModelValue()},events:{"click .link-grid a":"setYourIncome","click .js-no-rebate":"setDontApplyRebate","change .js-income-toggle":"setTaxableIncomeLabels"},render:function(){this.setTaxableIncomeLabels()},setTaxableIncomeLabels:function(){var n=this.model.get("lifestage")=="S"?"S":"F",t=$(".link-grid a .link-grid__title",this.el);n=="S"?$.each(t,function(n,t){switch(n){case 0:$(t).html("$90,000 or less");break;case 1:$(t).html("$90,001 - $105,000");break;case 2:$(t).html("$105,001 - $140,000");break;case 3:$(t).html("$140,001+")}}):$.each(t,function(n,t){switch(n){case 0:$(t).html("$180,000 or less");break;case 1:$(t).html("$180,001 - $210,000");break;case 2:$(t).html("$210,001 - $280,000");break;case 3:$(t).html("$280,001+")}});this.model.set("taxIncomePurpose",n);this.model.trigger("quote.rhsbar.rerender");this.model.save()},setYourIncome:function(n){n.preventDefault();var t=$(n.currentTarget).data("value");this.setRebate(t)},setDontApplyRebate:function(n){n.preventDefault();this.setRebate(4)},setRebate:function(n){var t=this.model.attributes.rebatetier;this.model.set("rebatetier",n);this.model.save();EventBroker.trigger("quote.rebatetier.selected",this.model.attributes.rebatetier,t);this.model.trigger("quote.step.next")},showModelValue:function(){this.$el.find("a").removeClass("is-active");this.$el.find("a[data-value='"+this.model.get("rebatetier")+"']").addClass("is-active")}});Quote.Views.CompareProduct=Backbone.View.extend({el:".step-frame #compare",productDetail:null,pricesLoading:!1,queryStringData:null,productCID:null,initialize:function(){this.model.on("quote.products.load",this.loadProducts,this);this.model.on("change:paymentfrequency",this.paymentFrequencyListener,this);this.model.on("change:state change:rebatetier quote.ratechange change:groupDiscount",this.reloadProductPricesListener,this);this.model.on("change:lifestage change:dob",this.reloadProductListener,this);this.model.on("change:need",this.toggleNeedButton,this);this.model.on("change:need",this.reloadProductListener,this);this.model.on("quote.step.start",this.onstart,this);this.model.on("quote.select.product",this.selectProduct,this);this.model.on("quote.reload.products",this.reloadProductListener,this);if(this.toggleNeedButton(),this.model.get("version")=="2"){this.$el.addClass("alternate");this.model.on("change:hospitalCoverLevel change:extrasCoverLevel",this.showCoverLevelValue,this);this.showCoverLevelValue();$("p.compare-tagline").show()}$(".coverlevel-container .ss-info",this.el).on("shown.bs.tooltip",this.captureCoverLevelShowInfo);this.model.on("quote.step.complete",this.onload,this)},events:{"click .js-filter-toggle":"setYourNeed","click .product-type-option":"coverTypeChanged","click .product-next-btn":"selectProduct","change .js-frequency":"paymentFrequencyChanged","change .js-excess":"excessChanged","change .js-pregnancy-toggle":"pregnancyChanged","change .js-extras-toggle":"extrasChanged","click .js-coverlevel-toggle":"setCoverLevel","click .slim-collapse-header":function(n){EventBroker.trigger("quote.details.section.showhide",$(n.currentTarget).data("mh"),$(n.currentTarget).parent().hasClass("is-open")?"close":"open")},"click .inner-collapse-header":function(n){EventBroker.trigger("quote.details.subSection.showhide",$(n.currentTarget).find(".inner-collapse-header__title").first().text(),$(n.currentTarget).parent().parent().hasClass("is-open")?"close":"open",$(n.currentTarget).parent().parent().attr("data-row"))},"click .product-modal-link":"showProductInfoModal","click .btn-back-top":"goBackToTop","click .js-clear-offer-reload":"reloadClearOffer","click .vitality-overlay":function(n){EventBroker.trigger("quote.products.vitality.accordion",$(n.currentTarget).children().hasClass("features out collapse in")?"close":"open")}},onstart:function(n){n&&n.id=="compare"&&(this.scrollTopOfView(),$("p.compare-tagline").html($("p.compare-tagline").html().replace("{{offerName}}",$("input#offerName").length!=0&&$("input#offerName").val().length>0?$("input#offerName").val():"current")),$(".js-product-type.product-type").toggleClass("hidden",this.model.get("version")=="2"||this.model.get("abcSettingID").length>0),$("p.compare-tagline").toggleClass("hidden",!(this.model.get("abcSettingID")!=null&&this.model.get("abcSettingID")!=0&&$("input#hasProductFilter").length!=0&&$("input#hasProductFilter").val()=="1")),$(".button-scroll-container").toggleClass("hidden",this.model.get("version")=="2"),$(".coverlevel-container").toggleClass("hidden",this.model.get("version")=="1"))},captureAnalytics:function(){},onload:function(n){n&&n.id=="compare"&&(this.compareStatus=!0,this.model.trigger("quote.stickyHeader.compareStatus",this.compareStatus),this.productDetail==null&&this.loadProducts())},reloadClearOffer:function(){Quote.Helpers.removeCookie(App.Settings.ABC.Key);Quote.Helpers.removeCookie("PAGE-CUSTOM-CONTENT");window.location.reload()},setYourNeed:function(n){var i=this.model.attributes.need,t;n.preventDefault();t=$(n.currentTarget).data("value");this.model.set("need",t);this.model.save();this.model.trigger("quote.needs.set",t,i,!0);this.model.trigger("quote.step.next")},showCoverLevelValue:function(){this.$el.find(".coverlevel-container a").removeClass("is-active");this.$el.find(".coverlevel-container .hospital a[data-value='"+this.model.get("hospitalCoverLevel")+"']").addClass("is-active");this.$el.find(".coverlevel-container .extras a[data-value='"+this.model.get("extrasCoverLevel")+"']").addClass("is-active");this.loadProducts()},setCoverLevel:function(n){var f;n.preventDefault();var i=$(n.currentTarget),t=i.data("value"),r=this.model.attributes.hospitalCoverLevel.firstLetterUpperCase(),u=this.model.attributes.extrasCoverLevel.firstLetterUpperCase();i.closest("ul").hasClass("hospital")?(this.model.set("hospitalCoverLevel",t),r=t=="none"?"No":t.firstLetterUpperCase()):i.closest("ul").hasClass("extras")&&(this.model.set("extrasCoverLevel",t),u=t=="none"?"No":t.firstLetterUpperCase());this.model.save();f="{0} Hospital & {1} Extras".replace("{0}",r).replace("{1}",u);this.model.trigger("quote.coverlevel.set",f,!0);this.model.attributes.hospitalCoverLevel=="none"&&this.model.attributes.extrasCoverLevel!="none"&&$(".coverlevel.extras ul li.toggle-none").hide();this.model.attributes.extrasCoverLevel=="none"&&this.model.attributes.hospitalCoverLevel!="none"&&$(".coverlevel.hospital ul li.toggle-none").hide();this.model.attributes.hospitalCoverLevel!="none"&&this.model.attributes.extrasCoverLevel!="none"&&($(".coverlevel.hospital ul li.toggle-none").show(),$(".coverlevel.extras ul li.toggle-none").show())},captureCoverLevelShowInfo:function(n){var t="",r=$(n.currentTarget),i=r.closest(".coverlevel");i&&(i.hasClass("hospital")?t="Hospital":i.hasClass("extras")&&(t="Extras"));EventBroker.trigger("quote.coverlevel.showinfo",t)},loadComplete:function(){this.model.trigger("quote.compare.loadComplete")},goBackToTop:function(n){n.preventDefault();var t=$(n.currentTarget).data("target");t=="#compare"&&Quote.Helpers.isMobile()==!0&&(t="body");$(t).animate({scrollTop:0})},scrollTopOfView:function(){$(this.el).animate({scrollTop:0})},showProductInfoModal:function(n){var r,u,t,i;n.preventDefault();r=$(n.currentTarget).closest("div.inner-collapse").data("prod-info");u=$(n.currentTarget).data("content-target");r>0?(t=this.productDetail.attributes.ProductInfoList.find(function(n){return n.ProductInfoID==r}),t&&UI.Component.Modal.show({title:t.Name,content:t.Notes})):u&&(i=$(u),i&&UI.Component.Modal.show({title:i.data("title"),content:i.html()}))},toggleNeedButton:function(){var n=this.model.get("need"),t;n!=null&&n!=""&&(t=$(".bulge-button__list",this.el),t.find(".js-filter-toggle").removeClass("is-active"),t.find(".js-filter-toggle[data-value="+n+"]").addClass("is-active"))},setYourNeed:function(n){n.preventDefault();var i=this.model.attributes.need,t=$(n.currentTarget).data("value");this.model.set("need",t);this.model.save();this.model.trigger("quote.needs.set",t,i,!0)},getCoverType:function(){var n=2,t=$(".js-product-type-chosen").html();return t=="hospital only"?n=0:t=="extras only"&&(n=1),n},getCoverTypeForCoverLevel:function(n,t){var i=2;return n=="none"?i=1:t=="none"&&(i=0),i},coverTypeChanged:function(){var n=this.model.attributes.coverType;this.model.set("coverType",this.getCoverType());this.loadProducts();EventBroker.trigger("quote.coverType.selected",this.getCoverType(),n)},selectProduct:function(n){var t,i,r,u;n.preventDefault();t=$(n.currentTarget);i=t.hasClass("sticky")?t.closest(".sh-product").attr("data-prod-code"):t.closest(".product").attr("data-prod-code");r=this.productDetail.getProductByCode(i);u=$.extend(!0,{},r);this.model.trigger("quote.product.selected",u,this.productDetail.get("ProductInfoList"));this.model.trigger("quote.step.next")},paymentFrequencyChanged:function(n){var i=this.model.attributes.paymentfrequency,t=$(n.currentTarget).val();this.model.set("paymentfrequency",parseInt(t));this.model.save();EventBroker.trigger("quote.paymentFrequency.selected",parseInt(t),i)},paymentFrequencyListener:function(){if(!this.pricesLoading&&this.productDetail!=null){var n=this;this.loadProductPrices(null,null,function(){n.renderFrequency();n.pricesLoading=!1})}},renderFrequency:function(){var n=this;n.$el.find("select.js-frequency").each(function(){$(this).val(n.model.get("paymentfrequency"));$(this).prev("div.faux-select-value").html(Quote.Views.Helpers.productGetSelectedFrequency(n.model.get("paymentfrequency")))})},excessChanged:function(n){var i;if(!this.pricesLoading){var r=this,t=$(n.currentTarget),u=this.model.attributes.excessLevel;this.productDetail.get("Products").forEach(function(n){var u=r.$el.find("div.product[data-prod-code="+n.Code+"]"),i=u.find(".js-excess");i&&i.each(function(){$(this).children("[value="+t.val()+"]").length!=0&&($(this).val(parseInt(t.val())),n.ExcessLevel=parseInt(t.val()),$(this).siblings(".span-excess").html($(this).children(":selected").html()))})});i={Type:"Excess"};EventBroker.trigger("quote.excessLevel.selected",t.val(),u);this.loadProductPrices(null,i)}},pregnancyChanged:function(n){if(!this.pricesLoading){var r=$(n.currentTarget),u=r.closest(".product").attr("data-prod-code"),t=this.productDetail.getProductByCode(u),f=Quote.Views.Helpers.productGetOption(t,"Hos"),i=Quote.Views.Helpers.productGetOption(t,"Anc"),e={retrieveProductInfo:!1,retrieveProductBy:3,hospitalCoverLevel:f.CoverLevel,extrasCoverLevel:i?i.CoverLevel:"",extrasBenefit:i?i.ExtrasBenefit:"",obstetricsCover:r.val()=="1",excessLevel:t.ExcessLevel,somePrivate:!1};this.replaceProduct(t,e);EventBroker.trigger("quote.obstetricsCover.selected",r.val(),"")}},extrasChanged:function(n){if(!this.pricesLoading){var o=this,t=$(n.currentTarget),r=t.val(),u=t.closest(".product").attr("data-prod-code"),i=this.productDetail.getProductByCode(u),f=i.HospitalComponentCode+r,e={productCodes:[f],retrieveProductInfo:!1,retrieveProductBy:1,excessLevel:i.ExcessLevel};this.replaceProduct(i,e);EventBroker.trigger("quote.extrasBenefit.selected",t.val(),"")}},replaceProduct:function(n,t){$.extend(t,Quote.Helpers.getProductDetailRequestParams(this.model));var i=n.SellingPoint;Quote.Helpers.getProductDetail(t,this,function(t){var r,u;t.Products.length!=0&&(r=t.Products[0],i&&(r.SellingPoint=i),u=this.productDetail.attributes.Products.indexOf(n),this.productDetail.get("Products").splice(u,1,r),this.renderProducts())},function(n){console.log(n)})},loadProducts:function(n){var t=this,i=this.getCoverType(),u=!1,r="",f;n&&n.found&&(n.hospitalcode&&(r=n.hospitalcode),n.extrascode&&(r+=n.extrascode),n.covertype&&(i=n.covertype,UI.Component.ProductTypeDropdown.set(i)));u=this.model.attributes.version=="2";u&&(i=this.getCoverTypeForCoverLevel(this.model.attributes.hospitalCoverLevel,this.model.attributes.extrasCoverLevel));f=u?Quote.Helpers.getProductByCoverLevelRequestParams(this.model,i):Quote.Helpers.getProductByNeedRequestParams(this.model,i);Quote.Helpers.getProductsByNeed(f,this,function(n){var i,u,f;t.pricesLoading=!1;t.productDetail=new Quote.Models.ProductDetail(n);t.productDetail.set("Version",t.model.attributes.version);r.length!=0&&(i=t.productDetail.get("Products"),i.length>1?(u=t.productDetail.getProductByCode(r),u&&(u.IsSelected=!0,f=i.indexOf(u),f>1&&i.move(f,1))):i.length==1&&(i[0].IsSelected=!0));t.renderProducts(r);EventBroker.trigger("quote.products.loaded",n)},function(n){console.log(n)})},renderProducts:function(n,t){var t,i,r;if(this.productDetail.attributes.Products.length==0){this.$el.find("#compare-panel").html($("#empty-panel-template").html());return}t=this.productCID==null||this.productCID!=this.productDetail.cid?0:this.$el.find(".product.slick-current").attr("data-slick-index");this.$el.find("#compare-panel").html($("#compare-panel-template").html());this.$el.find("#compare-panel").find(".product-container_showing > #product-count").text(this.productDetail.get("Products").length);this.productDetail.get("Products").length==1&&this.$el.find("#compare-panel").find(".product-container_showing > #product-verb").addClass("hidden");$(".slick-counter").toggleClass("hidden",this.productDetail.get("Products").length==1);i=new Quote.Views.ProductRecommendListView({el:"#compare .product-container_fixed",model:this.productDetail,prospect:this.model,selectedProductCode:n});this.productDetail.attributes.Products.length>0&&(r=new Quote.Views.ProductCompareListView({el:".slides.slides-flow",model:this.productDetail,prospect:this.model,selectedProductCode:n}));this.stickyHeader=new Quote.Views.StickyHeaders({model:this.productDetail,prospect:this.model,quoteStatus:this.compareStatus});this.productCID=this.productDetail.cid;UI.Component.ProductCarousel.init(t);UI.Component.MatchHeight.updateGroups();UI.Component.MatchHeight.updateHeights();UI.Core.initializeTooltips(!0);this.renderFrequency();this.loadComplete()},loadProductPrices:function(n,t,i){var r=this,u,f;this.pricesLoading=!0;n=n||this.productDetail.attributes.Products;u=Quote.Helpers.getRateRequestParams(this.model,!1);f=Quote.Helpers.constructPayload(n,u);Quote.Helpers.getRate(f,this,function(n){$.each(n,function(n,t){$("#"+t.reference+" .product-price .js-price-target",r.el).html(Quote.Helpers.formatCurrency(t.combinedNetAmount,!0,!0));var i=r.productDetail.getProductByUniqueRefID(t.reference);i&&(i.Rate=t);r.model.trigger("quote.stickyHeader.update")});i&&i();this.loadComplete();r.pricesLoading=!1},function(n){r.pricesLoading=!1;console&&console.log(n)})},reloadProductListener:function(){this.productDetail!=null&&this.loadProducts()},reloadProductPricesListener:function(){this.productDetail!=null&&this.loadProductPrices()}});Quote.Views.ProductRecommendListView=Backbone.View.extend({initialize:function(n){this.prospect=n.prospect;this.selectedProductCode=n.selectedProductCode;var t={determineCoverageIcon:Quote.Views.Helpers.determineCoverageIcon,productGetOption:Quote.Views.Helpers.productGetOption,productHasOption:Quote.Views.Helpers.productHasOption,formatCurrency:Quote.Helpers.formatCurrency,productGetFactsheet:Quote.Views.Helpers.productGetFactsheet,productGetSelectedExcess:Quote.Views.Helpers.productGetSelectedExcess,productGetExtrasOption1Value:Quote.Views.Helpers.productGetExtrasOption1Value,productGetExtrasOption2Value:Quote.Views.Helpers.productGetExtrasOption2Value,productGetExtrasOptionLabel:Quote.Views.Helpers.productGetExtrasOptionLabel};this.model=$.extend(!0,{},this.model.attributes,t);this.model.Products.splice(1,this.model.Products.length-1);this.model.Products[0].IsRecommended=!0;this.selectedProductCode&&this.model.Products[0].Code==this.selectedProductCode&&this.prospect.trigger("quote.product.selected",$.extend(!0,{},this.model.Products[0]),this.model.ProductInfoList);this.render()},render:function(){var n=_.template($("#product-template").html(),{model:this.model});return this.$el.html(n),this}});Quote.Views.ProductCompareListView=Backbone.View.extend({selectedProductCode:null,initialize:function(n){this.selectedProductCode=n.selectedProductCode;this.prospect=n.prospect;this.$el.hasClass("slides")&&this.$el.removeClass("slick-initialized slick-slider");var t={determineCoverageIcon:Quote.Views.Helpers.determineCoverageIcon,productGetOption:Quote.Views.Helpers.productGetOption,productHasOption:Quote.Views.Helpers.productHasOption,formatCurrency:Quote.Helpers.formatCurrency,productGetFactsheet:Quote.Views.Helpers.productGetFactsheet,productGetSelectedExcess:Quote.Views.Helpers.productGetSelectedExcess,productGetExtrasOption1Value:Quote.Views.Helpers.productGetExtrasOption1Value,productGetExtrasOption2Value:Quote.Views.Helpers.productGetExtrasOption2Value,productGetExtrasOptionLabel:Quote.Views.Helpers.productGetExtrasOptionLabel};this.model=$.extend(!0,{},this.model.attributes,t);this.selectedProductCode!=null&&this.selectedProductCode.length!=0&&this.model.Products.length>0&&this.model.Products[0].IsSelected==!0&&this.prospect.trigger("quote.product.selected",$.extend(!0,{},this.model.Products[0]),this.model.ProductInfoList);this.render()},render:function(){var n=_.template($("#product-template").html(),{model:this.model});return this.$el.html(n),this}});Quote.Views.ProductSingleView=Backbone.View.extend({initialize:function(n){var i,t;this.model!=null&&(this.prospect=n.prospect,i={determineCoverageIcon:Quote.Views.Helpers.determineCoverageIcon,productGetOption:Quote.Views.Helpers.productGetOption,productHasOption:Quote.Views.Helpers.productHasOption,formatCurrency:Quote.Helpers.formatCurrency,productGetFactsheet:Quote.Views.Helpers.productGetFactsheet,productGetSelectedExcess:Quote.Views.Helpers.productGetSelectedExcess,productGetExtrasOption1Value:Quote.Views.Helpers.productGetExtrasOption1Value,productGetExtrasOption2Value:Quote.Views.Helpers.productGetExtrasOption2Value,productGetExtrasOptionLabel:Quote.Views.Helpers.productGetExtrasOptionLabel},this.model=$.extend(!0,{},this.model.attributes,i),this.model.Products.length>0&&(this.model.Products.splice(1,this.model.Products.length-1),t=this.model.Products[0],t.IsRecommended=!1,t.IsSelected=!1,this.render(),this.prospect.trigger("quote.rhsbar.addproduct",t),this.prospect.trigger("quote.rhsbar.rerender"),this.$el.find("select.js-frequency").val(this.prospect.get("paymentfrequency")).prev(".faux-select-value").html(Quote.Views.Helpers.productGetSelectedFrequency(this.prospect.get("paymentfrequency"))),this.prospect.attributes.excessLevel!=t.ExcessLevel&&$(".js-excess").val(this.prospect.attributes.excessLevel).change()))},render:function(){var t=_.template($("#product-template").html(),{model:this.model}),n=$("<div>").append(t),i=n.find(":radio");return i.each(function(){var n=$(this),t;n.attr("name",n.attr("name")+"-final").attr("id",n.attr("id")+"-final");t=n.closest("label.radio-toggle");t.attr("for",t.attr("for")+"-final")}),this.$el.html(n.html()),this.$el.find("div[data-row='extras-cover-details'],div[data-row='hospital-cover-details']").addClass("is-open").children("div.slim-collapse-content").show(),this.$el.find("div.content-hospital > ul.icon-list").remove(),this.$el.find("a.product-next-btn").remove(),UI.Core.initializeTooltips(!0),this}});Quote.Views.LifetimeCoverQuestions=Backbone.View.extend({el:".step-frame #your-lhc",initialize:function(){this.showModelValue()},events:{"click .js-forward":"setQuestionResponse","click .js-back-to-products":"backToProducts"},backToProducts:function(n){n.preventDefault();this.model.trigger("quote.step.byname","compare")},setQuestionResponse:function(n){n.preventDefault();var t=this.model.attributes.primaryLhcContinuousCover,i=$(n.currentTarget).data("value");$("#your-lhc a").toggleClass("is-active",!1);$(n.currentTarget).toggleClass("is-active",!0);switch(i){case"Yes":this.model.set("primaryLhcContinuousCover",!0);this.model.save();this.model.hasPartner()?this.model.trigger("quote.step.next"):this.model.trigger("quote.step.byname","review");break;case"No":this.model.set("primaryLhcContinuousCover",!1);this.model.save();this.model.trigger("quote.step.next");break;case"Skip":this.model.set("primaryLhcContinuousCover",null);this.model.set("partnerLhcContinuousCover",null);this.model.save();this.model.trigger("quote.step.byname","review")}EventBroker.trigger("quote.primaryLhcContinuousCover.selected",this.model.attributes.primaryLhcContinuousCover,t)},showModelValue:function(){this.$el.find("a").removeClass("is-active");var n=this.model.get("primaryLhcContinuousCover");n!==null&&this.$el.find("a[data-value='"+(n?"Yes":"No")+"']").addClass("is-active")}});Quote.Views.LifetimeCoverQuestionsPartner=Backbone.View.extend({el:".step-frame #partner-lhc",initialize:function(){this.showModelValue()},events:{"click .js-forward":"setQuestionResponse"},setQuestionResponse:function(n){n.preventDefault();var t=this.model.attributes.partnerLhcContinuousCover,i=$(n.currentTarget).data("value");$("#partner-lhc a").toggleClass("is-active",!1);$(n.currentTarget).toggleClass("is-active",!0);switch(i){case"Yes":this.model.set("partnerLhcContinuousCover",!0);this.model.save();this.model.attributes.lhc.primary.loading!=0?this.model.trigger("quote.step.byname","lhc"):this.model.trigger("quote.step.byname","review");break;case"No":this.model.set("partnerLhcContinuousCover",!1);this.model.save();this.model.trigger("quote.step.byname","lhc");break;case"Skip":this.model.set("partnerLhcContinuousCover",null);this.model.save();this.model.attributes.lhc.primary.loading!=0?this.model.trigger("quote.step.byname","lhc"):this.model.trigger("quote.step.byname","review")}EventBroker.trigger("quote.partnerLhcContinuousCover.selected",this.model.attributes.partnerLhcContinuousCover,t)},showModelValue:function(){this.$el.find("a").removeClass("is-active");var n=this.model.get("partnerLhcContinuousCover");n!==null&&this.$el.find("a[data-value='"+(n?"Yes":"No")+"']").addClass("is-active")}});Quote.Views.LifetimeCoverInfo=Backbone.View.extend({el:".step-frame #lhc",rate:null,initialize:function(){this.model.on("change:dob",this.calculateLhc,this);this.model.on("change:primaryLhcContinuousCover",this.calculateLhc,this);this.model.on("change:partnerdob",this.calculateLhc,this);this.model.on("change:partnerLhcContinuousCover",this.calculateLhc,this);this.model.on("quote.rhsbar.addproduct",this.productChanged,this);this.model.on("quote.product.selected",this.productChanged,this);this.model.on("quote.lhc.recalc",this.calculateLhc,this);this.render()},events:{"click .js-forward":"nextStep"},productChanged:function(n){this.product=n;this.calculateLhc()},calculateLhc:function(){var t=Quote.Helpers.calculateLhcCombined(this.model.attributes.dob,this.model.attributes.primaryLhcContinuousCover,this.model.hasPartner(),this.model.attributes.partnerdob,this.model.attributes.partnerLhcContinuousCover),n=this.model.attributes.lhc;n.loading=t.combined;n.primary.loading=t.primary;n.partner.loading=t.partner;this.model.set("lhc",n);this.model.save();this.render()},render:function(){var i=this.product||this.model.get("selectedProduct"),n,t,r;i!=null&&(this.rate=i.Rate,n=0,this.rate&&this.rate.ProductHospital&&this.rate.ProductHospital.grossAmount&&(n=this.rate.ProductHospital.grossAmount),t=n*this.model.attributes.lhc.loading,r=((this.rate||{}).combinedNetAmount||0)+t,$(".price__premium__total").text(Quote.Helpers.formatCurrency(r,!0)),$(".quote__frequency").text(this.model.paymentfrequencyText()),$(".lhc__years_primary").text(Quote.Helpers.calculateLhcYears(this.model.attributes.dob,this.model.attributes.primaryLhcContinuousCover)),$(".primary__age").text(Quote.Helpers.getAge(this.model.attributes.dob)),$(".lhc__loading_primary").text(Math.round(100*this.model.attributes.lhc.primary.loading)),$("#lhc .partner").toggleClass("hidden",!this.model.hasPartner()),$(".lhc__years_partner").text(Quote.Helpers.calculateLhcYears(this.model.attributes.partnerdob,this.model.attributes.partnerLhcContinuousCover)),$(".partner__age").text(Quote.Helpers.getAge(this.model.attributes.partnerdob)),$(".lhc__loading_partner").text(Math.round(100*this.model.attributes.lhc.partner.loading)),$(".lhc__loading_combined").text(Math.round(100*this.model.attributes.lhc.loading)),this.model.trigger("quote.rhsbar.renderlhc",t))},nextStep:function(n){n.preventDefault();this.model.trigger("quote.step.next")}});sentryLogged=!1;Quote.Views.ReviewCover=Backbone.View.extend({el:".step-frame #review",initialize:function(){this.tryLoadProspect();this.toggleEMMQLink();this.model.on("quote.product.selected",this.setFinalProductSelection,this);this.model.on("quote.products.load.single",this.setSingleProductSelection,this);this.model.on("quote.step.start",this.onload,this);this.model.on("change:effectivefrom",this.toggleEMMQLink,this);this.model.on("change:paymentfrequency",this.paymentFrequencyListener,this);this.model.on("change:state change:rebatetier change:lifestage change:dob quote.ratechange change:groupDiscount",this.reloadProductListener,this);this.model.on("rate.message.reformsubmit",this.submitToSignupReform,this);this.$productFinalContainer=$(".product-container_fixed.product-container_final",this.el);this.emailMyQuoteModal=new Quote.Views.EmailMyQuoteModal({el:"#emailQuoteModal",model:this.model});this.ratesMessageView=new Quote.Views.RatesMessage({parentView:this,profile:this.model,isactive:App.Settings.Quote.ShowRatesMessaging&&!App.Settings.SalesPortal.IsActive})},events:{"click .btn-final":"submitToSignup","change .js-excess":"finalExcessChanged","change .js-frequency":"finalPaymentFrequencyChanged","change .js-pregnancy-toggle":"finalPregnancyChanged","change .js-extras-toggle":"finalExtrasChanged","click a.review-choice":"scrollToProductReview","click .product-modal-link":"showProductInfoModal","click a.emailme-modal-link":"doShowEmailQuoteModal"},FinalProduct:null,tryLoadProspectDone:!1,onload:function(n){n.id=="review"&&Quote.Helpers.Validation(Quote.Helpers.GetData(this.model),!1)},hasProduct:function(){return this.FinalProduct!=null&&this.FinalProduct.attributes.Products.length==1},getProduct:function(){return this.hasProduct()?this.FinalProduct.attributes.Products[0]:null},toggleEMMQLink:function(){this.model.get("effectivefrom")=="NOW"?($(".emailme-modal-link").show(),$("#future-rate-msg").addClass("hidden")):($(".emailme-modal-link").hide(),$("#future-rate-msg").removeClass("hidden"))},showProductInfoModal:function(n){var r,u,t,i;n.preventDefault();r=$(n.currentTarget).closest("div.inner-collapse").data("prod-info");u=$(n.currentTarget).data("content-target");r>0&&this.FinalProduct!=null?(t=this.FinalProduct.attributes.ProductInfoList.find(function(n){return n.ProductInfoID==r}),t&&UI.Component.Modal.show({title:t.Name,content:t.Notes})):u&&(i=$(u),i&&UI.Component.Modal.show({title:i.data("title"),content:i.html()}))},doShowEmailQuoteModal:function(){return this.hasProduct()&&this.emailMyQuoteModal.show(),!1},tryLoadProspect:function(n){var t;if(thisView=this,t=this.model.get("selectedProduct"),t&&t.Code!=null&&t.Code.length>0){var i=this.model.get("hospitalcode"),r=this.model.get("extrascode"),u={productCodes:[i==r?i:i+r],retrieveProductInfo:!0,retrieveProductBy:1,excessLevel:this.model.attributes.excessLevel};$.extend(u,Quote.Helpers.getProductDetailRequestParams(this.model));Quote.Helpers.getProductDetail(u,this,function(t){t.Products.length>0&&t.Products[0].Rate.combinedNetAmount!=-1&&(thisView.FinalProduct=new Quote.Models.ProductDetail(t),thisView.FinalProduct.set("Version",thisView.model.attributes.version),thisView.renderFinalProduct(),thisView.model.trigger("quote.emq.product",thisView.FinalProduct),thisView.model.trigger("quote.isfitproduct",thisView.getProduct()));thisView.tryLoadProspectDone=!0;n&&n()},function(n){console.log(n)})}},replaceFinalProduct:function(n,t){$.extend(t,Quote.Helpers.getProductDetailRequestParams(this.model));var i=n.SellingPoint;Quote.Helpers.getProductDetail(t,this,function(n){if(n.Products.length!=0){var t=n.Products[0];i&&(t.SellingPoint=i);this.FinalProduct.attributes.Products.splice(0,1,t);this.model.trigger("quote.emq.product",this.FinalProduct);this.renderFinalProduct()}},function(n){console.log(n)})},reloadProductListener:function(){var n=this;this.loadProduct(function(){n.model.trigger("rate.message.render");n.model.trigger("quote.rhsbar.addproduct",n.getProduct())})},setSingleProductSelection:function(n){var i=this,t={};n.hospitalcode&&(t.productCode=n.hospitalcode);n.extrascode&&(t.productCode+=n.extrascode);$.extend(t,Quote.Helpers.getProductDetailRequestParams(this.model));Quote.Helpers.getProductDetail(t,this,function(n){if(n.Products.length>0&&n.Products[0].Rate.combinedNetAmount!=-1){i.FinalProduct=new Quote.Models.ProductDetail(n);i.model.trigger("quote.emq.product",i.FinalProduct);var t=new Quote.Views.ProductSingleView({el:this.$productFinalContainer,model:this.FinalProduct,prospect:this.model})}},function(n){console.log(n)})},setFinalProductSelection:function(n,t){this.FinalProduct=new Quote.Models.ProductDetail({Products:[n],ProductInfoList:t,Version:this.model.attributes.version});this.model.trigger("quote.emq.product",this.FinalProduct);this.model.trigger("quote.isfitproduct",thisView.getProduct());this.renderFinalProduct()},finalExcessChanged:function(n){var t=this,u=this.model.attributes.excessLevel,i=$(n.currentTarget).val(),r;t.hasProduct()&&(r=t.getProduct(),r.ExcessLevel=i);EventBroker.trigger("quote.excessLevel.selected",i,u);this.loadProduct(function(){t.model.trigger("quote.rhsbar.addproduct",t.getProduct())})},finalExtrasChanged:function(n){var r;if(this.hasProduct()){var u=this,f=this.model.attributes.extrascode,i=$(n.currentTarget).val(),t=u.getProduct(),e=t.HospitalComponentCode+i;EventBroker.trigger("quote.extrasBenefit.selected",i,f);r={productCodes:[e],retrieveProductInfo:!1,retrieveProductBy:1,excessLevel:t.ExcessLevel};this.replaceFinalProduct(t,r)}},finalPaymentFrequencyChanged:function(n){var i=this.model.attributes.paymentfrequency,t=$(n.currentTarget).val();this.model.set("paymentfrequency",parseInt(t));this.model.save();EventBroker.trigger("quote.paymentFrequency.selected",t,i)},paymentFrequencyListener:function(){var n=this;if(n.hasProduct())try{this.loadProduct(function(){n.model.trigger("quote.rhsbar.addproduct",n.getProduct());n.renderFrequency()})}catch(t){console.log("Error : paymentFrequencyListener - "+t.message)}},renderFrequency:function(){this.$el.find("select.js-frequency").val(this.model.get("paymentfrequency"));this.$el.find("select.js-frequency").prev("div.faux-select-value").html(Quote.Views.Helpers.productGetSelectedFrequency(this.model.get("paymentfrequency")))},finalPregnancyChanged:function(n){var f=this.model.attributes.obstetricsCover,i=$(n.currentTarget).val(),r=this.getProduct(),e=Quote.Views.Helpers.productGetOption(r,"Hos"),t=Quote.Views.Helpers.productGetOption(r,"Anc"),u;this.model.set("obstetricsCover",i=="1");this.model.save();EventBroker.trigger("quote.obstetricsCover.selected",i,f);u={retrieveProductInfo:!1,retrieveProductBy:3,hospitalCoverLevel:e.CoverLevel,extrasCoverLevel:t?t.CoverLevel:"",extrasBenefit:t?t.ExtrasBenefit:"",obstetricsCover:i=="1",somePrivate:!1};this.replaceFinalProduct(r,u)},submitToSignup:function(n){var i,t,r;if(n.preventDefault(),App.Settings.Quote.ShowProductReformMessaging){this.model.trigger("rate.message.showreform",!0);return}if(i=Quote.Helpers.GetData(this.model),Quote.Helpers.Validation(i,!1)==!0){for(console.log("submitting form..."),$("body").append('<form id="quote-submit" method="post" action="'+App.Settings.Signup.Url+'"><\/form>'),t=$("#quote-submit").first().empty(),r=0;r<i.length;r++)t.append('<input type="hidden" name="'+i[r].key+'" value="'+i[r].val+'" />');t.append('<input type="hidden" name="quoteid" value="'+$("#_quoteid").val()+'" />');t.append('<input type="hidden" name="override" value="'+$("#_override").val()+'" />');t.append('<input type="hidden" name="showRatesMessaging" value="'+$("#_showRatesMessaging").val()+'" />');$("body").addClass("loading");EventBroker.trigger("quote.submit",this.model);t.submit();$("html").hasClass("ua-safari")&&$("body").removeClass("loading")}},submitToSignupReform:function(){var t,n,i;if(App.Settings.Quote.ShowProductReformMessaging&&(t=Quote.Helpers.GetData(this.model),Quote.Helpers.Validation(t,!1)==!0)){for(console.log("submitting form..."),$("body").append('<form id="quote-submit" method="post" action="'+App.Settings.Signup.Url+'"><\/form>'),n=$("#quote-submit").first().empty(),i=0;i<t.length;i++)n.append('<input type="hidden" name="'+t[i].key+'" value="'+t[i].val+'" />');n.append('<input type="hidden" name="quoteid" value="'+$("#_quoteid").val()+'" />');n.append('<input type="hidden" name="override" value="'+$("#_override").val()+'" />');n.append('<input type="hidden" name="showRatesMessaging" value="'+$("#_showRatesMessaging").val()+'" />');$("body").addClass("loading");EventBroker.trigger("quote.submit",this.model);n.submit();$("html").hasClass("ua-safari")&&$("body").removeClass("loading")}},loadProduct:function(n){var t=this;if(!t.hasProduct()){t.$productFinalContainer.empty();return}this.pricesLoading=!0;var i=t.getProduct(),r=Quote.Helpers.getFinalProductRequestParams(this.model),u=Quote.Helpers.constructPayload([i],r);Quote.Helpers.getRate(u,this,function(i){if(i.length==1){if(rate=i[0],(rate.ProductExtras!=null||rate.ProductHospital!=null)&&rate.combinedNetAmount==-1){t.FinalProduct=null;t.model.trigger("quote.emq.product",t.FinalProduct);t.$productFinalContainer.empty();$("li.progress__sub-item.visited.active").nextAll().removeClass("visited");$("li.progress__item.visited.active").nextAll().find("li").removeClass("visited");$("li.progress__item.visited.active").nextAll().removeClass("visited").removeClass("active");n&&n();return}$("#"+rate.reference+" .product-price .js-price-target",t.el).html(Quote.Helpers.formatCurrency(rate.combinedNetAmount,!0,!0));var r=t.getProduct();r.Rate=rate;t.model.trigger("rate.message.render");t.model.trigger("quote.emq.product",t.FinalProduct);n&&n();t.pricesLoading=!1}},function(n){t.pricesLoading=!1;console&&console.log(n)})},renderFinalProduct:function(){var n=new Quote.Views.ProductSingleView({el:this.$productFinalContainer,model:this.FinalProduct,prospect:this.model});return this.ratesMessageView.show(),this},scrollToProductReview:function(){$("html, body").animate({scrollTop:$("#final-review").offset().top},"slow")}});Quote.Views.RatesMessage=Backbone.View.extend({el:"#rates-message-panel",events:{"click .load-reform":function(n){n.preventDefault();EventBroker.trigger("ui.event",{eventAction:"Reform Changes",eventLabel:"Show Changes Viewed"});this.showProductChangeModal(!1)}},ReformModal:$("#product-change-modal"),isactive:!0,messageModel:null,initialize:function(n){var i=new Date,t;this.isactive=n.isactive;this.parentView=n.parentView;this.profile=n.profile;this.profile.on("quote.product.selected",this.setReformFlag,this);this.profile.on("rate.message.render",this.show,this);this.profile.on("rate.message.showreform",this.showProductChangeModal,this);this.ReformModal.on("show.bs.modal",function(){EventBroker.trigger("rate.message.modalEvent")}).on("hide.bs.modal",function(){EventBroker.trigger("rate.message.modalEvent","back","Go back")});t=this;this.ReformModal.find(".product-change-accept").on("click",function(n){n.preventDefault();EventBroker.trigger("rate.message.modalEvent","accept","I understand, continue");t.profile.trigger("rate.message.reformsubmit")})},showProductChangeModal:function(n){var t,o,u,e;if(this.profile!=null&&(t=this.profile.get("selectedProduct"),t!=null)&&typeof t.Rate!="undefined"&&t.Rate!=null){var i=this.ReformModal,f=i.find("div.row-hospital"),r=i.find("div.row-extras");f.hide();r.hide();o=this;n?(i.find(".product-change-close").text("Go back"),i.find(".product-change-accept").show()):(i.find(".product-change-close").text("Close"),i.find(".product-change-accept").hide());i.find("a.product-pdf").attr("href","#");i.find("a.product-pdf").hide();i.find(".hospital.hospital-detail").html("");t.Rate.ProductHospital!=null&&t.Rate.ProductHospital.code.length!=0&&Quote.Helpers.hasProductReform(t.Rate.ProductHospital.code,"Hos")&&(u=t.Rate.ProductHospital,i.find(".hospital.hospital-detail").load("/documents/product-reforms/"+u.code+".html",function(n,t){t=="error"&&i.find(".hospital.hospital-detail").html("<label class='error'>Unable to load the changes for this product, please contact us for the details.<\/label>")}),t.Rate.ProductHospital.code!=t.Rate.ProductExtras.code&&(i.find("a.new-product-pdf-hos").attr("href",Quote.Views.Helpers.productGet2019Factsheet(u.code)),i.find("a.new-product-pdf-hos").show()),f.show());t.Rate.ProductExtras!=null&&t.Rate.ProductExtras.code.length!=0&&Quote.Helpers.hasProductReform(t.Rate.ProductExtras.code,"Anc")&&(e=t.Rate.ProductExtras,t.Rate.ProductHospital.code!=t.Rate.ProductExtras.code&&(i.find("a.new-product-pdf-ext").attr("href",Quote.Views.Helpers.productGet2019Factsheet(e.code)),i.find("a.new-product-pdf-ext").show()),r.find("li.extras-service").show(),["BS","B55"].findIndex(function(n){return t.Rate.ProductExtras.code==n})>-1&&r.find("li.extras-service").hide(),r.show());t.Rate.ProductHospital.code==t.Rate.ProductExtras.code&&(i.find("a.new-product-pdf-pck").attr("href",Quote.Views.Helpers.productGet2019Factsheet(t.Rate.ProductHospital.code)),i.find("a.new-product-pdf-pck").show());i.find("p.rate-message-modal").html(this.$el.find("p.rate-message").html());i.find(".modal-footer").removeClass("hidden");i.modal("show")}},setReformFlag:function(){$("#_isProductReformAccepted").val("0")},hide:function(){this.$el.addClass("hide")},show:function(){if(!this.isactive){this.hide();return}this.render()},render:function(){var u=this,n={year:(new Date).getFullYear(),priceVerified:!1,futurePrice:0,frequency:1,showProductReform:App.Settings.Quote.ShowProductReformMessaging,hasHospitalReform:!1,hasExtrasReform:!1},t=this.parentView.getProduct(),r,i;t?(r=Quote.Helpers.getFinalProductRequestParams(this.profile),i=Quote.Helpers.constructPayload([t],r),i[0].effectiveFrom="FUTURE",Quote.Helpers.getRate(i,this,function(r){r.length==1&&(rate=r[0],n.priceVerified=(rate.ProductExtras!=null||rate.ProductHospital!=null)&&rate.combinedNetAmount==-1?!1:!0,n.futurePrice=Quote.Helpers.formatCurrency(rate.combinedNetAmount,!1,!1),n.frequency=Quote.Views.Helpers.getFrequencyLabel(i[0].paymentFrequency),n.hasHospitalReform=Quote.Helpers.hasProductReform(t.HospitalComponentCode,"Hos"),n.hasExtrasReform=Quote.Helpers.hasProductReform(t.ExtrasComponentCode,"Anc"),this.renderView(n))},function(){this.renderView(n)})):this.renderView(n)},renderView:function(n){$("#_showRatesMessaging").val(this.isactive?1:0);var t=_.template($("#rates-message-template").html(),{model:n});this.$el.html(t)}});Quote.Views.SalesPortalToolBar=Backbone.View.extend({el:".consultant-panel",initialize:function(){var n=this;this.showModelValue();this.showAppliedDiscount();$("#_override").val("0");this.discountModal=new Quote.Views.DiscountOverrideModal({model:this.model});this.model.on("quote.discount",this.showAppliedDiscount,this)},events:{"click .prospect-save":"callSave","change #select-discount":"changeDiscount","focus #select-discount":"focusDiscount"},showModelValue:function(){var n=this.model.get("groupDiscount");n&&$("#select-discount").val(n)},callSave:function(){var n=$("#emailQuoteModal");$(n).find(".selector-emq").addClass("hidden");$(n).find(".selector-prospect").removeClass("hidden");$(n).find(".status").html("");$(n).find(".form .data-inputs, .btn-save, .modal-footer").removeClass("hidden");$(n).find(".form .success, .form .prospect-success").addClass("hidden");$(n).modal("show")},changeDiscount:function(){if($("#_override").val()=="1"){this.discountModal.agreeClicked();return}this.discountModal.show()},focusDiscount:function(n){var t=$(n.currentTarget);t&&t.data("current",t.val())},showAppliedDiscount:function(n){if(typeof n!="undefined"){var t=n*100;this.$el.find("#applied-discount").text(t+"%")}}});Quote.Views.DiscountOverrideModal=Backbone.View.extend({el:"#discount-override",initialize:function(){this.$el.removeData("bs.modal").modal({backdrop:"static",keyboard:!1,show:!1})},events:{"click .btn-agree":"agreeClicked","click .btn-cancel":"cancelClicked"},show:function(){this.$el.modal("show")},agreeClicked:function(){this.model.set("discountOverride",!0);this.model.set("groupDiscount",$("#select-discount").val());$("#_override").val("1");this.$el.modal("hide")},cancelClicked:function(){var n=$("#select-discount");n.val(n.data("current"));this.$el.modal("hide")}});Quote.Views.EmailMyQuoteModal=Backbone.View.extend({product:null,quotekey_sent:null,quotekey_new:null,initialize:function(){this.model.on("quote.emq.product",this.setProduct,this)},setProduct:function(n){n&&(this.product=n.attributes.Products[0],$("#_quoteid").val(""),this.quotekey_sent=null)},events:{"click .close-btn, button.top.close":"toggle","click .btn-send":"sendEmailQuote","click .btn-save":"saveClicked"},show:function(){this.$el.find(".selector-emq").removeClass("hidden");this.$el.find(".selector-prospect, .prospect-success").addClass("hidden");this.$el.find(".status").addClass("hidden");this.$el.modal("show");$(".footer .status",this.el).html("");$(".form .data-inputs, .btn-send, .modal-footer",this.el).removeClass("hidden");$(".form .success, .form .prospect-success",this.el).addClass("hidden");this.model.trigger("quote.emailquote.open")},validFormFields:function(){var n=!0,i=$("#txtFirstName",this.el),r=$("#txtLastName",this.el),t=$("#txtEmailAddress",this.el);return i.removeClass("error"),r.removeClass("error"),t.removeClass("error"),i.val().length==0&&(n=!1,i.addClass("error")),r.val().length==0&&(n=!1,r.addClass("error")),(t.val().length==0||t.val().indexOf("@")<0)&&(n=!1,t.addClass("error")),n},getPayload:function(){var t=Quote.Helpers.getEmailQuoteRequestParams(this.model),n=Quote.Helpers.constructPayload([this.product],t);return n[0].reference="qreentry",n},sendEmailQuote:function(){var i=this,n=$(".status",this.el),t;if(!this.product){n.removeClass("hidden wait").html("No product data");return}this.validFormFields()&&(this.saveProspect(),n.removeClass("wait").html("Email send failure"),t=this.getPayload(),t.length>0&&(n.addClass("wait").removeClass("hidden").html("Sending request.."),Quote.Helpers.wait(500).then(function(){var r={EmailAddress:$("#txtEmailAddress",this.el).val(),FirstName:$("#txtFirstName",this.el).val(),LastName:$("#txtLastName",this.el).val(),MobileNo:$("#txtMobileNumber",this.el).val()};Quote.Helpers.sendQuoteEmail(App.SessionID,r,t,this,function(t){t==!0?(n.addClass("hidden"),$(".form .success",this.el).removeClass("hidden"),$(".form .data-inputs, .btn-send, .modal-footer",this.el).addClass("hidden"),i.model.trigger("quote.emailquote.sent")):n.removeClass("wait").html("Email send failure")},function(){n.removeClass("wait").html("Email send failure")})})))},saveClicked:function(){this.validFormFields()&&this.saveProspect(1)},saveProspect:function(n){var t=this,i=function(i){var r=t.buildProspectData(i);Quote.Helpers.sendProspect(r,function(i){if(i&&i.Status=="SUCCESS"){if($("#_prospectid").val(i.ProspectID),$("#_quoteid").val(i.QuoteID),n==1){var r=(i.ProspectID?"Prospect":"")+(i.QuoteID?" and Quote":"")+" saved!",u=$(".status",this.el);u.addClass("hidden");$(".form .prospect-success",this.el).removeClass("hidden");$(".form .data-inputs, .btn-save, .modal-footer",this.el).addClass("hidden");$(".form .prospect-success",this.el).find(".save-message").html(r)}i.QuoteID&&(t.quotekey_sent=t.quotekey_new)}else $(".status",this.el).removeClass("hidden").html("An error occured while saving prospect.")})};if(this.product==null){i();return}Quote.Helpers.getQuoteLink(App.SessionID,$("#txtEmailAddress",this.el).val(),this.getPayload(),i)},buildProspectData:function(n){var r=$("#txtEmailAddress",this.el).val(),u=null,h={FirstName:$("#txtFirstName",this.el).val(),LastName:$("#txtLastName",this.el).val(),DateOfBirth:this.model.get("dob"),EmailAddress:r,RebateTier:this.model.get("rebatetier").toString(),Brand:App.Settings.Brand,LifeStage:this.model.get("lifestage"),Location:App.Settings.SalesPortal.IsActive?App.Settings.SalesPortal.Location:"Web",SalesAgent:App.Settings.SalesPortal.IsActive?App.Settings.SalesPortal.ConsultantName:"Web"};if(this.product!=null){var i=this.product,f=Quote.Views.Helpers.productGetOption(i,"Hos"),e=Quote.Views.Helpers.productGetOption(i,"Anc"),t=i?i.Rate:null,o="",s="";t&&t.ProductHospital&&(o=t.ProductHospital.prodScaleCode);t&&t.ProductExtras&&(s=t.ProductExtras.prodScaleCode);this.quotekey_new=i.Code+"_"+(t?t.combinedNetAmount:0);this.quotekey_sent!=this.quotekey_new&&(u={Agent:App.Settings.SalesPortal.ConsultantName,BenefitSet:e?e.ExtrasBenefit:null,LifeStage:this.model.get("lifestage"),CoverType:this.model.get("coverType"),Excess:i.ExcessLevel,HospitalCode:o,ExtrasCode:s,PartnerDOB:this.model.get("partnerdob"),PriceNoRebate:t?t.combinedNetAmountNoRebate:0,PriceWithRebate:t?t.combinedNetAmount:0,RebateAmount:t?t.combinedRebateAmount:0,Referrer:window.location.href,PublicWebsiteQuoteURL:n,State:this.model.get("state"),DOB:this.model.get("dob"),RebateTier:this.model.get("rebatetier").toString(),IsPregnancy:f?f.Obstetrics:null,Brand:App.Settings.Brand,PaymentFrequency:this.model.get("paymentfrequency")})}return{EmailAddress:r,Prospect:h,Quote:u}}});Quote.Views.RHSQuoteBar=Backbone.View.extend({el:".quote-bar",isloading:!1,initialize:function(){this.isloading=!0;this.model.on("change:lifestage change:dob change:partnerdob change:rebatetier",this.renderProfileStatement,this);this.model.on("quote.rhsbar.addproduct",this.addToQuote,this);this.model.on("change:paymentfrequency",this.paymentFrequencyListener,this);this.model.on("quote.rhsbar.rerender",this.render,this);this.model.on("quote.rhsbar.renderlhc",this.renderLhc,this);this.render();this.isloading=!1},events:{"click .js-jump, .js-change-income":"gotoStep","change .js-state-switcher":"changeState","change .js-frequency":"changeFrequency","click .rate-update .option, .rate-update .option a":"ratechange"},gotoStep:function(n){var t=$(n.target).data("target");EventBroker.trigger("ui.event",{eventAction:"Prospect Information",eventLabel:"Updated"});this.model.trigger("quote.step.byname",t)},addToQuote:function(n){this.setToProspect(n);this.renderProduct(n)},setToProspect:function(n){var i="",u=0,r="",e=0,t,f;n!=null&&(n.Rate&&n.Rate.ProductHospital&&n.Rate.ProductExtras?(i=n.Rate.ProductHospital.code,u=n.Rate.ProductHospital.id,r=n.Rate.ProductExtras.code,e=n.Rate.ProductExtras.id):n.IsPackage||n.IsCombo?(i=n.HospitalComponentCode,r=n.ExtrasComponentCode):n.Type=="Hos"?(i=n.Code,u=n.ID):n.Type=="Anc"&&(r=n.Code,extrasID=n.ID),this.model.trigger("quote.discount",n.Rate.discountRate));this.model.set("hospitalcode",i);this.model.set("hospitalId",u);this.model.set("extrascode",r);this.model.set("extrasId",e);n!=null&&(this.model.set("excessLevel",n.ExcessLevel),this.model.set("coverType",Quote.Views.Helpers.productGetCoverType(n)),t=Quote.Views.Helpers.productGetOption(n,"Hos"),this.model.set("obstetricsCover",t?t.Obstetrics:!1),this.model.set("medicalGap",t?t.MedicalGap:!1),this.model.set("somePrivate",t?t.SomePrivate:!1),f=Quote.Views.Helpers.productGetOption(n,"Anc"),this.model.set("extrasBenefit",f?f.ExtrasBenefit:""));this.model.addProduct(n);this.model.save()},renderProduct:function(n){if(n==null){$(".price__display .price__title",this.el).addClass("is-inactive");$(".price__display .smallest-price",this.el).html("0");$(".product-title-selected",this.el).text("");return}$(".price__display .price__title",this.el).removeClass("is-inactive");$(".price__display .smallest-price",this.el).html(Quote.Helpers.formatCurrency(n.Rate.combinedNetAmount,!0,!0));$(".product-title-selected",this.el).text(n.Name)},renderLhc:function(n){App.Settings.SalesPortal.IsActive?($(".lhc__loading_combined",this.el).text(Math.round(100*this.model.attributes.lhc.loading)),$(".price__lhc",this.el).toggleClass("hidden",this.model.attributes.primaryLhcContinuousCover===null||this.model.attributes.lhc.loading<=0),$(".lhc__cost",this.el).text(Quote.Helpers.formatCurrency(n,!0)),$(".price__disclaimer",this.el).addClass("hidden")):$(".price__disclaimer",this.el).removeClass("hidden")},changeFrequency:function(n){prevValue=this.model.attributes.paymentfrequency;var t=$(n.currentTarget).val();this.model.set("paymentfrequency",parseInt(t));this.model.save();EventBroker.trigger("quote.paymentFrequency.selected",parseInt(t),prevValue)},paymentFrequencyListener:function(){this.renderFrequency()},renderFrequency:function(){this.$el.find("select.js-frequency").val(this.model.get("paymentfrequency"));this.$el.find("select.js-frequency").prev("div.faux-select-value").html(Quote.Views.Helpers.productGetSelectedFrequency(this.model.get("paymentfrequency")))},renderSelectedProduct:function(){var n=this.model.get("selectedProduct");try{n&&n.ID>0&&this.renderProduct(n)}catch(t){Tracker.SendError(t,{SelectedProduct:n})}},ratechange:function(n){n.preventDefault();var t=this;return $(n.target).closest(".options").find(".option").removeClass("active"),$(n.target).closest(".option").addClass("active"),$(n.currentTarget).hasClass("option-now")?this.model.set("effectivefrom","NOW"):this.model.set("effectivefrom","FUTURE"),this.model.save(function(){t.model.trigger("quote.ratechange");t.model.trigger("quote.analytics.ratechange")}),!1},renderRateToggle:function(){this.$el.find(".rate-update").length>0&&(this.$el.find(".option").removeClass("active"),this.model.attributes.effectivefrom=="NOW"?this.$el.find(".option-now").addClass("active"):this.$el.find(".option-apr").addClass("active"))},renderProfileStatement:function(){this.model.trigger("profile.statement.render")},render:function(){this.renderFrequency();this.renderProfileStatement();this.renderRateToggle()}});Quote.Views.Analytics=Backbone.View.extend({router:null,getAnalyticsDefault:function(){return{event:"createEvent",eventCategory:"quote",eventAction:"default",eventLabel:"default"}},initialize:function(n){n.router.on("route",this.routed,this);this.model.on("quote.step.complete",this.changeStep);n.router.on("route:compare",this.routeMethod,this);n.router.on("route:lifestage",this.routeMethod,this);n.router.on("route:need",this.routeMethod,this);n.router.on("route:review",this.routeMethod,this);this.model.on("quote.step.back",this.stepBack,this);this.model.on("quote.step.next",this.stepForward,this);this.model.on("quote.step.byname",this.stepByName,this);this.model.on("quote.emailquote.sent",this.emailMyQuoteSent,this);this.model.on("quote.emailquote.open",this.emailMyQuoteOpenModal,this);this.model.on("profile.apply.complete",this.quoteInlineEditApply,this);EventBroker.on("quote.lifestage.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Life Stage Selected";i.eventLabel=n;i.previousValue=t;dataLayer.push(i)},this);EventBroker.on("quote.primary.dob.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="DOB Entered";i.eventLabel=Quote.Helpers.getYear(n);i.previousValue=Quote.Helpers.getYear(t);dataLayer.push(i)},this);EventBroker.on("quote.partner.dob.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Partner DOB Entered";i.eventLabel=Quote.Helpers.getYear(n);i.previousValue=Quote.Helpers.getYear(t);dataLayer.push(i)},this);this.model.on("quote.needs.set",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="PHI Purpose";i.eventLabel=Quote.Views.Helpers.getNeedLabel(n);i.previousValue=Quote.Views.Helpers.getNeedLabel(t);dataLayer.push(i)},this);EventBroker.on("quote.rebatetier.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Rebate Tier";i.eventLabel=Quote.Views.Helpers.getIncomeRangeLabel(this.model.attributes.lifestage,n);i.previousValue=Quote.Views.Helpers.getIncomeRangeLabel(this.model.attributes.lifestage,t);dataLayer.push(i)},this);EventBroker.on("quote.paymentFrequency.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Payment Frequency Option - Selected";i.eventLabel=n+" weeks";i.previousValue=t;dataLayer.push(i)},this);EventBroker.on("quote.coverType.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Selected";i.eventLabel=Quote.Views.Helpers.getCoverLabel(n);i.previousValue=Quote.Views.Helpers.getCoverLabel(t);dataLayer.push(i)},this);EventBroker.on("quote.primaryLhcContinuousCover.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Primary LHC - Selected";i.eventLabel=n?"yes":n===null?"skip":"no";i.previousValue=t?"yes":t===null?"skip":"no";dataLayer.push(i)},this);EventBroker.on("quote.partnerLhcContinuousCover.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Partner LHC - Selected";i.eventLabel=n?"yes":n===null?"skip":"no";i.previousValue=t?"yes":t===null?"skip":"no";dataLayer.push(i)},this);EventBroker.on("quote.obstetricsCover.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Option Selected";i.eventLabel=n==="1"?"Obstetrics":"No Obstetrics";i.previousValue=t;dataLayer.push(i)},this);EventBroker.on("quote.extrasBenefit.selected",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Option Selected";i.eventLabel="Extras Benefit - "+n;i.previousValue=t;dataLayer.push(i)},this);EventBroker.on("quote.excessLevel.selected",function(n,t){var i=this.getAnalyticsDefault(),r=Quote.Views.Helpers.productGetSelectedExcess(n,!0);i.eventAction="Hospital Option - Selected";i.eventLabel="optionExcess"+r;i.previousValue=t;dataLayer.push(i)},this);EventBroker.on("quote.submit",function(n){var t=this.getAnalyticsDefault();t.eventAction="Submit to Signup";model=(n||{}).attributes||{};t.eventLabel=(model.selectedProduct||{}).Code;t.product=model.selectedProduct;t.prospect=model;dataLayer.push(t)},this);EventBroker.on("quote.details.section.showhide",function(n,t){var i=this.getAnalyticsDefault();i.eventAction="Product Detail Section";i.eventLabel=n+" - "+t;dataLayer.push(i)},this);EventBroker.on("quote.products.vitality.accordion",function(n){var t=this.getAnalyticsDefault();t.eventAction="Vitality Accordion Clicked";t.eventLabel="Vitality Accordion :"+n;dataLayer.push(t)},this);EventBroker.on("quote.details.subSection.showhide",function(n,t,i){var r=this.getAnalyticsDefault();i=i||"";i=i.indexOf("hospital")>=0?"hospital":"extras";r.eventAction="Product Detail "+i+" Sub";r.eventLabel=n+" - "+t;dataLayer.push(r)},this);this.model.on("quote.product.selected",this.productSelected,this);EventBroker.on("quote.products.loaded",this.productsLoaded,this);EventBroker.on("ui.action.webchat",function(n){var t=this.getAnalyticsDefault();t.eventAction="webchat";t.eventLabel="started - "+n.url;dataLayer.push(t)},this);EventBroker.on("ui.event",function(n){n=n||{};var t=this.getAnalyticsDefault();t.eventCategory=n.eventCategory||t.eventCategory;t.eventAction=n.eventAction||t.eventAction;t.eventLabel=n.eventLabel||t.eventLabel;dataLayer.push(t)},this);this.model.on("quote.analytics.ratechange",function(n){var t=this.getAnalyticsDefault();t.eventAction="Rates Toggle";t.eventLabel=n||"NOW";dataLayer.push(t)},this);this.model.on("quote.coverlevel.set",function(n){var t=this.getAnalyticsDefault();t.eventAction="PHI Level";t.eventLabel=n;dataLayer.push(t)},this);EventBroker.on("quote.coverlevel.showinfo",function(n){var t=this.getAnalyticsDefault();t.eventAction="PHI Level Description";t.eventLabel=n;dataLayer.push(t)},this);EventBroker.on("rate.message.modalEvent",function(n,t){var i={event:"VirtualPageview",VPURL:"quote/view-changes"+(n?"-"+n:""),VPTITLE:"Quote - View Changes"+(t?" - "+t:"")};dataLayer.push(i)},this)},render:function(){},emptyHandler:function(){},productSelected:function(n){var t=this.getAnalyticsDefault(),i,r;n=n||{};t.eventAction="Product - Selected";t.eventLabel=n.Name;t.previousValue=null;t.product=n;dataLayer.push({event:"productClick",ecommerce:{click:{actionField:{list:Quote.Views.Helpers.getNeedLabel(this.model.attributes.need)},products:[{name:n.Name,id:n.Code,price:n.Rate.combinedNetAmount,brand:App.Settings.Brand}]}}});dataLayer.push(t);i=this.getAnalyticsDefault();r=$("#"+n.UniqueRefID).prev().hasClass("product-recommended");i.eventLabel="Selected";i.eventAction=r?"Recommended Product":"Non-Recommended Product";dataLayer.push(i)},productsLoaded:function(n){if(products=(n||{}).Products,products.length){var t=products[0];dataLayer.push({event:"productImpression",ecommerce:{currencyCode:"AUD",impressions:[{name:t.Name,id:t.Code,price:(t.Rate||{}).combinedNetAmount,brand:App.Settings.Brand,list:this.model.attributes.need,position:1}]}})}},routed:function(){},changeStep:function(n){dataLayer.push({event:"navigate",eventCategory:"nav",eventAction:n.id||"",eventLabel:n,stepName:n.id,stepNumber:n.index})},stepForward:function(){this.stepDirection("forward")},stepBack:function(){this.stepDirection("back")},stepByName:function(n){this.stepDirection("byname",n)},stepDirection:function(n,t){dataLayer.push({event:"navigate",eventCategory:"direction",eventAction:n||"",eventLabel:t||""})},routeMethod:function(n,t){t&&t[0]&&t[0]==="defaultRoute"&&dataLayer.push({event:"navigate",eventCategory:"nav",eventAction:"default",eventLabel:document.location.hash,stepName:"default",stepNumber:0})},lifestageSelected:function(n,t){dataLayer.push({event:"createEvent",eventCategory:"Quote",eventAction:"Life Stage Selected",eventLabel:n,previousValue:t})},emailMyQuoteSent:function(){dataLayer.push({event:"createEvent",eventCategory:"Quote",eventAction:"Sent",eventLabel:"Email Me My Quote"})},emailMyQuoteOpenModal:function(){dataLayer.push({event:"createEvent",eventCategory:"Quote",eventAction:"Window Opened",eventLabel:"Email Me My Quote"})},quoteInlineEditApply:function(n){dataLayer.push({event:"createEventQuoteUpdate",eventCategory:"Quote",eventLabelLifeStage:n.attributes.lifestage,eventLabelDOB:Quote.Helpers.getYear(n.attributes.dob),eventLabelPartnerDOB:Quote.Helpers.getYear(n.attributes.partnerdob),eventLabelRebateTier:Quote.Views.Helpers.getIncomeRangeLabel(n.attributes.taxIncomePurpose,n.attributes.rebatetier),eventLabelState:n.attributes.state})}});Quote.Views.StickyHeaders=Backbone.View.extend({el:".sticky-product-header",productDetail:null,initialize:function(n){this.prospect=n.prospect;this.model.attributes.Products[0].IsRecommended=!0;this.prospect.on("quote.stickyHeader.update",this.render,this);EventBroker.on("quote.stickyHeader.slideChange",this.sliderUpdate,this);this.prospect.on("quote.compare.loadComplete",this.applySettings,this);this.prospect.on("quote.stickyHeader.compareStatus",this.updateQuoteStatus,this);EventBroker.on("quote.stickyHeader.hide",this.hideHeader,this);EventBroker.on("quote.stickyHeader.show",this.showHeader,this);this.$quoteStatus=n.quoteStatus;this.$stickyHeader=$(".product-sticky-wrapper",this.el);this.$stickyHeaderInner=$(".product-sticky-wrapper .sticky-inner",this.el);this.$firstLoad=!0;this.render()},events:{"click .product-next-btn":"stickySelectProduct"},updateQuoteStatus:function(n){this.$quoteStatus=n;this.applySettings()},render:function(){var t=_.template($("#sticky-header-template").html(),{model:this.model,prospect:this.prospect}),n;this.$stickyHeaderInner.html(t);this.$allProducts=$(".product-sticky-wrapper .sh-product",this.el);this.$productWaypoint="";this.$stickyObject="";this.$mobile=Quote.Helpers.isMobile();this.$passedWaypoint=!1;this.$firstWaypoint=null;this.$columns=this.columns();this.setInitialActiveItems();n=this;$(window).smartresize(function(){n.smartResizeFunctions()});this.$mobile==!0&&$("body").scrollTop(0)},hideHeader:function(){$(this.el).addClass("hidden");Quote.Helpers.isMobile()&&$(".site-header__prev").show()},hideHeaderOnResize:function(){var n=this;this.$mobile==!1&&$(window).resize(function(){n.hideHeader()})},columns:function(){return $(window).width()<620?1:$(window).width()>620&&$(window).width()<1024?2:$(window).width()>1023?3:void 0},reloadFrame:function(){$("body").addClass("loading");$(this.el).hide();location.reload()},scrollbarOffset:function(){Quote.Helpers.getScrollBarWidth()!=0&&this.$mobile==!1&&$(this.el).css("width","calc(66.6666666667% - "+Quote.Helpers.getScrollBarWidth()+"px)")},stickyHeaderDirection:function(n){this.$firstLoad==!1&&(n=="up"&&(this.hideHeader(),this.$passedWaypoint=!1),n=="down"&&(this.$passedWaypoint=!0,this.showHeader(!0)))},showHeader:function(n){var t;if(Quote.Helpers.isMobile())var i=$(window).scrollTop(),r=$(".slick-current .product-next-btn").offset().top,u=r-i;t=this;this.$quoteStatus==!0&&this.$firstLoad==!1&&$("#compare").hasClass("is-active")&&(Quote.Helpers.isMobile()?Quote.Helpers.getViewport().t>u&&(t.$passedWaypoint==!0&&$("#compare").hasClass("is-active")&&n==!1||n==!0)&&($(".site-header__prev").hide(),$(t.el).removeClass("hidden")):(t.$passedWaypoint==!0&&$("#compare").hasClass("is-active")&&n==!1||n==!0)&&$(t.el).removeClass("hidden"))},runWaypoints:function(){var n=this,t;Quote.Helpers.isMobile()==!1&&(t=$(".product + .product a.product-next-btn").waypoint(function(t){n.stickyHeaderDirection(t)},{offset:"0px",context:$("#compare")}));Quote.Helpers.isMobile()==!0&&(t=$(".product + .product a.product-next-btn").waypoint(function(t){n.stickyHeaderDirection(t)},{offset:"0px"}))},setInitialActiveItems:function(){visibleProducts="";$(window).width()>1023&&(visibleProducts=2);$(window).width()<1024&&$(window).width()>620&&(visibleProducts=1);this.$allProducts.nextAll(":lt("+visibleProducts+")").addClass("active")},setLastProduct:function(){(this.$columns==2||this.$columns==3&&this.$allProducts.length>2)&&(this.$stickyHeader.find(".sh-product.active:last").addClass("last-product"),this.$stickyHeader.find(".sh-product.last-product").nextAll().addClass("hidden"))},sliderUpdate:function(n){this.$stickyProducts=$(".product-sticky-wrapper .sh-product",this.el);activeProducts=[];n===undefined?(this.$columns==1&&(slides=$("#compare .swipeshow .slides .product")),this.$columns>1&&(slides=$("#compare .slides .product"))):slides=n.$slides;slides.each(function(){if($(this).hasClass("slick-active")||$(this).hasClass("slick-current")){var n=$(this).attr("data-prod-id");activeProducts.push(n)}});currentProducts=this.$allProducts;currentProducts.each(function(){$.inArray(this.attributes["data-prod-id"].value,activeProducts)!==-1&&$(this).removeClass("hidden").addClass("active").removeClass("last-product");$.inArray(this.attributes["data-prod-id"].value,activeProducts)==-1&&$(this).removeClass("active").addClass("hidden").removeClass("last-product")});this.applySettings(!0)},stickySelectProduct:function(n){n.preventDefault();this.hideHeader();this.prospect.trigger("quote.select.product",n)},applySettings:function(n){n||this.sliderUpdate();this.scrollbarOffset();var t=this;setTimeout(function(){t.runWaypoints()},300);this.hideHeaderOnResize();this.setLastProduct();this.loadComplete()},smartResizeFunctions:function(){this.$columns==1&&this.columns()==2&&this.sliderUpdate();this.$columns=this.columns();this.scrollbarOffset();Quote.Helpers.isMobile()!=this.$mobile&&(this.$mobile==!0&&Quote.Helpers.isMobile()==!1&&this.reloadFrame(),this.$mobile==!1&&Quote.Helpers.isMobile()==!0&&this.reloadFrame())},loadComplete:function(){this.$firstLoad=!1;$("body").removeClass("loading")}});Quote.Views.ProspectProfiler=Backbone.View.extend({el:".profile-view",initialize:function(n){this.reviewCoverView=n.reviewCover;this.isMobile=n.isMobile;this.isMobile&&(this.el=".mobile-profile-view",this.$el=$(this.el));this.model.on("profile.view.show",this.show,this);this.model.on("profile.view.hide",this.hide,this);this.model.on("profile.view.render",this.renderFields,this);this.render();this.isMobile||($(".primarydob .autotab",this.el).autotab(),$(".partnerdob .autotab",this.el).autotab());this.setupDateValidator()},events:{"click .js-btn-close":"hide","click .js-btn-apply":"apply","change .js-profile-lifestage":"changeLifestage"},setupDateValidator:function(){var n=$(".touch .profile-content .date-full");$(".form-inline",this.el).validate({onsubmit:!1,rules:{},errorPlacement:function(n,t){t.is(".dob-DDMMYYY")?n.appendTo(t.parent().parent().children(".dob-validation")):n.insertAfter(t)},onkeyup:function(n){if($(n).is(".dob-DDMMYYY")&&$(n).val().length<3)return!1}});$.validator.addMethod("dobDMY",function(n,t){var i=$(t).parent(),r=i.find(".date-day").val(),u=i.find(".date-month").val(),f=i.find(".date-year").val(),e=r+"/"+u+"/"+f;return Quote.Helpers.isValidAdultDate(e,"dd/mm/yyyy")},"There's a problem with your date of birth");$.validator.addClassRules({"date-full":{required:!0,date:!0},"dob-DDMMYYY":{dobDMY:!0}});n.length&&n.each(function(){var n=$(this);n.addClass("fake-placeholder").attr("type","text").attr("value","Enter date");n.on("touchstart touchend",function(){n.removeClass("fake-placeholder").attr("type","date").attr("value","");setTimeout(function(){n.trigger("focus")},50)}).on("blur",function(){(this.value==""||this.value=="Enter date")&&$(".android").length==0&&setTimeout(function(){n.addClass("fake-placeholder").attr("type","text").attr("value","Enter date")},50)})})},show:function(){this.renderFields();this.$el.toggleClass("active");$("body").toggleClass("profile-active");this.model.trigger("quote.view.shown")},hide:function(){$(this.$el).hasClass("active")&&(this.$el.toggleClass("active"),$("body").toggleClass("profile-active"),this.model.trigger("quote.view.hidden"))},apply:function(){var n=this,t;$(".form-inline").valid()&&(t=this.$lifestage&&this.$lifestage.val()!=this.model.attributes.lifestage,$.when(n.preloadProductAvailabilityCheck(t)).done(function(t){t?n.processApply():n.showProductAlert()}))},processApply:function(n){var r=this,i=!1,t=[],u,f;this.$lifestage&&this.$lifestage.val()!=this.model.attributes.lifestage&&(this.model.set("lifestage",this.$lifestage.val(),{silent:!0}),this.model.set("taxIncomePurpose",this.$lifestage.val()=="S"?"S":"F",{silent:!0}),t.push({name:"quote.lifestage.set",value:null}),Quote.NavigatorState.getState().step.id=="compare"&&t.push({name:"quote.step.reload",value:null}),i=!0);u=this.getProfileDateInput("dob");Quote.Helpers.isValidDate(u,"dd/mm/yyyy")&&u!=this.model.attributes.dob&&(this.model.set("dob",u,{silent:!0}),this.model.set("dobIsDefault",!1),t.push({name:"quote.dob.change",value:null}),t.push({name:"quote.lhc.recalc",value:null}),i=!0);f=this.getProfileDateInput("pdob");Quote.Helpers.isValidDate(f,"dd/mm/yyyy")&&f!=this.model.attributes.partnerdob&&(this.model.set("partnerdob",f,{silent:!0}),t.push({name:"quote.partnerdob.change",value:null}),t.push({name:"quote.lhc.recalc",value:null}),i=!0);this.$income&&this.$income.val()!=this.model.attributes.rebatetier&&(this.model.set("rebatetier",parseInt(this.$income.val()),{silent:!0}),t.push({name:"quote.rebatetier.change",value:null}),i=!0);this.$state&&this.$state.val()!=this.model.attributes.state&&(this.model.set("state",this.$state.val(),{silent:!0}),i=!0);i?(t.push({name:"quote.reload.products",value:null}),t.push({name:"quote.ratechange",value:null}),t.push({name:"profile.statement.render",value:null}),this.model.save(function(){$.when(r.fireBatchTriggers(t)).done(function(){r.model.trigger("profile.apply.complete",r.model);r.hide();n&&n()})})):r.hide()},showProductAlert:function(){var n=this;bootbox.confirm("Your selected product is no longer valid for the profile details requested.<br><br>Clicking OK will return you to the product selection page.",function(t){t==!0?n.processApply(function(){window.location.hash="#step/compare"}):n.hide()})},preloadProductAvailabilityCheck:function(n){var t=$.Deferred();if(!n||Quote.NavigatorState.getState().step.id!="review")return t.resolve(!0),t.promise();var i=this.reviewCoverView.getProduct(),r={dob:this.getProfileDateInput("dob"),partnerdob:this.getProfileDateInput("pdob"),lifeStage:this.$lifestage.val(),state:this.$state.val(),rebateTier:parseInt(this.$income.val()),paymentFrequency:this.model.attributes.paymentfrequency,need:this.model.attributes.need,effectiveFrom:this.model.attributes.effectivefrom,postcode:this.model.attributes.postcode,coverType:this.model.attributes.coverType,getProductBy:3,brand:App.Settings.Brand,groupDiscount:this.model.attributes.groupDiscount,useHAMBSCombinedRate:!0,abcSettingID:this.model.attributes.abcSettingID},u=Quote.Helpers.constructPayload([i],r);return Quote.Helpers.getRate(u,this,function(n){if(n.length==0){t.resolve(!1);return}if(rate=n[0],(rate.ProductExtras!=null||rate.ProductHospital!=null)&&rate.combinedNetAmount==-1){t.resolve(!1);return}t.resolve(!0)},function(){t.resolve(!1)}),t.promise()},fireBatchTriggers:function(n){var i=this,t=$.Deferred();EventBroker.on("quote.products.loaded",function(){t.resolve()},this);return $.each(n,function(n,t){var r=t;r&&i.model.trigger(r.name,r.value)}),t.promise()},changeLifestage:function(n){var t=$(n.currentTarget).val();$(".profile-item.partnerdob",this.el).toggleClass("hidden",t=="S"||t=="P");this.setProfileDateInput("pdob","");this.renderIncome(t)},renderIncome:function(n){var t=n=="F"||n=="C"||n=="P";this.$income.find("option[value='0']").text(t?"under $180,000":"under $90,000");this.$income.find("option[value='1']").text(t?"between $180,000 - $210,000":"between $90,000 - $105,000");this.$income.find("option[value='2']").text(t?"between $210,001 - $280,000":"between $105,001 - $140,000");this.$income.find("option[value='3']").text(t?"over $280,000":"over $140,000");this.$income.val(this.model.attributes.rebatetier)},renderPartnerDOB:function(){var n=$(".profile-item.partnerdob",this.el),t=$("input.js-profile-partnerdob",this.el);this.model.hasPartner()?(n.removeClass("hidden"),this.setProfileDateInput("pdob",this.model.attributes.partnerdob)):(this.setProfileDateInput("pdob",""),n.addClass("hidden"))},renderFields:function(){this.$lifestage.val(this.model.attributes.lifestage);this.setProfileDateInput("dob",this.model.attributes.dob);this.renderPartnerDOB();this.renderIncome(this.model.attributes.lifestage);this.$state.val(this.model.attributes.state)},getProfileDateInput:function(n){var i=Quote.Helpers.DateLeading0s($("input[name='"+n+"-date-day']",this.el)),r=Quote.Helpers.DateLeading0s($("input[name='"+n+"-date-month']",this.el)),u=$("input[name='"+n+"-date-year']",this.el).val(),f=$("input[name='"+n+"-date-full']",this.el),e,t;return f.is(":visible")&&(e=f.val(),t=e.split("-",3),u=t[0],r=t[1],i=t[2]),i+"/"+r+"/"+u},setProfileDateInput:function(n,t){var f=t||"//",i=f.split("/",3),r,u;$("input[name='"+n+"-date-day']",this.el).val(i[0]);$("input[name='"+n+"-date-month']",this.el).val(i[1]);$("input[name='"+n+"-date-year']",this.el).val(i[2]);r=$("input[name='"+n+"-date-full']",this.el);r.is(":visible")&&(u=i[0].length>0?""+i[2]+"-"+i[1]+"-"+i[0]:"",r.val(u))},render:function(){var n=_.template($("#profile-template").html(),{model:this.model,isMobile:this.isMobile});this.$el.html(n);this.$lifestage=$("select.js-profile-lifestage",this.el);this.$income=$("select.js-profile-income",this.el);this.$state=$("select.js-profile-state",this.el);this.renderFields()}});Quote.Views.ProfileStatement=Backbone.View.extend({el:".profile-statement",initialize:function(n){this.isMobile=n.isMobile;this.$el.toggleClass("hidden",this.isMobile);this.isMobile&&(this.el=".mobile-profile-statement",this.$el=$(this.el),this.$el.toggleClass("hidden",!1));this.model.on("profile.statement.render",this.render,this);this.model.on("quote.step.complete",this.onloadComplete,this);this.model.on("quote.view.hidden",this.hiddenProfile,this);this.render();this.$editButton=this.$el.find(".js-change-profile")},events:{"click .js-change-profile":"showProfile"},onloadComplete:function(n){this.$editButton.toggleClass("hidden",n&&n.id!="compare"&&n.id!="review")},showProfile:function(){this.model.trigger("profile.view.show");this.isMobile&&this.$editButton.addClass("hidden")},hiddenProfile:function(){this.isMobile&&this.$editButton.removeClass("hidden")},render:function(){var n="Based on a <strong>"+Quote.Views.Helpers.getLifeStageLabel(this.model.get("lifestage"))+"<\/strong>";n+=", aged <strong>"+Quote.Views.Helpers.getAgeLabel(this.model.get("dob"),this.model.get("partnerdob"),this.model.hasPartner())+"<\/strong>";n+=", "+(this.model.get("rebatetier")==4?"with":"earning")+" <strong>"+Quote.Views.Helpers.getIncomeRangeLabel(this.model.get("taxIncomePurpose"),this.model.get("rebatetier"))+"<\/strong>";n+=", living in <strong>"+this.model.get("state")+"<\/strong>";this.$el.find("p").html(n);this.model.trigger("profile.view.render")}});Quote.Views.App=Backbone.View.extend({initialize:function(){var n=this;_.templateSettings={evaluate:/\{\{(.+?)\}\}/g,interpolate:/\{\{=(.+?)\}\}/g,escape:/\{\{-(.+?)\}\}/g};var t=new Quote.Models.Prospect,i=Quote.Helpers.getCookie(App.Settings.ABC.Key),r=Quote.Helpers.getCookie("PAGE-CUSTOM-CONTENT");t.set("abcSettingID",i||0);t.set("pageCustomContentID",r||0);t.set("groupDiscount",i==null?"DISC-02":$("#hdnGroupDiscount").val());App.UI.init();this.prospect=t;this.isMobile=Quote.Helpers.isMobile();$.when(Quote.Helpers.mapQueryStringsToProspect(this.prospect)).done(function(t){n.initialiseOffers(n.prospect);n.stepNavigator=new Quote.Views.StepsViewNavigator({model:n.prospect,queryStringData:t});n.navMenu=new Quote.Views.NavMenu({model:n.prospect,queryStringData:t});n.aboutyou=new Quote.Views.AboutYou({model:n.prospect});n.yourage=new Quote.Views.YourAge({model:n.prospect});n.yourpartnersage=new Quote.Views.YourPartnersAge({model:n.prospect});n.yourneed=new Quote.Views.YourNeeds({model:n.prospect});n.yourincome=new Quote.Views.YourIncome({model:n.prospect});n.compareProduct=new Quote.Views.CompareProduct({model:n.prospect,queryStringData:t});n.lifetimeCover=new Quote.Views.LifetimeCoverQuestions({model:n.prospect});n.lifetimeCover=new Quote.Views.LifetimeCoverQuestionsPartner({model:n.prospect});n.lifetimeCoverInfo=new Quote.Views.LifetimeCoverInfo({model:n.prospect});n.reviewCover=new Quote.Views.ReviewCover({model:n.prospect});n.quoteBar=new Quote.Views.RHSQuoteBar({model:n.prospect});n.analytics=new Quote.Views.Analytics({model:n.prospect,router:n.stepNavigator.router});App.Settings.SalesPortal.IsActive&&(n.salestoolbar=new Quote.Views.SalesPortalToolBar({model:n.prospect}));n.profileStatement=new Quote.Views.ProfileStatement({model:n.prospect,isMobile:n.isMobile});n.profiler=new Quote.Views.ProspectProfiler({model:n.prospect,reviewCover:n.reviewCover,isMobile:n.isMobile})})},initialiseOffers:function(n){var t=$("input#offerName");t.length>0&&t.val().toUpperCase()=="GEELONG CATS"&&(n.set("hospitalCoverLevel","medium",{silent:!0}),n.set("extrasCoverLevel","medium",{silent:!0}))},start:function(){}});$(function(){var n="Unknown OS",t;navigator.appVersion.indexOf("Win")!=-1?n="windows":navigator.appVersion.indexOf("Mac")!=-1?n="osx":navigator.appVersion.indexOf("X11")!=-1?n="unix":navigator.appVersion.indexOf("Linux")!=-1&&(n="linux");$("body").addClass(n);Quote.Helpers.detectIE()!=!1&&($("body").addClass("ie"),$("body").addClass("ie-"+Quote.Helpers.detectIE()));App.Settings.SalesPortal.IsActive==!0&&$("body").addClass("sales-portal");t=new Quote.Views.App;t.start();Backbone.history.start()})