;
(self.AMP=self.AMP||[]).push({m:1,v:"2601162341000",n:"amp-access",ev:"0.1",l:!0,f:function(t,i){(()=>{var i;function s(){return i||(i=Promise.resolve(void 0))}var e=class{constructor(){this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}},{isArray:n}=Array;function r(t,i){const s=[];let e=0;for(let n=0;n<t.length;n++){const r=t[n];i(r,n,t)?s.push(r):(e<n&&(t[e]=r),e++)}return e<t.length&&(t.length=e),s}var{hasOwnProperty:o,toString:h}=Object.prototype;function c(t){return"[object Object]"===h.call(t)}function u(t){const i=Object.create(null);return t&&Object.assign(i,t),i}function a(t,i){return o.call(t,i)}function l(t,i){if("."==i)return t;const s=i.split(".");let e=t;for(const t of s){if(!(t&&e&&void 0!==e[t]&&"object"==typeof e&&a(e,t))){e=void 0;break}e=e[t]}return e}function f(t){return 1==(null==(i=t)?void 0:i.nodeType)?t.tagName.toLowerCase()+(t.id?`#${t.id}`:""):t;var i}function d(t,i,s,e,n,r,o,h,c,u,a){return t}function p(t){return JSON.parse(t)}function _(t,i){try{return p(t)}catch(t){return null==i||i(t),null}}function m(t){return CSS.escape(t)}var A=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;function P(t,i=""){try{return decodeURIComponent(t)}catch(t){return i}}function v(t){const i=u();if(!t)return i;let s;for(;s=A.exec(t);){const t=P(s[1],s[1]),e=s[2]?P(s[2].replace(/\+/g," "),s[2]):"";i[t]=e}return i}self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var g=self.__AMP_LOG;function b(t,i){throw new Error("failed to call initLogConstructor")}function E(t){return g.user||(g.user=w()),function(t,i){return i&&i.ownerDocument.defaultView!=t}(g.user.win,t)?g.userForEmbed||(g.userForEmbed=w()):g.user}function w(t){return b()}function T(){return g.dev||(g.dev=b())}function R(t,i,s,e,n,r,o,h,c,u,a){return t}function y(t,i,s,e,n,r,o,h,c,u,a){return E().assert(t,i,s,e,n,r,o,h,c,u,a)}function I(t,i){return x(t=O(t),i)}function M(t,i){return x(C(U(t)),i)}function V(t,i){const s=C(U(t));return j(s,i)?x(s,i):null}function S(t,i){return function(t,i){const s=z(t,i);if(s)return s;const n=L(t);return n[i]=function(){const t=new e,{promise:i,reject:s,resolve:n}=t;return i.catch((()=>{})),{obj:null,promise:i,resolve:n,reject:s,context:null,ctor:null}}(),n[i].promise}(C(t),i)}function k(t,i){return z(C(t),i)}function O(t){return t.__AMP_TOP||(t.__AMP_TOP=t)}function U(t){return t.nodeType?(s=t,i=(s.ownerDocument||s).defaultView,I(i,"ampdoc")).getAmpDoc(t):t;var i,s}function C(t){const i=U(t);return i.isSingleDoc()?i.win:i}function x(t,i){R(j(t,i));const s=L(t)[i];return s.obj||(R(s.ctor),R(s.context),s.obj=new s.ctor(s.context),R(s.obj),s.context=null,s.resolve&&s.resolve(s.obj)),s.obj}function z(t,i){const s=L(t)[i];return s?s.promise?s.promise:(x(t,i),s.promise=Promise.resolve(s.obj)):null}function L(t){let i=t.__AMP_SERVICES;return i||(i=t.__AMP_SERVICES={}),i}function j(t,i){const s=t.__AMP_SERVICES&&t.__AMP_SERVICES[i];return!(!s||!s.ctor)}var N,$=t=>x(t,"timer"),D=t=>M(t,"viewer"),F=t=>I(t,"vsync"),G=t=>I(t,"xhr");function J(t,i,s={},e=!0){var n;(n=t,function(t,i,s,e){const n=k(t,i);if(n)return n;const r=U(t);return r.whenExtensionsKnown().then((()=>{const t=r.getExtensionVersion(s);return t?I(r.win,"extensions").waitForExtension(s,t):null})).then((s=>s?S(t,i):null))}(n,"amp-analytics-instrumentation","amp-analytics")).then((n=>{n&&n.triggerEventForTarget(t,i,s,e)}))}function K(t,i,s,e){let n=t,r=s,o=t=>{try{return r(t)}catch(t){var i,s;throw null===(i=(s=self).__AMP_REPORT_ERROR)||void 0===i||i.call(s,t),t}};const h=function(){if(void 0!==N)return N;N=!1;try{const t={get capture(){return N=!0,!1}};self.addEventListener("test-options",null,t),self.removeEventListener("test-options",null,t)}catch(t){}return N}(),c=!(null==e||!e.capture);return n.addEventListener(i,o,h?e:c),()=>{null==n||n.removeEventListener(i,o,h?e:c),r=null,n=null,o=null}}function q(t){return t.data}var H=function(){var t=function(t,i,s,e){for(s=s||{},e=t.length;e--;s[t[e]]=i);return s},i=[1,3],s=[1,4],e=[1,18],n=[1,19],r=[1,14],o=[1,15],h=[1,16],c=[1,17],u=[1,21],a=[1,22],l=[5,6,7,10],f=[5,6,7,10,15,16,17,18,19,20,21],d=[5,6,7,10,15,16,17,18,19,20,21,25,27],p={trace:function(){},yy:{},dN:{"error":2,"result":3,"search_condition":4,"EOF":5,"OR":6,"AND":7,"NOT":8,"(":9,")":10,"predicate":11,"comparison_predicate":12,"truthy_predicate":13,"scalar_exp":14,"EQ":15,"DEQ":16,"NEQ":17,"LT":18,"LTE":19,"GT":20,"GTE":21,"atom":22,"field_ref":23,"literal":24,"DOT":25,"field_name":26,"[":27,"string":28,"]":29,"NAME":30,"STRING":31,"NUMERIC":32,"TRUE":33,"FALSE":34,"NULL":35,"$accept":0,"$end":1},bN:{2:"error",5:"EOF",6:"OR",7:"AND",8:"NOT",9:"(",10:")",15:"EQ",16:"DEQ",17:"NEQ",18:"LT",19:"LTE",20:"GT",21:"GTE",25:"DOT",27:"[",29:"]",30:"NAME",31:"STRING",32:"NUMERIC",33:"TRUE",34:"FALSE",35:"NULL"},vN:[0,[3,2],[4,3],[4,3],[4,2],[4,3],[4,1],[11,1],[11,1],[12,3],[12,3],[12,3],[12,3],[12,3],[12,3],[12,3],[13,1],[14,1],[14,1],[22,1],[23,3],[23,4],[23,1],[26,1],[28,1],[24,1],[24,1],[24,1],[24,1],[24,1]],performAction:function(t,i,s,e,n,r,o){var h=r.length-1;switch(n){case 1:return r[h-1];case 2:this.$=r[h-2]||r[h];break;case 3:this.$=r[h-2]&&r[h];break;case 4:this.$=!r[h];break;case 5:this.$=r[h-1];break;case 6:case 7:case 8:case 17:case 18:case 19:this.$=r[h];break;case 9:this.$=r[h-2]===r[h];break;case 10:throw new Error('"==" is not allowed, use "="');case 11:this.$=r[h-2]!==r[h];break;case 12:this.$=typeof r[h-2]==typeof r[h]&&r[h-2]<r[h];break;case 13:this.$=typeof r[h-2]==typeof r[h]&&r[h-2]<=r[h];break;case 14:this.$=typeof r[h-2]==typeof r[h]&&r[h-2]>r[h];break;case 15:this.$=typeof r[h-2]==typeof r[h]&&r[h-2]>=r[h];break;case 16:this.$=void 0!==r[h]&&null!==r[h]&&""!==r[h]&&0!==r[h]&&!1!==r[h];break;case 20:this.$="[object Object]"==Object.prototype.toString.call(r[h-2])&&r[h-2].hasOwnProperty(r[h])?r[h-2][r[h]]:null;break;case 21:this.$="[object Object]"==Object.prototype.toString.call(r[h-3])&&r[h-3].hasOwnProperty(r[h-1])?r[h-3][r[h-1]]:null;break;case 22:this.$=void 0!==e[r[h]]?e[r[h]]:null;break;case 23:this.$=t;break;case 24:this.$=t.substring(1,t.length-1);break;case 26:this.$=Number(t);break;case 27:this.$=!0;break;case 28:this.$=!1;break;case 29:this.$=null}},table:[{3:1,4:2,8:i,9:s,11:5,12:6,13:7,14:8,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{1:[3]},{5:[1,20],6:u,7:a},{4:23,8:i,9:s,11:5,12:6,13:7,14:8,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{4:24,8:i,9:s,11:5,12:6,13:7,14:8,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},t(l,[2,6]),t(l,[2,7]),t(l,[2,8]),t(l,[2,16],{15:[1,25],16:[1,26],17:[1,27],18:[1,28],19:[1,29],20:[1,30],21:[1,31]}),t(f,[2,17]),t(f,[2,18],{25:[1,32],27:[1,33]}),t(f,[2,19]),t(d,[2,22]),t(f,[2,25]),t(f,[2,26]),t(f,[2,27]),t(f,[2,28]),t(f,[2,29]),t(d,[2,23]),t([5,6,7,10,15,16,17,18,19,20,21,29],[2,24]),{1:[2,1]},{4:34,8:i,9:s,11:5,12:6,13:7,14:8,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{4:35,8:i,9:s,11:5,12:6,13:7,14:8,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},t(l,[2,4]),{6:u,7:a,10:[1,36]},{14:37,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{14:38,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{14:39,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{14:40,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{14:41,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{14:42,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{14:43,22:9,23:10,24:11,26:12,28:13,30:e,31:n,32:r,33:o,34:h,35:c},{26:44,30:e},{28:45,31:n},t([5,6,10],[2,2],{7:a}),t(l,[2,3]),t(l,[2,5]),t(l,[2,9]),t(l,[2,10]),t(l,[2,11]),t(l,[2,12]),t(l,[2,13]),t(l,[2,14]),t(l,[2,15]),t(d,[2,20]),{29:[1,46]},t(d,[2,21])],defaultActions:{20:[2,1]},parseError:function(t,i){if(!i.recoverable){var s=new Error(t);throw s.hash=i,s}this.trace(t)},parse:function(t){var i=this,s=[0],e=[null],n=[],r=this.table,o="",h=0,c=0,u=0,a=2,l=1,f=n.slice.call(arguments,1),d=Object.create(this.lexer),p={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(p.yy[_]=this.yy[_]);d.setInput(t,p.yy),p.yy.lexer=d,p.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var m=d.yylloc;n.push(m);var A=d.options&&d.options.ranges;"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var P,v,g,b,E,w,T,R,y,I=function(){var t;return"number"!=typeof(t=d.lex()||l)&&(t=i.dN[t]||t),t},M={};;){if(g=s[s.length-1],this.defaultActions[g]?b=this.defaultActions[g]:(null==P&&(P=I()),b=r[g]&&r[g][P]),void 0===b||!b.length||!b[0]){var V="";for(w in y=[],r[g])this.bN[w]&&w>a&&y.push("'"+this.bN[w]+"'");V=d.showPosition?"Parse error on line "+(h+1)+":\n"+d.showPosition()+"\nExpecting "+y.join(", ")+", got '"+(this.bN[P]||P)+"'":"Parse error on line "+(h+1)+": Unexpected "+(P==l?"end of input":"'"+(this.bN[P]||P)+"'"),this.parseError(V,{text:d.match,token:this.bN[P]||P,line:d.yylineno,loc:m,expected:y})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+g+", token: "+P);switch(b[0]){case 1:s.push(P),e.push(d.yytext),n.push(d.yylloc),s.push(b[1]),P=null,v?(P=v,v=null):(c=d.yyleng,o=d.yytext,h=d.yylineno,m=d.yylloc,u>0&&u--);break;case 2:if(T=this.vN[b[1]][1],M.$=e[e.length-T],M._$={first_line:n[n.length-(T||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(T||1)].first_column,last_column:n[n.length-1].last_column},A&&(M._$.range=[n[n.length-(T||1)].range[0],n[n.length-1].range[1]]),void 0!==(E=this.performAction.apply(M,[o,c,h,p.yy,b[1],e,n].concat(f))))return E;T&&(s=s.slice(0,-1*T*2),e=e.slice(0,-1*T),n=n.slice(0,-1*T)),s.push(this.vN[b[1]][0]),e.push(M.$),n.push(M._$),R=r[s[s.length-2]][s[s.length-1]],s.push(R);break;case 3:return!0}}return!0}},_=function(){return{EOF:1,parseError:function(t,i){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,i)},setInput:function(t,i){return this.yy=i||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var i=t.length,s=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var e=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),s.length-1&&(this.yylineno-=s.length-1);var n=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:s?(s.length===e.length?this.yylloc.first_column:0)+e[e.length-s.length].length-s[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),i=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+i+"^"},test_match:function(t,i){var s,e,n;if(this.options.backtrack_lexer&&(n={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(n.yylloc.range=this.yylloc.range.slice(0))),(e=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],s=this.performAction.call(this,this.yy,this,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s)return s;if(this._backtrack){for(var r in n)this[r]=n[r];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,i,s,e;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),r=0;r<n.length;r++)if((s=this._input.match(this.rules[n[r]]))&&(!i||s[0].length>i[0].length)){if(i=s,e=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(s,n[r])))return t;if(this._backtrack){i=!1;continue}return!1}if(!this.options.flex)break}return i?!1!==(t=this.test_match(i,n[e]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,i,s,e){switch(s){case 0:break;case 1:return 7;case 2:return 6;case 3:return 8;case 4:return 35;case 5:case 6:return 33;case 7:case 8:return 34;case 9:return 9;case 10:return 10;case 11:return 27;case 12:return 29;case 13:return"|";case 14:return 19;case 15:return 18;case 16:return 21;case 17:return 20;case 18:return 17;case 19:return 16;case 20:return 15;case 21:return 32;case 22:return 30;case 23:case 24:return 31;case 25:return 25;case 26:return"INVALID";case 27:return 5}},rules:[/^(?:\s+)/,/^(?:AND\b)/,/^(?:OR\b)/,/^(?:NOT\b)/,/^(?:NULL\b)/,/^(?:TRUE\b)/,/^(?:true\b)/,/^(?:FALSE\b)/,/^(?:false\b)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\|)/,/^(?:<=)/,/^(?:<)/,/^(?:>=)/,/^(?:>)/,/^(?:!=)/,/^(?:==)/,/^(?:=)/,/^(?:-?[0-9]+(\.[0-9]+)?\b)/,/^(?:[a-zA-Z_][a-zA-Z0-9_]*)/,/^(?:'[^\']*')/,/^(?:"[^\"]*")/,/^(?:\.)/,/^(?:.)/,/^(?:$)/],conditions:{"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27],"inclusive":!0}}}}();function m(){this.yy={}}return p.lexer=_,m.prototype=p,p.Parser=m,new m}(),Q=H;function W(t,i,s){return i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s,t}function B(t,i){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);i&&(e=e.filter((function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable}))),s.push.apply(s,e)}return s}function X(t){for(var i=1;i<arguments.length;i++){var s=null!=arguments[i]?arguments[i]:{};i%2?B(Object(s),!0).forEach((function(i){W(t,i,s[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):B(Object(s)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(s,i))}))}return t}var Y="__AMP__EXPERIMENT_TOGGLES";function Z(t,i){const s=function(t){var i,s,e,r,o;if(t[Y])return t[Y];t[Y]=u();const h=t[Y];d(h);const c=X(X({},null!==(i=t.AMP_CONFIG)&&void 0!==i?i:{}),null!==(s=t.AMP_EXP)&&void 0!==s?s:p((null===(e=t.__AMP_EXP)||void 0===e?void 0:e.textContent)||"{}"));for(const t in c){const i=c[t];"number"==typeof i&&i>=0&&i<=1&&(h[t]=Math.random()<i)}const a=null===(r=t.AMP_CONFIG)||void 0===r?void 0:r["allow-doc-opt-in"];if(n(a)&&a.length){const i=t.document.head.querySelector('meta[name="amp-experiments-opt-in"]');if(i){var l;const t=(null===(l=i.getAttribute("content"))||void 0===l?void 0:l.split(","))||[];for(const i of t)a.includes(i)&&(h[i]=!0)}}Object.assign(h,function(t){var i;let s="";try{var e;"localStorage"in t&&(s=null!==(e=t.localStorage.getItem("amp-experiment-toggles"))&&void 0!==e?e:"")}catch(t){}const n=(null===(i=s)||void 0===i?void 0:i.split(/\s*,\s*/g))||[],r=u();for(const t of n)t&&("-"==t[0]?r[t.substr(1)]=!1:r[t]=!0);return r}(t));const f=null===(o=t.AMP_CONFIG)||void 0===o?void 0:o["allow-url-opt-in"];if(n(f)&&f.length){const i=v(t.location.originalHash||t.location.hash);for(const t of f){const s=i[`e-${t}`];"1"==s&&(h[t]=!0),"0"==s&&(h[t]=!1)}}return h}(t);return!!s[i]}var tt,it=(()=>self.AMP.config.urls)(),st=new Set(["c","v","a","ad"]),et=t=>"string"==typeof t?nt(t):t;function nt(t,i){return tt||(tt=self.document.createElement("a")),function(t,i,s){return t.href="",new URL(i,t.href)}(tt,t)}function rt(t,i){return`${encodeURIComponent(t)}=${encodeURIComponent(i)}`}function ot(t,i,s="source"){var e;return y(null!=t,"%s %s must be available",i,s),y("https:"==(e=et(e=t)).protocol||"localhost"==e.hostname||"127.0.0.1"==e.hostname||function(t,i){const s=t.length-i.length;return s>=0&&t.indexOf(i,s)==s}(e.hostname,".localhost")||/^\/\//.test(t),'%s %s must start with "https://" or "//" or be relative and served from either https or from localhost. Invalid value: %s',i,s,t),t}function ht(t){const i=t.indexOf("#");return-1==i?t:t.substring(0,i)}function ct(t){return it.cdnProxyRegex.test(et(t).origin)}function ut(t){return nt(function(t){if(!ct(t=et(t)))return t.href;const i=t.pathname.split("/"),s=i[1];y(st.has(s),"Unknown path prefix in url %s",t.href);const e=i[2],n="s"==e?"https://"+decodeURIComponent(i[3]):"http://"+decodeURIComponent(e);return y(n.indexOf(".")>0,"Expected a . in origin %s",n),i.splice(1,"s"==e?3:2),n+i.join("/")+function(t,i){if(!t||"?"==t)return"";const s=new RegExp("[?&](amp_(js[^&=]*|gsa|r|kit)|usqp)\\b[^&]*","g"),e=t.replace(s,"").replace(/^[?&]/,"");return e?"?"+e:""}(t.search)+(t.hash||"")}(t)).origin}var at=class{constructor(t,i,s){this.ampdoc=t,this.t$=s,this.Lct=y(i.authorization,'"authorization" URL must be specified'),ot(this.Lct,'"authorization"'),this.kct=!i.noPingback,this.Dct=i.pingback,this.kct&&(y(this.Dct,'"pingback" URL must be specified'),ot(this.Dct,'"pingback"')),this.Mct=this.Oct(i),this.s$=G(t.win),this.ln=$(t.win)}Oct(t){if(!t.authorizationTimeout)return 3e3;let i=t.authorizationTimeout;return y("number"==typeof i,'"authorizationTimeout" must be a number'),i=Math.min(i,3e3),i}getConfig(){return{"authorizationUrl":this.Lct,"pingbackEnabled":this.kct,"pingbackUrl":this.Dct,"authorizationTimeout":this.Mct}}getAuthorizationUrl(){return this.Lct}isAuthorizationEnabled(){return!0}getAuthorizationTimeout(){return this.Mct}authorize(){return this.t$.buildUrl(this.Lct,!1).then((t=>this.ln.timeoutPromise(this.Mct,this.s$.fetchJson(t,{credentials:"include"})).then((t=>t.json()))))}isPingbackEnabled(){return this.kct}pingback(){return this.t$.buildUrl(R(this.Dct),!0).then((t=>this.s$.sendSignal(t,{method:"POST",credentials:"include",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:""})))}postAction(){}},lt="__AMP__",ft="amp-access-iframe",dt=["GET","POST"];function pt(t,i){const s=X({},i);if((e=i.body)&&"function"==typeof e.getFormData){const t=i.body;s.headers["Content-Type"]="multipart/form-data;charset=utf-8",s.body=function(t){const i=[];for(let s=t.next();!s.done;s=t.next())i.push(s.value);return i}(t.entries())}var e;return{input:t,init:s}}function _t(t,i,e){let o=function(t,i){const s=t||{},e=s.credentials;return d(void 0===e||"include"==e||"omit"==e),s.method=void 0===(n=s.method)?"GET":(n=n.toUpperCase(),d(dt.includes(n)),n),s.headers=s.headers||{},s.headers.Accept=i,d(null!==s.body),s;var n}(e,"text/html");o=function(t,i,s){s=s||{};const e=function(t){return t.origin||nt(t.location.href).origin}(t);return e==nt(i).origin&&(s.headers=s.headers||{},s.headers["AMP-Same-Origin"]="true"),s}(t,i,o),i=function(t,i,s){return d("string"==typeof i),!1!==s.ampCors&&(i=function(t,i){return function(t){y(!("__amp_source_origin"in v(nt(t).search)),"Source origin is not allowed in %s",t)}(i),function(t,i,s,e){return function(t,i,s){if(!i)return t;const e=t.split("#",2),n=e[0].split("?",2);let r=n[0]+(n[1]?`?${n[1]}&${i}`:`?${i}`);return r+=e[1]?`#${e[1]}`:"",r}(t,rt("__amp_source_origin",s))}(i,0,ut(t.location.href))}(t,i)),i}(t,i,o);const h=(t=>I(t,"ampdoc"))(t),a=h.isSingleDoc()?h.getSingleDoc():null;return o.responseType="document",function(t,i,e,o){if(!i)return s();const h=o.prerenderSafe?s():i.whenFirstVisible(),a=D(i),l=ct(e),d=a.hasCapability("xhrInterceptor"),p=o.bypassInterceptorForDev&&!1;return l||!d||p?h:i.getRootNode().documentElement.hasAttribute("allow-xhr-interception")?h.then((()=>a.isTrustedViewer())).then((i=>{if(!i&&!Z(t,"untrusted-xhr-interception"))return;const s={"originalRequest":pt(e,o)};return a.sendMessageAwaitResponse("xhr",s).then((t=>function(t,i){if(function(t,i,s="Assertion failed",e){var n,o;if(i)return i;t&&-1==s.indexOf(t)&&(s+=t);let h=3;const c=s.split("%s");let u=c.shift();const a=[u];for(;c.length;){const t=arguments[h++],i=c.shift();u+=f(t)+i,a.push(t,i.trim())}const l=new Error(u);throw l.messageArray=r(a,(t=>""!==t)),null===(n=(o=self).__AMP_REPORT_ERROR)||void 0===n||n.call(o,l),l}("​​​",c(t),"Object expected: %s",t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0),"document"!=i)return new Response(t.body,t.init);const s=u(),e={status:200,statusText:"OK",getResponseHeader:t=>s[String(t).toLowerCase()]||null};if(t.init){const i=t.init;n(i.headers)&&i.headers.forEach((t=>{const i=t[0],e=t[1];s[String(i).toLowerCase()]=String(e)})),i.status&&(e.status=parseInt(i.status,10)),i.statusText&&(e.statusText=String(i.statusText))}return new Response(t.body?String(t.body):"",e)}(t,o.responseType)))})):h}(t,a,i,o).then((t=>t?t.text().then((t=>(new DOMParser).parseFromString(t,"text/html"))):function(t,i){return new Promise(((s,e)=>{const n=new XMLHttpRequest;n.open(i.method||"GET",t,!0),n.withCredentials="include"==i.credentials,n.responseType="document";for(const t in i.headers)n.setRequestHeader(t,i.headers[t]);n.onreadystatechange=()=>{if(!(n.readyState<2)){if(n.status<100||n.status>599)return n.onreadystatechange=null,void e(E().createExpectedError(`Unknown HTTP status ${n.status}`));if(4==n.readyState){const i={status:n.status,statusText:n.statusText,headers:mt(n.getAllResponseHeaders())},e=(t=new Response("",i),new Promise((i=>{if(t.ok)return i(t);const{status:s}=t,e=E().createError(`HTTP error ${s}`);throw e.retriable=function(t){return 415==t||t>=500&&t<600}(s),e.response=t,e}))).then((t=>({response:t,xhr:n})));s(e)}}var t},n.onerror=()=>{e(E().createExpectedError("Request failure"))},n.onabort=()=>{e(E().createExpectedError("Request aborted"))},"POST"==i.method?n.send(i.body):n.send()}))}(i,o).then((t=>{const{xhr:i}=t;return i.responseXML}))))}function mt(t){const i={};return t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){const s=t.split(":"),e=s.shift().trim();if(e){const t=s.join(":").trim();i[e]=t}})),i}function At(t){if("undefined"!=typeof TextDecoder)return new TextDecoder("utf-8").decode(t);const i=function(t){const i=new Array(t.length);for(let s=0;s<t.length;s++)i[s]=String.fromCharCode(t[s]);return i.join("")}(new Uint8Array(t.buffer||t));return decodeURIComponent(escape(i))}function Pt(t){const i=new Uint8Array(t.length);for(let s=0;s<t.length;s++){const e=t.charCodeAt(s);d(e<=255),i[s]=e}return i}var vt={"-":"+","_":"/",".":"="};function gt(t){return Pt(atob(t.replace(/[-_.]/g,(t=>vt[t]))))}var bt="ampproject.org",Et=class{constructor(t,i,s){this.ampdoc=t,this.t$=s,this.t_t=new at(t,i,s),this.s$=G(t.win),this.ln=$(t.win),this.Xr=F(t.win),this.i_t=t.getMetaByName("i-amphtml-access-state");const e=Z(t.win,"amp-access-server-jwt");this.Uu=ct(t.win.location)||e;const n=e?t.getParam("serverAccessService"):null;this.tb=n||ht(t.win.location.href),this.sy=i.publicKey||null,this.s_t=i.publicKeyUrl||null,y(this.sy||this.s_t,'"publicKey" or "publicKeyUrl" must be specified'),this.s_t&&ot(this.s_t,'"publicKeyUrl"'),this.sy&&this.s_t,this.e_t=new class{constructor(t){this.win=t,this.n_t=t.crypto&&(t.crypto.subtle||t.crypto.webkitSubtle)||null}decode(t){return this.r_t(t).payload}isVerificationSupported(){return!!this.n_t}decodeAndVerify(t,i){if(!this.n_t)throw new Error("Crypto is not supported on this platform");return new Promise((i=>i(this.r_t(t)))).then((t=>{const s=t.header.alg;if(!s||"RS256"!=s)throw new Error("Only alg=RS256 is supported");return this.o_t(i).then((i=>{const s=gt(t.sig);return this.n_t.verify({name:"RSASSA-PKCS1-v1_5"},i,s,Pt(t.verifiable))})).then((i=>{if(i)return t.payload;throw new Error("Signature verification failed")}))}))}r_t(t){function i(){throw new Error(`Invalid token: "${t}"`)}const s=t.split(".");3!=s.length&&i();const e=gt(s[0]),n=gt(s[1]);return{header:_(At(e),i),payload:_(At(n),i),verifiable:`${s[0]}.${s[1]}`,sig:s[2]}}o_t(t){return t.then((t=>this.n_t.importKey("spki",function(t){const i=t.trim().replace(/^-+BEGIN[^-]*-+/,"").replace(/-+END[^-]*-+$/,"").replace(/[\r\n]/g,"").trim();return Pt(atob(i))}(t),{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"])))}}(t.win)}getConfig(){return{"client":this.t_t.getConfig(),"proxy":this.Uu,"serverState":this.i_t,"publicKey":this.sy,"publicKeyUrl":this.s_t}}isAuthorizationEnabled(){return!0}authorize(){return this.Uu&&this.i_t?this.h_t():this.c_t()}isPingbackEnabled(){return this.t_t.isPingbackEnabled()}pingback(){return this.t_t.pingback()}postAction(){}u_t(){let t=this.t$.buildUrl(this.t_t.getAuthorizationUrl(),!1).then((t=>this.ln.timeoutPromise(3e3,this.s$.fetchText(t,{credentials:"include"})))).then((t=>t.text())).then((t=>{const i=this.e_t.decode(t);return y(i.amp_authdata,'"amp_authdata" must be present in JWT'),{encoded:t,jwt:i}}));return this.a_t()&&(this.e_t.isVerificationSupported()&&(t=t.then((t=>this.e_t.decodeAndVerify(t.encoded,this.l_t()).then((()=>t))))),t=t.then((t=>(this.f_t(t.jwt),t)))),t.catch((t=>{throw E().createError("JWT fetch or validation failed: ",t)}))}l_t(){return this.sy?Promise.resolve(this.sy):this.s$.fetchText(this.s_t).then((t=>t.text()))}a_t(){return!1}f_t(t){const i=Date.now(),s=t.exp;y(s,'"exp" field must be specified'),y(1e3*parseFloat(s)>i,"token has expired: %s",s);const e=t.aud;y(e,'"aud" field must be specified');let r=!1;if(n(e)){for(let t=0;t<e.length;t++)if(e[t]==bt){r=!0;break}}else r=e==bt;y(r,'"aud" must be "%s": %s',bt,e)}c_t(){return this.u_t().then((t=>t.jwt.amp_authdata))}h_t(){return this.u_t().then((t=>{const{encoded:i,jwt:s}=t,e=s.amp_authdata,r=function(t){const i=[];for(const e in t){let r=t[e];if(null!=r){r=n(s=r)?s:[s];for(let t=0;t<r.length;t++)i.push(rt(e,r[t]))}}var s;return i.join("&")}({"url":ht(this.ampdoc.win.location.href),"state":this.i_t,"jwt":i});return this.ln.timeoutPromise(3e3,_t(this.ampdoc.win,this.tb,{method:"POST",body:r,headers:{"Content-Type":"application/x-www-form-urlencoded"}})).then((t=>this.d_t(t))).then((()=>e))}))}d_t(t){const i=t.querySelectorAll("[i-amphtml-access-id]");return this.Xr.mutatePromise((()=>{for(let t=0;t<i.length;t++){const s=i[t],e=s.getAttribute("i-amphtml-access-id"),n=this.ampdoc.getRootNode().querySelector(`[i-amphtml-access-id="${m(e)}"]`);n&&n.parentElement.replaceChild(this.ampdoc.win.document.importNode(s,!0),n)}}))}};function wt(t,i,s,e){let n;try{n=t.open(i,s,e)}catch(t){T().error("DOM","Failed to open url on target: ",s,t)}var r,o;return!n&&"_top"!=s&&("number"!=typeof o&&(o=0),o+"noopener".length>(r=e||"").length||-1===r.indexOf("noopener",o))&&(n=t.open(i,"_top")),n}var Tt=(()=>self.AMP.config.urls)(),Rt=new RegExp("RETURN_URL");function yt(t,i){const s=D(t);return parseInt(t.getParam("dialog"),10)?new Mt(s,i):new Vt(t.win,s,i)}function It(t,i){return yt(t,i).open()}var Mt=class{constructor(t,i){this.viewer=t,this.urlOrPromise=i}getLoginUrl(){let t;return t="string"==typeof this.urlOrPromise?Promise.resolve(this.urlOrPromise):this.urlOrPromise,t.then((t=>St(t,"RETURN_URL")))}open(){return this.getLoginUrl().then((t=>this.viewer.sendMessageAwaitResponse("openDialog",{"url":t})))}},Vt=class{constructor(t,i,s){this.win=t,this.viewer=i,this.urlOrPromise=s,this.Ue=null,this.eh=null,this.p_t=null,this.__t=null,this.m_t=null,this.A_t=null}open(){return y(!this.Ue,"Dialog already opened"),new Promise(((t,i)=>{this.Ue=t,this.eh=i,this.P_t()})).then((t=>(this.ar(),t)),(t=>{throw this.ar(),t}))}ar(){if(this.Ue=null,this.eh=null,this.p_t){try{this.p_t.close()}catch(t){}this.p_t=null}this.m_t&&(this.win.clearInterval(this.m_t),this.m_t=null),this.A_t&&(this.A_t(),this.A_t=null)}getLoginUrl(){let t;return t="string"==typeof this.urlOrPromise?Promise.resolve(this.urlOrPromise):this.urlOrPromise,t.then((t=>St(t,this.v_t())))}P_t(){const{screen:t}=this.win,i=Math.floor(Math.min(700,.9*t.width)),e=Math.floor(Math.min(450,.9*t.height)),n=`height=${e},width=${i},left=${Math.floor((t.width-i)/2)},top=${Math.floor((t.height-e)/2)},resizable=yes,scrollbars=yes`,r=this.v_t();if(this.__t=null,"string"==typeof this.urlOrPromise){const t=St(this.urlOrPromise,r);this.p_t=wt(this.win,t,"_blank",n),this.p_t&&(this.__t=s())}else this.p_t=wt(this.win,"","_blank",n),this.p_t&&(this.__t=this.urlOrPromise.then((t=>{const i=St(t,r);this.p_t.location.replace(i)}),(t=>{throw new Error("failed to resolve url: "+t)})));this.__t?this.__t.then((()=>{this.g_t(r)}),(t=>{this.b_t(null,t)})):this.b_t(null,new Error("failed to open dialog"))}g_t(t){const i=nt(t).origin;this.m_t=this.win.setInterval((()=>{this.p_t.closed&&(this.win.clearInterval(this.m_t),this.m_t=null,this.win.setTimeout((()=>{this.b_t("")}),3e3))}),500),this.A_t=K(this.win,"message",(t=>{t.origin==i&&q(t)&&"amp"==q(t).sentinel&&"result"==q(t).type&&(this.p_t&&this.p_t.postMessage({"sentinel":"amp","type":"result-ack"},i),this.b_t(q(t).result))}),void 0)}b_t(t,i){this.Ue&&(i?this.eh(i):this.Ue(t),this.ar())}v_t(){const t=this.viewer.getResolvedViewerUrl();let i;return i=`${Tt.cdn}/v0/amp-login-done-0.1.html`,i+"?url="+encodeURIComponent(t)}};function St(t,i){return Rt.test(t)?t.replace(Rt,encodeURIComponent(i)):t+(-1==t.indexOf("?")?"?":"&")+"return="+encodeURIComponent(i)}var kt="amp-access",Ot="client",Ut="server",Ct="vendor";function xt(t,i,s){if(i[s])return i[s];const e=t.querySelector(`style[${s}], link[${s}]`);return e?(i[s]=e,e):null}function zt(t,i){const s=t.styleSheets;for(let t=0;t<s.length;t++)if(s[t].ownerNode==i)return!0;return!1}var Lt=self.__AMP_ERRORS||[];self.__AMP_ERRORS=Lt;var jt="amp-access",Nt="__AMP_ACCESS__TEMPLATE";t.registerServiceForDoc("access",(function(t){return new class{constructor(t){this.ampdoc=t,function(t,i,s,e,n){const r=t.getHeadNode(),o=function(t,i,s,e){let n=t.__AMP_CSS_SM;n||(n=t.__AMP_CSS_SM=u());const r=`amp-extension=${e}`;if(r){const s=xt(t,n,r);if(s)return"STYLE"==s.tagName&&s.textContent!==i&&(s.textContent=i),s}const o=(t.ownerDocument||t).createElement("style");o.textContent=i;let h=null;return o.setAttribute("amp-extension",e),h=xt(t,n,"amp-runtime"),function(t,i,s=null){if(!s)return void function(t,i){t.insertBefore(i,t.firstChild)}(t,i);const e=s.nextSibling;t.insertBefore(i,e)}(t,o,h),r&&(n[r]=o),o}(r,function(t,i){const s=t.__AMP_CSS_TR;return s?s(i):i}(r,"\n/*# sourceURL=/extensions/amp-access/0.1/amp-access.css*/"),0,"amp-access");if(s){const i=t.getRootNode();if(zt(i,o))return o;const s=setInterval((()=>{zt(i,o)&&clearInterval(s)}),4)}}(t,0,(()=>{}));const i=t.getElementById("amp-access");if(this.E_t=!!i,!this.E_t)return;var s,e,n;this.w_t=i,this.T_t=ut(t.win.location),this.ln=$(t.win),this.Xr=F(t.win),this.R_t=S(t,"cid"),this.yn=D(t),this.Il=M(t,"viewport"),this.g_=(t=>M(t,"templates"))(t),this.qc=(t=>M(t,"mutator"))(t),this.pK=(s=t.win,n="performance",j(e=O(e=s),n)?x(e,n):null),this.Dat=null,this.y_t=new class{constructor(){this.cache=null,this.I_t=null}evaluate(t,i){return this.I_t!==i&&(this.I_t=i,this.cache=u()),a(this.cache,t)||(this.cache[t]=function(t,i){try{return Q.yy=i,!!Q.parse(t)}finally{Q.yy=null}}(t,i)),this.cache[t]}},this.bg=this.M_t();const r=this.bg.map((t=>t.whenFirstAuthorized()));this.V_t=!1,this.S_t=Promise.all(r),this.k_t=null,this.O_t=new class{constructor(){this.ut=null}add(t){return this.ut||(this.ut=[]),this.ut.push(t),()=>{this.remove(t)}}remove(t){this.ut&&function(t,i){const s=t.indexOf(i);-1!=s&&t.splice(s,1)}(this.ut,t)}removeAll(){this.ut&&(this.ut.length=0)}fire(t){if(this.ut)for(const i of this.ut.slice())i(t)}getHandlerCount(){var t,i;return null!==(t=null===(i=this.ut)||void 0===i?void 0:i.length)&&void 0!==t?t:0}},this.S_t.then((()=>{this.V_t=!0,this.y9("access-authorization-received"),this.pK&&(this.pK.tick("aaa"),this.pK.tickSinceVisible("aaav"),this.pK.flush())})),t.getRootNode().addEventListener("amp:dom-update",this.U_t.bind(this))}getAccessReaderId(){return this.E_t?this.C_t():null}C_t(){if(!this.Dat){const t=s();this.Dat=this.R_t.then((i=>i.get({scope:"amp-access",createCookieIfNotPresent:!0},t)))}return this.Dat}areFirstAuthorizationsCompleted(){return this.V_t}onApplyAuthorizations(t){this.O_t.add(t)}M_t(){var t,i;y("SCRIPT"==(t=this.w_t).tagName&&"APPLICATION/JSON"==(null===(i=t.getAttribute("type"))||void 0===i?void 0:i.toUpperCase()),`${jt} config should be inside a <script> tag with type="application/json"`);const r=_(this.w_t.textContent,(t=>{throw E().createError('Failed to parse "amp-access" JSON: '+t)})),o={};if(n(r)){const t=r;for(let i=0;i<t.length;i++){const s=t[i].namespace;y(!!s,"Namespace required"),y(!o[s],"Namespace already used: "+s),o[s]=t[i]}}else o[r.namespace||""]=r;const h=this.C_t.bind(this),u=this.x_t.bind(this),a=this.z_t.bind(this);return Object.keys(o).map((t=>new class{constructor(t,i,s,n,r,o){this.ampdoc=t,this.C_t=s,this.x_t=n,this.z_t=r,this.w_t=o,this.L_t=Z(t.win,"amp-access-server"),this.j_t=Z(t.win,"amp-access-jwt"),this.lC=this.N_t(i),this.$_t=this.D_t(i),this.F_t=i.authorizationFallbackResponse,this.G_t=i.namespace||null,this.J_t=this.K_t(i),this.yy=(t=>V(t,"url-replace"))(o),this.q_t=It.bind(null,t),this.zat=null;const h=new e;this.H_t=h.promise,this.Q_t=h.resolve,this.W_t={},this.B_t=null,this.X_t=0}getNamespace(){return this.G_t}getType(){return this.lC}getAdapter(){return this.J_t}getAuthResponse(){return this.zat}K_t(t){const i={buildUrl:this.buildUrl.bind(this),collectUrlVars:this.collectUrlVars.bind(this)},r=this.j_t&&!0===t.jwt;switch(this.lC){case Ot:return r?new Et(this.ampdoc,t,i):new at(this.ampdoc,t,i);case"iframe":return new class{constructor(t,i,s){var e,r;this.ampdoc=t,this.t$=s,this.jF=i,this.ln=$(t.win),this.ov=y(i.iframeSrc,'"iframeSrc" URL must be specified'),ot(this.ov,'"iframeSrc"'),this.Y_t=i.iframeVars||null,this.Y_t&&y(n(this.Y_t),'"iframeVars" must be an array'),this.Z_t=y(i.defaultResponse,'"defaultResponse" must be specified'),this.Yg=nt(this.ov).origin,this.tAt=null,this.iAt=null,this.bv=t.win.document.createElement("iframe"),e=this.bv,void 0===(r=!1)&&(r=e.hasAttribute("hidden")),r?e.removeAttribute("hidden"):e.setAttribute("hidden",""),this.sAt=new class{constructor(t,i,s){this.i=t,this.eAt=i,this.Yg=s,this.o=null,this.nAt=null,this.rAt=this.my.bind(this),this.oAt=0,this.hAt={}}connect(t){if(this.nAt)throw new Error("already connected");this.nAt=t,this.i.addEventListener("message",this.rAt)}disconnect(){this.nAt&&(this.nAt=null,this.i.removeEventListener("message",this.rAt))}isConnected(){return null!=this.Yg}getTarget(){const t=this.cAt();if(!t)throw new Error("not connected");return t}cAt(){return this.nAt&&!this.o&&("function"==typeof this.eAt?this.o=this.eAt():this.o=this.eAt),this.o}getTargetOrigin(){if(null==this.Yg)throw new Error("not connected");return this.Yg}sendCommand(t,i){this.Py(void 0,t,i)}sendCommandRsvp(t,i){const s=String(++this.oAt);let e=null;const n=new Promise((t=>{e=t}));return this.hAt[s]={promise:n,resolver:e},this.Py(s,t,i),n}Py(t,i,s){const e=this.getTarget(),n="connect"==i?null!=this.Yg?this.Yg:"*":this.getTargetOrigin();e.postMessage({"sentinel":lt,"_rsvp":t,"cmd":i,"payload":s||null},n)}my(t){const i=t,{data:s}=i;if(!s||s.sentinel!=lt)return;const e=i.origin,n=s.cmd,r=s.payload||null;if(null==this.Yg&&"start"==n&&(this.Yg=e),null==this.Yg&&i.source&&this.cAt()==i.source&&(this.Yg=e),e!=this.Yg)return;const o=s._rsvp,h=!!o&&"rsvp"!=n,c=this.uAt(o,n,r);h&&Promise.resolve(c).then((t=>{this.Py(o,"rsvp",{"result":t})}),(t=>{this.Py(o,"rsvp",{"error":String(t)})}))}uAt(t,i,s){if("rsvp"!=i)return this.nAt(i,s);{const i=t&&this.hAt[t];i&&("error"in s?i.resolver(Promise.reject(new Error(s.error))):i.resolver(s.result),delete this.hAt[t])}}}(this.ampdoc.win,(()=>this.bv.contentWindow),this.Yg),this.Lb=null}disconnect(){this.sAt.disconnect(),this.ampdoc.getBody().removeChild(this.bv)}getConfig(){return{"iframeSrc":this.ov,"iframeVars":this.Y_t}}isAuthorizationEnabled(){return!0}authorize(){return Promise.race([this.aAt(),this.lAt()])}isPingbackEnabled(){return!0}pingback(){return this.connect().then((()=>this.sAt.sendCommandRsvp("pingback",{})))}postAction(){this.fAt(null)}connect(){if(!this.iAt){const t=new e;this.iAt=t.promise,this.tAt=t.resolve,this.Lb=this.dAt(),this.sAt.connect(this.uAt.bind(this)),this.ampdoc.getBody().appendChild(this.bv),this.bv.src=this.ov}return this.iAt}dAt(){return new Promise((t=>{const i=p(JSON.stringify(this.jF));if(this.Y_t){const s=this.Y_t.join("&");t(this.t$.collectUrlVars(s,!1).then((t=>(i.iframeVars=t,i))))}else t(i)}))}aAt(){return this.ln.promise(3e3).then((()=>this.pAt()||this.Z_t))}lAt(){return this.connect().then((()=>this.sAt.sendCommandRsvp("authorize",{}))).then((t=>(t&&s().then((()=>this.fAt(t))),t)))}pAt(){const{win:t}=this.ampdoc,i=t.sessionStorage||t.localStorage;if(!i)return null;try{const t=i.getItem(ft);if(!t)return null;const s=p(t);return s.t+6048e5<this.ampdoc.win.Date.now()?null:s.d||null}catch(t){T().error(ft,"failed to restore access response: ",t);try{i.removeItem(ft)}catch(t){}return null}}fAt(t){const{win:i}=this.ampdoc,s=i.sessionStorage||i.localStorage;if(s)try{t?s.setItem(ft,JSON.stringify({"t":this.ampdoc.win.Date.now(),"d":t})):s.removeItem(ft)}catch(t){T().error(ft,"failed to store access response: ",t)}}uAt(t,i){"connect"!=t||this.Lb.then((t=>{this.sAt.sendCommandRsvp("start",{"protocol":"amp-access","config":t}).then((()=>{this.tAt&&(this.tAt(),this.tAt=null)}))}))}}(this.ampdoc,t,i);case Ut:return r?new Et(this.ampdoc,t,i):new class{constructor(t,i,s){this.ampdoc=t,this.t$=s,this.t_t=new at(t,i,s),this.s$=G(t.win),this.ln=$(t.win),this.Xr=F(t.win),this.i_t=t.getMetaByName("i-amphtml-access-state");const e=Z(t.win,"amp-access-server");this.Uu=ct(t.win.location)||e;const n=e?t.getParam("serverAccessService"):null;this.tb=n||ht(t.win.location.href)}getConfig(){return{"client":this.t_t.getConfig(),"proxy":this.Uu,"serverState":this.i_t}}isAuthorizationEnabled(){return!0}authorize(){return this.Uu&&this.i_t?this.t$.collectUrlVars(this.t_t.getAuthorizationUrl(),!1).then((t=>{const i={};for(const s in t)null!=t[s]&&(i[s]=String(t[s]));const s={"url":ht(this.ampdoc.win.location.href),"state":this.i_t,"vars":i};return this.ln.timeoutPromise(this.t_t.getAuthorizationTimeout(),_t(this.ampdoc.win,this.tb,{method:"POST",body:"request="+encodeURIComponent(JSON.stringify(s)),headers:{"Content-Type":"application/x-www-form-urlencoded"}}))})).then((t=>{const i=p(R(t.querySelector('script[id="amp-access-data"]')).textContent);return this.d_t(t).then((()=>i))})):this.t_t.authorize()}isPingbackEnabled(){return this.t_t.isPingbackEnabled()}pingback(){return this.t_t.pingback()}postAction(){}d_t(t){const i=t.querySelectorAll("[i-amphtml-access-id]");return this.Xr.mutatePromise((()=>{for(let t=0;t<i.length;t++){const s=i[t],e=s.getAttribute("i-amphtml-access-id"),n=this.ampdoc.getRootNode().querySelector(`[i-amphtml-access-id="${m(e)}"]`);n&&n.parentElement.replaceChild(this.ampdoc.win.document.importNode(s,!0),n)}}))}}(this.ampdoc,t,i);case Ct:return new class{constructor(t,i){this.ampdoc=t,this._At=y(i.vendor,'"vendor" name must be specified'),this.mAt=i[this._At]||{},this.kct=!i.noPingback;const s=new e;this.AAt=s.promise,this.PAt=s.resolve}getVendorName(){return this._At}getConfig(){return this.mAt}registerVendor(t){y(this.PAt,"Vendor has already been registered"),this.PAt(t),this.PAt=null}isAuthorizationEnabled(){return!0}authorize(){return this.AAt.then((t=>t.authorize()))}isPingbackEnabled(){return this.kct}pingback(){return this.AAt.then((t=>t.pingback()))}postAction(){}}(this.ampdoc,t);case"other":return new class{constructor(t,i,s){this.ampdoc=t,this.t$=s,this.vAt=i.authorizationFallbackResponse||null,this.Uu=ct(t.win.location)}getConfig(){return{"authorizationResponse":this.vAt}}isAuthorizationEnabled(){return!!this.vAt&&!this.Uu}authorize(){R(!this.Uu);const t=R(this.vAt);return Promise.resolve(t)}isPingbackEnabled(){return!1}pingback(){return s()}postAction(){}}(this.ampdoc,t,i)}throw T().createError("Unsupported access type: ",this.lC)}getAdapterConfig(){return this.J_t.getConfig()}whenFirstAuthorized(){return this.H_t}N_t(t){let{"type":i}=t;var s;return y(!i||"client"===(s=i)||"iframe"===s||"server"===s||"vendor"===s||"other"===s,`Unknown access type: ${i}`),i||(i=t.vendor?Ct:Ot),i!=Ut||this.L_t||(i=Ot),i==Ot&&this.L_t&&(i=Ut),i}D_t(t){const i=t.login,s={};if(i)if("string"==typeof i)s[""]=i;else if(c(i))for(const t in i)s[t]=i[t];else y(!1,'"login" must be either a single URL or a map of URLs');for(const t in s)ot(s[t],this.w_t);return s}gAt(){const t=this.ampdoc.getRootNode();return t.documentElement||t.body||t}y9(t){J(this.gAt(),t,void 0,!1)}start(){this.bAt()}buildUrl(t,i){return this.Bat(i).then((i=>this.yy.expandUrlAsync(t,i)))}collectUrlVars(t,i){return this.Bat(i).then((i=>this.yy.collectVars(t,i)))}Bat(t){return this.C_t().then((i=>{const s={"READER_ID":i,"ACCESS_READER_ID":i};return t&&(s.AUTHDATA=t=>{if(this.zat)return l(this.zat,t)}),s}))}runAuthorization(t){return this.J_t.isAuthorizationEnabled()?this.J_t.authorize().catch((i=>{if(this.y9("access-authorization-failed"),this.F_t&&!t)return E().error(kt,"Authorization failed: ",i),this.F_t;throw i})).then((t=>(this.EAt(t),this.bAt(),t))).catch((t=>{throw E().error(kt,"Authorization failed: ",t),this.Q_t(),t})):(this.Q_t(),s())}EAt(t){this.zat=t,this.Q_t()}reportViewToServer(){return this.J_t.pingback().then((()=>{this.y9("access-pingback-sent")})).catch((t=>{throw this.y9("access-pingback-failed"),E().createError("Pingback failed: ",t)}))}getLoginUrl(t){return function(t,i){return yt(t,i).getLoginUrl()}(this.ampdoc,t)}loginWithType(t){y(this.$_t[t],"Login URL is not configured: %s",t);const i=y(this.W_t[t],"Login URL is not ready: %s",t);return this.wAt(i,t)}loginWithUrl(t,i=""){return this.wAt(t,i)}wAt(t,i){const s=Date.now();if(this.B_t&&s-this.X_t<1e3)return this.B_t;this.TAt(i,"started");const e=this.q_t(t).then((t=>{this.B_t=null;const s=v(t).success,e="true"==s||"yes"==s||"1"==s;if(e?this.TAt(i,"success"):this.TAt(i,"rejected"),e||!s){this.J_t.postAction();const t=this.runAuthorization(!0);return this.z_t(t),t.then((()=>{this.x_t(0)}))}})).catch((t=>{throw this.TAt(i,"failed"),this.B_t==e&&(this.B_t=null),t}));return this.B_t=e,this.X_t=s,this.B_t}TAt(t,i){this.y9(`access-login-${i}`),t&&this.y9(`access-login-${t}-${i}`)}bAt(){if(0==Object.keys(this.$_t).length)return null;const t=[];for(const i in this.$_t)t.push(this.buildUrl(this.$_t[i],!0).then((t=>(this.W_t[i]=t,{type:i,url:t}))));return Promise.all(t)}}(this.ampdoc,o[t],h,u,a,this.w_t)))}U_t(t){if(this.V_t){const i=t.target;return this.S_t.then((()=>{const t=this.combinedResponses();this.RAt(i,t)}))}}getVendorSource(t){for(let i=0;i<this.bg.length;i++){const s=this.bg[i];if(s.getType()==Ct&&s.getAdapter().getVendorName()==t)return s}throw y(!1,'Access vendor "%s" can only be used for "type=vendor", but none found',t),new Error}isEnabled(){return this.E_t}gAt(){const t=this.ampdoc.getRootNode();return t.documentElement||t.body||t}y9(t){J(this.gAt(),t,void 0,!1)}Pr(){return this.E_t?(this.yAt(),this):this}yAt(){var t;(t=this.w_t,V(t,"action")).installActionHandler(this.w_t,this.mH.bind(this));for(let t=0;t<this.bg.length;t++)this.bg[t].start();this.IAt(),this.x_t(2e3),this.Tr()}Tr(){this.yn.onBroadcast((t=>{"amp-access-reauthorize"==t.type&&t.origin==this.T_t&&this.IAt()}))}z_t(t){this.MAt(),t.then((()=>{this.V_t&&this.S_t.then((()=>{this.ampdoc.whenReady().then((()=>{const t=this.ampdoc.getRootNode(),i=this.combinedResponses();return this.RAt(t,i)}))}))}))}MAt(){this.yn.broadcast({"type":"amp-access-reauthorize","origin":this.T_t})}IAt(t){this.VAt("amp-access-loading",!0);const i=this.ampdoc.whenFirstVisible().then((()=>Promise.all(this.bg.map((t=>this.SAt(t)))))).then((()=>(this.VAt("amp-access-loading",!1),this.ampdoc.whenReady().then((()=>{const t=this.ampdoc.getRootNode(),i=this.combinedResponses();return this.RAt(t,i)})))));return this.S_t=i,i}SAt(t){return t.runAuthorization().catch((()=>{this.VAt("amp-access-error",!0)}))}getAuthdataField(t){return this.E_t?this.S_t.then((()=>{const i=l(this.combinedResponses(),t);return void 0!==i?i:null})):null}RAt(t,i){const s=t.querySelectorAll("[amp-access]"),e=[];for(let t=0;t<s.length;t++)e.push(this.kAt(s[t],i));return Promise.all(e).then((()=>{this.O_t.fire()}))}kAt(t,i){const s=t.getAttribute("amp-access");let e=!1;try{e=this.y_t.evaluate(s,i)}catch(t){E().error(jt,t)}if(e){const s=this.OAt(t,i);if(s)return s.then((()=>this.UAt(t,e)))}return this.UAt(t,e)}UAt(t,i){const e=!t.hasAttribute("amp-access-hide");return i==e?s():this.qc.mutateElement(t,(()=>{i?t.removeAttribute("amp-access-hide"):t.setAttribute("amp-access-hide","")}))}OAt(t,i){const s=[],e=t.querySelectorAll("[amp-access-template]");if(e.length>0)for(let n=0;n<e.length;n++){const r=this.v9(t,e[n],i).catch((i=>{T().error(jt,"Template failed: ",i,e[n],t)}));s.push(r)}return s.length>0?Promise.all(s):null}v9(t,i,s){let e=i,n=null;return"TEMPLATE"!=e.tagName&&(n=e,e=n[Nt]),e?this.g_.renderTemplate(e,s).then((t=>this.Xr.mutatePromise((()=>{t.setAttribute("amp-access-template",""),t[Nt]=e,e.parentElement?e.parentElement.replaceChild(t,e):n&&n.parentElement&&n.parentElement.replaceChild(t,n)})))):Promise.reject(new Error("template not found"))}x_t(t){this.bg.some((t=>t.getAdapter().isPingbackEnabled()))&&(this.k_t=null,this.ampdoc.whenReady().then((()=>{this.ampdoc.isVisible()&&this.CAt(t),this.ampdoc.onVisibilityChanged((()=>{this.ampdoc.isVisible()&&this.CAt(t)}))})))}CAt(t){return this.k_t||(this.k_t=this.xAt(t).then((()=>this.S_t)).then((()=>(this.y9("access-viewed"),this.zAt()))).catch((t=>{throw this.k_t=null,t})),this.k_t.then(this.MAt.bind(this))),this.k_t}xAt(t){if(0==t)return s();const i=[];return new Promise(((s,e)=>{i.push(this.ampdoc.onVisibilityChanged((()=>{this.ampdoc.isVisible()||e(new Error("CANCELLED"))})));const n=this.ln.delay(s,t);i.push((()=>this.ln.cancel(n))),i.push(this.Il.onScroll(s)),i.push(function(t,i,s,e){let n=s;const r=K(t,"click",(t=>{try{n(t)}finally{n=null,r()}}),void 0);return r}(this.ampdoc.getRootNode(),0,s))})).then((()=>{i.forEach((t=>t()))}),(t=>{throw i.forEach((t=>t())),t}))}zAt(){const t=[];for(let i=0;i<this.bg.length;i++)this.bg[i].getAdapter().isPingbackEnabled()&&t.push(this.bg[i].reportViewToServer());return Promise.all(t)}VAt(t,i){this.Xr.mutate((()=>{this.gAt().classList.toggle(t,i)}))}mH(t){return t.satisfiesTrust(2)?("login"==t.method?(t.event&&t.event.preventDefault(),this.LAt("")):t.method.startsWith("login-")?(t.event&&t.event.preventDefault(),this.LAt(t.method.substring("login-".length))):"refresh"==t.method&&(t.event&&t.event.preventDefault(),this.IAt()),null):null}getSource(t){return y(t>=0&&t<this.bg.length,"Invalid index: %d",t),this.bg[t]}LAt(t){const i=t.indexOf("-"),s=1==this.bg.length,e=i>-1?t.substring(0,i):t,n=this.bg.filter((t=>t.getNamespace()==e));if(n.length){const s=i>-1?t.substring(i+1):"";return n[0].loginWithType(s)}return y(s,"Login must match namespace: %s",e),this.bg[0].loginWithType(t)}combinedResponses(){if(1==this.bg.length&&!this.bg[0].getNamespace())return this.bg[0].getAuthResponse()||{};const t={};return this.bg.forEach((i=>t[i.getNamespace()]=i.getAuthResponse())),t}}(t).Pr()}))})();
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}});
//# sourceMappingURL=amp-access-0.1.mjs.map