Free javascript Hosting


amp-bind-latest.js

Uploaded on Oct 20 2021 02:28 by jusjeruk8888

(self.AMP=self.AMP||[]).push({m:0,v:"2110082201001",n:"amp-bind",ev:"0.1",l:true,f:function(AMP,_){"use strict";var m;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ba(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}var ca="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b};function da(a){for(var b=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global],c=0;c<b.length;++c){var d=b[c];if(d&&d.Math==Math)return d}return function(){throw Error("Cannot find global object")}()}var ea=da(this);"function"===typeof Symbol&&Symbol("x");var fa;if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ia={a:!0},ja={};try{ja.__proto__=ia;ha=ja.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ka=fa;function la(a,b){a.prototype=ca(b.prototype);a.prototype.constructor=a;if(ka)ka(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.Na=b.prototype}function q(a){return a?Array.prototype.slice.call(a):[]}var t=Array.isArray;function ma(a,b){for(var c=[],d=0,e=0;e<a.length;e++){var f=a[e];b(f,e,a)?c.push(f):(d<e&&(a[d]=f),d++)}d<a.length&&(a.length=d);return c}function na(a,b){for(var c=0;c<a.length;c++)if(b(a[c],c,a))return c;return-1}var oa=Object.prototype,w=oa.hasOwnProperty,pa=oa.toString;function qa(a){return"[object Object]"===pa.call(a)}function y(a){var b=Object.create(null);a&&Object.assign(b,a);return b}function ra(a){return a||{}}function z(a,b){if(w.call(a,b))return a[b]}function sa(a,b){var c=[],d=[];for(d.push({t:a,s:b,d:0});0<d.length;){b=d.shift();var e=b.d;a=b.s;var f=b.t;if(c.includes(a))throw Error("Source object has a circular reference.");c.push(a);if(f!==a)if(10<e)Object.assign(f,a);else{b=ba(Object.keys(a));for(var g=b.next();!g.done;g=b.next()){g=g.value;var h=a[g];if(w.call(f,g)){var k=f[g];if(qa(h)&&qa(k)){d.push({t:k,s:h,d:e+1});continue}}f[g]=h}}}}function ta(a,b){if("."==b)return a;var c=b.split(".");b=ba(c);for(var d=b.next();!d.done;d=b.next()){var e=d.value;if(e&&a&&void 0!==a[e]&&"object"==typeof a&&w.call(a,e))a=a[e];else{a=void 0;break}}return a}function ua(a){return 1==(null==a?void 0:a.nodeType)?a.tagName.toLowerCase()+(a.id?"#"+a.id:""):a}function va(a,b,c,d){var e=void 0===c?"Assertion failed":c;if(!b){a&&-1==e.indexOf(a)&&(e+=a);for(var f=3,g=e.split("%s"),h=g.shift(),k=[h];g.length;){var l=arguments[f++],p=g.shift();h+=ua(l)+p;k.push(l,p.trim())}f=Error(h);f.messageArray=ma(k,(function(v){return""!==v}));var n,r;null==(r=(n=self).__AMP_REPORT_ERROR)||r.call(n,f);throw f}}function wa(a,b,c){va("​​​",a,b,c,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}function xa(){return AMP.BaseElement.apply(this,arguments)||this}la(xa,AMP.BaseElement);m=xa.prototype;m.getLayoutPriority=function(){return 1};m.isAlwaysFixed=function(){return!0};m.isLayoutSupported=function(){return!0};m.renderOutsideViewport=function(){return!0};m.K=function(){return"<amp-bind-macro> "+(this.element.getAttribute("id")||"<unknown id>")};var ya;function A(){return ya?ya:ya=Promise.resolve(void 0)}function B(){var a=this;this.promise=new Promise((function(b,c){a.resolve=b;a.reject=c}))}function za(a,b){try{return JSON.parse(a)}catch(c){return null==b||b(c),null}}function Aa(a,b){if(!isFinite(20))throw Error("Invalid depth: 20");if(a===b)return!0;for(a=[{a:a,b:b,depth:20}];0<a.length;){var c=a.shift();b=c.a;var d=c.b;c=c.depth;if(0<c){if(typeof b!==typeof d)return!1;if(t(b)&&t(d)){if(b.length!==d.length)return!1;for(var e=0;e<b.length;e++)a.push({a:b[e],b:d[e],depth:c-1});continue}else if(b&&d&&"object"===typeof b&&"object"===typeof d){var f=Object.keys(b),g=Object.keys(d);if(f.length!==g.length)return!1;e=ba(f);for(var h=e.next();!h.done;h=e.next())h=h.value,a.push({a:b[h],b:d[h],depth:c-1});continue}}if(b!==d)return!1}return!0}
/* https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
var Ba=/(\0)|^(-)$|([\x01-\x1f\x7f]|^-?[0-9])|([\x80-\uffff0-9a-zA-Z_-]+)|[^]/g;function Ca(a,b,c,d,e){return e?e:b?"�":d?a.slice(0,-1)+"\\"+a.slice(-1).charCodeAt(0).toString(16)+" ":"\\"+a}function Da(a,b){for(;a&&void 0!==a;a=a.parentElement)if(b(a))return a;return null}function Ea(a,b){return a.closest?a.closest(b):Da(a,(function(c){var d=c.matches||c.webkitMatchesSelector||c.mozMatchesSelector||c.msMatchesSelector||c.oMatchesSelector;return d?d.call(c,b):!1}))}function Fa(a,b){for(var c=a.length,d=0;d<c;d++)b(a[d],d)}function Ga(a){var b;return"SCRIPT"==a.tagName&&"APPLICATION/JSON"==(null==(b=a.getAttribute("type"))?void 0:b.toUpperCase())}function Ha(a){var b;if(null==(b=Object.getOwnPropertyDescriptor(a,"message"))?0:b.writable)return a;var c=a.stack;b=Error(a.message);for(var d in a)b[d]=a[d];b.stack=c;return b}var Ia,Ka="Webkit webkit Moz moz ms O o".split(" ");function La(a){var b=!1;void 0===b&&(b=a.hasAttribute("hidden"));b?a.removeAttribute("hidden"):a.setAttribute("hidden","")}var C=self.AMP_CONFIG||{},Ma=("string"==typeof C.cdnProxyRegex?new RegExp(C.cdnProxyRegex):C.cdnProxyRegex)||/^https:\/\/([a-zA-Z0-9_-]+\.)?cdn\.ampproject\.org$/;function Na(a){if(!self.document||!self.document.head||self.location&&Ma.test(self.location.origin))return null;var b=self.document.head.querySelector('meta[name="'+a+'"]');return b&&b.getAttribute("content")||null}var D={thirdParty:C.thirdPartyUrl||"https://3p.ampproject.net",thirdPartyFrameHost:C.thirdPartyFrameHost||"ampproject.net",thirdPartyFrameRegex:("string"==typeof C.thirdPartyFrameRegex?new RegExp(C.thirdPartyFrameRegex):C.thirdPartyFrameRegex)||/^d-\d+\.ampproject\.net$/,cdn:C.cdnUrl||Na("runtime-host")||"https://cdn.ampproject.org",cdnProxyRegex:Ma,localhostRegex:/^https?:\/\/localhost(:\d+)?$/,errorReporting:C.errorReportingUrl||"https://us-central1-amp-error-reporting.cloudfunctions.net/r",betaErrorReporting:C.betaErrorReportingUrl||"https://us-central1-amp-error-reporting.cloudfunctions.net/r-beta",localDev:C.localDev||!1,trustedViewerHosts:[/(^|\.)google\.(com?|[a-z]{2}|com?\.[a-z]{2}|cat)$/,/(^|\.)gmail\.(com|dev)$/],geoApi:C.geoApiUrl||Na("amp-geo-api")};var Oa=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;function Pa(a,b){var c=b=void 0===b?"":b;try{return decodeURIComponent(a)}catch(d){return c}}function Qa(a){var b=y();if(!a)return b;for(var c;c=Oa.exec(a);){var d=Pa(c[1],c[1]);c=c[2]?Pa(c[2].replace(/\+/g," "),c[2]):"";b[d]=c}return b}function Ra(a){a=(a||self).location;return Qa(a.originalHash||a.hash)}var Sa="";function E(){var a=self;if(a.__AMP_MODE)a=a.__AMP_MODE;else{var b=Ra(a)||Ra(a);b=["1","actions","amp","amp4ads","amp4email"].includes(b.development)||!!a.AMP_DEV_MODE;if(!Sa){var c;Sa=(null==(c=a.AMP_CONFIG)?void 0:c.v)||"012110082201001"}a=a.__AMP_MODE={localDev:!1,development:b,esm:!1,test:!1,rtvVersion:Sa}}return a}function Ta(){var a=D.cdn;return a+"/rtv/"+E().rtvVersion+"/ww.js"}function Ua(a,b){function c(){d=0;var g=5e3-(a.Date.now()-e);if(0<g)d=a.setTimeout(c,g);else{var h=f;f=null;b.apply(null,h)}}var d=0,e=0,f=null;return function(g){for(var h=[],k=0;k<arguments.length;++k)h[k-0]=arguments[k];e=a.Date.now();f=h;d||(d=a.setTimeout(c,5e3))}}self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var F=self.__AMP_LOG;function Va(){throw Error("failed to call initLogConstructor")}function G(){F.user||(F.user=Va());return F.user}function H(){return F.dev||(F.dev=Va())}function I(a,b,c,d,e){return G().assert(a,b,c,d,e,void 0,void 0,void 0,void 0,void 0,void 0)}function J(a,b){a=a.__AMP_TOP||(a.__AMP_TOP=a);return K(a,b)}function L(a,b){var c=N(a);c=O(c);return K(c,b)}function Wa(a,b){a=N(a);a=O(a);return Xa(a,b)?K(a,b):null}function N(a){return a.nodeType?J((a.ownerDocument||a).defaultView,"ampdoc").getAmpDoc(a):a}function O(a){a=N(a);return a.isSingleDoc()?a.win:a}function K(a,b){Xa(a,b);a=Ya(a)[b];a.obj||(a.obj=new a.ctor(a.context),a.context=null,a.resolve&&a.resolve(a.obj));return a.obj}function Za(a,b,c,d){var e=Ya(a),f=e[c];f||(f=e[c]={obj:null,promise:null,resolve:null,reject:null,context:null,ctor:null,sharedInstance:!1});f.ctor||(f.ctor=d,f.context=b,f.sharedInstance=!1,f.resolve&&K(a,c))}function $a(a,b){var c=ab(a,b);if(c)return c;a=Ya(a);a[b]=bb();return a[b].promise}function ab(a,b){var c=Ya(a)[b];if(c){if(c.promise)return c.promise;K(a,b);return c.promise=Promise.resolve(c.obj)}return null}function Ya(a){var b=a.__AMP_SERVICES;b||(b=a.__AMP_SERVICES={});return b}function Xa(a,b){a=a.__AMP_SERVICES&&a.__AMP_SERVICES[b];return!(!a||!a.ctor)}function bb(){var a=new B,b=a.promise,c=a.reject;a=a.resolve;b.catch((function(){}));return{obj:null,promise:b,resolve:a,reject:c,context:null,ctor:null}}function cb(a){var b=ab(O(a),"bind");if(b)return b;var c=N(a);return c.whenExtensionsKnown().then((function(){var d=c.getExtensionVersion("amp-bind");return d?J(c.win,"extensions").waitForExtension("amp-bind",d):null})).then((function(d){return d?$a(O(a),"bind"):null}))}function db(a){var b=Wa(a,"bind");return b?Promise.resolve(b):cb(a)}function eb(a,b,c,d){var e={detail:c};Object.assign(e,d);if("function"==typeof a.CustomEvent)return new a.CustomEvent(b,e);a=a.document.createEvent("CustomEvent");a.initCustomEvent(b,!!e.bubbles,!!e.cancelable,c);return a}function fb(){this.xa=100;this.U=this.$=0;this.N=y()}fb.prototype.has=function(a){return!!this.N[a]};fb.prototype.get=function(a){var b=this.N[a];if(b)return b.access=++this.U,b.payload};fb.prototype.put=function(a,b){this.has(a)||this.$++;this.N[a]={payload:b,access:this.U};if(!(this.$<=this.xa)){a=this.N;var d,c=this.U+1;for(d in a){var e=a[d].access;if(e<c){c=e;var f=d}}void 0!==f&&(delete a[f],this.$--)}};var hb,ib,gb=new Set(["c","v","a","ad"]);function P(a){return"string"==typeof a?Q(a):a}function Q(a){hb||(hb=self.document.createElement("a"),ib=self.__AMP_URL_CACHE||(self.__AMP_URL_CACHE=new fb));var b=hb,c=ib;if(c&&c.has(a))a=c.get(a);else{b.href=a;b.protocol||(b.href=b.href);var d={href:b.href,protocol:b.protocol,host:b.host,hostname:b.hostname,port:"0"==b.port?"":b.port,pathname:b.pathname,search:b.search,hash:b.hash,origin:null};"/"!==d.pathname[0]&&(d.pathname="/"+d.pathname);if("http:"==d.protocol&&80==d.port||"https:"==d.protocol&&443==d.port)d.port="",d.host=d.hostname;d.origin=b.origin&&"null"!=b.origin?b.origin:"data:"!=d.protocol&&d.host?d.protocol+"//"+d.host:d.href;c&&c.put(a,d);a=d}return a}function jb(a,b){var c=void 0===c?"source":c;I(null!=a,"%s %s must be available",b,c);var d=P(a);var e;(e="https:"==d.protocol||"localhost"==d.hostname||"127.0.0.1"==d.hostname)||(d=d.hostname,e=d.length-10,e=0<=e&&d.indexOf(".localhost",e)==e);I(e||/^\/\//.test(a),'%s %s must start with "https://" or "//" or be relative and served from either https or from localhost. Invalid value: %s',b,c,a)}function R(a){return D.cdnProxyRegex.test(P(a).origin)}function kb(a){a=P(a);if(!R(a))return a.href;var b=a.pathname.split("/");I(gb.has(b[1]),"Unknown path prefix in url %s",a.href);var c=b[2],d="s"==c?"https://"+decodeURIComponent(b[3]):"http://"+decodeURIComponent(c);I(0<d.indexOf("."),"Expected a . in origin %s",d);b.splice(1,"s"==c?3:2);b=d+b.join("/");d=(d=a.search)&&"?"!=d?(d=d.replace(/[?&](amp_(js[^&=]*|gsa|r|kit)|usqp)\b[^&]*/g,"").replace(/^[?&]/,""))?"?"+d:"":"";return b+d+(a.hash||"")}function lb(a,b){b=P(b);if("function"==typeof URL)var c=new URL(a,b.href).toString();else{c=a;var d=P(b);c=c.replace(/\\/g,"/");var e=Q(c);c=c.toLowerCase().startsWith(e.protocol)?e.href:c.startsWith("//")?d.protocol+c:c.startsWith("/")?d.origin+c:d.origin+d.pathname.replace(/\/[^/]*$/,"/")+c}return c}function mb(a){var b=Q(a),c=Qa(b.search);I(!("__amp_source_origin"in c),"Source origin is not allowed in %s",a)}function nb(a,b,c){c=void 0===c?{}:c;var d=void 0===c.expr?".":c.expr,e=void 0===c.urlReplacement?0:c.urlReplacement,f=void 0===c.refresh?!1:c.refresh,g=void 0===c.xssiPrefix?void 0:c.xssiPrefix;jb(b.getAttribute("src"),b);var h=J(a.win,"batched-xhr");return ob(b,e,f).then((function(k){return h.fetchJson(k.xhrUrl,k.fetchOpt)})).then((function(k){return J(a.win,"xhr").xssiJson(k,g)})).then((function(k){if(null==k)throw Error("Response is undefined.");return ta(k,d||".")})).catch((function(k){throw G().createError("failed fetching JSON data",k)}))}function ob(a,b,c){var d=a.getAttribute("src"),e=Wa(a,"url-replace");return(1<=b?e.expandUrlAsync(d):Promise.resolve(d)).then((function(f){if(1==b){var g=e.collectDisallowedVarsSync(a);if(0<g.length)throw G().createError('URL variable substitutions in CORS fetches from dynamic URLs (e.g. via amp-bind) require opt-in. Please add data-amp-replace="'+g.join(" ")+'" to the <'+a.tagName+"> element. See https://bit.ly/amp-var-subs.")}var h={};a.hasAttribute("credentials")&&(h.credentials=a.getAttribute("credentials"));c&&(h.cache="reload");return{xhrUrl:f,fetchOpt:h}}))}function pb(a){a=AMP.BaseElement.call(this,a)||this;a.O=void 0;a.Y=new B;return a}la(pb,AMP.BaseElement);m=pb.prototype;m.getLayoutPriority=function(){return 1};m.isAlwaysFixed=function(){return!0};m.isLayoutSupported=function(){return!0};m.buildCallback=function(){var a=this;La(this.element);this.element.setAttribute("aria-hidden","true");var b=this.element;b.hasAttribute("overridable")&&db(b).then((function(c){c.addOverridableKey(b.getAttribute("id"))}));this.parseAndUpdate();this.element.hasAttribute("src")&&qb(this,!0);this.registerAction("refresh",(function(){I(a.element.hasAttribute("src"),'Can\'t refresh <amp-state> without "src" attribute.');qb(a,!1,!0)}))};m.mutatedAttributesCallback=function(a){if(this.getAmpDoc().hasBeenVisible())void 0!==a.src&&this.element.hasAttribute("src")&&qb(this,!1);else{var b=this.K();H().error(b,"ampdoc must be visible before mutation.")}};m.renderOutsideViewport=function(){return!0};m.parseAndUpdate=function(){return void 0===this.O&&(this.O=rb(this),null!==this.O)?sb(this,this.O,!0):A()};function rb(a){var b=a.element.children;if(0==b.length)return null;var c=a.K();if(1!=b.length)return a.user().error(c,"Should contain exactly one <script> child."),null;var d=b[0];return Ga(d)?za(d.textContent,(function(e){a.user().error(c,"Failed to parse state. Is it valid JSON?",e)})):(a.user().error(c,'State should be in a <script> tag with type="application/json".'),null)}function tb(a,b,c){var d=a.element,e=a.getAmpDoc(),f=d.getAttribute("src");f=Q(kb(f)).origin===Q(kb(e.win.location)).origin||b?2:1;return nb(e,a.element,{urlReplacement:f,refresh:c}).catch((function(g){g=g?eb(a.win,"amp-state.error",ra({response:g.response})):null;Wa(d,"action").trigger(d,"fetch-error",g,1)}))}function qb(a,b,c){b||(a.Y=new B);var d=a.Y;a.getAmpDoc().whenFirstVisible().then((function(){return tb(a,b,c)})).then((function(e){return sb(a,e,b)})).then((function(){return d.resolve()})).catch((function(e){d.resolve();throw e}))}m.getFetchingPromise=function(){return this.element.hasAttribute("src")?this.Y.promise:A()};function sb(a,b,c){if(void 0===b||null===b)return A();var d=I(a.element.id,"<amp-state> must have an id.");return db(a.element).then((function(e){var f=y();f[d]=b;e.setState(f,{skipEval:c,skipAmpState:!c})}))}m.K=function(){return"<amp-state> "+(this.element.getAttribute("id")||"<unknown id>")};function ub(){this.B=y();this.C=null}m=ub.prototype;m.get=function(a){a=this.B[a];return null==a?null:a};m.whenSignal=function(a){var b,c=null==(b=this.C)?void 0:b[a];c||(b=this.B[a],c=null!=b?{promise:"number"==typeof b?Promise.resolve(b):Promise.reject(b)}:new B,this.C||(this.C=y()),this.C[a]=c);return c.promise};m.signal=function(a,b){if(null==this.B[a]){var c=null!=b?b:Date.now();this.B[a]=c;var d;a=null==(d=this.C)?void 0:d[a];if(null==a?0:a.resolve)a.resolve(c),a.resolve=void 0,a.reject=void 0}};m.rejectSignal=function(a,b){if(null==this.B[a]){this.B[a]=b;var c;a=null==(c=this.C)?void 0:c[a];if(null==a?0:a.reject)a.reject(b),a.promise.catch((function(){})),a.resolve=void 0,a.reject=void 0}};m.reset=function(a){this.B[a]&&delete this.B[a];var b,c=null==(b=this.C)?void 0:b[a];c&&!c.resolve&&delete this.C[a]};function vb(a){var b=a.documentElement;return["⚡4email","amp4email"].some((function(c){return b.hasAttribute(c)}))}function wb(a){a.tagName.startsWith("AMP-");if(a.createdCallback)return Promise.resolve(a);if(!a.__AMP_UPG_PRM){var b=new B;a.__AMP_UPG_PRM=b.promise;a.__AMP_UPG_RES=b.resolve}return a.__AMP_UPG_PRM}var xb=/(\S+)(?:\s+(?:(-?\d+(?:\.\d+)?)([a-zA-Z]*)))?\s*(?:,|$)/g;function zb(a){for(var c,b=[];c=xb.exec(a);){var d=c[1],e=void 0,f=void 0;if(c[2]){var g=c[3].toLowerCase();if("w"==g)e=parseInt(c[2],10);else if("x"==g)f=parseFloat(c[2]);else continue}else f=1;b.push({url:d,width:e,dpr:f})}return new Ab(b)}function Ab(a){wa(0<a.length,"Srcset must have at least one source");this.M=a;for(var b=!1,c=!1,d=0;d<a.length;d++){var e=a[d];b=b||!!e.width;c=c||!!e.dpr}wa(!!(b^c),"Srcset must have width or dpr sources, but not both");a.sort(b?Bb:Cb);this.ta=b}Ab.prototype.select=function(a,b){if(this.ta){b*=a;a=this.M;for(var c=0,d=1/0,e=1/0,f=0;f<a.length;f++){var g=a[f].width,h=Math.abs(g-b);if(h<=1.1*d||1.2<b/e)c=f,d=h,e=g;else break}b=c}else{a=this.M;c=0;d=1/0;for(e=0;e<a.length;e++)if(f=Math.abs(a[e].dpr-b),f<=d)c=e,d=f;else break;b=c}return this.M[b].url};Ab.prototype.getUrls=function(){return this.M.map((function(a){return a.url}))};Ab.prototype.stringify=function(a){for(var b=[],c=this.M,d=0;d<c.length;d++){var e=c[d],f=e.url;a&&(f=a(f));f=this.ta?f+" "+e.width+"w":f+" "+e.dpr+"x";b.push(f)}return b.join(", ")};function Bb(a,b){wa(a.width!=b.width,"Duplicate width: %s",a.width);return a.width-b.width}function Cb(a,b){wa(a.dpr!=b.dpr,"Duplicate dpr: %s",a.dpr);return a.dpr-b.dpr}var Db={"class":{denylistedValueRegex:"(^|\\W)i-amphtml-"},hidden:null,text:null},Eb={width:null,height:null},Fb={"AMP-AUDIO":{album:null,artist:null,artwork:null,controlsList:null,loop:null,src:{allowedProtocols:{https:!0}},title:null},"AMP-AUTOCOMPLETE":{src:{allowedProtocols:{https:!0}}},"AMP-BASE-CAROUSEL":{"advance-count":null,"auto-advance-count":null,"auto-advance-interval":null,"auto-advance-loops":null,"auto-advance":null,horizontal:null,"initial-index":null,loop:null,"mixed-length":null,"side-slide-count":null,slide:null,"snap-align":null,"snap-by":null,snap:null,"visible-count":null},"AMP-BRIGHTCOVE":{"data-account":null,"data-embed":null,"data-player":null,"data-player-id":null,"data-playlist-id":null,"data-video-id":null},"AMP-CAROUSEL":{slide:null},"AMP-DATE-PICKER":{max:null,min:null,src:{allowedProtocols:{https:!0}}},"AMP-GOOGLE-DOCUMENT-EMBED":{src:null,title:null},"AMP-IFRAME":{src:null,title:null},"AMP-IMG":{alt:null,attribution:null,src:{allowedProtocols:{data:!0,http:!0,https:!0}},srcset:{alternativeName:"src"}},"AMP-LIGHTBOX":{open:null},"AMP-LIST":{src:{allowedProtocols:{https:!0}},state:null,"is-layout-container":null},"AMP-RENDER":{src:{allowedProtocols:{https:!0}}},"AMP-SELECTOR":{disabled:null,selected:null},"AMP-STATE":{src:{allowedProtocols:{https:!0}}},"AMP-TIMEAGO":{datetime:null,title:null},"AMP-TWITTER":{"data-tweetid":null},"AMP-VIDEO":{album:null,alt:null,artist:null,artwork:null,attribution:null,controls:null,controlslist:null,loop:null,poster:null,preload:null,src:{allowedProtocols:{https:!0}},title:null},"AMP-YOUTUBE":{"data-videoid":null},A:{href:{allowedProtocols:{ftp:!0,geo:!0,http:!0,https:!0,mailto:!0,maps:!0,bip:!0,bbmi:!0,chrome:!0,"itms-services":!0,facetime:!0,"fb-me":!0,"fb-messenger":!0,intent:!0,line:!0,skype:!0,sms:!0,snapchat:!0,tel:!0,tg:!0,threema:!0,twitter:!0,viber:!0,webcal:!0,"web+mastodon":!0,wh:!0,whatsapp:!0}}},BUTTON:{disabled:null,type:null,value:null},DETAILS:{open:null},FIELDSET:{disabled:null},IMAGE:{"xlink:href":{allowedProtocols:{http:!0,https:!0}}},INPUT:{accept:null,accesskey:null,autocomplete:null,checked:null,disabled:null,height:null,inputmode:null,max:null,maxlength:null,min:null,minlength:null,multiple:null,pattern:null,placeholder:null,readonly:null,required:null,selectiondirection:null,size:null,spellcheck:null,step:null,type:{denylistedValueRegex:"(^|\\s)(button|image|)(\\s|$)"},value:null,width:null},OPTION:{disabled:null,label:null,selected:null,value:null},OPTGROUP:{disabled:null,label:null},SECTION:{"data-expand":null,expanded:null},SELECT:{autofocus:null,disabled:null,multiple:null,required:null,size:null},SOURCE:{src:{allowedProtocols:{https:!0}},type:null},TRACK:{label:null,src:{allowedProtocols:{https:!0}},srclang:null},TEXTAREA:{autocomplete:null,autofocus:null,cols:null,disabled:null,maxlength:null,minlength:null,pattern:null,placeholder:null,readonly:null,required:null,rows:null,selectiondirection:null,selectionend:null,selectionstart:null,spellcheck:null,wrap:null,defaulttext:null}},Gb={src:!0,srcset:!0,href:!0,"xlink:href":!0};function Hb(a){this.va=a}Hb.prototype.canBind=function(a,b){return void 0!==Ib(this,a,b)};Hb.prototype.isResultValid=function(a,b,c){var d=Ib(this,a,b);d&&d.alternativeName&&(d=Ib(this,a,d.alternativeName));if(void 0===d)return!1;if(null===d)return!0;if(c&&z(Gb,b)){if("srcset"===b){try{var e=zb(c)}catch(k){return G().error("amp-bind","Failed to parse srcset: ",k),!1}var f=e.getUrls()}else f=[c];for(a=0;a<f.length;a++){a:{var g=f[a];b=d;if(g){if(/__amp_source_origin/.test(g)){b=!1;break a}if(b=b.allowedProtocols)if(g=/^([^:\/?#.]+):[\s\S]*$/.exec(g),null!==g&&(g=g[1].toLowerCase().trim(),!w.call(b,g))){b=!1;break a}}b=!0}if(!b)return!1}}var h=d.denylistedValueRegex;return c&&h&&new RegExp(h,"i").test(c)?!1:!0};function Ib(a,b,c){if(c.startsWith("aria-"))return null;if(!z(Gb,c)||a.va){var d=z(Db,c);if(void 0!==d)return d;var e=z(Eb,c);if(b.startsWith("AMP-")&&void 0!==e)return e;var f=z(Fb,b);if(f)return f[c]}}function S(){this.F=[]}S.prototype.peek=function(){var a=this.length;return a?this.F[a-1].item:null};S.prototype.enqueue=function(a,b){if(isNaN(b))throw Error("Priority must not be NaN.");for(var c=-1,d=0,e=this.length;d<=e;){c=Math.floor((d+e)/2);if(c===this.length)break;if(this.F[c].priority<b)d=c+1;else if(0<c&&this.F[c-1].priority>=b)e=c-1;else break}this.F.splice(c,0,{item:a,priority:b})};S.prototype.forEach=function(a){for(var b=this.length;b--;)a(this.F[b].item)};S.prototype.dequeue=function(){return this.length?this.F.pop().item:null};ea.Object.defineProperties(S.prototype,{length:{configurable:!0,enumerable:!0,get:function(){return this.F.length}}});var Jb=!1;function Kb(a){if(!Jb){Jb=!0;a=a.body;var c,b={opacity:1,visibility:"visible",animation:"none"};for(c in b){var d=a,e=b[c];var f=d.style;var g=c;if(g.startsWith("--"))f=g;else{Ia||(Ia=y());var h=Ia[g];if(!h){h=g;if(void 0===f[g]){var k=g;k=k.charAt(0).toUpperCase()+k.slice(1);b:{for(var l=0;l<Ka.length;l++){var p=Ka[l]+k;if(void 0!==f[p]){k=p;break b}}k=""}void 0!==f[k]&&(h=k)}Ia[g]=h}f=h}f&&(f.startsWith("--")?d.style.setProperty(f,e):d.style[f]=e)}}}var Lb=/nochunking=1/.test(self.location.hash),Mb=A();function Nb(a,b){if(Lb)Mb.then(b);else{var c=Ob,d=N(a),e=O(d);Za(e,d,"chunk",c);L(a,"chunk").run(b,10)}}function T(a){this.state="not_run";this.W=a}function Pb(a,b){if("run"!=a.state){a.state="run";try{a.W(b)}catch(c){throw a.la(),c}}}T.prototype.K=function(){return this.W.displayName||this.W.name};T.prototype.la=function(){};T.prototype.ia=function(){return!1};T.prototype.ra=function(){return!1};function U(a,b,c){T.call(this,a);this.ea=c}la(U,T);U.prototype.la=function(){Kb(self.document)};U.prototype.ia=function(){return this.ea.ampdoc.isVisible()};U.prototype.ra=function(){return this.ea.fa};function Ob(a){var b=this;this.ampdoc=a;this.h=a.win;this.J=new S;this.da=this.ga.bind(this);this.G=0;this.Fa=!(!this.h.navigator.scheduling||!this.h.navigator.scheduling.isInputPending);this.R=!1;this.wa=this.h.document.documentElement.hasAttribute("i-amphtml-no-boilerplate");this.h.addEventListener("message",(function(c){"amp-macro-task"==c.data&&b.ga(null)}));this.fa=!1;$a(O(a),"viewer").then((function(){b.fa=!0}));a.onVisibilityChanged((function(){a.isVisible()&&Qb(b)}))}Ob.prototype.run=function(a,b){a=new T(a);this.J.enqueue(a,b);Qb(this)};Ob.prototype.runForStartup=function(a){a=new U(a,this.h,this);this.J.enqueue(a,Number.POSITIVE_INFINITY);Qb(this)};function Rb(a,b){for(var c=a.J.peek();c&&"not_run"!==c.state;)a.J.dequeue(),c=a.J.peek();c&&b&&a.J.dequeue();return c}Ob.prototype.ga=function(a){var b=this,c=Rb(this,!0);if(!c)return this.R=!1,this.G=0,!1;try{var d=Date.now();Pb(c,a)}finally{Mb.then().then().then().then().then().then().then().then().then((function(){b.R=!1;b.G+=Date.now()-d;H().fine("CHUNK",c.K(),"Chunk duration",Date.now()-d,b.G);Qb(b)}))}return!0};function Sb(a){a.wa&&(a.Fa?a.h.navigator.scheduling.isInputPending():5<a.G)?(a.G=0,Tb(a)):Mb.then((function(){a.da(null)}))}function Qb(a){if(!a.R){var b=Rb(a);b&&(b.ia()?(a.R=!0,Sb(a)):b.ra()&&a.h.requestIdleCallback?Ub(a.h,a.da):Tb(a))}}function Tb(a){a.h.postMessage("amp-macro-task","*")}function Ub(a,b){function c(e){if(15>e.timeRemaining()){var f=2e3-(Date.now()-d);0>=f||e.didTimeout?(H().fine("CHUNK","Timed out",2e3,e.didTimeout),b(e)):(H().fine("CHUNK","Rescheduling with",f,e.timeRemaining()),a.requestIdleCallback(c,{timeout:f}))}else H().fine("CHUNK","Running idle callback with ",15),b(e)}var d=Date.now();a.requestIdleCallback(c,{timeout:2e3})}function Vb(){var a=Wb();return function(b){return setTimeout(b,a())}}function Wb(){var a=0;return function(){var b=Math.pow(1.5,a++);var c=b*(c||.3)*Math.random();.5<Math.random()&&(c*=-1);b+=c;return 1e3*b}}var V=self.__AMP_ERRORS||[];self.__AMP_ERRORS=V;function Xb(a){Xb=Vb();return Xb(a)}function Yb(a){try{return JSON.stringify(a)}catch(b){return String(a)}}function W(a,b){try{if(a)if(void 0!==a.message)a=Ha(a);else{var c=a;a=Error(Yb(c));a.origError=c}else a=Error("Unknown error");if(!a.reported){a.reported=!0;if(a.messageArray){var d,e=na(a.messageArray,(function(h){return null==(d=h)?void 0:d.tagName}));-1<e&&(a.associatedElement=a.messageArray[e])}var f=b||a.associatedElement;f&&f.classList&&(f.classList.add("i-amphtml-error"),E().development&&(f.classList.add("i-amphtml-element-error"),f.setAttribute("error-message",a.message)));if(self.console&&(0<=a.message.indexOf("​​​")||!a.expected)){var g=console.error||console.log;a.messageArray?g.apply(console,a.messageArray):f?g.call(console,a.message,f):g.call(console,a.message)}f&&f.Ba&&f.Ba("amp:error",a.message);Zb.call(self,void 0,void 0,void 0,void 0,a)}}catch(h){setTimeout((function(){throw h}))}}function Zb(a,b,c,d,e){var f=this;!this||!this.document||e&&e.expected||Kb(this.document);if(!E().development){var g=!1;try{g=$b()}catch(k){}if(!(g&&.01<Math.random())){var h=ac(a,b,c,d,e,g);h&&Xb((function(){try{return bc(f,h).catch((function(){}))}catch(k){}}))}}}function bc(a,b){return b.pt&&.9>Math.random()?A():cc(a,b).then((function(c){if(!c){var d=new XMLHttpRequest;d.open("POST",.1>Math.random()?D.betaErrorReporting:D.errorReporting,!0);d.send(JSON.stringify(b))}}))}function cc(a,b){a=J(a,"ampdoc");if(!a.isSingleDoc())return Promise.resolve(!1);var c=a.getSingleDoc();if(!c.getRootNode().documentElement.hasAttribute("report-errors-to-viewer"))return Promise.resolve(!1);var d=L(c,"viewer");return d.hasCapability("errorReporter")?d.isTrustedViewer().then((function(e){if(!e)return!1;d.sendMessage("error",ra({m:b.m,a:b.a,s:b.s,el:b.el,ex:b.ex,v:b.v,pt:b.pt}));return!0})):Promise.resolve(!1)}function ac(a,b,c,d,e,f){var g=a;e&&(g=e.message?e.message:String(e));g||(g="Unknown error");a=g;var h=!(!e||!e.expected);if(!/_reported_/.test(a)&&"CANCELLED"!=a){var k=!(self&&self.window),l=Math.random();if(-1!=a.indexOf("Failed to load:")||"Script error."==a||k)if(h=!0,.001<l)return;var p=0<=a.indexOf("​​​");if(!(p&&.1<l)){g=Object.create(null);g.v=E().rtvVersion;g.noAmp=f?"1":"0";g.m=a.replace("​​​","");g.a=p?"1":"0";g.ex=h?"1":"0";g.dw=k?"1":"0";var n="1p";self.context&&self.context.location?(g["3p"]="1",n="3p"):E().runtime&&(n=E().runtime);g.rt=n;"inabox"===n&&(g.adid=E().a4aId);var r;f=!(null==(r=self.AMP_CONFIG)||!r.canary);g.ca=f?"1":"0";var v;r=(null==(v=self.AMP_CONFIG)?void 0:v.type)||"unknown";g.bt=r;self.location.ancestorOrigins&&self.location.ancestorOrigins[0]&&(g.or=self.location.ancestorOrigins[0]);self.viewerState&&(g.vs=self.viewerState);self.parent&&self.parent!=self&&(g.iem="1");if(self.AMP&&self.AMP.viewer){var x=self.AMP.viewer.getResolvedViewerUrl(),u=self.AMP.viewer.maybeGetMessagingOrigin();x&&(g.rvu=x);u&&(g.mso=u)}var M=[];v=self.__AMP__EXPERIMENT_TOGGLES||null;for(var X in v)M.push(X+"="+(v[X]?"1":"0"));g.exps=M.join(",");if(e){var Y;g.el=(null==(Y=e.associatedElement)?void 0:Y.tagName)||"u";e.args&&(g.args=JSON.stringify(e.args));p||e.ignoreStack||!e.stack||(g.s=e.stack);e.message&&(e.message+=" _reported_")}else g.f=b||"",g.l=c||"",g.c=d||"";g.r=self.document?self.document.referrer:"";g.ae=V.join(",");g.fr=self.location.originalHash||self.location.hash;"production"===g.bt&&(g.pt="1");b=a;25<=V.length&&V.splice(0,V.length-25+1);V.push(b);return g}}}function $b(){var a=self;if(!a.document)return!1;a=a.document.querySelectorAll("script[src]");for(var b=0;b<a.length;b++)if(!R(a[b].src.toLowerCase()))return!0;return!1}function dc(a,b,c){var d=self.location;mb(c);var e=R(d),f=Q(kb(d));if("href"==b&&!c.startsWith("#"))return lb(c,f);if("src"==b)return"amp-img"==a?ec(c,f,e):lb(c,f);if("srcset"==b){try{var g=zb(c)}catch(h){return G().error("URL-REWRITE","Failed to parse srcset: ",h),c}return g.stringify((function(h){return ec(h,f,e)}))}return c}function ec(a,b,c){a=Q(lb(a,b));return"data:"==a.protocol||R(a)||!c?a.href:D.cdn+"/i/"+("https:"==a.protocol?"s/":"")+encodeURIComponent(a.host)+a.pathname+(a.search||"")+(a.hash||"")}function fc(a){var b=this;this.h=a;this.Ha=J(a,"xhr");var c=Ta();H().fine("web-worker","Fetching web worker from",c);this.aa=null;this.ha=this.Ha.fetchText(c,{ampCors:!1,bypassInterceptorForDev:!1}).then((function(d){return d.text()})).then((function(d){d=d.replace(/^\/\/# sourceMappingURL=.*/,"//# sourceMappingURL="+c+".map");d=new a.Blob([d+"\n//# sourceurl="+c],{type:"text/javascript"});var e=a.URL.createObjectURL(d);b.aa=new a.Worker(e);b.aa.onmessage=b.Ea.bind(b)}));this.P={};this.ya=0;this.ua=[a]}function gc(a,b,c,d){return a.ha.then((function(){return new Promise((function(e,f){var g=a.ya++;a.P[g]={method:b,resolve:e,reject:f};e=d||a.h;f=a.ua.indexOf(e);e=0<=f?f:a.ua.push(e)-1;a.aa.postMessage({method:b,args:c,scope:e,id:g})}))}))}fc.prototype.Ea=function(a){var b=a.data;a=b.id;var c=b.method,d=b.returnValue;(b=this.P[a])?(b.resolve(d),delete this.P[a]):H().error("web-worker","Received unexpected message ("+c+", "+a+") from worker.")};fc.prototype.hasPendingMessages=function(){return 0<Object.keys(this.P).length};fc.prototype.Ia=function(){return this.ha};var hc=/^(i?-)?amp(html)?-/,ic={INPUT:{checked:!0,value:!0},OPTION:{selected:!0},TEXTAREA:{text:!0,disabled:!0}},jc=y({"AMP-CAROUSEL":["slide"],"AMP-LIST":["is-layout-container"],"AMP-SELECTOR":["selected"]}),kc=["AMP-LIST","AMP-RENDER"];function lc(a){var b=this;this.ampdoc=a;this.H=this.h=a.win;this.V=[];this.Ca=Ua(this.h,(function(){b.V.length=0}));this.D=[];this.o=y();this.X=L(a,"history");this.ma=[];this.I=1e3;this.ka=L(a,"mutator");this.j=y();this.Ga=K(this.h,"timer");this.sa=null;this.T=L(this.ampdoc,"viewer");this.T.onMessageRespond("premutate",this.Da.bind(this));this.na=a.whenFirstVisible().then((function(){return a.whenReady().then((function(){return a.getRootNode()}))}));this.L=this.na.then((function(d){return mc(b,d)}));this.ba=new B;this.S=null;this.oa=new ub;var c=self.AMP;c.printState=c.printState||this.Aa.bind(this);c.setState=c.setState||function(d){return b.setState(d)};c.eval=c.eval||this.za.bind(this)}m=lc.prototype;m.signals=function(){return this.oa};m.setState=function(a,b){var c=this,d=b=void 0===b?{}:b;H().info("amp-bind","setState (init=%s):",d.skipEval,a);try{sa(this.j,a)}catch(e){G().error("amp-bind","Failed to merge result from AMP.setState().",e)}return d.skipEval?A():this.S=this.L.then((function(){return nc(c)})).then((function(e){return oc(c,e,{skipAmpState:d.skipAmpState,constrain:d.constrain})}))};m.invoke=function(a){var b=a.args,c=a.event,d=a.method,e=a.sequenceId,f=a.tagOrTarget;if(this.V.includes(e))return G().error("amp-bind","One state action allowed per event."),A();this.V.push(e);this.Ca();if(b=b.__AMP_OBJECT_STRING__){this.I=Math.min(2e3,Math.max(1e3,this.I+500));this.oa.signal("FIRST_MUTATE");var g={};c&&c.detail&&(g.event=c.detail);switch(d){case"setState":return this.setStateWithExpression(b,g);case"pushState":return this.pushStateWithExpression(b,g);default:return Promise.reject(H().createError("Unrecognized method: %s.%s",f,d))}}else G().error("AMP-BIND","Please use the object-literal syntax, e.g. \"AMP.setState({foo: 'bar'})\" instead of \"AMP.setState(foo='bar')\".");return A()};m.setStateWithExpression=function(a,b){var c=this;return pc(this,a,b).then((function(d){return qc(c,d)}))};m.setStateWithObject=function(a){return(a=rc(a))?qc(this,a):Promise.reject("Invalid state")};function qc(a,b){H().info("amp-bind","setState:",b);a.S=a.setState(b).then((function(){return sc(a)})).then((function(c){c&&a.X.replace(c)}));return a.S}m.pushStateWithExpression=function(a,b){var c=this;H().info("amp-bind","pushState:",a);return pc(this,a,b).then((function(d){function e(){return c.setState(f)}var f=y();Object.keys(d).forEach((function(g){f[g]=rc(c.j[g])}));return c.setState(d).then((function(){return sc(c)})).then((function(g){c.X.push(e,g)}))}))};function sc(a){var b=ra({data:ra({"amp-bind":a.j}),title:a.H.document.title});return a.T.isEmbedded()?a.T.isTrustedViewer().then((function(c){return c?b:null})):Promise.resolve(b)}m.rescan=function(a,b,c){var d=this,e=c=void 0===c?{}:c;return(e.fast?this.ba.promise:this.L).then((function(){return d.Ga.timeoutPromise(e.timeout||2e3,tc(d,a,b,e),"Timed out waiting for amp-bind to rescan.")}))};function tc(a,b,c,d){H().info("amp-bind","rescan: ",b,c,d);return(d.fast?uc(a,b,c):vc(a,b,c)).then((function(){if(d.update)return nc(a).then((function(e){return oc(a,e,{constrain:b,evaluateOnly:"evaluate"===d.update})}))}))}function uc(a,b,c){var d=wc(a,c),e=[],f=b.filter((function(h){return h.hasAttribute("i-amphtml-binding")}));b.forEach((function(h){h=h.querySelectorAll("[i-amphtml-binding]");Array.prototype.push.apply(f,h)}));var g=a.I-a.numberOfBindings();for(b=0;b<f.length&&!xc(a,f[b],g-e.length,e);b++);d.then((function(h){H().info("amp-bind","rescan.fast: delta=%s, total=%s",e.length-h,a.numberOfBindings())}));return 0<e.length?yc(a,e):A()}m.getState=function(a){a=a?ta(this.j,a):void 0;return qa(a)||t(a)?rc(a):a};m.getStateAsync=function(a){var b=this,c=/^[^.]*/.exec(a)[0];return this.na.then((function(d){var e=d.querySelector("#"+String(c).replace(Ba,Ca));if(!e)throw G().createError("amp-bind","#"+c+" does not exist.");return wb(e).then((function(f){return f.getImpl(!0)})).then((function(f){return f.getFetchingPromise()})).catch((function(){})).then((function(){return b.getState(a)}))}))};m.getStateValue=function(a){a=ta(this.j,a);return void 0===a||null===a?null:qa(a)||t(a)?JSON.stringify(a):String(a)};function mc(a,b){var c=!vb(a.H.document);a.sa=new Hb(c);return Z(a,"bind.init",[c]).then((function(){return Promise.all([zc(a).then((function(){return a.ba.resolve()})),Ac(a,[b])])})).then((function(){b.addEventListener("amp:dom-update",(function(d){return Bc(a,d)}))})).then((function(){var d=b.querySelectorAll("AMP-STATE"),e=q(d).map((function(f){return wb(f).then((function(){return f.getImpl(!1)})).then((function(g){return g.parseAndUpdate()}))}));return Promise.all(e)})).then((function(){a.T.sendMessage("bindReady",void 0);if(E().development)return nc(a).then((function(d){return Cc(a,d)}))}))}m.numberOfBindings=function(){return this.D.reduce((function(a,b){return a+b.boundProperties.length}),0)};m.La=function(a){this.I=a};m.Ja=function(){return this.X};m.Da=function(a){var b=this,c=[];return this.L.then((function(){Object.keys(a.state).forEach((function(d){b.ma.includes(d)||(delete a.state[d],c.push(d))}));0<c.length&&G().warn("amp-bind","Some state keys could not be premutated because they are missing the overridable attribute: "+c.join(", "));return b.setState(a.state)}))};m.addOverridableKey=function(a){this.ma.push(a)};function zc(a){var b=a.ampdoc.getBody().querySelectorAll("AMP-BIND-MACRO"),c=[];Fa(b,(function(d){var e=(d.getAttribute("arguments")||"").split(",").map((function(f){return f.trim()}));c.push({id:d.getAttribute("id"),argumentNames:e,expressionString:d.getAttribute("expression")})}));return 0==c.length?Promise.resolve(0):Z(a,"bind.addMacros",[c]).then((function(d){d.forEach((function(e,f){Dc(e,"amp-bind: Parsing amp-bind-macro failed.",b[f])}));return c.length}))}function Ac(a,b){if(!b.length)return Promise.resolve(0);var c=b.map((function(d){var e=a.I-a.numberOfBindings();return Ec(a,d,e).then((function(f){var g=f.bindings;f.limitExceeded&&H().expectedError("amp-bind","Maximum number of bindings reached (%s). Additional elements with bindings will be ignored.",a.I);return g}))}));return Promise.all(c).then((function(d){d=Array.prototype.concat.apply([],d);return 0<d.length?yc(a,d):0}))}function yc(a,b){return Z(a,"bind.addBindings",[b]).then((function(c){Object.keys(c).forEach((function(d){var e=a.o[d];0<e.length&&Dc(c[d],'amp-bind: Expression compile error in "'+d+'".',e[0])}));return b.length}))}function wc(a,b){if(!b.length)return Promise.resolve(0);ma(a.D,(function(g){for(var h=0;h<b.length;h++)if(b[h].contains(g.element))return!0;return!1}));var d,c=[];for(d in a.o){var e=a.o[d];ma(e,(function(g){for(var h=0;h<b.length;h++)if(b[h].contains(g))return!0;return!1}));0==e.length&&(c.push(d),delete a.o[d])}var f=c.length;return 0<f?Z(a,"bind.removeBindingsWithExpressionStrings",[c]).then((function(){return f})):Promise.resolve(0)}function Ec(a,b,c){function d(){var h=f.currentNode;if(h.nodeType!==Node.ELEMENT_NODE)return!f.nextNode();xc(a,h,c-e.length,e)&&(g=!0);return!(kc.includes(h.nodeName)?f.skipSubtree():f.nextNode())||g}var e=[],f=new Fc(b),g=!1;return new Promise((function(h){function k(l){var p=!1;if(l&&!l.didTimeout)for(;1<l.timeRemaining()&&!p;)p=d();else for(l=0;250>l&&!p;l++)p=d();p?h({bindings:e,limitExceeded:g}):Nb(a.ampdoc,k)}Nb(a.ampdoc,k)}))}function xc(a,b,c,d){var e=!1,f=Gc(a,b);f.length>c&&(f.length=c,e=!0);0<f.length&&a.D.push({element:b,boundProperties:f});var g=b.tagName;f.forEach((function(h){var k=h.expressionString;d.push({tagName:g,property:h.property,expressionString:k});a.o[k]||(a.o[k]=[]);a.o[k].push(b)}));return e}function Gc(a,b){for(var c=[],d=b.attributes,e=0,f=d.length;e<f;e++){a:{var g=void 0,h=a,k=d[e];var l=b;var p=l.tagName,n=k.name;if(2<n.length&&"["===n[0]&&"]"===n[n.length-1])g=n.substr(1,n.length-2);else if(n.startsWith("data-amp-bind-")&&(g=n.substr(14),l.hasAttribute("["+g+"]"))){l=null;break a}if(g){if(h.sa.canBind(p,g)){l={property:g,expressionString:k.value};break a}g=G().createError("%s: Binding to [%s] on <%s> is not allowed.","amp-bind",g,p);W(g,l)}l=null}l&&c.push(l)}return c}function pc(a,b,c){return a.L.then((function(){Object.assign(c,a.j);return Z(a,"bind.evaluateExpression",[b,c])})).then((function(d){var e=d.error;d=d.result;if(e)throw Dc(e,"amp-bind: Expression eval failed.");return d}))}function nc(a){return Z(a,"bind.evaluateBindings",[a.j]).then((function(b){var c=b.errors;b=b.results;Object.keys(c).forEach((function(d){var e=a.o[d];if(0<e.length){var f=c[d],g=G().createError('%s: Expression evaluation error in "%s". %s',"amp-bind",d,f.message);g.stack=f.stack;W(g,e[0])}}));H().info("amp-bind","evaluation:",b);return b}))}function Cc(a,b){var c=void 0===c?!0:c;var d={};a.D.forEach((function(e){var f=e.element;e.boundProperties.forEach((function(g){var h=b[g.expressionString];if(void 0!==h){var k=g.property,l=jc[f.tagName];if(l&&l.includes(k))h=null;else{switch(k){case"text":k=f.textContent;h=String(h);l=k.trim()===h.trim();break;case"class":k=[];for(l=0;l<f.classList.length;l++){var p=f.classList[l];hc.test(p)||k.push(p)}p=[];Array.isArray(h)?p=h:"string"===typeof h?(l=h.trim(),0<l.length&&(p=l.split(" "))):(l=G().createError('%s: "%s" is not a valid result for [class].',"amp-bind",h),W(l,f));b:{l=k;var n=p;if(l.length!==n.length)l=!1;else{p=(t(l)?l:q(l)).sort();n=(t(n)?n:q(n)).sort();for(var r=0;r<l.length;r++)if(p[r]!==n[r]){l=!1;break b}l=!0}}break;default:k=f.getAttribute(k),l=!0===h?""===k:!1===h?null===k:"number"===typeof h?Number(k)===h:k===h}h=l?null:{expected:h,actual:k}}var v=h;if(v){h=f.tagName;k=g.expressionString;g=g.property;var x=v.actual;l=v.expected;d[h+"["+g+"]"+l+":"+x]=!0;c&&G().warn("amp-bind","Default value ("+x+") does not match first result ("+l+") for <"+h+" ["+g+']="'+k+'">. We recommend writing expressions with matching default values, but this can be safely ignored if intentional.')}}}))}));return Object.keys(d)}function Hc(a,b){var c=[];a.forEach((function(d){var e=d.previousResult,f=b[d.expressionString];void 0===f||Aa(f,e)||(d.previousResult=f,c.push({boundProperty:d,newValue:f}))}));return c}function oc(a,b,c){var d=[];a.D.forEach((function(e){if(!c.skipAmpState||"AMP-STATE"!==e.element.tagName)if(!c.constrain||c.constrain.some((function(h){return h.contains(e.element)}))){var f=e.element,g=Hc(e.boundProperties,b);c.evaluateOnly||d.push(Ic(a,f,g))}}));return Promise.all(d)}function Ic(a,b,c){return 0===c.length?A():a.ka.mutateElement(b,(function(){var e,f,d=y();c.forEach((function(h){var k=h.boundProperty,l=h.newValue,p=k.property;a:{k=k.property;var n=b.tagName;switch(k){case"defaulttext":b.textContent=String(l);break;case"text":k=String(l);"TITLE"===n&&b.parentNode===a.H.document.head&&(a.H.document.title=k);"TEXTAREA"===n?b.value=k:b.textContent=k;break;case"class":k=[];for(n=0;n<b.classList.length;n++){var r=b.classList[n];hc.test(r)&&k.push(r)}Array.isArray(l)||"string"===typeof l?b.setAttribute("class",k.concat(l).join(" ")):null===l?b.setAttribute("class",k.join(" ")):(k=G().createError('%s: "%s" is not a valid result for [class].',"amp-bind",l),W(k,b));break;default:var v="INPUT"===n&&k in b,x=b.getAttribute(k);n=!1;if("boolean"===typeof l){if(v&&b[k]!==l&&(b[k]=l,n=!0),l&&""!==x?(b.setAttribute(k,""),n=!0):l||null===x||(b.removeAttribute(k),n=!0),n&&"OPTION"===b.tagName&&"selected"===k&&l&&J(a.h,"platform").isSafari()&&(r=Ea(b,"select"))){var u=q(r.options).indexOf(b);0<=u&&(r.selectedIndex=u)}}else if("object"===typeof l&&null!==l)n=!0;else if(l!==x)b:{x=String(l);try{r=b.tagName.toLowerCase();u=k.toLowerCase();var M="src"==u||"href"==u||"xlink:href"==u||"srcset"==u?dc(r,u,x):x;if(R(self.location)&&"a"===r&&"href"===u){var X=b.getAttribute(u),Y="#"===M[0],yb=X&&"#"===X[0];Y&&!yb?(b.__AMP_ORIGINAL_TARGET_VALUE_||(b.__AMP_ORIGINAL_TARGET_VALUE_=b.getAttribute("target")),b.removeAttribute("target")):yb&&!Y&&b.setAttribute("target",b.__AMP_ORIGINAL_TARGET_VALUE_||"_top")}v&&(b[u]=M);b.setAttribute(u,M);n=!0;break b}catch(Jc){n=G().createError('%s: "%s" is not a valid result for [%]',"amp-bind",x,k,Jc),W(n,b)}n=!1}if(n){k={name:k,value:l};break a}}k=null}var Ja=k;Ja&&(d[Ja.name]=Ja.value,"width"==p?e="number"===typeof l&&isFinite(l)?Number(l):e:"height"==p&&(f="number"===typeof l&&isFinite(l)?Number(l):f));(l=ic[b.tagName])&&l[p]&&(p="OPTION"===b.tagName?Ea(b,"SELECT"):b)&&(l=eb(a.H,"amp:form-value-change",null,{bubbles:!0}),p.dispatchEvent(l))}));void 0===e&&void 0===f||a.ka.forceChangeSize(b,f,e);if("function"===typeof b.mutatedAttributesCallback)try{b.mutatedAttributesCallback(d)}catch(h){var g=G().createError("%s: Applying expression results (%s) failed with error,","amp-bind",JSON.stringify(d),h);W(g,b)}}))}function Bc(a,b){b=b.target;var c=b.parentNode;c&&kc.includes(c.nodeName)||(H().info("amp-bind","dom_update:",b),vc(a,[b],[b],"dom_update.end").then((function(){})))}function vc(a,b,c,d){var e=void 0===d?"rescan.slow":d,f=0;return wc(a,c).then((function(g){f=g;return Ac(a,b)})).then((function(g){H().info("amp-bind","%s: delta=%s, total=%s",e,g-f,a.numberOfBindings())}))}function Z(a,b,c){var d=a.h;a=a.H;if(d.Worker){var e=d;e=e.__AMP_TOP||(e.__AMP_TOP=e);Za(e,e,"amp-worker",fc);b=gc(J(d,"amp-worker"),b,c||[],a)}else b=Promise.reject("Worker not supported in window.");return b}function Dc(a,b,c){b=G().createError("%s %s",b,a.message);b.stack=a.stack;W(b,c);return b}function rc(a){if(void 0===a)return null;try{return JSON.parse(JSON.stringify(a))}catch(b){H().error("amp-bind","Failed to copy JSON ("+a+") with error: "+b)}return null}m.Aa=function(a){if(a)if("string"==typeof a){var b=ta(this.j,a);G().info("amp-bind",b)}else a.nodeType==Node.ELEMENT_NODE?(b=G().assertElement(a),Kc(this,b)):G().info("amp-bind",'Invalid argument. Pass a JSON expression or an element instead e.g. AMP.printState("foo.bar") or AMP.printState($0) after selecting an element.');else G().info("amp-bind",this.j)};function Kc(a,b){var c=na(a.D,(function(f){return f.element==b}));if(0>c)G().info("amp-bind","Element has no bindings:",b);else{var d=[],e=a.D[c].boundProperties;e.forEach((function(f){d.push(pc(a,f.expressionString,a.j))}));Promise.all(d).then((function(f){var g=y();e.forEach((function(h,k){g[h.property]=f[k]}));G().info("amp-bind",g)}))}}m.za=function(a){pc(this,a,this.j).then((function(b){G().info("amp-bind",b)}))};m.Ka=function(){return this.L};m.Ma=function(){return this.S};function Fc(a){var b=a.nodeType==Node.DOCUMENT_NODE?a:a.ownerDocument,c=b.documentElement.hasAttribute("i-amphtml-binding");this.qa=c;this.currentNode=a;this.ja=0;this.Z=c?q(a.querySelectorAll("[i-amphtml-binding]")):[];c&&a.nodeType===Node.ELEMENT_NODE&&a.hasAttribute("i-amphtml-binding")&&this.Z.unshift(a);this.pa=c?null:b.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,null,!1)}Fc.prototype.nextNode=function(){if(this.qa){if(this.ja==this.Z.length)return null;var a=this.Z[this.ja++];return this.currentNode=a}a=this.pa.nextNode();null!==a&&(this.currentNode=a);return a};Fc.prototype.skipSubtree=function(){if(this.qa){var a=this.currentNode;do{var b=this.nextNode()}while(null!==b&&a.contains(b));return b}b=this.pa;for(var c=b.currentNode;c;c=b.parentNode()){var d=b.nextSibling();if(null!==d)return this.currentNode=d}return null};AMP.registerServiceForDoc("bind",lc);AMP.registerElement("amp-state",pb);AMP.registerElement("amp-bind-macro",xa)}});//# sourceMappingURL=amp-bind-0.1.js.map

Back to list