require(["page","stApp","ccData","cuData","ccFilters","pitLS","ccModel","cookie-helper","jquery","jquery.vclick","cards-compare"],function(e,t,i,r,s,n,l,a,o,c){function f(e){for(var t in e){if("boolean"==typeof e[t]&&!e[t])return!1;if("object"==typeof e[t]){if(!("checked"in e[t]&&"boolean"==typeof e[t].checked))return!1;if("code"in e[t]&&e[t].code<0)continue;if(!e[t].checked)return!1}}return!0}function d(e,t){for(var i,r=[],s=e.length;s--;)i=e[s],-1===t.indexOf(i)&&r.push(i);return r.reverse()}n.group("mw");var u=a.is_logged_in()&&n.get("has-sess")&&n.get("full"),h={standing:null,score:null};u&&n.get("vs")&&n.get("crd")&&(h.standing=n.get("crd"),h.score=n.get("vs")),n.group("src-cc"),"cards"in i&&(i=i.cards),t.angular.run(["$rootScope",function(e){e.tooltips={minCred:"<div class='table-container'> <div class='row'> <div class='white'></div> <div class='grey'>Credit Score</div> </div><div class='row'> <div class='grey'>Excellent Credit</div> <div class='white'>750 — 850</div> </div> <div class='row'> <div class='grey'>Good Credit</div> <div class='white'>700 — 749</div> </div> <div class='row'> <div class='grey'>Fair Credit</div> <div class='white'>640 — 699</div> </div> <div class='row'> <div class='grey'>Bad Credit</div> <div class='white'>300 — 639</div> </div> <div class='row'> <div class='grey'>Limited Credit</div> <div class='white'>Less than 3 years of credit history</div> </div> </div><strong>Get Your Free Credit Score</strong> <p>Join WalletHub and get your credit score. It&rsquo;s 100% free, forever.</p> <a href='/join/' hm-url target='_blank' class='btn blue no-decoration'>Get your free credit score now</a>"}}]),t.angular.directive("reviewStars",["$rootScope","$compile","$timeout","$http",function(e,t,i,r){var s=["Bad","Below Average","Average","Good","Excellent"],l=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}}();return n.get("rate_tracking")||n.set("rate_tracking",l()),{restrict:"A",link:function(e,t,l){var a,o,c,f=e.$eval(l.reviewStars),d=f.getStars(),u=["bf-icon-star","bf-icon-star-half","bf-icon-star-empty"],h=!!n.get("card-votes")&&n.get("card-votes")[f.aM];e.stars=d.slice(0),e.rate=f.getRating(),e.rating="",e.reviews=f.getVotes(),e.rateHeading=angular.isNumber(h)?"Thanks for your review!":"Rating:",e.show_tip=!1,e.voted=h,e.track=function(t,r,n){if("add"==n){if(!e.voted){for(c=0;c<d.length;c++)e.stars[c]=c<=r?u[0]:u[2];angular.isNumber(h)&&(e.stars[h]=u[0]),e.rating=s[r],i.cancel(a)}e.show_tip=!0,i.cancel(o)}else e.voted||(a=i(function(){for(c=0;c<d.length;c++)e.stars[c]=d[c]})),o=i(function(){e.show_tip=!1},1e3)},e.inPopup=function(t,r){"over"==r?(e.show_tip=!0,i.cancel(o)):o=i(function(){e.show_tip=!1},100)},e.voting=!1,e.rateCard=function(t,i){if(!e.voting){e.voting=!0;var s=n.get("card-votes")||{};r({url:"/ajax.php",method:"POST",data:{action:"Details.SetRate",rtg:i+1,uri:f.getDetailsPage(),tracker:n.get("rate_tracking")}}).then(function(t){var r=t.data;e.voting=!1,r.error?"rtg-hasreview"==r.type&&(e.voted=!0,e.rateHeading="Thanks for your review!",s[f.aM]=i,n.set("card-votes",s)):r.guest&&r.redirect?window.location.href=r.redirect:(e.voted=!0,e.rateHeading="Thanks for your review!",s[f.aM]=i,n.set("card-votes",s),f.setRating(r.rating),e.stars=f.getStars(),e.rate=f.getRating(),e.rating="",f.setVotes(r.total),e.reviews=f.getVotes())})}},e.show_tip=!1}}}]),t.angular.directive("ngRepeatDone",["$timeout",function(e){return{restrict:"A",link:function(t,i,r){!0===t.$last&&e(function(){t.$emit("repeat-done")})}}}]),t.angular.directive("removeClass",function(){return{restrict:"A",link:function(e,t,i){t.removeClass(i.removeClass)}}}),t.angular.controller("SearchToolController",["$scope","$rootScope","$http","$timeout","$location","$url","$comparedFactory","$window","$viewport","$q",function(t,a,c,g,_,p,m,v,w,y){function b(e){switch(e){case"Excellent":return"ex";case"Good":return"gd";case"Fair":return"fr";case"Bad":return"bd";case"Limited":return"nc"}return"ex"}function R(){t.filters.inst_pristine=f(t.filters.inst)&&t.filters.inst_o,t.filters.rw_all_true=f(t.filters.rw),t.filters.nw_all_true=f(t.filters.nw),t.filters.bt_all_true=f(t.filters.bt),t.filters.emv_all_true=f(t.filters.emv)}function A(e){if(e.inst_pristine)return null;var t,i,r=0;for(t=0;t<e.inst.length;t++)e.inst[t].checked&&r++;if(r>1)return null;for(t=0;t<e.inst.length;t++)if((i=e.inst[t]).checked&&"invisible"in i&&i.invisible)return i.value;return null}function x(){var e=angular.merge({},t.filters);e.mc=t.get_credit_standing(),e.other_issuer=A(e),i.sort($);var r,s,n=[],l=25,a=25;t.show_loading_animation(),g.cancel(q),q=g(function(){if(t.filtered=[],"y"==e.stcrd){for(s=0;s<M.length;s++)r=M[s],t.$applyAsync(function(){r.details=!1,r.visible=!1});n=M}else for(s=0;s<i.length;s++)(r=i[s]).filter(e)&&(t.$applyAsync(function(){r.details=!1,r.visible=!1}),n.push(r),null!=(l=i[s].getRegularRate())&&l<a&&(a=l));t.filtering=!1,t.initialized_cards=!0,t.filtered=n,t.filtered_begin=0,t.filtered_page=1,null!==t.filtered_length_override?t.filtered_page_total=Math.ceil(t.filtered_length_override/t.filtered_limit):t.filtered_page_total=Math.ceil(t.filtered.length/t.filtered_limit),0==t.filtered.length&&(a=5),t.regmin=a,t.filters.reg<a&&(t.filters.reg=a),void 0!==t.my_standing&&(t.mycredit_changing?b(t.my_standing)==t.filters.mc&&(t.filters.mc="lg",t.mycredit_changing=!1):t.filters.mc="lg")},400),t.inview_fast=!1,t.filtered_once=!0}function I(e){var i,n,l,a,o,c,f=[],u=_.search(),h=[],g=[],m=!1,v=!1,w=!1;if(void 0===e||p.entry==e){if(R(),t.filters.bt_all_true&&"y"!=t.filters.ft&&t.filters.emv_all_true&&"y"!=t.filters.pic&&"y"!=t.filters.cha&&t.filters.inst_pristine&&"y"!=t.filters.stcrd&&"y"!=t.filters.chcrd||(t.more_filters=!0),null!=(n=t.filters.iam)&&"gc"!=n&&(f.push("iam:"+n),g.push({ftr:"iam",tag:s.iam[n].tag})),"lg"==(n=t.filters.mc)&&(n=void 0===t.my_standing?null:b(t.my_standing)),null!=n&&(f.push("mc:"+n),h.push(s.mc[n].uri),"bd"==n&&"unsecured"==p.uri||g.push({ftr:"mc",tag:s.mc[n].tag})),null!=(n=t.filters.iam)&&"gc"!=n&&h.push(s.iam[n].uri),t.badcredit())t.filters.iw.sc&&t.filters.iw.us||(n=t.filters.iw.sc?"sc":"us",f.push("iw:"+n),h.push(s.iw[n].uri),g.push({ftr:"iw",tag:s.iw[n].tag}));else if((n=C("iw",d(Object.keys(s.iw),["sc","us"]))).length>0)for(f.push("iw:"+n.join(",")),l=0;l<n.length;l++)h.push(s.iw[n[l]].uri),g.push({ftr:"iw",subftr:n[l],tag:s.iw[n[l]].tag});if(t.filters.iw.reg&&(f.push("reg:"+t.filters.reg),w=!0),t.filters.iw.rw&&!t.filters.rw_all_true&&(n=C("rw",Object.keys(s.rw))).length>0)for(f.push("rw:"+n.join(",")),l=0;l<n.length;l++)h.push(s.rw[n[l]].uri);if(t.badcredit()&&(!t.filters.nw.vi||!t.filters.nw.mc)||!t.badcredit()&&!t.filters.nw_all_true){if((n=C("nw",d(Object.keys(s.nw),t.badcredit()?["am","di"]:[]))).length>0)for(f.push("nw:"+n.join(",")),l=0;l<n.length;l++)h.push(s.nw[n[l]].uri);g.push({ftr:"nw",tag:"Card Network"})}if(!t.badcredit()&&t.more_filters){if(t.filters.bt_all_true||(n=["n"],t.filters.bt.bt3&&n.push("3"),t.filters.bt.bt4&&n.push("4"),t.filters.bt.bt5&&n.push("5"),f.push("bt:"+n.join(",")),"n"==n?h.push(s.bt.n.uri):w=!0,g.push({ftr:"bt",tag:"Balance Transfer Fee"})),"y"==t.filters.ft&&(f.push("ft:y"),h.push(s.ft.y.uri),g.push({ftr:"ft",tag:"Foreign Transaction Fee"})),t.filters.emv_all_true||(n=C("emv",Object.keys(s.emv))).length>0&&(f.push("emv:"+n.join(",")),angular.equals(n,["pn","sg"])?h.push(s.emv.sg.uri):"pn"==n?h.push(s.emv.pn.uri):w=!0,g.push({ftr:"emv",tag:"Smart Chip"})),"y"==t.filters.pic&&(f.push("pic:y"),h.push(s.pic.y.uri),g.push({ftr:"pic",tag:"Picture on Plastic"})),"y"==t.filters.cha&&(f.push("cha:y"),h.push(s.cha.y.uri),g.push({ftr:"cha",tag:"Charity"})),!t.filters.inst_pristine){n=[];for(l in t.filters.inst)"invisible"in t.filters.inst[l]&&t.filters.inst[l].invisible||t.filters.inst[l].checked&&(n.push(t.filters.inst[l].uid),a=t.filters.inst[l].uri);t.filters.inst_o&&n.push("o"),f.push("inst:"+n.join(",")),1==n.length&&"o"!=n&&-1==["discover","american-express"].indexOf(a)?h.push(a):w=!0,1==n.length&&(m="american-express"==a,v="discover"==a),g.push({ftr:"inst",tag:"Credit Card Companies"})}"y"==t.filters.stcrd&&(f.push("stcrd:y"),h.push(s.stcrd.y.uri),g.push({ftr:"stcrd",tag:"Store Credit Cards"})),"y"==t.filters.chcrd&&(f.push("chcrd:y"),h.push(s.chcrd.y.uri),g.push({ftr:"chcrd",tag:"Charge Cards"}))}if("ftr"!=t.filters.srt&&(f.push("srt:"+t.filters.srt),w=!0),t.filters_tags=g.slice(),t.total_filters=g.length,o="Credit Cards",c="Compare credit card offers (some of which are from WalletHub advertisers) and quickly find the one that best fits your needs. Once you’ve made your choice, click “Apply Now” and we’ll redirect you to the credit card company’s secure online application.",0==t.total_filters&&"__default"in r&&(o=r.__default.title,c=r.__default.intro),angular.equals(h,["bad-credit","secured"])&&(h=["secured"]),""!=(i=h.join("-")))if(i in r)o=r[i].title,c=r[i].intro;else for(i in r)if("uri"in r[i]){for(n=0,l=0;l<h.length;l++)r[i].uri.indexOf(h[l])>-1&&n++;if(n==r[i].uri.length&&n==h.length){o=r[i].title,c=r[i].intro,h=[i];break}}if(m&&"american-express"in r?(o=r["american-express"].title,c=r["american-express"].intro):v&&"discover"in r?(o=r.discover.title,c=r.discover.intro):"system"==p.entry&&p.uri in r&&(o=r[p.uri].title,c=r[p.uri].intro),t.pageintro!=c&&angular.element().cssSelect(".intro p").removeClass("more"),t.pagetitle=o,t.pageintro=c,null!=A(t.filters)){for(l=0;l<t.filters.inst.length;l++)t.filters.inst[l].checked=!1;t.filters.inst_o=!0}"unsecured"==p.uri&&(t.filters.mc=null),"user"==p.entry&&_.path(0==h.length?"/":"/"+h.join("-")+"/").search(angular.extend(w?{q:f.join(";")}:{},"v"in u?{v:u.v}:{}))}}function C(e,i){var r,s=[];if(e in t.filters)for(r=0;r<i.length;r++)i[r]in t.filters[e]&&t.filters[e][i[r]]&&s.push(i[r]);return s}function E(e){return e in t.filters&&e in s.defaults&&angular.equals(t.filters[e],s.defaults[e])}function S(e){if(!E(e)&&e in t.filters&&e in s.defaults)if("inst"==e)for(var i in t.filters[e])t.filters[e][i].checked=!0;else angular.isArray(s.defaults[e])?angular.merge(t.filters[e],s.defaults[e]):t.filters[e]=s.defaults[e]}function k(){for(var e=0;e<arguments.length;e++)S(arguments[e])}function T(e,i,r){var s=r?0:1,n=r?1:0,l=t.is_credit_standing("ex")?e[s]-i[s]:e[n]-i[n];return 0==l&&t.is_credit_standing("ex")&&(l=e[n]-i[n]),l}function D(e,t){if(null==t)return 1;var i,r,s=0,n=0;for(e.length!=t.length&&(s=e.length>t.length?1:-1),n=e.length>t.length?t.length:e.length,r=0;r<n;r++)if(0!=(i=e.charCodeAt(r)-t.charCodeAt(r)))return i;return s}function O(e,t,i){var r,s=i?"cR":"eW",n=e[s],l=t[s];return null==n?1:null==l?-1:0!=(r=T(n,l,!0))?r:(s=i?"iY":"zW",n=e[s],l=t[s],null==n?1:null==l?-1:0!=(r=T(n,l,!1))?-1*r:D(e.ca,t.ca))}function N(e,t){var i=e.ar-t.ar;return 0!=i?-1*i:0!=(i=(e.aB?1:0)-(t.aB?1:0))?-1*i:D(e.ca,t.ca)}function P(e,t){if(e.Qz!=t.Qz){if("A"==e.Qz)return-1;if("A"==t.Qz)return 1}else if(e.Qc!=t.Qc){if(e.Qc)return-1;if(t.Qc)return 1}return 0}function $(e,i){var r;switch(t.filters.srt){case"ftr":if(e.aM==t.lv_cid)return-1;if(i.aM==t.lv_cid)return 1;if(0!=(r=P(e,i)))return r;if(e.Et!=i.Et)return-1*(e.Et-i.Et);if(e.ct!=i.ct)return-1*(e.ct-i.ct);break;case"pop":if(0!=(r=P(e,i)))return r;if(e.at!=i.at)return-1*(e.at-i.at);if(e.ct!=i.ct)return-1*(e.ct-i.ct);break;case"ep":return 0!=(r=P(e,i))?r:0!=(r=(e.aD?1:0)-(i.aD?1:0))?-1*r:O(e,i,!1);case"rtg":if(0!=(r=1e3*(i.rG-e.rG)))return 1e3*r;break;case"pch":return O(e,i,!1);case"bt":return O(e,i,!0);case"reg":if(null==e.sU)return 1;if(null==i.sU)return-1;if(0!=(r=T(e.sU,i.sU,!0)))return r;break;case"init":return N(e,i);case"base":return 0!=(r=e.bp-i.bp)?-1*r:(B.test(e.qP)?r=-1:B.test(i.qP)&&(r=1),N(e,i));case"max":return 0!=(r=e.dc-i.dc)?-1*r:(B.test(e.SN)?r=-1:B.test(i.SN)&&(r=1),N(e,i))}return D(e.ca,i.ca)}var q,W,L,M=[],j={},F=p.uri,B=/up to/i;for(W in s)if(!(["v","defaults"].indexOf(W)>-1))for(L in s[W])null!=s[W][L].regex&&"string"==typeof s[W][L].regex&&(s[W][L].regex=new RegExp(s[W][L].regex,"i")),null!=s[W][L].uri&&(j[s[W][L].uri]=[{ftr:W,val:L}]);for(t.mc_opts=[["Excellent – Above 749","ex"],["Good – 700-749","gd"],["Fair – 640-699","fr"],["Bad – Below 640","bd"],["No Credit/Limited History","nc"]],t.isSessionActive=u,u&&null!=h.standing&&null!=h.score&&(t.my_standing=h.standing,t.mc_opts.push(["My Credit Score: "+h.score,"lg"]),t.my_score=h.score,t.hasCreditStanding=!0),t.filters=angular.merge({},s.defaults,null!=e.filters?e.filters:{},void 0!==t.my_standing?{mc:"lg"}:{}),W=0;W<t.filters.inst.length;W++)(L=t.filters.inst[W]).uri in j?j[L.uri].push({ftr:"inst",val:L.uid}):j[L.uri]=[{ftr:"inst",val:L.uid}];t.filtered=[],t.filtered_limit=10,t.filtered_begin=0,t.inview_fast=!0,t.filtered_once=!1,t.more_filters=!1,t.get_credit_standing=function(){return"filters"in this&&"mc"in this.filters&&"lg"!=this.filters.mc?this.filters.mc:void 0!==this.my_standing&&"lg"==this.filters.mc?b(this.my_standing):null},t.is_credit_standing=function(e){var t=this.get_credit_standing();return e==t||"ex"==e&&null==t},t.badcredit=function(){return this.is_credit_standing("bd")},t.uri_is_secured_or_unsecured=function(){return/^(un)?secured$/.test(p.uri)},t.sidebar_condensed=function(){return this.badcredit()||this.uri_is_secured_or_unsecured()},t.initialized_cards=!1,t.store_cards_ammended=!1,t.filtered_length_override=null,function(){if("y"==t.filters.stcrd)return c.get("/credit-cards/store/",{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}}).then(function(e){var i=e.headers();"x-pagination-count"in i&&(t.filtered_length_override=parseInt(i["x-pagination-count"]),isNaN(t.filtered_length_override)&&(t.filtered_length_override=null));for(var r=0;r<e.data.length;r++)M.push(e.data[r]);return!0});var e=y.defer();return e.resolve(!1),e.promise}().then(function(r){if(t.store_cards_ammended=r,null!=e.added_cards&&angular.isArray(e.added_cards)&&e.added_cards.length>0)for(W=0;W<e.added_cards.length;W++)i.push(e.added_cards[W])}).then(function(){var r,s,n=[],a=25,o=25;for(R(),t.filters.mc=t.get_credit_standing(),t.filters.other_issuer=A(t.filters),i.sort($),s=0;s<i.length;s++)(r=new l(i[s])).searchtool=!0,r.visible=!1,r.details=!1,r.aM in e.votes&&(r.vT=e.votes[r.aM][0],r.rG=e.votes[r.aM][1]),"n"==t.filters.stcrd&&r.filter(t.filters)&&(n.push(r),null!=(a=r.getRegularRate())&&a<o&&(o=a)),i[s]=r;if("y"==t.filters.stcrd)for(s=0;s<M.length;s++)(r=new l(M[s])).searchtool=!0,r.visible=!1,r.details=!1,r.aM in e.votes&&(r.vT=e.votes[r.aM][0],r.rG=e.votes[r.aM][1]),n.push(r),M[s]=r;g(function(){t.regmin=o,t.filtered=n,0==t.filtered.length&&(t.initialized_cards=!0),t.filtered_begin=0,t.filtered_page=1,null!==t.filtered_length_override?t.filtered_page_total=Math.ceil(t.filtered_length_override/t.filtered_limit):t.filtered_page_total=Math.ceil(t.filtered.length/t.filtered_limit)}),t.$on("repeat-done",function(){g(function(){t.inview_fast=!1},100),t.initialized_cards=!0,t.filters.bt_all_true&&"y"!=t.filters.ft&&t.filters.emv_all_true&&"y"!=t.filters.pic&&"y"!=t.filters.cha&&t.filters.inst_pristine&&"y"!=t.filters.stcrd&&"y"!=t.filters.chcrd||(t.more_filters=!0)})}).then(function(){var e,t=[];m.when("added",function(e){t.push(e.aM),n.set("saved",t)}),m.when("removed",function(e){var i=t.indexOf(e.aM),r=n.get("skipped")||[];i>-1&&t.splice(i,1),n.set("saved",t),r.indexOf(i)<0&&(r.push(i),n.set("skipped",r))}),m.when("change",function(e){e.length<=0&&n.set("saved",[])}),n.getExpiration("saved")&&n.get("saved")||n.expireKey("saved",1296e6),e=n.get("saved")||[],angular.forEach(e,function(e,t){angular.forEach(i,function(t){if(t.aM==e)return t.savedForCompare=!0,m.switchItem(t,{},"add"),!1})})}),t.pagetitle=angular.element().cssSelect(".page-header-top h1").text(),t.pageintro=angular.element().cssSelect(".intro p").html(),t.inview_debounce=75,v.innerWidth<881&&(t.inview_debounce=20),angular.extend(t,{more_filters_toggle:function(){this.more_filters=!this.more_filters},filters_tags:e.filters_tags||[],remove_filter_tag:function(e,i){e=[e],"cs"!=this.filters.iam||"nc"!=this.filters.mc||"iam"!=e&&"mc"!=e||e.push("iam"==e?"mc":"iam"),!this.badcredit()||"mc"!=e||this.filters.iw.sc&&this.filters.iw.us||e.push("iw");var r,n,l;for(r=0;r<e.length;r++){for(l=e[r],n=this.filters_tags.length;n--;)l==this.filters_tags[n].ftr&&this.filters_tags.splice(n,1);l in this.filters&&(l in s.defaults&&null!=s.defaults[l]?"string"!=typeof this.filters[l]&&i in this.filters[l]&&"string"!=typeof s.defaults[l]&&i in s.defaults[l]?this.filters[l][i]=s.defaults[l][i]:"string"==typeof s.defaults[l]?this.filters[l]=s.defaults[l]:this.filters[l]=angular.merge({},s.defaults[l]):this.filters[l]=null,"iw"==l&&"rw"==i&&(this.filters.rw=angular.merge({},s.defaults.rw)),"inst"==l&&(this.filters.inst_o=!0))}null==this.filters.mc&&t.hasCreditStanding&&(t.mycredit_changing=!0),p.entry="user",I()},reset_filters:function(){t.filters=angular.merge({},s.defaults),p.entry="user",I()},regmin:25,reg_disabled_width:function(){return this.regmin/30*100+"%"},nw_old:{am:!0,di:!0},sort_opts:[["Featured","ftr"],["Most Popular","pop"],["Editor’s Picks","ep"],["User Rating","rtg"],["Rates – 0% on Purchases","pch"],["Rates – 0% on Transfers","bt"],["Rates – 0% on Regular Rate","reg"],["Rewards – Initial Bonus","init"],["Rewards – Base Earn","base"],["Rewards – Max Earn","max"]],mycredit_change:function(){this.mycredit_changing=!0},only_company:function(e){for(var t in this.filters.inst)this.filters.inst[t].checked=this.filters.inst[t].uid==e;this.filters.inst_o="o"==e,this.change_filter("inst",e)},all_companies:function(){for(var e in this.filters.inst)this.filters.inst[e].checked=!0;this.filters.inst_o=!0,this.change_filter("inst")},compareSet:function(e){var t=m.getStack();t.indexOf(e)<0&&5==t.length?(e.savedForCompare=!1,setTimeout(function(){window.alert("You can select a maximum of 5 cards")})):m.switchItem(e)},showCardImage:function(e,t){t&&g(function(){e.visible=!0},10)},toggleDetails:function(e,t){t.details=!t.details,v.scrollTo(0,v.pageYOffset-1)},toggleIntro:function(e){angular.element(e.target.parentNode).toggleClass("more")}}),t.show_loading_animation=function(){if(t.filtering=!0,!t.__track_scroll){var e=function(){var e=w.body.prop("scrollTop")+55,t=angular.element().cssSelect("#searchtool .cards-container"),i=angular.element().cssSelect("#searchtool .loading-box"),r=t.offset().top,s=t.offset().top+t.prop("offsetHeight")-i.prop("offsetHeight");i.css("top",Math.min(s,Math.max(r,e))+"px")};angular.element(window).on("scroll",e),e(),t.__track_scroll=!0}},t.$on("$url:changed",function(i,n,l){if(null===F&&(F=p.uri),p.expert&&function(){window.location.hash.substring(1);p.expert&&angular.element().cssSelect("section.experts-answers").length>0&&function(){var e=p.expert;t.questionSelect(!1,e)}()}(),n==l||null===n)return!1;p.uri&&p.uri.indexOf("bad-credit")>-1?angular.element().cssSelect("#searchtool .experts-gallery").css({display:"block"}):angular.element().cssSelect("#searchtool .experts-gallery").css({display:"none"}),window.location.hash.length>0&&(setTimeout(function(){window.history.replaceState({},document.title,window.location.pathname)}),window.location.hash=""),Object.keys(p.filters).length>0?(!function(e){var i,r,s;for(i in e)switch(i){case"rw":case"nw":case"bt":case"emv":for(s in t.filters[i])t.filters[i][s]=!1;break;case"iw":"bd"==e.mc&&(t.filters.iw.sc=!1,t.filters.iw.us=!1);break;case"inst":for(t.filters.inst_o=!1,s=0;s<t.filters.inst.length;s++)t.filters.inst[s].checked=!1}for(i in e)if(r=e[i],"inst"==i)for(t.filters.inst_o=r.indexOf("o")>-1,s=0;s<t.filters.inst.length;s++)t.filters.inst[s].checked=r.indexOf(t.filters.inst[s].uid+"")>-1;else if(["iam","mc","pic","cha","ft","reg"].indexOf(i)>-1)"reg"==i&&(r[0]=parseFloat(r[0]),r[0]>30&&(r[0]=30)),t.filters[i]=r[0];else for(s=0;s<r.length;s++)"bt"==i&&"n"!=r[s]?t.filters[i][i+r[s]]=!0:t.filters[i][r[s]]=!0;null!=e.srt&&(t.filters.srt=e.srt[0])}(p.filters),I("system"),x()):null!=e.filters?(e.filters=null,t.hasCreditStanding&&(p.entry="user"),I(),t.filtered_once&&x(),t.filtered_once=!0):""!=p.uri?(!function(e){var i,n,l,a,o,c,f,d=[];for(o in r)o==e&&(e="","uri"in r[o]?d=r[o].uri:-1==o.indexOf("-")&&d.push(o));for(;""!=e;){n=!1;for(o in j)if((i=new RegExp("^"+o+"-?")).test(e)){d.push(o),e=e.replace(i,""),n=!0;break}if(!n)break}if(""==e){for("system"==p.entry&&(t.filters=angular.merge({},s.defaults,{iam:"gc"})),o=0;o<d.length;o++)if(d[o]in j)for(l=j[d[o]],c=0;c<l.length;c++)switch(a=l[c].ftr){case"rw":case"nw":case"bt":case"emv":for(f in t.filters[a])t.filters[a][f]=!1;break;case"iw":d.indexOf("bad-credit")>-1&&(t.filters.iw.sc=!1,t.filters.iw.us=!1);break;case"inst":if(["discover","american-express"].indexOf(d[o])>-1)continue;t.filters.inst_o=!1;for(f in t.filters[a])t.filters[a][f].checked=!1}for(o=0;o<d.length;o++)if(d[o]in j)for(l=j[d[o]],c=0;c<l.length;c++)if(a=l[c].ftr,val=l[c].val,a in t.filters||(t.filters[a]=null),"inst"==a){if(["discover","american-express"].indexOf(d[o])>-1)continue;for(f=0;f<t.filters.inst.length;f++)t.filters.inst[f].checked=t.filters.inst[f].uid==val}else["iam","mc","stcrd","chcrd","pic","cha"].indexOf(a)>-1?t.filters[a]=val:t.filters[a][val]=!0}}(p.uri),I("system"),p.uri==F&&F in r&&(t.pagetitle=r[F].title,t.pageintro=r[F].intro),x()):t.filtered_once&&x(),p.entry="system"}),t.change_filter=function(i,r){var s,n,a=!1;if("iam"==i&&"cs"==this.filters.iam&&E("mc")&&E("iw")&&E("rw")&&E("rw")&&E("nw")&&E("bt")&&E("ft")&&E("emv")&&E("pic")&&E("cha")&&E("inst")&&(this.filters.mc="nc",a=!0),this.badcredit()?(0==Object.keys(this.nw_old).length&&(this.nw_old={am:this.filters.nw.am,di:this.filters.nw.di}),"mc"!=i||this.filters.nw.vi||this.filters.nw.mc||(this.filters.nw.vi=!0)):"mc"==i&&(a=!0),(["rw","nw","emv"].indexOf(i)>-1&&function(e){for(var t in e){if("boolean"==typeof e[t]&&e[t])return!1;if("object"==typeof e[t]){if(!("checked"in e[t]&&"boolean"==typeof e[t].checked))return!1;if(e[t].checked)return!1}}return!0}(this.filters[i])||"nw"==i&&this.badcredit()&&!this.filters.nw.vi&&!this.filters.nw.mc)&&("rw"==i&&(r="cb"!=r?"cb":"gas"),"nw"==i&&(r="vi"!=r?"vi":"mc"),"emv"==i&&(r="n"!=r?"n":"pn"),this.filters[i][r]=!0),"iw"!=i||this.filters.iw.sc&&this.filters.iw.us||(this.filters.iw["sc"==r?"us":"sc"]=!0),"inst"==i){for(s=!0,n=0;n<this.filters.inst.length;n++)if(this.filters.inst[n].checked){s=!1;break}if(s&&!this.filters.inst_o)for(r=13000208!=r?13000208:13000450,n=0;n<this.filters.inst.length;n++)this.filters.inst[n].checked=this.filters.inst[n].uid==r}"y"==this.filters.stcrd&&"stcrd"!=i&&(this.filters.stcrd="n"),"stcrd"==i&&k("iam","mc","iw","rw","nw","bt","ft","emv","ft","pic","cha","inst","inst_o","chcrd"),"y"==this.filters.chcrd&&("iam"!=i&&"chcrd"!=i||"iam"==i&&"cs"==r)&&(this.filters.chcrd="n"),"chcrd"==i&&("cs"==this.filters.iam&&(this.filters.iam="gc",S("gc")),k("mc","iw","rw","nw","bt","ft","emv","ft","pic","cha","inst","inst_o","stcrd")),a&&(angular.extend(this.filters.nw,this.nw_old),this.nw_old={}),p.entry="user",t.store_cards_ammended||"stcrd"!=i||"y"!=r?I():(t.show_loading_animation(),c.get("/credit-cards/store/",{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}}).then(function(i){var r,s,n=i.headers();"x-pagination-count"in n&&(t.filtered_length_override=parseInt(n["x-pagination-count"]),isNaN(t.filtered_length_override)&&(t.filtered_length_override=null)),M=[];for(s=0;s<i.data.length;s++)(r=new l(i.data[s])).searchtool=!0,r.visible=!1,r.details=!1,r.aM in e.votes&&(r.vT=e.votes[r.aM][0],r.rG=e.votes[r.aM][1]),M.push(r);g(function(){t.store_cards_ammended=!0,I()})}))},t.uncheck_no_balance_transfer=function(e){window.alert("You can not uncheck 'None', because everyone enjoys a card without a balance transfer fee."),e.preventDefault()},t.iAmOptions=[["Personal Cards","gc"],["Business Cards","bo"],["Student Cards","cs"]],t.iwOptions=[["0% on Purchases","pch"],["0% on Balance Transfers","bt"],["Low Regular Rate","reg"],["No Annual Fee","af"]],t.drps={iam:"",cred:"",iw:{pch:!1,bt:!1,reg:!1,af:!1,rw:!1}},t.$watch("filters.srt",function(e,i){e!=i&&(p.entry="user",t.change_filter("sort"))}),t.$watch("filters.reg",function(e,i){e!=i&&(p.entry="user",t.change_filter("reg"))}),t.pagChange=function(i,r){var s="y"==t.filters.stcrd;t.cards_page_change=!0,s&&t.show_loading_animation(),g(function(){if(t.cards_page_change=!1,"next"==r){if(s)for(W=0;W<10;W++)t.filtered.unshift({});t.filtered_page++,t.filtered_begin+=10}else{if(s)for(W=0;W<10;W++)t.filtered.shift();t.filtered_page--,t.filtered_begin-=10}s&&c.get("/credit-cards/store/",{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest","X-Pagination-Page":t.filtered_page}}).then(function(i){var r,s,n=i.headers();"x-pagination-count"in n&&(t.filtered_length_override=parseInt(n["x-pagination-count"]),isNaN(t.filtered_length_override)&&(t.filtered_length_override=null)),M=[];for(s=0;s<t.filtered_begin;s++)M.push({});for(s=0;s<i.data.length;s++)(r=new l(i.data[s])).searchtool=!0,r.visible=!1,r.details=!1,r.aM in e.votes&&(r.vT=e.votes[r.aM][0],r.rG=e.votes[r.aM][1]),M.push(r);g(function(){t.filtered=M,t.store_cards_ammended=!0,null!==t.filtered_length_override?t.filtered_page_total=Math.ceil(t.filtered_length_override/t.filtered_limit):t.filtered_page_total=Math.ceil(t.filtered.length/t.filtered_limit),t.filtering=!1})})},100)},t.ques_select=window["page-default-question"];var G;t.questionSelect=function(e,i){G=i,window.innerWidth<=640?t.ques_select==i&&(i=!1):t.ques_select||(i=G),g(function(){t.ques_select=i,t.ques_select_scroll=i},100),e&&(e.preventDefault(),window.location.hash="#"+i)},t.all_questions=!1,t.showAllQuestions=function(e){t.all_questions=!0};var H=t.$watch(function(){return{filters:t.filters}},function(e,t){e!=t&&(H(),p.entry="user")},!0);t.drpselect={iam:function(){g(function(){t.change_filter("iam")},50)},mc:function(){g(function(){"lg"==t.filters.mc&&(t.mycredit_changing=!1),t.change_filter("mc")},50)}};var U=!1;t.mobIWHolder="Select Please",t.mobIW=!1,t.showIW=function(e){U=!0,t.mobIW=!0,setTimeout(function(){U=!1})},t.show_sidebar_filters=!1,t.sidebar_filters_dialog=window.innerWidth<=1003;var Y;t.revealSideBar=function(e){t.show_sidebar_filters=!0,Y=!0,setTimeout(function(){Y=!1})},t.hideSideBar=function(e){t.show_sidebar_filters=!1},t.disclosure_scroll=function(e){return"block"==angular.element().cssSelect(".mob-disclosure").css("display")?(v.scrollTo(0,angular.element().cssSelect(".mob-disclosure").prop("offsetTop")-50),angular.element().cssSelect(".mob-disclosure p:last-child").addClass("yellow"),g(function(){angular.element().cssSelect(".mob-disclosure p:last-child").removeClass("yellow")},2e3)):(v.scrollTo(0,angular.element().cssSelect(".sidebar .box:last-child p:last-child").prop("offsetTop")-20),angular.element().cssSelect(".sidebar .box:last-child p:last-child").addClass("yellow"),g(function(){angular.element().cssSelect(".sidebar .box:last-child p:last-child").removeClass("yellow")},2e3)),!1},t.expert_scroll=function(e){v.scrollTo(0,angular.element().cssSelect(".experts-answers .header-part").prop("offsetTop")-50)},t.discussion_scroll=function(e){v.scrollTo(0,angular.element().cssSelect(".sect-community-discussion .header").prop("offsetTop")-50)},angular.element(window).on("scroll",function(e){var i=angular.element("body").prop("scrollTop");t.$applyAsync(function(){t.navbarScrolled=i>=70})});var X=function(e){U||t.$applyAsync(function(){t.mobIW=!1})},z=function(){t.$applyAsync(function(){t.mobIW=!1,t.show_sidebar_filters=!1;var e=window.innerWidth;t.sidebar_filters_dialog=e<=1003})};angular.element(document).on("vclick",X),angular.element(window).on("resize",z),t.$on("$destroy",function(){angular.element(document).off("vclick",X),angular.element(window).off("resize",z)}),t.$watch(function(){return{w:v.innerWidth,sidebar:t.show_sidebar_filters,compare_page:a.cardCompare}},function(e){if(e.w<881){if(null==t.more_filters_old&&(t.more_filters_old=t.more_filters),t.more_filters=!0,e.compare_page)return;e.sidebar?(angular.element().cssSelect("body").addClass("no-scroll"),angular.element().cssSelect("#searchtool .compare-cc .sidebar").prop("scrollTop",1)):angular.element().cssSelect("body").removeClass("no-scroll")}else null!=t.more_filters_old?(t.more_filters=t.more_filters_old,delete t.more_filters_old):t.more_filters=!1},!0),t.$watch(function(){return{iam:t.filters.iam,mc:t.filters.mc,iw:t.filters.iw,nw:t.filters.nw.vi,bt:t.filters.bt,ft:t.filters.ft,emv:t.filters.emv,pic:t.filters.pic,cha:t.filters.cha,inst:t.filters.inst}},function(e){var i=[];t.filters.iw.pch&&i.push("0% on Purchases"),t.filters.iw.bt&&i.push("0% on Balance Transfers"),t.filters.iw.reg&&i.push("Low Regular Rate"),t.filters.iw.af&&i.push("No Annual Fee"),t.filters.iw.rw&&i.push("Rewards"),t.mobIWSelected=i.join(";")},!0),function(e){e(".experts-gallery #hidden-profiles").hide();var i,r=e(".experts-gallery #gallery-1").contents();goToExpert=function(){var t=window.location.hash.substring(1);if(t.length<2||i)return i=!1,!1;var r=t.replace(/\_/g," "),s=e('.experts-gallery .expert-profile[profile-name="'+r+'"]').eq(0).attr("profile-id");s?switchToFull(s):e(".experts-gallery .container").addClass("all")},blinkGallery=function(){e(".experts-gallery #gallery-1").addClass("blink-start").removeClass("blink-end"),setTimeout(function(){e(".experts-gallery #gallery-1").addClass("blink-end").removeClass("blink-start")})},switchToFull=function(t){var r=e('.experts-gallery .expert-profile[profile-id="'+t+'"]').eq(0),s=e.trim(e(r).attr("profile-name")).replace(/ /g,"_");i=!0,window.location.hash!==s&&(window.location.hash=s),e(".experts-gallery #gallery-1").html(r),e(document).duScrollToElementAnimated(e(".experts-gallery #gallery-1"),80,300),e(".experts-gallery .container").removeClass("all"),blinkGallery()},e("body").on("vclick",".experts-gallery .gallery-item",function(t){var i=e(this).attr("profile-id");return switchToFull(i),t.preventDefault(),!1}),e("body").on("vclick",".experts-gallery .back-to-xprts",function(){var t=e(this).parent().attr("profile-id"),i=e('.experts-gallery .expert-profile[profile-id="'+t+'"]').eq(0);e(".experts-gallery #hidden-profiles").append(i),e(".experts-gallery #gallery-1").html(r);var s=e(".experts-gallery #gallery-1").offset().top-100;return window.history?(window.history.scrollRestoration="manual",window.history.pushState({scrollTop:s},document.title,window.location.pathname)):window.location.hash="",e(".experts-gallery .container").addClass("all"),blinkGallery(),!1});var s=t.$watch("initialized_cards",function(t){t&&(s(),setTimeout(function(){e(window).on("hashchange",goToExpert),goToExpert()}))})}(o)}]),t.bootstrap()});