/* * Braze Web SDK v3.5.1 * (c) Braze, Inc. 2022 - http://braze.com * License available at https://github.com/Appboy/appboy-web-sdk/blob/master/LICENSE * Compiled on 2022-03-24 */ (function(){(function(b,a){if("function"===typeof define&&define.amd)define([],a);else if("object"===typeof module&&module.exports){var e = a();module.exports=e;module.exports.default=e}else if(b.appboy){var d=a(),c;for(c in d)b.appboy[c]=d[c]}else b.appboy=a()})("undefined"!==typeof self?self:this,function(){var appboyInterface={};var p;function aa(a){var b=0;return function(){return bb||1342177279>>=1)c+=c;return d}}); ha("Promise",function(a){function b(g){this.Ub=0;this.Rd=void 0;this.sb=[];var h=this.Ad();try{g(h.resolve,h.reject)}catch(l){h.reject(l)}}function c(){this.Ha=null}function d(g){return g instanceof b?g:new b(function(h){h(g)})}if(a)return a;c.prototype.Te=function(g){if(null==this.Ha){this.Ha=[];var h=this;this.Ue(function(){h.eh()})}this.Ha.push(g)};var e=fa.setTimeout;c.prototype.Ue=function(g){e(g,0)};c.prototype.eh=function(){for(;this.Ha&&this.Ha.length;){var g=this.Ha;this.Ha=[];for(var h= 0;h=d?b++:2047=d&&(b+=2);56320<=d&&57343>=d&&c--}return b};function Qa(a,b,c,d){(d="string"===typeof a||null===a&&d)||x.error("Cannot "+b+" because "+c+' "'+a+'" is invalid.');return d}function Ra(a,b,c){var d=null!=a&&"string"===typeof a&&(""===a||a.match(Sa));d||x.error("Cannot "+b+" because "+c+' "'+a+'" is invalid.');return d} function Ta(a,b,c,d,e){null==a&&(a={});if("object"!==typeof a||Ca(a))return x.error(b+" requires that "+c+" be an object. Ignoring "+e+"."),[!1,null];b=JSON.stringify(a);if(Pa(b)>Ua)return x.error("Could not "+d+" because "+c+" was greater than the max size of "+Va+"."),[!1,null];try{var f=JSON.parse(b)}catch(k){return x.error("Could not "+d+" because "+c+" did not contain valid JSON."),[!1,null]}for(var g in a){if(!Ra(g,d,"the "+e+" property name"))return[!1,null];c=a[g];if(null==c)delete a[g],delete f[g]; else{Da(c)&&(f[g]=Ka(c));var h=d,l="the "+e+' property "'+g+'"';(b=Ea(c)||Ca(c)?Wa(c,f[g]):Ya(c))||x.error("Cannot "+h+" because "+l+' "'+c+'" is invalid.');if(!b)return[!1,null]}}return[!0,f]}function Wa(a,b){if(Ca(a)&&Ca(b))for(var c=0;c=a.length)return x.error("addAlias requires a non-empty alias"),!1;if(!Qa(b,"add alias","the label",!1)||0>=b.length)return x.error("addAlias requires a non-empty label"),!1;var c=this.H,d=new $a,e=ab(c.D),f=z.Df;d.j.push(new E(c.f.o(),f,(new Date).valueOf(),e,{a:a,l:b}));d.h=bb(c.b,d.j);return d.h};p.Eh=function(a){return Qa(a,"set first name","the firstName",!0)?cb(this.f,"first_name",a):!1}; p.Ih=function(a){return Qa(a,"set last name","the lastName",!0)?cb(this.f,"last_name",a):!1};p.Ch=function(a){return null===a||"string"===typeof a&&null!=a.toLowerCase().match(Za)?cb(this.f,"email",a):(x.error('Cannot set email address - "'+a+'" did not pass RFC-5322 validation.'),!1)};p.Fh=function(a){"string"===typeof a&&(a=a.toLowerCase());return null===a||Aa(db,a,'Gender "'+a+'" is not a valid gender.',"User.Genders")?cb(this.f,"gender",a):!1}; p.Bh=function(a,b,c){if(null===a&&null===b&&null===c)return cb(this.f,"dob",null);a=parseInt(a);b=parseInt(b);c=parseInt(c);return isNaN(a)||isNaN(b)||isNaN(c)||12b||31c?(x.error("Cannot set date of birth - parameters should comprise a valid date e.g. setDateOfBirth(1776, 7, 4);"),!1):cb(this.f,"dob",""+a+"-"+b+"-"+c)};p.yh=function(a){return Qa(a,"set country","the country",!0)?cb(this.f,"country",a):!1}; p.Gh=function(a){return Qa(a,"set home city","the homeCity",!0)?cb(this.f,"home_city",a):!1};p.Hh=function(a){return Qa(a,"set language","the language",!0)?cb(this.f,"language",a):!1};p.Dh=function(a){return Aa(eb,a,'Email notification setting "'+a+'" is not a valid subscription type.',"User.NotificationSubscriptionTypes")?cb(this.f,"email_subscribe",a):!1}; p.Ud=function(a){return Aa(eb,a,'Push notification setting "'+a+'" is not a valid subscription type.',"User.NotificationSubscriptionTypes")?cb(this.f,"push_subscribe",a):!1};p.Jh=function(a){return Qa(a,"set phone number","the phoneNumber",!0)?null===a||a.match(fb)?cb(this.f,"phone",a):(x.error('Cannot set phone number - "'+a+'" did not pass validation.'),!1):!1};p.xh=function(a){return cb(this.f,"image_url",a)}; p.Oc=function(a,b,c,d,e){if(null==a||null==b)return x.error("Cannot set last-known location - latitude and longitude are required."),!1;a=parseFloat(a);b=parseFloat(b);null!=c&&(c=parseFloat(c));null!=d&&(d=parseFloat(d));null!=e&&(e=parseFloat(e));return isNaN(a)||isNaN(b)||null!=c&&isNaN(c)||null!=d&&isNaN(d)||null!=e&&isNaN(e)?(x.error("Cannot set last-known location - all supplied parameters must be numeric."),!1):90a||180b?(x.error("Cannot set last-known location - latitude and longitude are bounded by \u00b190 and \u00b1180 respectively."), !1):null!=c&&0>c||null!=e&&0>e?(x.error("Cannot set last-known location - accuracy and altitudeAccuracy may not be negative."),!1):this.H.Oc(this.f.o(),a,b,d,c,e).h}; p.Sd=function(a,b){if(!Ra(a,"set custom user attribute","the given key"))return!1;var c=typeof b,d=Da(b),e=Ca(b);if("number"!==c&&"boolean"!==c&&!d&&!e&&null!==b&&!Ra(b,'set custom user attribute "'+a+'"',"the given value"))return!1;d&&(b=Ka(b));if(e){for(c=0;cb||isNaN(c)||180c)return x.error("Received invalid values for latitude and/or longitude. Latitude and longitude are bounded by \u00b190 and \u00b1180 respectively, or must both be null for removal."),!1;var d=this.H,e=c;c=new $a;if(ib(d.J,a))x.info('Custom Attribute "'+a+'" is blocklisted, ignoring.'),c.h=!1;else{var f=ab(d.D); if(null===b&&null===e){var g=z.kg;a={key:a}}else g=z.jg,a={key:a,latitude:b,longitude:e};c.j.push(new E(d.f.o(),g,(new Date).valueOf(),f,a));c.h=bb(d.b,c.j)}return c.h};p.Rg=function(a){return!Qa(a,"add user to subscription group","subscription group ID",!1)||0>=a.length?(x.error("addToSubscriptionGroup requires a non-empty subscription group ID"),!1):jb(this.H,a,kb).h}; p.rh=function(a){return!Qa(a,"remove user from subscription group","subscription group ID",!1)||0>=a.length?(x.error("removeFromSubscriptionGroup requires a non-empty subscription group ID"),!1):jb(this.H,a,lb).h};var fb=/^[0-9 .\\(\\)\\+\\-]+$/,db={MALE:"m",FEMALE:"f",OTHER:"o",UNKNOWN:"u",NOT_APPLICABLE:"n",PREFER_NOT_TO_SAY:"p"},eb={OPTED_IN:"opted_in",SUBSCRIBED:"subscribed",UNSUBSCRIBED:"unsubscribed"},kb="subscribed",lb="unsubscribed";J.User=K;J.User.Genders=db; J.User.NotificationSubscriptionTypes=eb;J.User.prototype.getUserId=K.prototype.o;J.User.prototype.setFirstName=K.prototype.Eh;J.User.prototype.setLastName=K.prototype.Ih;J.User.prototype.setEmail=K.prototype.Ch;J.User.prototype.setGender=K.prototype.Fh;J.User.prototype.setDateOfBirth=K.prototype.Bh;J.User.prototype.setCountry=K.prototype.yh;J.User.prototype.setHomeCity=K.prototype.Gh;J.User.prototype.setLanguage=K.prototype.Hh;J.User.prototype.setEmailNotificationSubscriptionType=K.prototype.Dh; J.User.prototype.setPushNotificationSubscriptionType=K.prototype.Ud;J.User.prototype.setPhoneNumber=K.prototype.Jh;J.User.prototype.setAvatarImageUrl=K.prototype.xh;J.User.prototype.setLastKnownLocation=K.prototype.Oc;J.User.prototype.setCustomUserAttribute=K.prototype.Sd;J.User.prototype.addToCustomAttributeArray=K.prototype.Qg;J.User.prototype.removeFromCustomAttributeArray=K.prototype.qh;J.User.prototype.incrementCustomUserAttribute=K.prototype.kh;J.User.prototype.addAlias=K.prototype.Pg; J.User.prototype.setCustomLocationAttribute=K.prototype.Ah;J.User.prototype.addToSubscriptionGroup=K.prototype.Rg;J.User.prototype.removeFromSubscriptionGroup=K.prototype.rh;function mb(){}mb.prototype.Ed=function(){};mb.prototype.Fd=function(){};mb.prototype.qb=function(){};function nb(a,b){if(a&&b)if(a=a.toLowerCase(),Ca(b.O))for(var c=0;cthis.Ke)return x.info("Storage failure: object is \u2248"+d+" bytes which is greater than the max of "+this.Ke),!1;this.ud[a]=c;return!0};Lb.prototype.Z=function(a){a=this.ud[a];return null==a?null:a.value}; Lb.prototype.remove=function(a){this.ud[a]=null};function Mb(a,b,c){this.ma=[];b&&this.ma.push(new Ib(a));c&&this.ma.push(new Hb(a));this.ma.push(new Lb)}Mb.prototype.store=function(a,b){for(var c=!0,d=0;dMath.abs(h)&&25<=Math.abs(g)?(0g&&b===Xb&&c(f),e=d=null):25<=Math.abs(h)&&(0h&&b===Zb&&0===a.scrollTop&&c(f),e=d=null)}})} function $b(a,b,c){var d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("viewBox",a);d.setAttribute("xmlns","http://www.w3.org/2000/svg");a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d",b);null!=c&&a.setAttribute("fill",c);d.appendChild(a);return d}var Rb=null,Yb="up",Zb="down",Wb="left",Xb="right";function ac(a,b,c){var d=document.createElement("button");d.setAttribute("aria-label",a);d.setAttribute("tabindex","0");d.setAttribute("role","button");Sb(d,"touchstart",function(){});d.className="ab-close-button";a=$b("0 0 15 15","M15 1.5L13.5 0l-6 6-6-6L0 1.5l6 6-6 6L1.5 15l6-6 6 6 1.5-1.5-6-6 6-6z",b);d.appendChild(a);d.addEventListener("keydown",function(e){if(32===e.keyCode||13===e.keyCode)c(),e.stopPropagation()});d.onclick=function(e){c();e.stopPropagation()};return d};var bc={nh:function(){return 600>=screen.width},hh:function(){if("orientation"in window)return 90===Math.abs(window.orientation)||270===window.orientation?bc.Sa.Zc:bc.Sa.jc;if("screen"in window){var a=window.screen.orientation||screen.ci||screen.ei;null!=a&&"object"===typeof a&&(a=a.type);if("landscape-primary"===a||"landscape-secondary"===a)return bc.Sa.Zc}return bc.Sa.jc},oh:function(a,b,c){c||null!=b&&b.metaKey?window.open(a):window.location=a},Sa:{jc:0,Zc:1}};J.WindowUtils=bc; J.WindowUtils.openUri=bc.oh;function cc(a,b,c,d,e,f,g,h,l,k,m,q,v,t,w,r){this.id=a;this.viewed=b||!1;this.title=c||"";this.imageUrl=d;this.description=e||"";this.created=f||null;this.updated=g||null;this.categories=h||[];this.expiresAt=l||null;this.url=k;this.linkText=m;q=parseFloat(q);this.aspectRatio=isNaN(q)?null:q;this.extras=v;this.pinned=t||!1;this.dismissible=w||!1;this.dismissed=!1;this.clicked=r||!1;this.test=!1;this.pd=this.X=null}function dc(a){null==a.X&&(a.X=new Nb);return a.X} function ec(a){null==a.pd&&(a.pd=new Nb);return a.pd}p=cc.prototype;p.Vb=function(a){return Ob(dc(this),a)};p.Wd=function(a){return Ob(ec(this),a)};p.N=function(a){dc(this).N(a);ec(this).N(a)};p.K=function(){dc(this).K();ec(this).K()};p.Od=function(){this.viewed=!0};p.fb=function(){this.clicked=this.viewed=!0;Pb(dc(this))};p.Nd=function(){return this.dismissible&&!this.dismissed?(this.dismissed=!0,Pb(ec(this)),!0):!1}; function fc(a,b){if(null==b||b[T.wa]!==a.id)return!0;if(b[T.pe])return!1;if(null!=b[T.ea]&&null!=a.updated&&b[T.ea]>>24}function sc(a){a=parseInt(a);if(isNaN(a))return"";var b=parseFloat(b);isNaN(b)&&(b=1);a>>>=0;var c=a&255,d=(a&65280)>>>8,e=(a&16711680)>>>16;return(vb.Ya===ob.dc?8>>24)/255*b].join()+")":"rgb("+[e,d,c].join()+")"};function W(a,b,c,d,e,f,g,h,l,k,m,q,v,t,w,r,F,D,G,H,A,N,L,I,V,Q,n,u,y,B,P){this.message=a;this.messageAlignment=b||tc;this.duration=q||5E3;this.slideFrom=c||uc;this.extras=d||{};this.campaignId=e;this.cardId=f;this.triggerId=g;this.clickAction=h||vc;this.uri=l;this.openTarget=k||wc;this.dismissType=m||xc;this.icon=v;this.imageUrl=t;this.imageStyle=w||yc;this.iconColor=r||zc.nd;this.iconBackgroundColor=F||zc.$d;this.backgroundColor=D||zc.nd;this.textColor=G||zc.ce;this.closeButtonColor=H||zc.Sf;this.animateIn= A;null==this.animateIn&&(this.animateIn=!0);this.animateOut=N;null==this.animateOut&&(this.animateOut=!0);this.header=L;this.headerAlignment=I||tc;this.headerTextColor=V||zc.ce;this.frameColor=Q||zc.vg;this.buttons=n||[];this.cropType=u||Ac;this.orientation=y;this.htmlId=B;this.css=P;this.Fe=this.Wa=this.Ge=!1;this.X=new Nb;this.nc=new Nb}p=W.prototype;p.Ja=function(){return!0};p.xf=function(){return this.Ja()};function Bc(a){return null!=a.htmlId&&4a.target.clientHeight||document.querySelector("."+Sc)&&a.preventDefault()} p.Kc=function(a){this.Ja()&&null!=a.parentNode&&this.orientation!==Zc&&(null!=a.parentNode.classList&&a.parentNode.classList.add(Sc),document.body.addEventListener("touchmove",Tc,Qb()?{passive:!1}:!1));a.className+=" "+Uc};p.oa=function(){var a="";this.animateIn&&(a+=" ab-animate-in");this.animateOut&&(a+=" ab-animate-out");return a}; var zc={ce:4281545523,nd:4294967295,$d:4278219733,Tf:4293914607,Uf:4283782485,vg:3224580915,Sf:4288387995},dd={ge:"hd",Bf:"ias",rg:"of",Vf:"do",Ab:"umt",yb:"tf",ie:"te"},uc="BOTTOM",ed={TOP:"TOP",BOTTOM:uc},bd="NEWS_FEED",$c="URI",vc="NONE",fd={NEWS_FEED:bd,URI:$c,NONE:vc},xc="AUTO_DISMISS",gd={AUTO_DISMISS:xc,MANUAL:"SWIPE"},wc="NONE",ad="BLANK",hd={NONE:wc,BLANK:ad},yc="TOP",Yc="GRAPHIC",id={TOP:yc,GRAPHIC:Yc},Zc="LANDSCAPE",jd={PORTRAIT:"PORTRAIT",LANDSCAPE:Zc},tc="CENTER",kd={START:"START",CENTER:tc, END:"END"},cd="CENTER_CROP",Ac="FIT_CENTER",ld={CENTER_CROP:cd,FIT_CENTER:Ac},Mc="SLIDEUP",Hc="MODAL",Ic="MODAL_STYLED",Kc="FULL",Oc="WEB_HTML",Pc="HTML",Xc=500,Uc="ab-show",Vc="ab-hide",Sc="ab-pause-scrolling";J.InAppMessage=W;J.InAppMessage.SlideFrom=ed;J.InAppMessage.ClickAction=fd;J.InAppMessage.DismissType=gd;J.InAppMessage.OpenTarget=hd;J.InAppMessage.ImageStyle=id;J.InAppMessage.TextAlignment=kd;J.InAppMessage.Orientation=jd;J.InAppMessage.CropType=ld;J.InAppMessage.fromJson=Ec; J.InAppMessage.prototype.subscribeToClickedEvent=W.prototype.Vb;J.InAppMessage.prototype.subscribeToDismissedEvent=W.prototype.Wd;J.InAppMessage.prototype.removeSubscription=W.prototype.N;J.InAppMessage.prototype.removeAllSubscriptions=W.prototype.K;J.InAppMessage.prototype.closeMessage=W.prototype.Ye;function Gc(a,b,c,d,e,f,g){this.text=a||"";this.backgroundColor=b||zc.$d;this.textColor=c||zc.nd;this.borderColor=d||this.backgroundColor;this.clickAction=e||vc;this.uri=f;null==g&&(g=md);this.id=g;this.Wa=!1;this.X=new Nb}Gc.prototype.Vb=function(a){return Ob(this.X,a)};Gc.prototype.N=function(a){this.X.N(a)};Gc.prototype.K=function(){this.X.K()};Gc.prototype.fb=function(){return this.Wa?!1:(this.Wa=!0,Pb(this.X),!0)};var md=-1;J.InAppMessageButton=Gc; J.InAppMessageButton.prototype.subscribeToClickedEvent=Gc.prototype.Vb;J.InAppMessageButton.prototype.removeSubscription=Gc.prototype.N;J.InAppMessageButton.prototype.removeAllSubscriptions=Gc.prototype.K;function Fc(a){this.triggerId=a}J.ControlMessage=Fc;function nd(a){for(var b=a.querySelectorAll(".ab-close-button, .ab-message-text, .ab-message-button"),c=0;c/g,"