SWG Js
SWG Js
SWG Js
{}whenComplete(){}shouldFadeBody(){}hasLoadingIndicator(){}};function ba(a,b,c,d)
{return a.acceptResult().then(e=>{if(e.origin!=b||c&&!e.originVerified||d&&!
e.secureChannel)throw Error("channel mismatch");return e.data})};function ca(a)
{if(/swg.debug=1/.test(self.location.hash)){const
b=Array.prototype.slice.call(arguments,0);b.unshift("[Subscriptions]");l.apply(l,b)
}}function l(a){console.log.apply(console,arguments)}function n(a)
{console.warn.apply(console,arguments)}
function q(a,b,c){let d;if(!a){const h=(b||"Assertion failed").split("%s");var
e=h.shift();let k=e;const m=[];""!=e&&m.push(e);for(e=2;e<arguments.length;e++)
{const p=arguments[e];p&&p.tagName&&(d=p);const v=h.shift();m.push(p);var
f=v.trim();""!=f&&m.push(f);f=k;var g=(g=p)&&1==g.nodeType?g.tagName.toLowerCase()+
(g.id?"#"+g.id:""):g;k=f+(g+v)}e=Error(k);e.fromAssert=!
0;e.associatedElement=d;e.messageArray=m;throw e;}};function da(a,b){if(!a)return
null;const c=a.length||0;if(0<c)for(let d=0;d<c;d++){const
e=a[d];if(b(e,d,a))return e}return null};const
ea={"-":"+",_:"/"},fa={"+":"-","/":"_","=":""};function ha(a){const b=new
Uint8Array(a.length);for(let c=0;c<a.length;c++){const
d=a.charCodeAt(c);q(255>=d,"Characters must be in range [0,255]");b[c]=d}return
b}function ia(a){const b=Array(a.length);for(let c=0;c<a.length;c+
+)b[c]=String.fromCharCode(a[c]);return b.join("")}function ja(a){if("undefined"!
==typeof TextDecoder)return(new TextDecoder("utf-8")).decode(a);const b=ia(new
Uint8Array(a));return decodeURIComponent(escape(b))}
function ka(a){return"undefined"!==typeof TextEncoder?(new TextEncoder("utf-
8")).encode(a):ha(unescape(encodeURIComponent(a)))}function la(a){const
b=atob(a.replace(/[-_]/g,c=>ea[c]));return ha(b)}function ma(a){a=ia(a);return
btoa(a).replace(/[+/=]/g,b=>fa[b])};function na(){var a=Date.now().toString(16);let
b=a.substring(a.length-8).toUpperCase()+"-",c=0;a=new Uint8Array(23);var
d=self.msCrypto?
self.msCrypto:self.crypto;if(d&&d.getRandomValues)for(d.getRandomValues(a),d=a.leng
th-1;-1<d;d--)a[d]%=16;else for(d=a.length-1;-
1<d;d--)a[d]=Math.floor(16*Math.random());for(d=9;36>d;d++)switch(d){case 13:case
18:case 23:b+="-";break;case 14:b+="4";break;case 19:b+="0123456789ABCDEF"[a[c+
+]&3|8];break;default:b+="0123456789ABCDEF"[a[c++]]}return b}
function oa(a){let b;const c=null==(b=self.crypto||self.msCrypto)?void
0:b.subtle;return c?c.digest("SHA-512",ka(a)).then(d=>{const e=[],f=new
DataView(d);for(let g=0;g<f.byteLength;g+=4){const
h=f.getUint32(g).toString(16);e.push(("00000000"+h).slice(-8))}return e.join("")}):
(n("Swgjs only works on secure (HTTPS or localhost) pages."),Promise.reject("Swgjs
only works on secure (HTTPS or localhost) pages."))};let pa;
const qa="Webkit webkit Moz moz ms O o".split(" "),ra={"align-
content":"normal",animation:"none","align-items":"normal","align-
self":"auto","alignment-baseline":"auto","backface-
visibility":"hidden","background-clip":"border-box","background-
image":"none","baseline-shift":"0","block-size":"auto",border:"none","border-
collapse":"separate",bottom:"0","box-sizing":"border-box","break-
after":"auto","break-before":"auto","break-inside":"auto","buffered-
rendering":"auto","caption-side":"top","caret-color":"rgb(51, 51,
51)",clear:"none",
color:"rgb(51, 51, 51)","color-rendering":"auto","column-count":"auto","column-
fill":"balance","column-gap":"normal","column-rule-color":"rgb(51, 51,
51)","column-rule-style":"none","column-rule-width":"0","column-
span":"none","column-width":"auto",contain:"none","counter-
increment":"none","counter-
reset":"none",cursor:"auto",direction:"inherit",display:"block","empty-
cells":"show",filter:"none",flex:"none","flex-flow":"row
nowrap","float":"none","flood-color":"rgb(0, 0, 0)","flood-
opacity":"1",font:"none",
"font-size":"medium","font-family":"",height:"auto",hyphens:"manual","image-
rendering":"auto","inline-size":"",isolation:"auto","justify-
content":"normal","justify-items":"normal","justify-self":"auto","letter-
spacing":"normal","lighting-color":"rgb(255, 255, 255)","line-break":"auto","line-
height":"normal","margin-bottom":"0",mask:"none","max-block-size":"none","max-
height":"none","max-inline-size":"none","max-width":"none","min-block-
size":"none","min-height":"0","min-inline-size":"0","min-width":"0",
"mix-blend-mode":"normal","object-fit":"fill","offset-distance":"none","offset-
path":"none","offset-rotate":"auto
0deg",opacity:"1",order:"0",orphans:"2",outline:"none","overflow-
anchor":"auto","overflow-
wrap":"normal",overflow:"visible",padding:"0",page:"",perspective:"none","pointer-
events":"auto",position:"static",quotes:"",resize:"none",right:"0","scroll-
behavior":"auto","tab-size":"8","table-layout":"auto","text-align":"start","text-
align-last":"auto","text-anchor":"start","text-combine-upright":"none",
"text-decoration":"none","text-indent":"0","text-orientation":"mixed","text-
overflow":"clip","text-rendering":"auto","text-shadow":"none","text-size-
adjust":"auto","text-transform":"none","text-underline-
position":"auto",top:"auto","touch-action":"auto",transform:"none",transition:"none
0s ease 0s","unicode-bidi":"normal","user-select":"auto","vector-
effect":"none","vertical-align":"baseline",visibility:"visible","white-
space":"normal",widows:"2","word-break":"normal","word-spacing":"0","word-
wrap":"normal",
"writing-mode":"horizontal-tb",zoom:"1","z-index":"auto"};function sa(a,b,c)
{if(2>b.length?0:0==b.lastIndexOf("--",0))return b;pa||(pa=Object.create(null));let
d=pa[b];if(!d||c){d=b;if(void 0===a[b]){var e=b.charAt(0).toUpperCase()
+b.slice(1);a:{for(let g=0;g<qa.length;g++){const h=qa[g]+e;if(void 0!==a[h])
{e=h;break a}}e=""}const f=e;void 0!==a[f]&&(d=f)}c||(pa[b]=d)}return d}function
r(a,b){for(const c in b)a.style.setProperty(sa(b,c),b[c].toString(),"important")}
function ta(a,b,c){(b=sa(a.style,b,void 0))&&(a.style[b]=c)}function ua(a,b)
{for(const c in b)ta(a,c,b[c])}function va(a){const b={};
["height"].forEach(c=>{b[c]=null});ua(a,b)};function t(a,b,c)
{b=a.createElement(b);for(const d in c)"style"==d?
ua(b,c[d]):b.setAttribute(d,c[d]);return b}function wa(a,b){const
c=t(a.getWin().document,"style",
{type:"text/css"});c.textContent=b;a.getHead().appendChild(c)}function xa(a){const
b=a.navigator;return/Edge/i.test(b&&b.userAgent)};/*
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:[email protected]
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
var
pf="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");funct
ion qf(a){for(var b=Array(36),c=0,d,e=0;36>e;e++)8==e||13==e||18==e||23==e?
b[e]="-":14==e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|
0),d=c&15,c>>=4,b[e]=pf[19==e?d&3|8:d]);return b.join("")+"."+a};const
rf="actions.google.com amp-actions.sandbox.google.com amp-actions-
staging.sandbox.google.com amp-actions-autopush.sandbox.google.com
payments.developers.google.com payments.google.com".split(" ");function sf(a,b)
{console.error("DEVELOPER_ERROR in "+a+" : "+b)}function tf(a,b)
{if(a.Uc.isUpiRequest(b))return a.Uc.isReadyToPay(b);if(Ue()&&!uf(b))
{if(2<=b.apiVersion)return vf(a,b);const
c=a.xa.isReadyToPay(b),d=a.La.isReadyToPay(b);return Ve(b)?d:d.then(()=>c)}return
a.xa.isReadyToPay(b)}
function vf(a,b){let c=Promise.resolve({result:!
1});b.existingPaymentMethodRequired&&(c=Promise.resolve({result:!
1,paymentMethodPresent:!1}));var d=c;if(Xe(b,"CRYPTOGRAM_3DS")){const
f=JSON.parse(JSON.stringify(b));for(d=0;d<f.allowedPaymentMethods.length;d+
+)"CARD"==f.allowedPaymentMethods[d].type&&(f.allowedPaymentMethods[d].parameters.a
llowedAuthMethods=["CRYPTOGRAM_3DS"]);d=a.La.isReadyToPay(f)}let
e=c;Xe(b,"PAN_ONLY")&&(e=a.xa.isReadyToPay(b));return d.then(f=>1==(f&&f.result)?
f:e)}
function wf(a){const b={startTimeMs:Date.now(),googleTransactionId:Y};a.i=a.i?
Object.assign(b,a.i):b}
class xf{constructor(a,b,c)
{this.qd=b;Ze(a);this.md=null;this.J=a.environment||"TEST";Y||(Y=-1!
=rf.indexOf(window.location.hostname)&&a.i&&a.i.googleTransactionId?
a.i.googleTransactionId:qf(this.J));this.Zd=a;this.xa=new
lf(this.J,c,a.i&&a.i.redirectKey);this.Ga=5;const d=Ue();this.La=d?new
Qe(this.J):this.xa;this.Uc=new
of;this.xa.onResult(this.oc.bind(this));this.La.onResult(this.oc.bind(this));Le();d
&&(Ie=4);Fe=Y;X({eventType:9,clientLatencyStartMs:Date.now()});window.addEventListe
ner("message",
e=>{-1!
=rf.indexOf(window.location.hostname)&&"logPaymentData"===e.data.name&&X(e.data.dat
a)})}isReadyToPay(a){a&&(a=Object.assign({},this.Zd,a));const b=Date.now(),c=Ye()||
$e(a);if(c)return new
Promise((e,f)=>{sf("isReadyToPay",c);X({eventType:0,error:2});f({statusCode:"DEVELO
PER_ERROR",statusMessage:c})});const
d=tf(this,a);d.then(e=>{X({eventType:0,clientLatencyStartMs:b,isReadyToPayApiRespon
se:e});return e});return d}prefetchPaymentData(a){const b=Ye()||cf(a);b?
sf("prefetchPaymentData",b):(wf(a),
Ue()&&!uf(a)?
this.La.prefetchPaymentData(a):this.xa.prefetchPaymentData(a))}loadPaymentData(a)
{X({eventType:5});const b=Ye()||cf(a);this.Ga=a&&a.swg?6:5;if(b)this.qd(new
Promise((d,e)=>{X({eventType:1,error:2,buyFlowMode:this.Ga});sf("loadPaymentData",b
);e({statusCode:"DEVELOPER_ERROR",statusMessage:b})}));else{var c=df(a);c?
this.Uc.loadPaymentData(a,c,this.oc.bind(this)):(this.md=Date.now(),wf(a),uf(a)?
this.xa.loadPaymentData(a):this.La.loadPaymentData(a))}}createButton(){const
a=Date.now();X({eventType:2,
clientLatencyStartMs:a});return null}oc(a)
{a.then(()=>{X({eventType:1,clientLatencyStartMs:this.md,buyFlowMode:this.Ga})}).ca
tch(b=>{b.errorCode?
X({eventType:1,error:b.errorCode,buyFlowMode:this.Ga}):X({eventType:1,error:6,buyFl
owMode:this.Ga})});this.qd(a)}}var Y;function uf(a){return!
0===(a.i&&a.i.disableNative)};function yf(a,b,c,d){const e=t(a.j,"link",
{rel:c,href:b});d&&e.setAttribute("as",d);a.j.head.appendChild(e)}class
zf{constructor(a){this.j=a}preconnect(a){yf(this,a,"preconnect")}dnsPrefetch(a)
{yf(this,a,"dns-prefetch")}prefetch(a){yf(this,a,"preconnect
prefetch")}preload(a,b){yf(this,a,"preconnect preload",b)}};const
Af={PRODUCTION:"https://pay.google.com",SANDBOX:"https://pay.sandbox.google.com"};f
unction Bf(a){var b={environment:G().payEnv,i:{redirectKey:a.xc.restoreKey()}};var
c=a.ad.getTransactionId(),d=a.Od.bind(a);Y=c;b=new
xf(b,d,a.m.getOriginalWebActivityPorts());a.eb=b}function Cf(a,b,c){return
b.then(d=>{c&&(d.paymentRequest=c);return d}).catch(d=>"object"==typeof
d&&"CANCELED"==d.statusCode?(d=ya(a.g,void 0),d.productType=c?
c.i.productType:null,Promise.reject(d)):Promise.reject(d))}
class Df{constructor(a)
{this.g=a.win();this.m=a.activities();this.Dc=this.Ac=this.Cc=null;this.ad=a.analyt
ics();this.xc=new Ef(this.g);this.eb=null;this.td=new zf(this.g.document);var
b;if(b=P(this.g,"pay-client-redirect")){var
c=this.g.location.hash;b=/redirectEncryptedCallbackData/.test(c);c=/swgRequest/.tes
t(c);b=b&&c}b&&(this.preconnect(this.td),Bf(this));this.xc.prepare();this.u=a.event
Manager()}preconnect(a){a.prefetch(F(Af[G().payEnv]
+"/gp/p/ui/pay","_",Zb()));a.prefetch("https://payments.google.com/payments/v4/js/i
ntegrator.js?ss=md");
a.prefetch("https://clients2.google.com/gr/gr_full_2.0.6.js")}getType()
{return"PAYJS"}start(a,b={}){this.Ac=a;this.eb||
(this.preconnect(this.td),Bf(this));b.forceRedirect&&(a=Object.assign(a,
{forceRedirect:b.forceRedirect||!1}));a.i=Object.assign(a.i||{},
{["disableNative"]:b.forceDisableNative||this.g!=this.g.top});let c=null;const
d=new Promise(e=>c=e);this.xc.useVerifier(e=>{e&&(a.i=Object.assign(a.i||{},
{["redirectVerifier"]:e}));if(b.forceRedirect){const
f=this.eb;this.u.getReadyPromise().then(()=>
{this.ad.getLoggingPromise().then(()=>{f.loadPaymentData(a);c(!0)})})}else
this.eb.loadPaymentData(a),c(!0)});return d}onResponse(a){this.Cc=a;const
b=this.Dc;b&&Promise.resolve().then(()=>{b&&a(Cf(this,b,this.Ac))})}Od(a)
{this.Dc=a;this.Cc&&this.Cc(Cf(this,this.Dc,this.Ac))}}function Ff(a,b){Gf(a);a.kb?
b(a.qc):a.Va&&a.Va.then(c=>b(c));return a.Va}
function Gf(a){if(!a.kb&&!a.Va){try{var b=!!a.g.localStorage}catch(d){b=!1}var
c=a.g.crypto;b&&c&&c.getRandomValues&&c.subtle&&c.subtle.digest?a.Va=(new
Promise((d,e)=>{const f=new Uint8Array(16);c.getRandomValues(f);const
g=btoa(ia(f));c.subtle.digest({name:"SHA-384"},ha(g)).then(h=>{h=btoa(ia(new
Uint8Array(h)));d({key:g,verifier:h})},h=>{e(h)})})).catch(()=>null).then(d=>{a.kb=
!0;return a.qc=d}):(a.kb=!0,a.qc=null)}}
class Ef{constructor(a){this.g=a;this.kb=!1;this.Va=this.qc=null}prepare(){return
Ff(this,()=>{})}useVerifier(a)
{Ff(this,b=>{if(b)try{this.g.localStorage.setItem("subscribe.google.com:rk",b.key)}
catch(c){b=null}a(b&&b.verifier||null)})}restoreKey(){try{return
this.g.localStorage&&this.g.localStorage.getItem("subscribe.google.com:rk")||
null}catch(a){return null}}};function Hf(a,b)
{b=F(b,"u_tz","240");b=F(b,"v",String(a.ke));if(!a.Gb){var
c=a.g.document.cookie.match("(^|;)\\s*__gads\\s*=\\s*([^;]
+)");a.Gb=c&&encodeURIComponent(c.pop())}(c=a.Gb)&&(b=F(b,"cookie",c));return
b=F(b,"cdm",a.g.location.hostname)}
class If{constructor(a,b,c)
{this.g=a;this.h=b;this.L=this.h.pageConfig().getPublicationId();this.Gb=null;this.
G=c;this.ke=1;this.h.eventManager().registerEventListener(this.Na.bind(this))}sendS
ubscriptionState(a,b)
{a=F("https://pubads.g.doubleclick.net/subopt/data","states",this.L+":"+a);b&&(a=F(
a,"extrainfo",b));return this.G.fetch(Hf(this,a),
{method:"GET",credentials:"include"})}Na(a){if(6!
==a.eventOriginator&&(this.h.config().enablePropensity||
3===a.eventOriginator))if(4E3===a.eventType)this.sendSubscriptionState(a.additional
Parameters.state,
a.additionalParameters.productsOrSkus);else{var b=td[a.eventType];if(null!=b){var
c=a.additionalParameters;c instanceof z&&(c=void 0);O(a.isFromUserAction)&&(M(c)||
(c={}),c.is_active=a.isFromUserAction);a=JSON.stringify(c);let
d;d=F("https://pubads.g.doubleclick.net/subopt/data","events",this.L+":"+b);a&&(d=F
(d,"extrainfo",a));this.G.fetch(Hf(this,d),
{method:"GET",credentials:"include"})}}}getPropensity(a,b){return
this.G.fetch(Hf(this,"https://pubads.g.doubleclick.net/subopt/pts?
products="+this.L+"&type="+b+"&ref="+a),
{method:"GET",credentials:"include"}).then(c=>
c.json()).then(c=>{var d={};if(c.header)if(c.header.ok){const
e=c.scores;c=[];for(let f=0;f<e.length;f++){const g=e[f];c.push(g.score?
{product:g.product,score:{value:g.score,bucketed:2==g.score_type}}:
{product:g.product,error:g.error_message})}c&&(d={header:{ok:!0},body:
{scores:c}})}else d={header:{ok:!1},body:{error:c.error}};else d={header:{ok:!
1},body:{error:"No valid response"}};return d})}};class Jf{constructor(a,b,c)
{this.g=a;this.vd=new If(a,b,c);this.u=b.eventManager()}sendSubscriptionState(a,b)
{if(!Object.values(Nb).includes(a))throw Error("Invalid subscription state
provided");if(("subscriber"==a||"past_subscriber"==a)&&!b)throw Error("Entitlements
must be provided for users with active or expired subscriptions");if(b&&!M(b))throw
Error("Entitlements must be an Object");let
c=null;b&&(c=JSON.stringify(b));this.vd.sendSubscriptionState(a,c)}getPropensity(a)
{if(a&&!Object.values(Pb).includes(a))throw Error("Invalid propensity type
requested");
a||(a="general");return
this.vd.getPropensity(this.g.document.referrer,a)}sendEvent(a){const
b=sd[a.name];let c=null;if(!N(Ob,a.name)||!b)throw Error("Invalid user event
provided("+a.name+")");if(a.data)if(M(a.data))c={},Object.assign(c,a.data);else
throw Error("Event data must be an Object("+a.data+")");if(O(a.active))c||
(c={}),Object.assign(c,{is_active:a.active});else if(null!=a.active)throw
Error("Event active must be a
boolean");this.u.logEvent({eventType:b,eventOriginator:3,isFromUserAction:a.active,
additionalParameters:c})}};class Kf{constructor(a){this.g=a;this.Za={}}get(a,b=!1)
{this.Za[a]||(this.Za[a]=new Promise(c=>{const d=b?
this.g.localStorage:this.g.sessionStorage;if(d)try{c(d.getItem(Lf(a)))}catch(e)
{c(null)}else c(null)}));return this.Za[a]}set(a,b,c=!1)
{this.Za[a]=Promise.resolve(b);return new Promise(d=>{const e=c?
this.g.localStorage:this.g.sessionStorage;if(e)try{e.setItem(Lf(a),b)}catch(f)
{}d()})}remove(a,b=!1){delete this.Za[a];return new Promise(c=>{const d=b?
this.g.localStorage:this.g.sessionStorage;if(d)try{d.removeItem(Lf(a))}catch(e)
{}c()})}}
function Lf(a){return"subscribe.google.com:"+a};class Mf{constructor(a,b)
{this.h=a;this.g=a.win();this.m=a.activities();this.o=a.dialogManager();this.Ta=nul
l;this.zd=b||Promise.reject("No account promise provided");this.l=new
y(this.g,this.m,I("/waitforsubscriptionlookupiframe"),J({publicationId:a.pageConfig
().getPublicationId(),productId:a.pageConfig().getProductId()}),!0,!0)}start()
{this.Ta=this.o.openView(this.l);return
this.zd.then(a=>{this.o.completeView(this.l);return
a},a=>{this.o.completeView(this.l);throw a;})}};function Z(a,b){if(!a.Ib&&b){a.Ib=!
0;let c;a.uc?c=Promise.resolve(new he(a.uc,!1)):(a.Ua=new
oe(a.j),c=a.Ua.resolveConfig().then(d=>{a.Ua=null;return d}));c.then(d=>{a.Ja(new
Nf(a.j,d,
{configPromise:a.Jb},a.V));a.Ja=null},d=>{a.Ja(Promise.reject(d));a.Ja=null})}else
b&&a.Ua&&a.Ua.check();return a.Jb}
class Of{constructor(a)
{this.g=a;this.j=bd(a);this.tb=Promise.resolve();this.uc=null;this.V={};this.Ib=!
1;this.Ja=null;this.Jb=new Promise(b=>{this.Ja=b});this.Ua=null;this.na=new
Fc(this.j,this.Jb);this.na.init()}whenReady(){return
this.tb}startSubscriptionsFlowIfNeeded(){{var a=this.g.document;const
b=te(a,"subscriptions-control");a=b?b:(a=a.querySelector("script[subscriptions-
control]"))?a.getAttribute("subscriptions-
control"):null}ca(a,"mode");return"manual"==a?null:this.start()}init(a){q(!this.Ib,
"already configured");this.uc=a;Z(this,!0)}configure(a)
{Object.assign(this.V,a);return Z(this,!1).then(b=>b.configure(a))}start(){return
Z(this,!0).then(a=>a.start())}reset(){return Z(this,!0).then(a=>a.reset())}clear()
{return Z(this,!0).then(a=>a.clear())}getEntitlements(a){return Z(this,!
0).then(b=>b.getEntitlements(a))}setOnEntitlementsResponse(a){return Z(this,!
1).then(b=>b.setOnEntitlementsResponse(a))}getOffers(a){return Z(this,!
0).then(b=>b.getOffers(a))}showOffers(a){return Z(this,!0).then(b=>
b.showOffers(a))}showUpdateOffers(a){return Z(this,!
0).then(b=>b.showUpdateOffers(a))}showSubscribeOption(a){return Z(this,!
0).then(b=>b.showSubscribeOption(a))}showAbbrvOffer(a){return Z(this,!
0).then(b=>b.showAbbrvOffer(a))}showContributionOptions(a){return Z(this,!
0).then(b=>b.showContributionOptions(a))}waitForSubscriptionLookup(a){return
Z(this,!0).then(b=>b.waitForSubscriptionLookup(a))}setOnNativeSubscribeRequest(a)
{return Z(this,!
1).then(b=>b.setOnNativeSubscribeRequest(a))}setOnSubscribeResponse(a){return
Z(this,
!1).then(b=>b.setOnSubscribeResponse(a))}subscribe(a){return Z(this,!
0).then(b=>b.subscribe(a))}updateSubscription(a){return Z(this,!
0).then(b=>b.updateSubscription(a))}setOnContributionResponse(a){return Z(this,!
1).then(b=>b.setOnContributionResponse(a))}setOnPaymentResponse(a){return Z(this,!
1).then(b=>b.setOnPaymentResponse(a))}contribute(a){return Z(this,!
0).then(b=>b.contribute(a))}completeDeferredAccountCreation(a){return Z(this,!
0).then(b=>b.completeDeferredAccountCreation(a))}setOnLoginRequest(a){return
Z(this,
!1).then(b=>b.setOnLoginRequest(a))}triggerLoginRequest(a){return Z(this,!
1).then(b=>b.triggerLoginRequest(a))}setOnLinkComplete(a){return Z(this,!
1).then(b=>b.setOnLinkComplete(a))}linkAccount(a={}){return Z(this,!
0).then(b=>b.linkAccount(a))}setOnFlowStarted(a){return Z(this,!
1).then(b=>b.setOnFlowStarted(a))}setOnFlowCanceled(a){return Z(this,!
1).then(b=>b.setOnFlowCanceled(a))}saveSubscription(a){return Z(this,!
0).then(b=>b.saveSubscription(a))}showLoginPrompt(){return Z(this,!
0).then(a=>a.showLoginPrompt())}showLoginNotification(){return Z(this,
!0).then(a=>a.showLoginNotification())}createButton(a,b){return
this.na.create(a,b)}attachSmartButton(a,b,c){return Z(this,!
0).then(d=>d.attachSmartButton(a,b,c))}attachButton(a,b,c){return
this.na.attach(a,b,c)}getPropensityModule(){return Z(this,!
0).then(a=>a.getPropensityModule())}getLogger(){return Z(this,!
0).then(a=>a.getLogger())}getEventManager(){return Z(this,!
0).then(a=>a.getEventManager())}setShowcaseEntitlement(a){return Z(this,!
0).then(b=>b.setShowcaseEntitlement(a))}consumeShowcaseEntitlementJwt(a,
b){return Z(this,!
0).then(c=>c.consumeShowcaseEntitlementJwt(a,b))}showBestAudienceAction(){n("Not
implemented yet")}}
function Pf(a,b){let c="";for(const d in b){const e=b[d];switch(d){case
"windowOpenMode":"auto"!=e&&"redirect"!=e&&(c="Unknown windowOpenMode:
"+e);break;case "experiments":e.forEach(f=>{qc(a.g)[f]=!
0});a.analytics()&&a.analytics().addLabels(e);break;case "analyticsMode":0!=e&&1!
=e&&(c="Unknown analytics mode: "+e);break;case "enableSwgAnalytics":O(e)||
(c="Unknown enableSwgAnalytics value: "+e);break;case "enablePropensity":O(e)||
(c="Unknown enablePropensity value: "+e);break;case
"skipAccountCreationScreen":O(e)||
(c="Unknown skipAccountCreationScreen value: "+e);break;default:c="Unknown config
property: "+d}}q(!c,c||void 0);Object.assign(a.V,b)}
class Nf{constructor(a,b,c,d){c=c||{};c.configPromise=c.configPromise||
Promise.resolve();this.u=new
oc(c.configPromise);this.j=bd(a);this.g=this.j.getWin();this.V={windowOpenMode:"aut
o",analyticsMode:0,enableSwgAnalytics:!1,enablePropensity:!
1};xa(this.g)&&(this.V.windowOpenMode="redirect");d&&Pf(this,d);this.R=b;this.K=thi
s.j.whenReady();this.kd=new Xd(this.j);this.G=c.fetcher||new Vd(this.g);this.H=new
Kf(this.g);this.o=new jd(this.j);this.C=new
Hc;this.ac=this.bc=null;c.enableGoogleAnalytics&&
(this.Ld=new Wd(this),this.Ld.start());this.m=new lc(this);this.Y=new
wc(this,this.G);this.Y.start();this.rc=new Df(this);this.Td=new de(this);this.$=new
Kd(this.g,this.R,this.G,this);this.D=new
Pc(b.getPublicationId(),this.G);this.be=new
Jf(this.g,this,this.G);this.u.logSwgEvent(11,!1);this.Xd=new
ge(this.R,this.G);this.na=new Fc(this.j,Promise.resolve(this));const e=new
zf(this.g.document);e.prefetch("https://news.google.com/swg/js/v1/loader.svg");e.pr
econnect("https://www.gstatic.com/");e.preconnect("https://fonts.googleapis.com/");
e.preconnect("https://www.google.com/");$d(this);cc(this);wa(this.j,".swg-
dialog,.swg-toast{background-color:#fff!important;box-sizing:border-box}.swg-
toast{border:none!important;bottom:0!important;max-height:46px!
important;position:fixed!important;z-index:2147483647!important}@media (min-
width:871px) and (min-height:641px){.swg-dialog.swg-wide-dialog{left:-435px!
important;width:870px!important}}@media (max-height:640px),(max-width:640px){.swg-
dialog,.swg-toast{border-top-left-radius:8px!important;border-top-right-radius:8px!
important;box-shadow:0 1px 1px rgba(60,64,67,.3),0 1px 4px 1px rgba(60,64,67,.15)!
important;left:-240px!important;margin-left:50vw!important;width:480px!
important}}@media (min-width:641px) and (min-height:641px){.swg-dialog{background-
color:transparent!important;border:none!important;left:-315px!important;margin-
left:50vw!important;width:630px!important}.swg-toast{border-radius:4px!
important;bottom:8px!important;box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0
rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)!important;left:8px!important}}@media
(max-width:480px){.swg-dialog,.swg-toast{left:0!important;margin-left:0!
important;right:0!important;width:100%!important}}\n/*#
sourceURL=/./src/components/dialog.css*/\n");
this.m.onRedirectError(f=>{this.Y.addLabels(["redirect"]);this.u.logSwgEvent(2E3,!
1);this.kd.error("Redirect error",f)})}doc(){return this.j}win(){return
this.g}pageConfig(){return this.R}jserror(){return this.kd}activities(){return
this.m}payClient(){return this.rc}dialogManager(){return
this.o}entitlementsManager(){return this.$}callbacks(){return this.C}storage()
{return this.H}clientConfigManager(){return this.D}analytics(){return this.Y}init()
{}configure(a){Pf(this,a)}config(){return this.V}reset(){this.$.reset();
this.closeDialog()}clear(){this.$.clear();this.closeDialog()}closeDialog()
{this.o.completeAll()}start(){if(!this.R.getProductId()||!this.R.isLocked())return
Promise.resolve();this.getEntitlements()}getEntitlements(a){return this.
$.getEntitlements(a).then(b=>{if(b)try{const
c=b.entitlements.map(d=>d.getSku()||"unknown
subscriptionToken");0<c.length&&this.Y.setSku(c.join(","))}catch(c){}return
b.clone()})}setOnEntitlementsResponse(a)
{this.C.setOnEntitlementsResponse(a)}getOffers(a){return this.Xd.getOffers(a&&
a.productId)}showOffers(a){return this.K.then(()=>{q(a?!a.oldSku:!0,"The
showOffers() method cannot be used to update a subscription. Use the
showUpdateOffers() method instead.");this.bc=new fc(this,a);return
this.bc.start()})}showUpdateOffers(a){q(P(this.g,"replace-subscription"),"Not yet
launched!");return this.K.then(()=>{q(a?!!a.oldSku:!1,"The showUpdateOffers()
method cannot be used for new subscribers. Use the showOffers() method
instead.");return(new fc(this,a)).start()})}showSubscribeOption(a){return
this.K.then(()=>
(new gc(this,a)).start())}showAbbrvOffer(a){return this.K.then(()=>(new
hc(this,a)).start())}showContributionOptions(a){return this.K.then(()=>{this.ac=new
Qc(this,a);return this.ac.start()})}getLastContributionsFlow(){return
this.ac}waitForSubscriptionLookup(a){return this.K.then(()=>(new
Mf(this,a)).start())}setOnLoginRequest(a)
{this.C.setOnLoginRequest(a)}triggerLoginRequest(a)
{this.C.triggerLoginRequest(a)}setOnLinkComplete(a)
{this.C.setOnLinkComplete(a)}linkAccount(a={}){return this.K.then(()=>
(new Zd(this)).start(a))}saveSubscription(a){return this.K.then(()=>(new
ce(this,a)).start())}showLoginPrompt(){return this.K.then(()=>(new
fe(this)).start())}showLoginNotification(){return this.K.then(()=>(new
ee(this)).start())}setOnNativeSubscribeRequest(a)
{this.C.setOnSubscribeRequest(a)}setOnSubscribeResponse(a)
{this.C.setOnSubscribeResponse(a)}setOnPaymentResponse(a)
{this.C.setOnPaymentResponse(a)}subscribe(a){q("string"===typeof a,"The subscribe()
method can only take a sku as its parameter; for subscription updates please use
the updateSubscription() method");
return this.K.then(()=>(new L(this,{skuId:a})).start())}updateSubscription(a)
{q(P(this.g,"replace-subscription"),"Not yet launched!");q(a?a.oldSku:!1,"The
updateSubscription() method should be used for subscription updates; for new
subscriptions please use the subscribe() method");return this.K.then(()=>(new
L(this,a)).start())}setOnContributionResponse(a)
{this.C.setOnContributionResponse(a)}contribute(a){const b="string"==typeof a?
{skuId:a}:a;return this.K.then(()=>(new
L(this,b,"UI_CONTRIBUTION")).start())}completeDeferredAccountCreation(a){return
this.K.then(()=>
(new Sc(this,a||null)).start())}setOnFlowStarted(a)
{this.C.setOnFlowStarted(a)}setOnFlowCanceled(a)
{this.C.setOnFlowCanceled(a)}createButton(a,b){return
this.na.create(a,b)}attachButton(a,b,c)
{this.na.attach(a,b,c)}attachSmartButton(a,b,c){q(P(this.g,"smartbox"),"Not yet
launched!");this.na.attachSmartButton(this,a,b,c)}getPropensityModule(){return
Promise.resolve(this.be)}eventManager(){return this.u}getLastOffersFlow(){return
this.bc}getEventManager(){return Promise.resolve(this.u)}getLogger(){return
Promise.resolve(this.Td)}setShowcaseEntitlement(a){var b;
if(b=a&&Wb(this.win().location)){b=(b=B(this.win().document.referrer))||Vb;var
c;if(c=Wb(b))b=b||Ub,c=Qb.test(b.hostname);b=c}if(!b||!
zd(this.win().location.search,!0))return Promise.resolve();const
d=ud[a.entitlement]||[];b=new
z;b.setIsUserRegistered(a.isUserRegistered);for(a=0;a<d.length;a+
+)this.eventManager().logEvent({eventType:d[a],eventOriginator:6,isFromUserAction:!
1,additionalParameters:b});return
Promise.resolve()}consumeShowcaseEntitlementJwt(a,b)
{this.entitlementsManager().parseEntitlements({signedEntitlements:a}).consume(b)}sh
owBestAudienceAction(){n("Not implemented yet")}}
function Qf(a)
{return{init:a.init.bind(a),configure:a.configure.bind(a),start:a.start.bind(a),res
et:a.reset.bind(a),clear:a.clear.bind(a),getEntitlements:a.getEntitlements.bind(a),
linkAccount:a.linkAccount.bind(a),showLoginPrompt:a.showLoginPrompt.bind(a),showLog
inNotification:a.showLoginNotification.bind(a),getOffers:a.getOffers.bind(a),showOf
fers:a.showOffers.bind(a),showUpdateOffers:a.showUpdateOffers.bind(a),showAbbrvOffe
r:a.showAbbrvOffer.bind(a),showSubscribeOption:a.showSubscribeOption.bind(a),
showContributionOptions:a.showContributionOptions.bind(a),waitForSubscriptionLookup
:a.waitForSubscriptionLookup.bind(a),subscribe:a.subscribe.bind(a),updateSubscripti
on:a.updateSubscription.bind(a),contribute:a.contribute.bind(a),completeDeferredAcc
ountCreation:a.completeDeferredAccountCreation.bind(a),setOnEntitlementsResponse:a.
setOnEntitlementsResponse.bind(a),setOnLoginRequest:a.setOnLoginRequest.bind(a),tri
ggerLoginRequest:a.triggerLoginRequest.bind(a),setOnLinkComplete:a.setOnLinkComplet
e.bind(a),
setOnNativeSubscribeRequest:a.setOnNativeSubscribeRequest.bind(a),setOnPaymentRespo
nse:a.setOnPaymentResponse.bind(a),setOnSubscribeResponse:a.setOnSubscribeResponse.
bind(a),setOnContributionResponse:a.setOnContributionResponse.bind(a),setOnFlowStar
ted:a.setOnFlowStarted.bind(a),setOnFlowCanceled:a.setOnFlowCanceled.bind(a),saveSu
bscription:a.saveSubscription.bind(a),createButton:a.createButton.bind(a),attachBut
ton:a.attachButton.bind(a),attachSmartButton:a.attachSmartButton.bind(a),getPropens
ityModule:a.getPropensityModule.bind(a),
getLogger:a.getLogger.bind(a),getEventManager:a.getEventManager.bind(a),setShowcase
Entitlement:a.setShowcaseEntitlement.bind(a),consumeShowcaseEntitlementJwt:a.consum
eShowcaseEntitlementJwt.bind(a),showBestAudienceAction:a.showBestAudienceAction.bin
d(a)}};l("Subscriptions Runtime: 0.1.22.197");(function(a){function b(e)
{e&&c.whenReady().then(()=>{e(d)})}if(!a.SWG||Array.isArray(a.SWG)){/MSIE|
Trident/.test(self.navigator.userAgent)&&n("IE Support is being deprecated, in
September 2021 IE will no longer be supported.");var c=new Of(a),d=Qf(c);
[].concat(a.SWG,a.SUBSCRIPTIONS).forEach(b);a.SWG=a.SUBSCRIPTIONS={push:b};c.startS
ubscriptionsFlowIfNeeded()}})(self);}).call(this);
//# sourceMappingURL=swg.js.map