sitespeed.io/docs/testcases/info/js/v0.js

27 lines
151 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

try{!function t(e,i,n){function r(o,a){if(!i[o]){if(!e[o]){var l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[o]={exports:{}};e[o][0].call(c.exports,function(t){var i=e[o][1][t];return r(i?i:t)},c,c.exports,t,e,i,n)}return i[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)r(n[o]);return r}({1:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n={doubleclick:"https://www.googletagservices.com/tag/js/gpt.js",a9:"https://c.amazon-adsystem.com/aax2/assoc.js",adsense:"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"};i.adPrefetch=n;var r={adreactor:"https://adserver.adreactor.com",adsense:"https://googleads.g.doubleclick.net",doubleclick:["https://partner.googleadservices.com","https://securepubads.g.doubleclick.net","https://tpc.googlesyndication.com"]};i.adPreconnect=r},{}],2:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n="body{margin:0!important;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;-ms-text-size-adjust:100%;text-size-adjust:100%}.-amp-element{display:inline-block}.-amp-layout-fixed{display:inline-block;position:relative}.-amp-layout-container,.-amp-layout-fixed-height,.-amp-layout-responsive{display:block;position:relative}.-amp-layout-fill{display:block;position:absolute;top:0;left:0;bottom:0;right:0}.-amp-layout-fill,.-amp-layout-size-defined{overflow:hidden!important}i-amp-sizer{display:block!important}.-amp-fill-content{display:block;width:100%;height:100%;margin:auto}.-amp-layout-size-defined .-amp-fill-content{position:absolute;top:0;left:0;bottom:0;right:0}.-amp-replaced-content{padding:0!important;border:none!important}.-amp-unresolved{position:relative!important;overflow:hidden!important}.-amp-notbuilt{position:relative!important;overflow:hidden!important;color:transparent!important}.-amp-notbuilt>*{display:none}.-amp-ghost{visibility:hidden!important}.-amp-element>[placeholder]{display:block}.-amp-element>[placeholder].amp-hidden,.-amp-element>[placeholder].hidden{visibility:hidden}.-amp-element:not(.amp-notsupported)>[fallback]{display:none}.-amp-layout-size-defined>[fallback],.-amp-layout-size-defined>[placeholder]{position:absolute!important;top:0!important;left:0!important;right:0!important;bottom:0!important;z-index:1!important}.-amp-notbuilt>[placeholder]{display:block!important}.-amp-hidden-by-media-query{display:none}.-amp-element-error{background:red!important;color:#fff!important;position:relative!important}.-amp-element-error:before{content:attr(error-message)}i-amp-scroll-container{position:absolute;top:0;left:0;right:0;bottom:0;overflow:auto}.-amp-loading-container{display:block!important;z-index:1}.-amp-notbuilt>.-amp-loading-container{display:block!important}.-amp-loading-container.amp-hidden{visibility:hidden}.-amp-loader{position:absolute;display:block;height:10px;top:50%;left:50%;-webkit-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);-webkit-transform-origin:50% 50%;transform-origin:50% 50%;white-space:nowrap}.-amp-loader.amp-active .-amp-loader-dot{-webkit-animation:a 2s infinite;animation:a 2s infinite}.-amp-loader-dot{position:relative;display:inline-block;height:10px;width:10px;margin:2px;border-radius:100%;background-color:rgba(0,0,0,.3);box-shadow:2px 2px 2px 1px rgba(0,0,0,.2);will-change:transform}.-amp-loader .-amp-loader-dot:nth-child(1){-webkit-animation-delay:0s;animation-delay:0s}.-amp-loader .-amp-loader-dot:nth-child(2){-webkit-animation-delay:.1s;animation-delay:.1s}.-amp-loader .-amp-loader-dot:nth-child(3){-webkit-animation-delay:.2s;animation-delay:.2s}@-webkit-keyframes a{0%,to{-webkit-transform:scale(.7);transform:scale(.7);background-color:rgba(0,0,0,.3)}50%{-webkit-transform:scale(.8);transform:scale(.8);background-color:rgba(0,0,0,.5)}}@keyframes a{0%,to{-webkit-transform:scale(.7);transform:scale(.7);background-color:rgba(0,0,0,.3)}50%{-webkit-transform:scale(.8);transform:scale(.8);background-color:rgba(0,0,0,.5)}}.-amp-element>[overflow]{cursor:pointer;z-index:2;visibility:hidden}.-amp-element>[overflow].amp-visible{visibility:visible}template{display:none!important}amp-pixel{position:absolute!important;top:0!important;width:1px!important;height:1px!important;overflow:hidden!important;visibility:hidden}amp-ad iframe{border:0!important;margin:0!important;padding:0!important}amp-instagram{padding:48px 8px!important}amp-analytics{position:absolute!important;top:0!important;width:1px!important;height:1px!important;overflow:hidden!important;visibility:hidden}\n/*# sourceURL=/css/amp.css*/";i.cssText=n},{}],3:[function(e,t,i){function n(e){var t=0,i=function(e){function i(){babelHelpers.classCallCheck(this,i),babelHelpers.get(Object.getPrototypeOf(i.prototype),"constructor",this).apply(this,arguments)}return babelHelpers.inherits(i,e),babelHelpers.createClass(i,[{key:"renderOutsideViewport",value:function(){return this.getViewport().hasScrolled()?t>0?!1:!0:!1}},{key:"isLayoutSupported",value:function(e){return(0,a.isLayoutSizeDefined)(e)}},{key:"isReadyToBuild",value:function(){return!1}},{key:"buildCallback",value:function(){this.iframe_=null,this.placeholder_=this.getPlaceholder(),this.fallback_=this.getFallback(),this.isInFixedContainer_=!1,this.iframeLayoutBox_=null,this.unlistenViewportChanges_=null,this.shouldSendIntersectionChanges_=!1}},{key:"preconnectCallback",value:function(e){var t=this;(0,c.prefetchBootstrap)(this.getWin());var i=this.element.getAttribute("type"),n=h.adPrefetch[i],r=h.adPreconnect[i];"string"==typeof n?this.preconnect.prefetch(n):n&&n.forEach(function(e){t.preconnect.prefetch(e)}),"string"==typeof r?this.preconnect.url(r,e):r&&r.forEach(function(i){t.preconnect.url(i,e)});var s=this.element.getAttribute("src");s&&this.preconnect.url(s)}},{key:"onLayoutMeasure",value:function(){this.isInFixedContainer_=this.isPositionFixed(),this.measureIframeLayoutBox_()}},{key:"measureIframeLayoutBox_",value:function(){this.iframe_&&(this.iframeLayoutBox_=this.getViewport().getLayoutRect(this.iframe_))}},{key:"isPositionFixed",value:function(){var e=this.element,t=e.ownerDocument.body;do{if(p[e.tagName])return!1;if("fixed"==this.getWin().getComputedStyle(e).position)return!0;e=e.parentNode}while(e.getAttribute&&e!=t);return!1}},{key:"layoutCallback",value:function(){var e=this;return t++,d.timer.delay(function(){t--},1e3),(0,s.assert)(!this.isInFixedContainer_,"<amp-ad> is not allowed to be placed in elements with position:fixed: %s",this.element),this.iframe_||(this.iframe_=(0,c.getIframe)(this.element.ownerDocument.defaultView,this.element),this.applyFillContent(this.iframe_),this.element.appendChild(this.iframe_),(0,c.listenOnce)(this.iframe_,"no-content",function(){e.deferMutate(e.noContentHandler_.bind(e))}),(0,c.listenOnce)(this.iframe_,"send-intersections",function(){e.startSendingIntersectionChanges_()})),(0,l.loadPromise)(this.iframe_)}},{key:"viewportCallback",value:function(e){this.sendAdIntersection_(),e?this.unlistenViewportChanges_=this.getViewport().onChanged(this.sendAdIntersection_.bind(this)):this.unlistenViewportChanges_&&(this.unlistenViewportChanges_(),this.unlistenViewportChanges_=null)}},{key:"startSendingIntersectionChanges_",value:function(){var e=this;this.shouldSendIntersectionChanges_=!0,this.getVsync().measure(function(){e.iframeLayoutBox_||e.measureIframeLayoutBox_(),e.sendAdIntersection_()})}},{key:"sendAdIntersection_",value:function(){if(this.shouldSendIntersectionChanges_&&this.iframeLayoutBox_){var e=this.getViewport().getRect(),t=(0,o.getIntersectionChangeEntry)(d.timer.now(),e,this.iframeLayoutBox_);(0,c.postMessage)(this.iframe_,"intersection",{changes:[t]})}}},{key:"noContentHandler_",value:function(){this.element.removeChild(this.iframe_),this.toggleFallback(!0)}}]),i}(r.BaseElement);(0,u.registerElement)(e,"amp-ad",i)}Object.defineProperty(i,"__esModule",{value:!0}),i.installAd=n;var r=e("../src/base-element"),s=e("../src/asserts"),o=e("../src/intersection-observer"),a=e("../src/layout"),l=e("../src/event-helper"),u=e("../src/custom-element"),c=e("../src/3p-frame"),h=e("../ads/_prefetch"),d=e("../src/timer"),p={"AMP-LIGHTBOX":!0}},{"../ads/_prefetch":1,"../src/3p-frame":51,"../src/asserts":54,"../src/base-element":55,"../src/custom-element":59,"../src/event-helper":66,"../src/intersection-observer":72,"../src/layout":74,"../src/timer":95}],4:[function(e,t,i){function n(e){var t=function(e){function t(){babelHelpers.classCallCheck(this,t),babelHelpers.get(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"isLayoutSupported",value:function(e){return(0,s.isLayoutSizeDefined)(e)}},{key:"buildCallback",value:function(){this.img_=new Image,this.element.id&&this.img_.setAttribute("amp-img-id",this.element.id),this.propagateAttributes(["alt"],this.img_),this.applyFillContent(this.img_,!0),this.img_.width=(0,s.getLengthNumeral)(this.element.getAttribute("width")),this.img_.height=(0,s.getLengthNumeral)(this.element.getAttribute("height")),this.element.appendChild(this.img_),this.srcset_=(0,a.parseSrcset)(this.element.getAttribute("srcset")||this.element.getAttribute("src"))}},{key:"prerenderAllowed",value:function(){return!0}},{key:"isRelayoutNeeded",value:function(){return!0}},{key:"layoutCallback",value:function(){return this.updateImageSrc_()}},{key:"updateImageSrc_",value:function(){if(this.getLayoutWidth()<=0)return Promise.resolve();var e=this.srcset_.select(this.getLayoutWidth(),this.getDpr()).url;return e==this.img_.getAttribute("src")?Promise.resolve():(this.img_.setAttribute("src",e),(0,o.loadPromise)(this.img_))}}]),t}(r.BaseElement);(0,l.registerElement)(e,"amp-img",t)}Object.defineProperty(i,"__esModule",{value:!0}),i.installImg=n;var r=e("../src/base-element"),s=e("../src/layout"),o=e("../src/event-helper"),a=e("../src/srcset"),l=e("../src/custom-element")},{"../src/base-element":55,"../src/custom-element":59,"../src/event-helper":66,"../src/layout":74,"../src/srcset":90}],5:[function(e,t,i){function n(e){var t=function(e){function t(){babelHelpers.classCallCheck(this,t),babelHelpers.get(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"isLayoutSupported",value:function(e){return e==s.Layout.FIXED}},{key:"buildCallback",value:function(){this.element.style.width="",this.element.style.height="",this.element.setAttribute("aria-hidden","true")}},{key:"layoutCallback",value:function(){var e=this,t=this.element.getAttribute("src");return(0,o.urlReplacementsFor)(this.getWin()).expand(this.assertSource(t)).then(function(t){var i=new Image;i.src=t,i.width=1,i.height=1,e.element.style.width=0,e.element.appendChild(i)})}},{key:"assertSource",value:function(e){return(0,a.assert)(/^(https\:\/\/|\/\/)/i.test(e),'The <amp-pixel> src attribute must start with "https://" or "//". Invalid value: '+e),e}}]),t}(r.BaseElement);(0,l.registerElement)(e,"amp-pixel",t)}Object.defineProperty(i,"__esModule",{value:!0}),i.installPixel=n;var r=e("../src/base-element"),s=e("../src/layout"),o=e("../src/url-replacements"),a=e("../src/asserts"),l=e("../src/custom-element")},{"../src/asserts":54,"../src/base-element":55,"../src/custom-element":59,"../src/layout":74,"../src/url-replacements":96}],6:[function(e,t,i){function n(e){var t=function(e){function t(){babelHelpers.classCallCheck(this,t),babelHelpers.get(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"isLayoutSupported",value:function(e){return(0,o.isLayoutSizeDefined)(e)}},{key:"layoutCallback",value:function(){var e=this.element.getAttribute("width"),t=this.element.getAttribute("height"),i=document.createElement("video");return i.play?(this.element.getAttribute("src")&&(0,s.assertHttpsUrl)(this.element.getAttribute("src"),this.element),this.propagateAttributes(["src","controls","autoplay","muted","loop","poster"],i),i.width=(0,o.getLengthNumeral)(e),i.height=(0,o.getLengthNumeral)(t),this.applyFillContent(i,!0),this.getRealChildNodes().forEach(function(e){e.getAttribute&&e.getAttribute("src")&&(0,s.assertHttpsUrl)(e.getAttribute("src"),e),i.appendChild(e)}),this.element.appendChild(i),this.video_=i,(0,u.setStyles)(i,{visibility:"hidden"}),(0,a.loadPromise)(i).then(function(){(0,u.setStyles)(i,{visibility:""})})):(this.toggleFallback(!0),Promise.resolve())}},{key:"documentInactiveCallback",value:function(){return this.video_&&this.video_.pause(),!1}}]),t}(r.BaseElement);(0,l.registerElement)(e,"amp-video",t)}Object.defineProperty(i,"__esModule",{value:!0}),i.installVideo=n;var r=e("../src/base-element"),s=e("../src/url"),o=e("../src/layout"),a=e("../src/event-helper"),l=e("../src/custom-element"),u=e("../src/style")},{"../src/base-element":55,"../src/custom-element":59,"../src/event-helper":66,"../src/layout":74,"../src/style":92,"../src/url":97}],7:[function(e,t,i){function n(){c=!1,a.length?u=a.concat(u):h=-1,u.length&&r()}function r(){if(!c){var e=setTimeout(n);c=!0;for(var t=u.length;t;){for(a=u,u=[];++h<t;)a&&a[h].run();h=-1,t=u.length}a=null,c=!1,clearTimeout(e)}}function s(e,t){this.fun=e,this.array=t}function o(){}var a,l=t.exports={},u=[],c=!1,h=-1;l.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];u.push(new s(e,t)),1!==u.length||c||setTimeout(r,0)},s.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=o,l.addListener=o,l.once=o,l.off=o,l.removeListener=o,l.removeAllListeners=o,l.emit=o,l.binding=function(e){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(e){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},{}],8:[function(e,t,i){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],9:[function(e,t,i){var n=e("./$.is-object");t.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},{"./$.is-object":24}],10:[function(e,t,i){var n=e("./$.cof"),r=e("./$.wks")("toStringTag"),s="Arguments"==n(function(){return arguments}());t.exports=function(e){var t,i,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=(t=Object(e))[r])?i:s?n(t):"Object"==(o=n(t))&&"function"==typeof t.callee?"Arguments":o}},{"./$.cof":11,"./$.wks":46}],11:[function(e,t,i){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],12:[function(e,t,i){var n=t.exports={version:"1.2.1"};"number"==typeof __e&&(__e=n)},{}],13:[function(e,t,i){var n=e("./$.a-function");t.exports=function(e,t,i){if(n(e),void 0===t)return e;switch(i){case 1:return function(i){return e.call(t,i)};case 2:return function(i,n){return e.call(t,i,n)};case 3:return function(i,n,r){return e.call(t,i,n,r)}}return function(){return e.apply(t,arguments)}}},{"./$.a-function":8}],14:[function(e,t,i){var n=e("./$.global"),r=e("./$.core"),s=e("./$.hide"),o=e("./$.redef"),a="prototype",l=function(e,t){return function(){return e.apply(t,arguments)}},u=function(e,t,i){var c,h,d,p,f=e&u.G,v=e&u.P,m=f?n:e&u.S?n[t]||(n[t]={}):(n[t]||{})[a],_=f?r:r[t]||(r[t]={});f&&(i=t);for(c in i)h=!(e&u.F)&&m&&c in m,d=(h?m:i)[c],p=e&u.B&&h?l(d,n):v&&"function"==typeof d?l(Function.call,d):d,m&&!h&&o(m,c,d),_[c]!=d&&s(_,c,p),v&&((_[a]||(_[a]={}))[c]=d)};n.core=r,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,t.exports=u},{"./$.core":12,"./$.global":18,"./$.hide":20,"./$.redef":33}],15:[function(e,t,i){var n=e("./$.is-object"),r=e("./$.global").document,s=n(r)&&n(r.createElement);t.exports=function(e){return s?r.createElement(e):{}}},{"./$.global":18,"./$.is-object":24}],16:[function(e,t,i){t.exports=function(e){try{return!!e()}catch(t){return!0}}},{}],17:[function(e,t,i){var n=e("./$.ctx"),r=e("./$.iter-call"),s=e("./$.is-array-iter"),o=e("./$.an-object"),a=e("./$.to-length"),l=e("./core.get-iterator-method");t.exports=function(e,t,i,u){var c,h,d,p=l(e),f=n(i,u,t?2:1),v=0;if("function"!=typeof p)throw TypeError(e+" is not iterable!");if(s(p))for(c=a(e.length);c>v;v++)t?f(o(h=e[v])[0],h[1]):f(e[v]);else for(d=p.call(e);!(h=d.next()).done;)r(d,f,h.value,t)}},{"./$.an-object":9,"./$.ctx":13,"./$.is-array-iter":23,"./$.iter-call":25,"./$.to-length":44,"./core.get-iterator-method":47}],18:[function(e,t,i){var n="undefined",r=t.exports=typeof window!=n&&window.Math==Math?window:typeof self!=n&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},{}],19:[function(e,t,i){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],20:[function(e,t,i){var n=e("./$"),r=e("./$.property-desc");t.exports=e("./$.support-desc")?function(e,t,i){return n.setDesc(e,t,r(1,i))}:function(e,t,i){return e[t]=i,e}},{"./$":28,"./$.property-desc":32,"./$.support-desc":40}],21:[function(e,t,i){t.exports=e("./$.global").document&&document.documentElement},{"./$.global":18}],22:[function(e,t,i){t.exports=function(e,t,i){var n=void 0===i;switch(t.length){case 0:return n?e():e.call(i);case 1:return n?e(t[0]):e.call(i,t[0]);case 2:return n?e(t[0],t[1]):e.call(i,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(i,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(i,t[0],t[1],t[2],t[3])}return e.apply(i,t)}},{}],23:[function(e,t,i){var n=e("./$.iterators"),r=e("./$.wks")("iterator");t.exports=function(e){return(n.Array||Array.prototype[r])===e}},{"./$.iterators":27,"./$.wks":46}],24:[function(e,t,i){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],25:[function(e,t,i){var n=e("./$.an-object");t.exports=function(e,t,i,r){try{return r?t(n(i)[0],i[1]):t(i)}catch(s){var o=e["return"];throw void 0!==o&&n(o.call(e)),s}}},{"./$.an-object":9}],26:[function(e,t,i){var n=e("./$.wks")("iterator"),r=!1;try{var s=[7][n]();s["return"]=function(){r=!0},Array.from(s,function(){throw 2})}catch(o){}t.exports=function(e){if(!r)return!1;var t=!1;try{var i=[7],s=i[n]();s.next=function(){t=!0},i[n]=function(){return s},e(i)}catch(o){}return t}},{"./$.wks":46}],27:[function(e,t,i){t.exports={}},{}],28:[function(e,t,i){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},{}],29:[function(e,t,i){t.exports=!1},{}],30:[function(e,t,i){var n,r,s,o=e("./$.global"),a=e("./$.task").set,l=o.MutationObserver||o.WebKitMutationObserver,u=o.process,c="process"==e("./$.cof")(u),h=function(){var e,t;for(c&&(e=u.domain)&&(u.domain=null,e.exit());n;)t=n.domain,t&&t.enter(),n.fn.call(),t&&t.exit(),n=n.next;r=void 0,e&&e.enter()};if(c)s=function(){u.nextTick(h)};else if(l){var d=1,p=document.createTextNode("");new l(h).observe(p,{characterData:!0}),s=function(){p.data=d=-d}}else s=function(){a.call(o,h)};t.exports=function(e){var t={fn:e,next:void 0,domain:c&&u.domain};r&&(r.next=t),n||(n=t,s()),r=t}},{"./$.cof":11,"./$.global":18,"./$.task":42}],31:[function(e,t,i){var n=e("./$.redef");t.exports=function(e,t){for(var i in t)n(e,i,t[i]);return e}},{"./$.redef":33}],32:[function(e,t,i){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],33:[function(e,t,i){var n=e("./$.global"),r=e("./$.hide"),s=e("./$.uid")("src"),o="toString",a=Function[o],l=(""+a).split(o);e("./$.core").inspectSource=function(e){return a.call(e)},(t.exports=function(e,t,i,o){"function"==typeof i&&(r(i,s,e[t]?""+e[t]:l.join(String(t))),"name"in i||(i.name=t)),e===n?e[t]=i:(o||delete e[t],r(e,t,i))})(Function.prototype,o,function(){return"function"==typeof this&&this[s]||a.call(this)})},{"./$.core":12,"./$.global":18,"./$.hide":20,"./$.uid":45}],34:[function(e,t,i){t.exports=Object.is||function(e,t){return e===t?0!==e||1/e===1/t:e!=e&&t!=t}},{}],35:[function(e,t,i){var n=e("./$").getDesc,r=e("./$.is-object"),s=e("./$.an-object"),o=function(e,t){if(s(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,i,r){try{r=e("./$.ctx")(Function.call,n(Object.prototype,"__proto__").set,2),r(t,[]),i=!(t instanceof Array)}catch(s){i=!0}return function(e,t){return o(e,t),i?e.__proto__=t:r(e,t),e}}({},!1):void 0),check:o}},{"./$":28,"./$.an-object":9,"./$.ctx":13,"./$.is-object":24}],36:[function(e,t,i){var n=e("./$.global"),r="__core-js_shared__",s=n[r]||(n[r]={});t.exports=function(e){return s[e]||(s[e]={})}},{"./$.global":18}],37:[function(e,t,i){t.exports=Math.sign||function(e){return 0==(e=+e)||e!=e?e:0>e?-1:1}},{}],38:[function(e,t,i){"use strict";var n=e("./$"),r=e("./$.wks")("species");t.exports=function(t){!e("./$.support-desc")||r in t||n.setDesc(t,r,{configurable:!0,get:function(){return this}})}},{"./$":28,"./$.support-desc":40,"./$.wks":46}],39:[function(e,t,i){t.exports=function(e,t,i){if(!(e instanceof t))throw TypeError(i+": use the 'new' operator!");return e}},{}],40:[function(e,t,i){t.exports=!e("./$.fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./$.fails":16}],41:[function(e,t,i){var n=e("./$.has"),r=e("./$.hide"),s=e("./$.wks")("toStringTag");t.exports=function(e,t,i){e&&!n(e=i?e:e.prototype,s)&&r(e,s,t)}},{"./$.has":19,"./$.hide":20,"./$.wks":46}],42:[function(e,t,i){"use strict";var n,r,s,o=e("./$.ctx"),a=e("./$.invoke"),l=e("./$.html"),u=e("./$.dom-create"),c=e("./$.global"),h=c.process,d=c.setImmediate,p=c.clearImmediate,f=c.MessageChannel,v=0,m={},_="onreadystatechange",g=function(){var e=+this;if(m.hasOwnProperty(e)){var t=m[e];delete m[e],t()}},y=function(e){g.call(e.data)};d&&p||(d=function(e){for(var t=[],i=1;arguments.length>i;)t.push(arguments[i++]);return m[++v]=function(){a("function"==typeof e?e:Function(e),t)},n(v),v},p=function(e){delete m[e]},"process"==e("./$.cof")(h)?n=function(e){h.nextTick(o(g,e,1))}:f?(r=new f,s=r.port2,r.port1.onmessage=y,n=o(s.postMessage,s,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(n=function(e){c.postMessage(e+"","*")},c.addEventListener("message",y,!1)):n=_ in u("script")?function(e){l.appendChild(u("script"))[_]=function(){l.removeChild(this),g.call(e)}}:function(e){setTimeout(o(g,e,1),0)}),t.exports={set:d,clear:p}},{"./$.cof":11,"./$.ctx":13,"./$.dom-create":15,"./$.global":18,"./$.html":21,"./$.invoke":22}],43:[function(e,t,i){var n=Math.ceil,r=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},{}],44:[function(e,t,i){var n=e("./$.to-integer"),r=Math.min;t.exports=function(e){return e>0?r(n(e),9007199254740991):0}},{"./$.to-integer":43}],45:[function(e,t,i){var n=0,r=Math.random();t.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},{}],46:[function(e,t,i){var n=e("./$.shared")("wks"),r=e("./$.global").Symbol;t.exports=function(t){return n[t]||(n[t]=r&&r[t]||(r||e("./$.uid"))("Symbol."+t))}},{"./$.global":18,"./$.shared":36,"./$.uid":45}],47:[function(e,t,i){var n=e("./$.classof"),r=e("./$.wks")("iterator"),s=e("./$.iterators");t.exports=e("./$.core").getIteratorMethod=function(e){return void 0!=e?e[r]||e["@@iterator"]||s[n(e)]:void 0}},{"./$.classof":10,"./$.core":12,"./$.iterators":27,"./$.wks":46}],48:[function(e,t,i){var n=e("./$.def");n(n.S,"Math",{sign:e("./$.sign")})},{"./$.def":14,"./$.sign":37}],49:[function(e,t,i){"use strict";var n,r=e("./$"),s=e("./$.library"),o=e("./$.global"),a=e("./$.ctx"),l=e("./$.classof"),u=e("./$.def"),c=e("./$.is-object"),h=e("./$.an-object"),d=e("./$.a-function"),p=e("./$.strict-new"),f=e("./$.for-of"),v=e("./$.set-proto").set,m=e("./$.same"),_=e("./$.species"),g=e("./$.wks")("species"),y=e("./$.uid")("record"),b=e("./$.microtask"),w="Promise",k=o.process,E="process"==l(k),C=o[w],S=function(e){var t=new C(function(){});return e&&(t.constructor=Object),C.resolve(t)===t},T=function(){function t(e){var i=new C(e);return v(i,t.prototype),i}var i=!1;try{if(i=C&&C.resolve&&S(),v(t,C),t.prototype=r.create(C.prototype,{constructor:{value:t}}),t.resolve(5).then(function(){})instanceof t||(i=!1),i&&e("./$.support-desc")){var n=!1;C.resolve(r.setDesc({},"then",{get:function(){n=!0}})),i=n}}catch(s){i=!1}return i}(),O=function(e){return c(e)&&(T?"Promise"==l(e):y in e)},P=function(e,t){return s&&e===C&&t===n?!0:m(e,t)},L=function(e){var t=h(e)[g];return void 0!=t?t:e},A=function(e){var t;return c(e)&&"function"==typeof(t=e.then)?t:!1},x=function(e,t){if(!e.n){e.n=!0;var i=e.c;b(function(){for(var n=e.v,r=1==e.s,s=0,a=function(t){var i,s,o=r?t.ok:t.fail;try{o?(r||(e.h=!0),i=o===!0?n:o(n),i===t.P?t.rej(TypeError("Promise-chain cycle")):(s=A(i))?s.call(i,t.res,t.rej):t.res(i)):t.rej(n)}catch(a){t.rej(a)}};i.length>s;)a(i[s++]);i.length=0,e.n=!1,t&&setTimeout(function(){var t,i,r=e.p;I(r)&&(E?k.emit("unhandledRejection",n,r):(t=o.onunhandledrejection)?t({promise:r,reason:n}):(i=o.console)&&i.error&&i.error("Unhandled promise rejection",n)),e.a=void 0},1)})}},I=function(e){var t,i=e[y],n=i.a||i.c,r=0;if(i.h)return!1;for(;n.length>r;)if(t=n[r++],t.fail||!I(t.P))return!1;return!0},M=function(e){var t=this;t.d||(t.d=!0,t=t.r||t,t.v=e,t.s=2,t.a=t.c.slice(),x(t,!0))},H=function(e){var t,i=this;if(!i.d){i.d=!0,i=i.r||i;try{(t=A(e))?b(function(){var n={r:i,d:!1};try{t.call(e,a(H,n,1),a(M,n,1))}catch(r){M.call(n,r)}}):(i.v=e,i.s=1,x(i,!1))}catch(n){M.call({r:i,d:!1},n)}}};T||(C=function(e){d(e);var t={p:p(this,C,w),c:[],a:void 0,s:0,d:!1,v:void 0,h:!1,n:!1};this[y]=t;try{e(a(H,t,1),a(M,t,1))}catch(i){M.call(t,i)}},e("./$.mix")(C.prototype,{then:function(e,t){var i=h(h(this).constructor)[g],n={ok:"function"==typeof e?e:!0,fail:"function"==typeof t?t:!1},r=n.P=new(void 0!=i?i:C)(function(e,t){n.res=e,n.rej=t});d(n.res),d(n.rej);var s=this[y];return s.c.push(n),s.a&&s.a.push(n),s.s&&x(s,!1),r},"catch":function(e){return this.then(void 0,e)}})),u(u.G+u.W+u.F*!T,{Promise:C}),e("./$.tag")(C,w),_(C),_(n=e("./$.core")[w]),u(u.S+u.F*!T,w,{reject:function(e){return new this(function(t,i){i(e)})}}),u(u.S+u.F*(!T||S(!0)),w,{resolve:function(e){return O(e)&&P(e.constructor,this)?e:new this(function(t){t(e)})}}),u(u.S+u.F*!(T&&e("./$.iter-detect")(function(e){C.all(e)["catch"](function(){})})),w,{all:function(e){var t=L(this),i=[];return new t(function(n,s){f(e,!1,i.push,i);var o=i.length,a=Array(o);o?r.each.call(i,function(e,i){t.resolve(e).then(function(e){a[i]=e,--o||n(a)},s)}):n(a)})},race:function(e){var t=L(this);return new t(function(i,n){f(e,!1,function(e){t.resolve(e).then(i,n)})})}})},{"./$":28,"./$.a-function":8,"./$.an-object":9,"./$.classof":10,"./$.core":12,"./$.ctx":13,"./$.def":14,"./$.for-of":17,"./$.global":18,"./$.is-object":24,"./$.iter-detect":26,"./$.library":29,"./$.microtask":30,"./$.mix":31,"./$.same":34,"./$.set-proto":35,"./$.species":38,"./$.strict-new":39,"./$.support-desc":40,"./$.tag":41,"./$.uid":45,"./$.wks":46}],50:[function(e,t,i){/*!
Copyright (C) 2014-2015 by WebReflection
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
!function(e,t,i,n){"use strict";function r(e,t){for(var i=0,n=e.length;n>i;i++)v(e[i],t)}function s(e){for(var t,i=0,n=e.length;n>i;i++)t=e[i],k(t,N[a(t)])}function o(e){return function(t){ie(t)&&(v(t,e),r(t.querySelectorAll(V),e))}}function a(e){var t=e.getAttribute("is"),i=e.nodeName.toUpperCase(),n=j.call(F,t?H+t.toUpperCase():M+i);return t&&n>-1&&!l(i,t)?-1:n}function l(e,t){return-1<V.indexOf(e+'[is="'+t+'"]')}function u(e){var t=e.currentTarget,i=e.attrChange,n=e.attrName,r=e.target;!fe||r&&r!==t||!t.attributeChangedCallback||"style"===n||t.attributeChangedCallback(n,i===e[O]?null:e.prevValue,i===e[L]?null:e.newValue)}function c(e){var t=o(e);return function(e){m.push(t,e.target)}}function h(e){pe&&(pe=!1,e.currentTarget.removeEventListener(x,h)),r((e.target||t).querySelectorAll(V),e.detail===S?S:C),te&&f()}function d(e,t){var i=this;se.call(i,e,t),_.call(i,{target:i})}function p(e,t){Z(e,t),b?b.observe(e,le):(de&&(e.setAttribute=d,e[E]=y(e),e.addEventListener(I,_)),e.addEventListener(A,u)),e.createdCallback&&fe&&(e.created=!0,e.createdCallback(),e.created=!1)}function f(){for(var e,t=0,i=ne.length;i>t;t++)e=ne[t],$.contains(e)||(ne.splice(t,1),v(e,S))}function v(e,t){var i,n=a(e);n>-1&&(w(e,N[n]),n=0,t!==C||e[C]?t!==S||e[S]||(e[C]=!1,e[S]=!0,n=1):(e[S]=!1,e[C]=!0,n=1,te&&j.call(ne,e)<0&&ne.push(e)),n&&(i=e[t+"Callback"])&&i.call(e))}if(!(n in t)){var m,_,g,y,b,w,k,E="__"+n+(1e5*Math.random()>>0),C="attached",S="detached",T="extends",O="ADDITION",P="MODIFICATION",L="REMOVAL",A="DOMAttrModified",x="DOMContentLoaded",I="DOMSubtreeModified",M="<",H="=",R=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,D=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],F=[],N=[],V="",$=t.documentElement,j=F.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},U=i.prototype,B=U.hasOwnProperty,z=U.isPrototypeOf,q=i.defineProperty,W=i.getOwnPropertyDescriptor,Y=i.getOwnPropertyNames,Q=i.getPrototypeOf,X=i.setPrototypeOf,G=!!i.__proto__,K=i.create||function ve(e){return e?(ve.prototype=e,new ve):this},Z=X||(G?function(e,t){return e.__proto__=t,e}:Y&&W?function(){function e(e,t){for(var i,n=Y(t),r=0,s=n.length;s>r;r++)i=n[r],B.call(e,i)||q(e,i,W(t,i))}return function(t,i){do e(t,i);while((i=Q(i))&&!z.call(i,t));return t}}():function(e,t){for(var i in t)e[i]=t[i];return e}),J=e.MutationObserver||e.WebKitMutationObserver,ee=(e.HTMLElement||e.Element||e.Node).prototype,te=!z.call(ee,$),ie=te?function(e){return 1===e.nodeType}:function(e){return z.call(ee,e)},ne=te&&[],re=ee.cloneNode,se=ee.setAttribute,oe=ee.removeAttribute,ae=t.createElement,le=J&&{attributes:!0,characterData:!0,attributeOldValue:!0},ue=J||function(e){de=!1,$.removeEventListener(A,ue)},ce=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,10)},he=!1,de=!0,pe=!0,fe=!0;X||G?(w=function(e,t){z.call(t,e)||p(e,t)},k=p):(w=function(e,t){e[E]||(e[E]=i(!0),p(e,t))},k=w),te?(de=!1,function(){var e=W(ee,"addEventListener"),t=e.value,i=function(e){var t=new CustomEvent(A,{bubbles:!0});t.attrName=e,t.prevValue=this.getAttribute(e),t.newValue=null,t[L]=t.attrChange=2,oe.call(this,e),this.dispatchEvent(t)},n=function(e,t){var i=this.hasAttribute(e),n=i&&this.getAttribute(e),r=new CustomEvent(A,{bubbles:!0});se.call(this,e,t),r.attrName=e,r.prevValue=i?n:null,r.newValue=t,i?r[P]=r.attrChange=1:r[O]=r.attrChange=0,this.dispatchEvent(r)},r=function(e){var t,i=e.currentTarget,n=i[E],r=e.propertyName;n.hasOwnProperty(r)&&(n=n[r],t=new CustomEvent(A,{bubbles:!0}),t.attrName=n.name,t.prevValue=n.value||null,t.newValue=n.value=i[r]||null,null==t.prevValue?t[O]=t.attrChange=0:t[P]=t.attrChange=1,i.dispatchEvent(t))};e.value=function(e,s,o){e===A&&this.attributeChangedCallback&&this.setAttribute!==n&&(this[E]={className:{name:"class",value:this.className}},this.setAttribute=n,this.removeAttribute=i,t.call(this,"propertychange",r)),t.call(this,e,s,o)},q(ee,"addEventListener",e)}()):J||($.addEventListener(A,ue),$.setAttribute(E,1),$.removeAttribute(E),de&&(_=function(e){var t,i,n,r=this;if(r===e.target){t=r[E],r[E]=i=y(r);for(n in i){if(!(n in t))return g(0,r,n,t[n],i[n],O);if(i[n]!==t[n])return g(1,r,n,t[n],i[n],P)}for(n in t)if(!(n in i))return g(2,r,n,t[n],i[n],L)}},g=function(e,t,i,n,r,s){var o={attrChange:e,currentTarget:t,attrName:i,prevValue:n,newValue:r};o[s]=e,u(o)},y=function(e){for(var t,i,n={},r=e.attributes,s=0,o=r.length;o>s;s++)t=r[s],i=t.name,"setAttribute"!==i&&(n[i]=t.value);return n})),t[n]=function(e,i){if(n=e.toUpperCase(),he||(he=!0,J?(b=function(e,t){function i(e,t){for(var i=0,n=e.length;n>i;t(e[i++]));}return new J(function(n){for(var r,s,o=0,a=n.length;a>o;o++)r=n[o],"childList"===r.type?(i(r.addedNodes,e),i(r.removedNodes,t)):(s=r.target,fe&&s.attributeChangedCallback&&"style"!==r.attributeName&&s.attributeChangedCallback(r.attributeName,r.oldValue,s.getAttribute(r.attributeName)))})}(o(C),o(S)),b.observe(t,{childList:!0,subtree:!0})):(m=[],ce(function _(){for(;m.length;)m.shift().call(null,m.shift());ce(_)}),t.addEventListener("DOMNodeInserted",c(C)),t.addEventListener("DOMNodeRemoved",c(S))),t.addEventListener(x,h),t.addEventListener("readystatechange",h),t.createElement=function(e,i){var n=ae.apply(t,arguments),r=""+e,s=j.call(F,(i?H:M)+(i||r).toUpperCase()),o=s>-1;return i&&(n.setAttribute("is",i=i.toLowerCase()),o&&(o=l(r.toUpperCase(),i))),fe=!t.createElement.innerHTMLHelper,o&&k(n,N[s]),n},ee.cloneNode=function(e){var t=re.call(this,!!e),i=a(t);return i>-1&&k(t,N[i]),e&&s(t.querySelectorAll(V)),t}),-2<j.call(F,H+n)+j.call(F,M+n))throw new Error("A "+e+" type is already registered");if(!R.test(n)||-1<j.call(D,n))throw new Error("The type "+e+" is invalid");var n,u=function(){return p?t.createElement(f,n):t.createElement(f)},d=i||U,p=B.call(d,T),f=p?i[T].toUpperCase():n,v=F.push((p?H:M)+n)-1;return V=V.concat(V.length?",":"",p?f+'[is="'+e.toLowerCase()+'"]':f),u.prototype=N[v]=B.call(d,"prototype")?d.prototype:K(ee),r(t.querySelectorAll(V),C),u}}}(window,document,Object,"registerElement")},{}],51:[function(e,t,i){function n(e,t,i){var n=t.getAttribute("width"),r=t.getAttribute("height"),s=i||t.getAttribute("type");(0,p.assert)(s,"Attribute type required for <amp-ad>: %s",t);var o={};l(t,o),o.width=(0,f.getLengthNumeral)(n),o.height=(0,f.getLengthNumeral)(r);var a=t.getLayoutBox();o.initialWindowWidth=a.width,o.initialWindowHeight=a.height,o.type=s;var u=(0,m.documentInfoFor)(e);o._context={referrer:e.document.referrer,canonicalUrl:u.canonicalUrl,pageViewId:u.pageViewId,location:{href:e.location.href},mode:(0,_.getMode)()};var c=t.getAttribute("src");return c&&(o.src=c),o}function r(e,t,i){var r=n(e,t,i),s=document.createElement("iframe");w[r.type]||(w[r.type]=0),s.name="frame_"+r.type+"_"+w[r.type]++;var o=c(e)+"#"+JSON.stringify(r);return s.src=o,s.ampLocation=(0,b.parseUrl)(o),s.width=r.width,s.height=r.height,s.style.border="none",s.setAttribute("scrolling","no"),s.onload=function(){this.readyState="complete"},s}function s(e,t,i){var n=e.ownerDocument.defaultView,r=e.ampLocation.origin,s=function(n){n.origin==r&&n.source==e.contentWindow&&n.data&&"amp-3p"==n.data.sentinel&&n.data.type==t&&i(n.data)};return n.addEventListener("message",s),function(){n.removeEventListener("message",s)}}function o(e,t,i){var n=s(e,t,function(e){return n(),i(e)});return n}function a(e,t,i){i.type=t,i.sentinel="amp-3p",e.contentWindow.postMessage(i,e.ampLocation.origin)}function l(e,t){for(var i=0;i<e.attributes.length;i++){var n=e.attributes[i];0==n.name.indexOf("data-")&&(t[(0,y.dashToCamelCase)(n.name.substr(5))]=n.value)}var r=e.getAttribute("json");if(r){var s=void 0;try{s=JSON.parse(r)}catch(o){(0,p.assert)(!1,"Error parsing JSON in json attribute in element %s",e)}for(var a in s)t[a]=s[a]}}function u(e){var t=c(e),i=(0,g.preconnectFor)(e);i.prefetch(t),i.prefetch("https://3p.ampproject.net/1450396666888/f.js")}function c(e){return(0,v.getService)(window,"bootstrapBaseUrl",function(){return d(e)||h(e)})}function h(e){var t="https://3p.ampproject.net/1450396666888/frame.html";return(0,_.getMode)().localDev&&(t="http://ads.localhost:"+e.location.port+"/dist.3p/current"+((0,_.getMode)().minified?"-min/frame":"/frame.max")+".html"),t}function d(e){var t=e.document.querySelector('meta[name="amp-3p-iframe-src"]');if(!t)return null;var i=(0,b.assertHttpsUrl)(t.getAttribute("content"),t);return(0,p.assert)(-1==i.indexOf("?"),"3p iframe url must not include query string %s in element %s.",i,t),(0,p.assert)((0,b.parseUrl)(i).origin!=(0,b.parseUrl)(e.location.href).origin,"3p iframe url must not be on the same origin as the current document %s in element %s.",i,t),i+"?1450396666888"}Object.defineProperty(i,"__esModule",{value:!0}),i.getIframe=r,i.listen=s,i.listenOnce=o,i.postMessage=a,i.addDataAndJsonAttributes_=l,i.prefetchBootstrap=u,i.getBootstrapBaseUrl=c;var p=e("./asserts"),f=e("../src/layout"),v=e("./service"),m=e("./document-info"),_=e("./mode"),g=e("./preconnect"),y=e("./string"),b=e("./url"),w={}},{"../src/layout":74,"./asserts":54,"./document-info":61,"./mode":77,"./preconnect":83,"./service":87,"./string":91,"./url":97}],52:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n=e("./log"),r=(e("./platform"),e("./timer"),"Action"),s="__AMP_ACTION_MAP__"+Math.random(),o="activate",a=function c(e,t,i,n){babelHelpers.classCallCheck(this,c),this.target=e,this.method=t,this.source=i,this.event=n},l=function(){function e(t){babelHelpers.classCallCheck(this,e),this.win=t}return babelHelpers.createClass(e,[{key:"addEvent",value:function(e){var t=this;"tap"==e&&this.win.document.addEventListener("click",function(e){e.defaultPrevented||t.trigger(e.target,"tap",e)})}},{key:"trigger",value:function(e,t,i){this.action_(e,t,i)}},{key:"execute",value:function(e,t,i,n){this.invoke_(e,t,i,n,null)}},{key:"action_",value:function(e,t,i){var n=this.findAction_(e,t);if(n){var r=document.getElementById(n.actionInfo.target);return r?void this.invoke_(r,n.actionInfo.method,n.node,i,n.actionInfo):void this.actionInfoError_("target not found",n.actionInfo,r)}}},{key:"actionInfoError_",value:function(e,t,i){throw new Error("Action Error: "+e+(t?" in ["+t.str+"]":"")+(i?" on ["+i+"]":""))}},{key:"invoke_",value:function(e,t,i,n,r){var s=new a(e,t,i,n);return"amp-"!=e.tagName.toLowerCase().substring(0,4)?void this.actionInfoError_("Target must be an AMP element",r,e):e.enqueAction?void e.enqueAction(s):void this.actionInfoError_('Unrecognized AMP element "'+e.tagName.toLowerCase()+'". Did you forget to include it via <script custom-element>?',r,e)}},{key:"findAction_",value:function(e,t){for(var i=e,n=null;i;){if(n=this.matchActionInfo_(i,t))return{node:i,actionInfo:n};i=i.parentElement}return null}},{key:"matchActionInfo_",value:function(e,t){var i=this.getActionMap_(e);return i?i[t]||null:null}},{key:"getActionMap_",value:function(e){var t=e[s];return void 0===t&&(t=null,e.hasAttribute("on")&&(t=this.parseActionMap_(e.getAttribute("on"))),e[s]=t),t}},{key:"parseActionMap_",value:function(e){var t=null,i=e.split(";");if(i&&i.length>0)for(var n=0;n<i.length;n++){var r=i[n],s=this.parseAction_(r);s&&(t||(t={}),t[s.event]=s)}return t}},{key:"parseAction_",value:function(e){if(e=e.trim(),!e)return null;var t=e.indexOf(":"),i=e.indexOf(".",t+1),s=(-1!=t?e.substring(0,t):"").toLowerCase().trim()||null,a=e.substring(t+1,-1!=i?i:e.length).trim(),l=(-1!=i?e.substring(i+1):"").trim()||o;return s&&a?{event:s,target:a,method:l,str:e}:(n.log.error(r,"invalid action definition: "+e),null)}}]),e}();i.Action=l;var u=new l(window);i.action=u},{"./log":76,"./platform":81,"./timer":95}],53:[function(e,t,i){e("./polyfills");var n=e("./service/history-impl"),r=e("./pull-to-refresh"),s=e("./performance"),o=e("./viewer"),a=e("./vsync"),l=e("./template"),u=e("../builtins/amp-ad"),c=e("./document-click"),h=e("../builtins/amp-img"),d=e("../builtins/amp-video"),p=e("../builtins/amp-pixel"),f=e("./styles"),v=e("./error"),m=e("./custom-element"),_=e("./runtime"),g=e("../build/css.js"),y=e("./action"),b=e("./validator-integration");try{!function(){(0,v.installErrorReporting)(window);var e=(0,s.performanceFor)(window);e.tick("is"),(0,f.installStyles)(document,g.cssText,function(){try{(0,n.installHistoryService)(window),(0,o.viewerFor)(window),(0,a.vsyncFor)(window),(0,l.templatesFor)(window),(0,h.installImg)(window),(0,u.installAd)(window),(0,p.installPixel)(window),(0,d.installVideo)(window),(0,_.adopt)(window),(0,m.stubElements)(window),y.action.addEvent("tap"),(0,r.installPullToRefreshBlocker)(window),(0,c.installGlobalClickListener)(window),(0,b.maybeValidate)(window)}finally{(0,f.makeBodyVisible)(document),e.tick("e_is"),e.flush()}},!0)}()}catch(w){throw(0,f.makeBodyVisible)(document),w}window.console&&(console.info||console.log).call(console,"Powered by AMP ⚡ HTML Version 1450396666888"),document.documentElement.setAttribute("amp-version","1450396666888")},{"../build/css.js":2,"../builtins/amp-ad":3,"../builtins/amp-img":4,"../builtins/amp-pixel":5,"../builtins/amp-video":6,"./action":52,"./custom-element":59,"./document-click":60,"./error":65,"./performance":80,"./polyfills":82,"./pull-to-refresh":84,"./runtime":86,"./service/history-impl":88,"./styles":93,"./template":94,"./validator-integration":98,"./viewer":99,"./vsync":101}],54:[function(e,t,i){function n(e,t,i){var n=void 0;if(!e){t=t||"Assertion failed";var o=t.split("%s"),a=o.shift(),l=a,u=[];s(u,a);for(var c=2;c<arguments.length;c++){var h=arguments[c];h&&h.tagName&&(n=h);var d=o.shift();u.push(h),s(u,d.trim()),l+=r(h)+d}var p=new Error(l);throw p.fromAssert=!0,p.associatedElement=n,p.messageArray=u,p}return e}function r(e){return e instanceof Element?e.tagName.toLowerCase()+(e.id?"#"+e.id:""):e}function s(e,t){""!=t&&e.push(t)}Object.defineProperty(i,"__esModule",{value:!0}),i.assert=n},{}],55:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n=e("./layout"),r=(e("./asserts"),e("./preconnect")),s=e("./resources"),o=e("./viewer"),a=e("./viewport"),l=e("./vsync"),u=function(){function e(t){babelHelpers.classCallCheck(this,e),this.element=t,this.layout_=n.Layout.NODISPLAY,this.layoutWidth_=-1,this.inViewport_=!1,this.actionMap_=this.getWin().Object.create(null),this.preconnect=(0,r.preconnectFor)(this.getWin()),this.resources_=(0,s.resourcesFor)(this.getWin())}return babelHelpers.createClass(e,[{key:"getLayout",value:function(){return this.layout_}},{key:"getWin",value:function(){return this.element.ownerDocument.defaultView}},{key:"getVsync",value:function(){return(0,l.vsyncFor)(this.getWin())}},{key:"getLayoutWidth",value:function(){return this.layoutWidth_}},{key:"isLayoutSupported",value:function(e){return e==n.Layout.NODISPLAY}},{key:"isInViewport",value:function(){return this.inViewport_}},{key:"createdCallback",value:function(){}},{key:"firstAttachedCallback",value:function(){}},{key:"isReadyToBuild",value:function(){return!0}},{key:"buildCallback",value:function(){}},{key:"preconnectCallback",value:function(){}},{key:"setAsOwner",value:function(e){this.resources_.setOwner(e,this.element)}},{key:"prerenderAllowed",value:function(){return!1}},{key:"renderOutsideViewport",value:function(){return!0}},{key:"isRelayoutNeeded",value:function(){return!1}},{key:"layoutCallback",value:function(){return Promise.resolve()}},{key:"firstLayoutCompleted",value:function(){this.togglePlaceholder(!1)}},{key:"viewportCallback",value:function(e){}},{key:"documentInactiveCallback",value:function(){return!1}},{key:"activate",value:function(e){}},{key:"registerAction",value:function(e,t){this.actionMap_[e]=t}},{key:"executeAction",value:function(e,t){if("activate"==e.method)this.activate(e);else{var i=this.actionMap_[e.method];if(!i)throw new Error("Method not found: "+e.method);i(e)}}},{key:"getMaxDpr",value:function(){return this.resources_.getMaxDpr()}},{key:"getDpr",value:function(){return this.resources_.getDpr()}},{key:"propagateAttributes",value:function(e,t){for(var i=0;i<e.length;i++){var n=e[i];this.element.hasAttribute(n)&&t.setAttribute(n,this.element.getAttribute(n))}}},{key:"getPlaceholder",value:function(){return this.element.getPlaceholder()}},{key:"togglePlaceholder",value:function(e){this.element.togglePlaceholder(e)}},{key:"getFallback",value:function(){return this.element.getFallback()}},{key:"toggleFallback",value:function(e){this.element.toggleFallback(e)}},{key:"getOverflowElement",value:function(){return this.element.getOverflowElement()}},{key:"getRealChildNodes",value:function(){return this.element.getRealChildNodes()}},{key:"getRealChildren",value:function(){return this.element.getRealChildren()}},{key:"applyFillContent",value:function(e,t){e.classList.add("-amp-fill-content"),t&&e.classList.add("-amp-replaced-content")}},{key:"getViewport",value:function(){return(0,a.viewportFor)(this.getWin())}},{key:"scheduleLayout",value:function(e){this.resources_.scheduleLayout(this.element,e)}},{key:"schedulePreload",value:function(e){this.resources_.schedulePreload(this.element,e)}},{key:"updateInViewport",value:function(e,t){this.resources_.updateInViewport(this.element,e,t)}},{key:"changeHeight",value:function(e){this.resources_.changeHeight(this.element,e)}},{key:"requestChangeHeight",value:function(e){this.resources_.requestChangeHeight(this.element,e)}},{key:"deferMutate",value:function(e){this.resources_.deferMutate(this.element,e)}},{key:"requestFullOverlay",value:function(){(0,o.viewerFor)(this.getWin()).requestFullOverlay()}},{key:"cancelFullOverlay",value:function(){(0,o.viewerFor)(this.getWin()).cancelFullOverlay()}},{key:"onLayoutMeasure",value:function(){}}]),e}();i.BaseElement=u},{"./asserts":54,"./layout":74,"./preconnect":83,"./resources":85,"./viewer":99,"./viewport":100,"./vsync":101}],56:[function(e,t,i){function n(e){return(0,r.getElementService)(e,"cid","amp-analytics")}Object.defineProperty(i,"__esModule",{value:!0}),i.cidFor=n;var r=e("./service")},{"./service":87}],57:[function(e,t,i){function n(e,t){var i=e.document.cookie;if(!i)return null;for(var n=i.split(";"),r=0;r<n.length;r++){var s=n[r].trim(),o=s.indexOf("=");if(-1!=o&&decodeURIComponent(s.substring(0,o).trim())==t)return decodeURIComponent(s.substring(o+1).trim())}return null}function r(e,t,i,n){e.document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(i)+"; path=/; expires="+new Date(n).toUTCString()}Object.defineProperty(i,"__esModule",{value:!0}),i.getCookie=n,i.setCookie=r},{}],58:[function(e,t,i){e("core-js/modules/es6.math.sign"),e("core-js/modules/es6.promise"),t.exports=e("core-js/modules/$.core")},{"core-js/modules/$.core":12,"core-js/modules/es6.math.sign":48,"core-js/modules/es6.promise":49}],59:[function(e,t,i){function n(e,t,i){if(!C[t])return void l(e,t,i);(0,h.assert)(C[t]==c.ElementStub,"Expected "+t+" to be an ElementStub.");for(var n=0;n<c.stubbedElements.length;n++){var r=c.stubbedElements[n],s=r.element;if(s.tagName.toLowerCase()==t)try{s.upgrade(i)}catch(o){(0,v.reportError)(o,this)}}}function r(e){e.ampExtendedElements={};for(var t=e.document.querySelectorAll("[custom-element]"),i=0;i<t.length;i++){var n=t[i].getAttribute("custom-element");e.ampExtendedElements[n]=!0,C[n]||l(e,n,c.ElementStub)}}function s(e){var t=e.getAttribute("layout"),i=e.getAttribute("width"),n=e.getAttribute("height"),r=e.getAttribute("sizes"),s=t?(0,u.parseLayout)(t):null;(0,h.assert)(void 0!==s,"Unknown layout: %s",t);var o=i&&"auto"!=i?(0,u.parseLength)(i):i;(0,h.assert)(void 0!==o,"Invalid width value: %s",i);var a=n?(0,u.parseLength)(n):null;(0,h.assert)(void 0!==a,"Invalid height value: %s",n);var l=void 0,c=void 0,d=void 0;if(s&&s!=u.Layout.FIXED&&s!=u.Layout.FIXED_HEIGHT||o&&a||!(0,u.hasNaturalDimensions)(e.tagName))l=o,c=a;else{var p=(0,u.getNaturalDimensions)(e.tagName);l=o||s==u.Layout.FIXED_HEIGHT?o:p.width,c=a||p.height}if(d=s?s:l||c?!c||l&&"auto"!=l?c&&l&&r?u.Layout.RESPONSIVE:u.Layout.FIXED:u.Layout.FIXED_HEIGHT:u.Layout.CONTAINER,(d==u.Layout.FIXED||d==u.Layout.FIXED_HEIGHT||d==u.Layout.RESPONSIVE)&&(0,h.assert)(c,"Expected height to be available: %s",n),d==u.Layout.FIXED_HEIGHT&&(0,h.assert)(!l||"auto"==l,'Expected width to be either absent or equal "auto" for fixed-height layout: %s',i),(d==u.Layout.FIXED||d==u.Layout.RESPONSIVE)&&(0,h.assert)(l&&"auto"!=l,'Expected width to be available and not equal to "auto": %s',i),d==u.Layout.RESPONSIVE&&(0,h.assert)((0,u.getLengthUnits)(l)==(0,u.getLengthUnits)(c),"Length units should be the same for width and height: %s, %s",i,n),e.classList.add((0,u.getLayoutClass)(d)),(0,u.isLayoutSizeDefined)(d)&&e.classList.add("-amp-layout-size-defined"),d==u.Layout.NODISPLAY)e.style.display="none";else if(d==u.Layout.FIXED)e.style.width=l,e.style.height=c;else if(d==u.Layout.FIXED_HEIGHT)e.style.height=c;else if(d==u.Layout.RESPONSIVE){var f=e.ownerDocument.createElement("i-amp-sizer");f.style.display="block",f.style.paddingTop=(0,u.getLengthNumeral)(c)/(0,u.getLengthNumeral)(l)*100+"%",e.insertBefore(f,e.firstChild),e.sizerElement_=f}else d==u.Layout.FILL||d==u.Layout.CONTAINER;return d}function o(e){return(0,u.isInternalElement)(e)?!0:e.tagName&&(e.hasAttribute("placeholder")||e.hasAttribute("fallback")||e.hasAttribute("overflow"))?!0:!1}function a(e,t,i){var n=e.Object.create(e.HTMLElement.prototype);return n.createdCallback=function(){this.classList.add("-amp-element"),this.built_=!1,this.classList.add("-amp-notbuilt"),this.classList.add("amp-notbuilt"),this.readyState="loading",this.everAttached=!1,this.resources_=(0,m.resourcesFor)(e),this.layout_=u.Layout.NODISPLAY,this.layoutWidth_=-1,this.layoutCount_=0,this.isInViewport_=!1,this.mediaQuery_,this.sizeList_,this.sizerElement_=null,this.loadingDisabled_,this.loadingState_,this.loadingContainer_=null,this.loadingElement_=null,this.overflowElement_,this.implementation_=new i(this),this.implementation_.createdCallback(),this.actionQueue_=[],this.isInTemplate_},n.assertNotTemplate_=function(){(0,h.assert)(!this.isInTemplate_,"Must never be called in template")},n.isUpgraded=function(){return!(this.implementation_ instanceof c.ElementStub)},n.upgrade=function(e){if(!this.isInTemplate_){this.implementation_;if(this.implementation_=new e(this),this.classList.remove("amp-unresolved"),this.classList.remove("-amp-unresolved"),this.implementation_.createdCallback(),this.layout_!=u.Layout.NODISPLAY&&!this.implementation_.isLayoutSupported(this.layout_))throw new Error("Layout not supported: "+this.layout_);this.implementation_.layout_=this.layout_,this.implementation_.layoutWidth_=this.layoutWidth_,this.everAttached&&(this.implementation_.firstAttachedCallback(),this.dispatchCustomEvent("amp:attached")),this.resources_.upgraded(this)}},n.isBuilt=function(){return this.built_},n.build=function(e){if(this.assertNotTemplate_(),this.isBuilt())return!0;if((0,h.assert)(this.isUpgraded(),"Cannot build unupgraded element"),!e&&!this.implementation_.isReadyToBuild())return!1;try{this.implementation_.buildCallback(),this.preconnect(!1),this.built_=!0,this.classList.remove("-amp-notbuilt"),this.classList.remove("amp-notbuilt")}catch(t){throw(0,v.reportError)(t,this),t}return this.built_&&this.isInViewport_&&this.updateInViewport_(!0),this.actionQueue_&&(this.actionQueue_.length>0?_.timer.delay(this.dequeueActions_.bind(this),1):this.actionQueue_=null),!0},n.preconnect=function(e){this.implementation_.preconnectCallback(e)},n.getVsync_=function(){return(0,g.vsyncFor)(this.ownerDocument.defaultView)},n.updateLayoutBox=function(e){var t=this;this.layoutWidth_=e.width,this.isUpgraded()&&(this.implementation_.layoutWidth_=this.layoutWidth_),this.implementation_.onLayoutMeasure(),this.isLoadingEnabled_()&&(this.isInViewport_?this.toggleLoading_(!0):e.top<E&&e.top>=0&&this.getVsync_().mutate(function(){t.prepareLoading_()}))},n.applySizesAndMediaQuery=function(){if(this.assertNotTemplate_(),void 0===this.mediaQuery_&&(this.mediaQuery_=this.getAttribute("media")||null),this.mediaQuery_&&this.classList.toggle("-amp-hidden-by-media-query",!this.ownerDocument.defaultView.matchMedia(this.mediaQuery_).matches),void 0===this.sizeList_){var e=this.getAttribute("sizes");this.sizeList_=e?(0,f.parseSizeList)(e):null}this.sizeList_&&(this.style.width=(0,u.assertLength)(this.sizeList_.select(this.ownerDocument.defaultView)))},n.changeHeight=function(e){this.sizerElement_&&(this.sizerElement_.style.paddingTop="0"),this.style.height=e+"px"},n.attachedCallback=function(){if(S||(this.isInTemplate_=!!b.closestByTag(this,"template")),!this.isInTemplate_){if(!this.everAttached){this.everAttached=!0;try{this.firstAttachedCallback_()}catch(e){(0,v.reportError)(e,this)}}this.resources_.add(this)}},n.detachedCallback=function(){this.isInTemplate_||this.resources_.remove(this)},n.firstAttachedCallback_=function(){this.isUpgraded()||(this.classList.add("amp-unresolved"),this.classList.add("-amp-unresolved"));try{if(this.layout_=s(this),this.layout_!=u.Layout.NODISPLAY&&!this.implementation_.isLayoutSupported(this.layout_))throw new Error("Layout not supported for: "+this.layout_);this.implementation_.layout_=this.layout_,this.implementation_.firstAttachedCallback()}catch(e){throw(0,v.reportError)(e,this),e}this.isUpgraded()?this.dispatchCustomEvent("amp:attached"):this.dispatchCustomEvent("amp:stubbed")},n.dispatchCustomEvent=function(e,t){var i=t||{},n=(this.ownerDocument.defaultView,document.createEvent("Event"));n.data=i,n.initEvent(e,!0,!0),this.dispatchEvent(n)},n.prerenderAllowed=function(){return this.implementation_.prerenderAllowed()},n.renderOutsideViewport=function(){return this.implementation_.renderOutsideViewport()},n.getLayoutBox=function(){return this.resources_.getResourceForElement(this).getLayoutBox()},n.isRelayoutNeeded=function(){return this.implementation_.isRelayoutNeeded()},n.layoutCallback=function(){var e=this;this.assertNotTemplate_(),(0,h.assert)(this.isUpgraded()&&this.isBuilt(),"Must be upgraded and built to receive viewport events"),this.dispatchCustomEvent("amp:load:start");var t=this.implementation_.layoutCallback();return this.preconnect(!0),this.classList.add("-amp-layout"),t.then(function(){e.readyState="complete",e.layoutCount_++,e.toggleLoading_(!1,!0),1==e.layoutCount_&&e.implementation_.firstLayoutCompleted()},function(t){return e.toggleLoading_(!1,!0),Promise.reject(t)})},n.viewportCallback=function(e){var t=this;this.assertNotTemplate_(),this.isInViewport_=e,0==this.layoutCount_&&(e?_.timer.delay(function(){0==t.layoutCount_&&t.isInViewport_&&t.toggleLoading_(!0)},100):this.toggleLoading_(!1)),this.isUpgraded()&&this.isBuilt()&&this.updateInViewport_(e)},n.updateInViewport_=function(e){this.implementation_.inViewport_=e,this.implementation_.viewportCallback(e)},n.documentInactiveCallback=function(){return this.assertNotTemplate_(),this.isBuilt()&&this.isUpgraded()?this.implementation_.documentInactiveCallback():!1},n.enqueAction=function(e){this.assertNotTemplate_(),this.isBuilt()?this.executionAction_(e,!1):(0,h.assert)(this.actionQueue_).push(e)},n.dequeueActions_=function(){var e=this;if(this.actionQueue_){var t=(0,h.assert)(this.actionQueue_);this.actionQueue_=null,t.forEach(function(t){e.executionAction_(t,!0)})}},n.executionAction_=function(e,t){try{this.implementation_.executeAction(e,t)}catch(i){p.log.error(w,"Action execution failed:",e,i)}},n.getRealChildNodes=function(){for(var e=[],t=this.firstChild;t;t=t.nextSibling)o(t)||e.push(t);return e},n.getRealChildren=function(){for(var e=[],t=0;t<this.children.length;t++){var i=this.children[t];o(i)||e.push(i)}return e},n.getPlaceholder=function(){return b.childElementByAttr(this,"placeholder")},n.togglePlaceholder=function(e){this.assertNotTemplate_();var t=this.getPlaceholder();t&&t.classList.toggle("amp-hidden",!e)},n.getFallback=function(){return b.childElementByAttr(this,"fallback")},n.toggleFallback=function(e){this.assertNotTemplate_(),this.classList.toggle("amp-notsupported",e)},n.isLoadingEnabled_=function(){return void 0===this.loadingDisabled_&&(this.loadingDisabled_=this.hasAttribute("noloading")),this.loadingDisabled_||!(0,u.isLoadingAllowed)(this.tagName)||this.layoutWidth_<k||this.layoutCount_>0||o(this)||!(0,u.isLayoutSizeDefined)(this.layout_)?!1:!0},n.prepareLoading_=function(){if(!this.loadingContainer_){var e=document.createElement("div");e.classList.add("-amp-loading-container"),e.classList.add("-amp-fill-content"),e.classList.add("amp-hidden");var t=(0,d.createLoaderElement)();e.appendChild(t),this.appendChild(e),this.loadingContainer_=e,this.loadingElement_=t}},n.toggleLoading_=function(e,t){var i=this;return this.assertNotTemplate_(),this.loadingState_=e,e||this.loadingContainer_?e&&!this.isLoadingEnabled_()?void(this.loadingState_=!1):void this.getVsync_().mutate(function(){var e=i.loadingState_;e&&!i.isLoadingEnabled_()&&(e=!1),e&&i.prepareLoading_(),i.loadingContainer_&&(i.loadingContainer_.classList.toggle("amp-hidden",!e),i.loadingElement_.classList.toggle("amp-active",e),!e&&t&&!function(){var e=i.loadingContainer_;i.loadingContainer_=null,i.loadingElement_=null,i.resources_.deferMutate(i,function(){b.removeElement(e)})}())}):void 0},n.getOverflowElement=function(){return void 0===this.overflowElement_&&(this.overflowElement_=b.childElementByAttr(this,"overflow"),this.overflowElement_&&(this.overflowElement_.hasAttribute("tabindex")||this.overflowElement_.setAttribute("tabindex","0"),this.overflowElement_.hasAttribute("role")||this.overflowElement_.setAttribute("role","button"))),this.overflowElement_},n.overflowCallback=function(e,t){var i=this;if(e||this.overflowElement_){var n=this.getOverflowElement();if(!n)return void(e&&p.log.warn(w,"Cannot resize element and overlfow is not available",this));n.classList.toggle("amp-visible",e),e?this.overflowElement_.onclick=function(){i.resources_.changeHeight(i,t),i.getVsync_().mutate(function(){i.overflowCallback(!1,t)})}:this.overflowElement_.onclick=null}},n}function l(e,t,i){C[t]=i,e.document.registerElement(t,{prototype:a(e,t,i)})}Object.defineProperty(i,"__esModule",{value:!0}),i.upgradeOrRegisterElement=n,i.stubElements=r,i.applyLayout_=s,i.createAmpElementProto=a,i.registerElement=l;var u=e("./layout"),c=e("./element-stub"),h=e("./asserts"),d=e("../src/loader"),p=e("./log"),f=e("./size-list"),v=e("./error"),m=e("./resources"),_=e("./timer"),g=e("./vsync"),y=e("./dom"),b=babelHelpers.interopRequireWildcard(y),w="CustomElement",k=100,E=1e3,C={},S="content"in document.createElement("template")},{"../src/loader":75,"./asserts":54,"./dom":63,"./element-stub":64,"./error":65,"./layout":74,"./log":76,"./resources":85,"./size-list":89,"./timer":95,"./vsync":101}],60:[function(e,t,i){function n(e){s(e)}function r(e){s(e).cleanup()}function s(e){return(0,l.getService)(e,"clickhandler",function(){return new d(e)})}function o(e,t){if(!e.defaultPrevented){var i=(0,a.closestByTag)(e.target,"A");if(i){var n=null,r=e.currentTarget,s=r.ownerDocument,o=(0,c.parseUrl)(i.href);if(o.hash){var l=(0,c.parseUrl)(s.location.href),h=""+o.origin+o.pathname+o.search,d=""+l.origin+l.pathname+l.search;if(h==d){e.preventDefault();var p=o.hash.slice(1);n=s.getElementById(p),n||(n=s.querySelector("a[name="+p+"]")),n?t.scrollIntoView(n):u.log.warn("documentElement","failed to find element with id="+p+" or a[name="+p+"]")}}}}}Object.defineProperty(i,"__esModule",{value:!0}),i.installGlobalClickListener=n,i.uninstallGlobalClickListener=r,i.onDocumentElementClick_=o;var a=e("./dom"),l=e("./service"),u=e("./log"),c=e("./url"),h=e("./viewport"),d=function(){function e(t){babelHelpers.classCallCheck(this,e),this.win=t,this.viewport_=(0,h.viewportFor)(t),this.boundHandle_=this.handle_.bind(this),this.win.document.documentElement.addEventListener("click",this.boundHandle_)}return babelHelpers.createClass(e,[{key:"cleanup",value:function(){this.win.document.documentElement.removeEventListener("click",this.boundHandle_)}},{key:"handle_",value:function(e){o(e,this.viewport_)}}]),e}();i.ClickHandler=d},{"./dom":63,"./log":76,"./service":87,"./url":97,"./viewport":100
}],61:[function(e,t,i){function n(e){return(0,s.getService)(e,"documentInfo",function(){return{canonicalUrl:(0,a.parseUrl)((0,o.assert)(e.document.querySelector("link[rel=canonical]"),"AMP files are required to have a <link rel=canonical> tag.").href).href,pageViewId:r(e)}})}function r(e){return String(Math.floor(1e4*e.Math.random()))}Object.defineProperty(i,"__esModule",{value:!0}),i.documentInfoFor=n;var s=e("./service"),o=e("./asserts"),a=e("./url")},{"./asserts":54,"./service":87,"./url":97}],62:[function(e,t,i){function n(e){return"loading"!=e.readyState}function r(e,t){var i=n(e);i?t():!function(){var n=function(){"loading"!=e.readyState&&(i||(i=!0,t()),e.removeEventListener("readystatechange",n))};e.addEventListener("readystatechange",n)}()}function s(e){return new c(e)}function o(e){return(0,l.getService)(e,"documentState",function(){return s(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.isDocumentReady=n,i.onDocumentReady=r,i.documentStateFor=o;var a=e("./observable"),l=e("./service"),u=e("./style"),c=function(){function e(t){if(babelHelpers.classCallCheck(this,e),this.win=t,this.document_=t.document,this.hiddenProp_=(0,u.getVendorJsPropertyName)(this.document_,"hidden",!0),void 0===this.document_[this.hiddenProp_]&&(this.hiddenProp_=null),this.visibilityStateProp_=(0,u.getVendorJsPropertyName)(this.document_,"visibilityState",!0),void 0===this.document_[this.visibilityStateProp_]&&(this.visibilityStateProp_=null),this.visibilityObservable_=new a.Observable,this.visibilityChangeEvent_=null,this.hiddenProp_){this.visibilityChangeEvent_="visibilitychange";var i=this.hiddenProp_.indexOf("Hidden");-1!=i&&(this.visibilityChangeEvent_=this.hiddenProp_.substring(0,i)+"Visibilitychange")}this.boundOnVisibilityChanged_=this.onVisibilityChanged_.bind(this),this.visibilityChangeEvent_&&this.document_.addEventListener(this.visibilityChangeEvent_,this.boundOnVisibilityChanged_)}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){this.visibilityChangeEvent_&&this.document_.removeEventListener(this.visibilityChangeEvent_,this.boundOnVisibilityChanged_)}},{key:"isReady",value:function(){return n(this.document_)}},{key:"onReady",value:function(e){return r(this.document_,e)}},{key:"isHidden",value:function(){return this.hiddenProp_?this.document_[this.hiddenProp_]:!1}},{key:"getVisibilityState",value:function(){return this.visibilityStateProp_?this.document_[this.visibilityStateProp_]:this.isHidden()?"hidden":"visible"}},{key:"onVisibilityChanged",value:function(e){return this.visibilityObservable_.add(e)}},{key:"onVisibilityChanged_",value:function(){this.visibilityObservable_.fire()}}]),e}();i.DocumentState=c},{"./observable":78,"./service":87,"./style":92}],63:[function(e,t,i){function n(e){e.parentElement&&e.parentElement.removeChild(e)}function r(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function s(e,t){for(var i=t.ownerDocument.createDocumentFragment(),n=e.firstChild;n;n=n.nextSibling)i.appendChild(n.cloneNode(!0));t.appendChild(i)}function o(e,t){for(var i=e;i;i=i.parentElement)if(t(i))return i;return null}function a(e,t){return t=t.toUpperCase(),o(e,function(e){return e.tagName==t})}function l(e,t){var i=e.getElementsByTagName(t);return i.length>0?i[0]:null}function u(e,t){for(var i=e.children,n=0;n<i.length;n++)if(t(i[n]))return i[n];return null}function c(e,t,i){return u(e,function(e){return e.hasAttribute(t)?void 0!==i&&e.getAttribute(t)!=i?!1:!0:!1})}function h(e,t){return t=t.toUpperCase(),u(e,function(e){return e.tagName==t})}Object.defineProperty(i,"__esModule",{value:!0}),i.removeElement=n,i.removeChildren=r,i.copyChildren=s,i.closest=o,i.closestByTag=a,i.elementByTag=l,i.childElement=u,i.childElementByAttr=c,i.childElementByTag=h},{}],64:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n=e("./base-element"),r=(e("./layout"),[]);i.stubbedElements=r;var s=function(e){function t(e){babelHelpers.classCallCheck(this,t),babelHelpers.get(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),r.push(this)}return babelHelpers.inherits(t,e),babelHelpers.createClass(t,[{key:"isLayoutSupported",value:function(e){return!0}}]),t}(n.BaseElement);i.ElementStub=s},{"./base-element":55,"./layout":74}],65:[function(e,t,i){(function(t){function n(e,i){if(window.console&&!e.reported){e.reported=!0;var n=i||e.associatedElement;n&&(n.classList.add("-amp-error"),(0,a.getMode)().development&&(n.classList.add("-amp-element-error"),n.setAttribute("error-message",e.message))),e.messageArray?(console.error||console.log).apply(console,e.messageArray):(n?(console.error||console.log).call(console,n.tagName+"#"+n.id,e.message):(console.error||console.log).call(console,e.message),"production"!=t.env.NODE_ENV&&(console.error||console.log).call(console,e.stack)),n&&n.dispatchCustomEvent&&n.dispatchCustomEvent("amp:error",e.message),s(void 0,void 0,void 0,void 0,e)}}function r(e){e.onerror=s}function s(e,t,i,n,r){this&&this.document&&(0,u.makeBodyVisible)(this.document);var s=(0,a.getMode)();if(!(s.isLocalDev||s.development||s.test)){var l=o(e,t,i,n,r);c(function(){(new Image).src=l})}}function o(e,t,i,n,r){if(e=r&&r.message?r.message:e,!/_reported_/.test(e)){e||(e="Unknown error");var s="https://amp-error-reporting.appspot.com/r?v="+encodeURIComponent("1450396666888")+"&m="+encodeURIComponent(e);if(r){var o=r&&r.associatedElement?r.associatedElement.tagName:"u";s+="&a="+(r.fromAssert?1:0)+"&el="+encodeURIComponent(o)+"&s="+encodeURIComponent(r.stack||""),r.message+=" _reported_"}else s+="&f="+encodeURIComponent(t)+"&l="+encodeURIComponent(i)+"&c="+encodeURIComponent(n||"");return s.substr(0,2e3)}}Object.defineProperty(i,"__esModule",{value:!0}),i.reportError=n,i.installErrorReporting=r,i.getErrorReportUrl=o;var a=e("./mode"),l=e("./exponential-backoff.js"),u=e("./styles"),c=(0,l.exponentialBackoff)(1.5)}).call(this,e("_process"))},{"./exponential-backoff.js":68,"./mode":77,"./styles":93,_process:7}],66:[function(e,t,i){function n(e,t,i,n){var r=n||!1,s=void 0,o=function(e){i(e),s()};return s=function(){e.removeEventListener(t,o,r)},e.addEventListener(t,o,r),s}function r(e,t,i,r){var s=void 0,o=new Promise(function(r,o){s=n(e,t,r,i)});return a(o,s,r)}function s(e){return e.complete||"complete"==e.readyState}function o(e,t){var i=void 0,r=void 0,o=new Promise(function(t,o){s(e)?t(e):(i="AUDIO"===e.tagName||"VIDEO"===e.tagName?n(e,"loadstart",function(){return t(e)}):n(e,"load",function(){return t(e)}),r=n(e,"error",o))});return a(o,function(){i&&i(),r&&r()},t)}function a(e,t,i){var n=void 0;return n=void 0===i?e:l.timer.timeoutPromise(i||0,e),t?n.then(function(e){return t(),e},function(e){throw t(),e}):n}Object.defineProperty(i,"__esModule",{value:!0}),i.listenOnce=n,i.listenOncePromise=r,i.isLoaded=s,i.loadPromise=o;var l=e("./timer")},{"./timer":95}],67:[function(e,t,i){function n(e,t){return-1!=s(e).indexOf(t)}function r(e,t,i){var n=s(e),r=-1!=n.indexOf(t),a=void 0!==i?i:!r;return a!=r&&(a?n.push(t):n.splice(n.indexOf(t),1),o(e,n)),a}function s(e){var t=(0,a.getCookie)(e,u);return t?t.split(/\s*,\s*/g):[]}function o(e,t){(0,a.setCookie)(e,u,t.join(","),l.timer.now()+h)}Object.defineProperty(i,"__esModule",{value:!0}),i.isExperimentOn=n,i.toggleExperiment=r;var a=e("./cookies"),l=e("./timer"),u="AMP_EXP",c=180,h=24*c*60*60*1e3},{"./cookies":57,"./timer":95}],68:[function(e,t,i){function n(e){var t=0;return function(i){var n=Math.pow(e||2,t++),r=.3*n*Math.random();Math.random()>.5&&(r*=-1),n+=r,setTimeout(i,Math.round(1e3*n))}}Object.defineProperty(i,"__esModule",{value:!0}),i.exponentialBackoff=n},{}],69:[function(e,t,i){function n(e,t,i){(0,r.upgradeOrRegisterElement)(e,t,i)}Object.defineProperty(i,"__esModule",{value:!0}),i.registerExtendedElement=n;var r=(e("./base-element"),e("./custom-element"))},{"./base-element":55,"./custom-element":59}],70:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n=e("./observable"),r=e("./timer"),s=function(){function e(t,i){var s=this;babelHelpers.classCallCheck(this,e),this.win=t,this.purgeTimeout_=i,this.history_=[],this.observeFocus_=new n.Observable,this.captureFocus_=function(e){e.target&&s.pushFocus_(e.target)},this.captureBlur_=function(e){r.timer.delay(function(){s.pushFocus_(s.win.document.activeElement)},500)},this.win.document.addEventListener("focus",this.captureFocus_,!0),this.win.addEventListener("blur",this.captureBlur_)}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){this.win.document.removeEventListener("focus",this.captureFocus_,!0),this.win.removeEventListener("blur",this.captureBlur_)}},{key:"onFocus",value:function(e){return this.observeFocus_.add(e)}},{key:"pushFocus_",value:function(e){var t=r.timer.now();0==this.history_.length||this.history_[this.history_.length-1].el!=e?this.history_.push({el:e,time:t}):this.history_[this.history_.length-1].time=t,this.purgeBefore(t-this.purgeTimeout_),this.observeFocus_.fire(e)}},{key:"getLast",value:function(){return 0==this.history_.length?null:this.history_[this.history_.length-1].el}},{key:"purgeBefore",value:function(e){for(var t=this.history_.length-1,i=0;i<this.history_.length;i++)if(this.history_[i].time>=e){t=i-1;break}-1!=t&&this.history_.splice(0,t+1)}},{key:"hasDescendantsOf",value:function(e){this.win.document.activeElement&&this.pushFocus_(this.win.document.activeElement);for(var t=0;t<this.history_.length;t++)if(e.contains(this.history_[t].el))return!0;return!1}}]),e}();i.FocusHistory=s},{"./observable":78,"./timer":95}],71:[function(e,t,i){function n(e){return(0,s.getService)(e,"input",function(){return new h(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.inputFor=n;var r=e("./observable"),s=e("./service"),o=e("./log"),a=e("./event-helper"),l=(e("./timer"),"Input"),u=3,c=300,h=function(){function e(t){babelHelpers.classCallCheck(this,e),this.win=t,this.boundOnKeyDown_=this.onKeyDown_.bind(this),this.boundOnMouseDown_=this.onMouseDown_.bind(this),this.boundOnMouseMove_=this.onMouseMove_.bind(this),this.boundMouseCanceled_=this.mouseCanceled_.bind(this),this.boundMouseConfirmed_=this.mouseConfirmed_.bind(this),this.hasTouch_="ontouchstart"in t||void 0!==t.navigator.maxTouchPoints&&t.navigator.maxTouchPoints>0||void 0!==t.DocumentTouch,o.log.fine(l,"touch detected:",this.hasTouch_),this.keyboardActive_=!1,this.win.document.addEventListener("keydown",this.boundOnKeyDown_),this.win.document.addEventListener("mousedown",this.boundOnMouseDown_),this.hasMouse_=!0,this.mouseConfirmAttemptCount_=0,this.touchDetectedObservable_=new r.Observable,this.mouseDetectedObservable_=new r.Observable,this.keyboardStateObservable_=new r.Observable,this.hasTouch_&&(this.hasMouse_=!this.hasTouch_,(0,a.listenOnce)(t.document,"mousemove",this.boundOnMouseMove_))}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){this.win.document.removeEventListener("keydown",this.boundOnKeyDown_),this.win.document.removeEventListener("mousedown",this.boundOnMouseDown_)}},{key:"isTouchDetected",value:function(){return this.hasTouch_}},{key:"onTouchDetected",value:function(e,t){return t&&e(this.isTouchDetected()),this.touchDetectedObservable_.add(e)}},{key:"isMouseDetected",value:function(){return this.hasMouse_}},{key:"onMouseDetected",value:function(e,t){return t&&e(this.isMouseDetected()),this.mouseDetectedObservable_.add(e)}},{key:"isKeyboardActive",value:function(){return this.keyboardActive_}},{key:"onKeyboardStateChanged",value:function(e,t){return t&&e(this.isKeyboardActive()),this.keyboardStateObservable_.add(e)}},{key:"onKeyDown_",value:function(e){if(!this.keyboardActive_&&!e.defaultPrevented){var t=e.target;(!t||"INPUT"!=t.tagName&&"TEXTAREA"!=t.tagName&&"SELECT"!=t.tagName&&"OPTION"!=t.tagName&&!t.hasAttribute("contenteditable"))&&(this.keyboardActive_=!0,this.keyboardStateObservable_.fire(!0),o.log.fine(l,"keyboard activated"))}}},{key:"onMouseDown_",value:function(){this.keyboardActive_&&(this.keyboardActive_=!1,this.keyboardStateObservable_.fire(!1),o.log.fine(l,"keyboard deactivated"))}},{key:"onMouseMove_",value:function(){return(0,a.listenOncePromise)(this.win.document,"click",!1,c).then(this.boundMouseCanceled_,this.boundMouseConfirmed_)}},{key:"mouseConfirmed_",value:function(){this.hasMouse_=!0,this.mouseDetectedObservable_.fire(!0),o.log.fine(l,"mouse detected")}},{key:"mouseCanceled_",value:function(){this.mouseConfirmAttemptCount_++,this.mouseConfirmAttemptCount_<=u?(0,a.listenOnce)(this.win.document,"mousemove",this.boundOnMouseMove_):o.log.fine(l,"mouse detection failed")}}]),e}();i.Input=h},{"./event-helper":66,"./log":76,"./observable":78,"./service":87,"./timer":95}],72:[function(e,t,i){function n(e,t,i){t.x=t.left,t.y=t.top;var n=(0,s.moveLayoutRect)(i,-1*t.x,-1*t.y);(0,r.assert)(n.width>=0&&n.height>=0,"Negative dimensions in ad."),n.x=n.left,n.y=n.top;var o=(0,s.rectIntersection)(t,i)||(0,s.layoutRectLtwh)(0,0,0,0);return o.x=o.left,o.y=o.top,{time:e,rootBounds:t,boundingClientRect:n,intersectionRect:o}}Object.defineProperty(i,"__esModule",{value:!0}),i.getIntersectionChangeEntry=n;var r=e("./asserts"),s=e("./layout-rect")},{"./asserts":54,"./layout-rect":73}],73:[function(e,t,i){function n(e,t,i,n){return{left:e,top:t,width:i,height:n,bottom:t+n,right:e+i}}function r(e){return{left:e.left,top:e.top,width:e.width,height:e.height,bottom:e.top+e.height,right:e.left+e.width}}function s(e,t){return e.top<=t.bottom&&t.top<=e.bottom&&e.left<=t.right&&t.left<=e.right}function o(e,t){var i=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width);if(r>=i){var s=Math.max(e.top,t.top),o=Math.min(e.top+e.height,t.top+t.height);if(o>=s)return n(i,s,r-i,o-s)}return null}function a(e,t,i){return{top:e.top-e.height*i,bottom:e.bottom+e.height*i,left:e.left-e.width*t,right:e.right+e.width*t,width:e.width*(1+2*t),height:e.height*(1+2*i)}}function l(e,t,i){return 0==t&&0==i?e:n(e.left+t,e.top+i,e.width,e.height)}Object.defineProperty(i,"__esModule",{value:!0}),i.layoutRectLtwh=n,i.layoutRectFromDomRect=r,i.layoutRectsOverlap=s,i.rectIntersection=o,i.expandLayoutRect=a,i.moveLayoutRect=l},{}],74:[function(e,t,i){function n(e){for(var t in v)if(v[t]==e)return v[t]}function r(e){return"-amp-layout-"+e}function s(e){return e==v.FIXED||e==v.FIXED_HEIGHT||e==v.RESPONSIVE||e==v.FILL}function o(e){var t="string"==typeof e?e:e.tagName;return t&&0==t.toLowerCase().indexOf("i-")}function a(e){if("number"==typeof e)return e+"px";if(e&&/^\d+(\.\d+)?(px|em|rem|vh|vw|vmin|vmax)?$/.test(e))return/^\d+(\.\d+)?$/.test(e)?e+"px":e}function l(e){return(0,f.assert)(/^\d+(\.\d+)?(px|em|rem|vh|vw|vmin|vmax)$/.test(e),"Invalid length value: %s",e),e}function u(e){l(e);var t=(0,f.assert)(e.match(/[a-z]+/i),"Failed to read units from %s",e);return t[0]}function c(e){return parseFloat(e)}function h(e){return e=e.toUpperCase(),void 0!==m[e]}function d(e){if(e=e.toUpperCase(),(0,f.assert)(void 0!==m[e]),!m[e]){var t=e.replace(/^AMP\-/,""),i=document.createElement(t);i.controls=!0,i.style.position="absolute",i.style.visibility="hidden",document.body.appendChild(i),m[e]={width:(i.offsetWidth||1)+"px",height:(i.offsetHeight||1)+"px"},document.body.removeChild(i)}return m[e]}function p(e){return _[e.toUpperCase()]||!1}Object.defineProperty(i,"__esModule",{value:!0}),i.parseLayout=n,i.getLayoutClass=r,i.isLayoutSizeDefined=s,i.isInternalElement=o,i.parseLength=a,i.assertLength=l,i.getLengthUnits=u,i.getLengthNumeral=c,i.hasNaturalDimensions=h,i.getNaturalDimensions=d,i.isLoadingAllowed=p;var f=e("./asserts"),v={NODISPLAY:"nodisplay",FIXED:"fixed",FIXED_HEIGHT:"fixed-height",RESPONSIVE:"responsive",CONTAINER:"container",FILL:"fill"};i.Layout=v;var m={"AMP-PIXEL":{width:"1px",height:"1px"},"AMP-ANALYTICS":{width:"1px",height:"1px"},"AMP-AUDIO":null};i.naturalDimensions_=m;var _={"AMP-ANIM":!0,"AMP-BRIGHTCOVE":!0,"AMP-IFRAME":!0,"AMP-IMG":!0,"AMP-INSTAGRAM":!0,"AMP-LIST":!0,"AMP-PINTEREST":!0,"AMP-VIDEO":!0};i.LOADING_ELEMENTS_=_},{"./asserts":54}],75:[function(e,t,i){function n(){var e=document.createElement("div");e.classList.add("-amp-loader");for(var t=0;3>t;t++){var i=document.createElement("div");i.classList.add("-amp-loader-dot"),e.appendChild(i)}return e}Object.defineProperty(i,"__esModule",{value:!0}),i.createLoaderElement=n},{}],76:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n=e("./mode"),r=(new Date).getTime(),s=function(){function e(t){babelHelpers.classCallCheck(this,e),this.win=t.AMP_TEST?t.parent:t,this.isEnabled_=this.shouldBeEnabled_()}return babelHelpers.createClass(e,[{key:"shouldBeEnabled_",value:function(){if(!this.win.console||!this.win.console.log)return!1;var e=this.win.location.hash.match(/log=(\d)/),t=e&&e[1];return(0,n.getMode)().localDev&&"0"!=t?!0:this.win.location.hash&&"1"==t?!0:!1}},{key:"msg_",value:function(e,t,i){if(this.isEnabled_){var n=this.win.console.log;"ERROR"==t?n=this.win.console.error||n:"INFO"==t?n=this.win.console.info||n:"WARN"==t&&(n=this.win.console.warn||n),i.unshift((new Date).getTime()-r,"["+e+"]"),n.apply(this.win.console,i)}}},{key:"fine",value:function(e,t){this.isEnabled_&&this.msg_(e,"FINE",Array.prototype.slice.call(arguments,1))}},{key:"info",value:function(e,t){this.isEnabled_&&this.msg_(e,"INFO",Array.prototype.slice.call(arguments,1))}},{key:"warn",value:function(e,t){this.isEnabled_&&this.msg_(e,"WARN",Array.prototype.slice.call(arguments,1))}},{key:"error",value:function(e,t){this.isEnabled_&&this.msg_(e,"ERROR",Array.prototype.slice.call(arguments,1))}}]),e}();i.Log=s;var o=new s(window);i.log=o},{"./mode":77}],77:[function(e,t,i){(function(t){function n(){return a?a:a=s()}function r(e){a=e}function s(){var e=("localhost"==location.hostname||location.ancestorOrigins&&location.ancestorOrigins[0]&&0==location.ancestorOrigins[0].indexOf("http://localhost:"))&&!!document.querySelector('script[src*="/dist/"],script[src*="/base/"]'),i=(0,o.parseQueryString)(location.hash).development,n=void 0!=i?"1"==i:!!document.querySelector("script[development]");return{localDev:e,development:n,minified:"production"==t.env.NODE_ENV,test:window.AMP_TEST}}Object.defineProperty(i,"__esModule",{value:!0}),i.getMode=n,i.setModeForTesting=r;var o=e("./url"),a=null}).call(this,e("_process"))},{"./url":97,_process:7}],78:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(){babelHelpers.classCallCheck(this,e),this.handlers_=[]}return babelHelpers.createClass(e,[{key:"add",value:function(e){var t=this;return this.handlers_.push(e),function(){t.remove(e)}}},{key:"remove",value:function(e){for(var t=0;t<this.handlers_.length;t++)if(e==this.handlers_[t]){this.handlers_.splice(t,1);break}}},{key:"fire",value:function(e){this.handlers_.forEach(function(t){t(e)})}},{key:"getHandlerCount",value:function(){return this.handlers_.length}}]),e}();i.Observable=n},{}],79:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n=e("./timer"),r=function(){function e(t,i){babelHelpers.classCallCheck(this,e),this.handler_=t,this.defaultDelay_=i||0,this.scheduled_=-1,this.nextTime_=0}return babelHelpers.createClass(e,[{key:"isPending",value:function(){return-1!=this.scheduled_}},{key:"schedule",value:function(e){var t=this,i=e||this.defaultDelay_,r=n.timer.now()+i;return-1==this.scheduled_||r-this.nextTime_<-10?(-1!=this.scheduled_&&n.timer.cancel(this.scheduled_),this.nextTime_=r,this.scheduled_=n.timer.delay(function(){t.scheduled_=-1,t.nextTime_=0,t.handler_()},i),!0):!1}},{key:"cancel",value:function(){-1!=this.scheduled_&&(n.timer.cancel(this.scheduled_),this.scheduled_=-1)}}]),e}();i.Pass=r},{"./timer":95}],80:[function(e,t,i){function n(e){return(0,r.getService)(e,"performance",function(){return new a(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.performanceFor=n;var r=e("./service"),s=e("./timer"),o=50,a=function(){function e(t){babelHelpers.classCallCheck(this,e),this.win=t,this.tick_,this.flush_,this.events_=[]}return babelHelpers.createClass(e,[{key:"tick",value:function(e,t,i){this.tick_?this.tick_(e,t,i):this.queueTick_(e,t,i)}},{key:"flush",value:function(){this.flush_&&this.flush_()}},{key:"queueTick_",value:function(e,t,i){void 0==i&&(i=s.timer.now()),this.events_.length>=o&&this.events_.shift(),this.events_.push({label:e,opt_from:t,opt_value:i})}},{key:"flushQueuedTicks_",value:function(){var e=this;this.tick_&&(this.events_.forEach(function(t){e.tick_(t.label,t.opt_from,t.opt_value)}),this.events_.length=0)}},{key:"setTickFunction",value:function(e,t){this.tick_=e,this.flush_=t,this.flushQueuedTicks_(),this.flush()}}]),e}();i.Performance=a},{"./service":87,"./timer":95}],81:[function(e,t,i){function n(e){return(0,r.getService)(e,"platform",function(){return new s(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.platformFor=n;var r=e("./service"),s=function(){function e(t){babelHelpers.classCallCheck(this,e),this.win=t}return babelHelpers.createClass(e,[{key:"isIos",value:function(){return/iPhone|iPad|iPod/i.test(this.win.navigator.userAgent)}},{key:"isSafari",value:function(){return/Safari/i.test(this.win.navigator.userAgent)&&!this.isChrome()}},{key:"isChrome",value:function(){return/Chrome|CriOS/i.test(this.win.navigator.userAgent)}}]),e}();i.Platform=s;var o=n(window);i.platform=o},{"./service":87}],82:[function(e,t,i){e("document-register-element/build/document-register-element.max"),e("../third_party/babel/custom-babel-helpers"),e("./custom-core-js-shim")},{"../third_party/babel/custom-babel-helpers":102,"./custom-core-js-shim":58,"document-register-element/build/document-register-element.max":50}],83:[function(e,t,i){function n(e){return(0,r.getService)(e,"preconnect",function(){return new c(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.preconnectFor=n;var r=e("./service"),s=e("./url"),o=e("./timer"),a=e("./platform"),l=18e4,u=1e4,c=function(){function e(t){babelHelpers.classCallCheck(this,e),this.head_=t.document.head,this.origins_={},this.urls_={},this.platform_=(0,a.platformFor)(t),this.origins_[(0,s.parseUrl)(t.location.href).origin]=!0}return babelHelpers.createClass(e,[{key:"url",value:function(e,t){if(this.isInterestingUrl_(e)){var i=(0,s.parseUrl)(e).origin,n=o.timer.now(),r=this.origins_[i];if(r&&r>n)return void(t&&(this.origins_[i]=n+l));var a=t?l:u;this.origins_[i]=n+a;var c=document.createElement("link");c.setAttribute("rel","dns-prefetch"),c.setAttribute("href",i);var h=document.createElement("link");h.setAttribute("rel","preconnect"),h.setAttribute("href",i),this.head_.appendChild(c),this.head_.appendChild(h),o.timer.delay(function(){c.parentNode&&c.parentNode.removeChild(c),h.parentNode&&h.parentNode.removeChild(h)},1e4),this.preconnectPolyfill_(i)}}},{key:"prefetch",value:function t(e){if(this.isInterestingUrl_(e)&&!this.urls_[e]){this.urls_[e]=!0,this.url(e,!0);var t=document.createElement("link");t.setAttribute("rel","prefetch"),t.setAttribute("href",e),this.head_.appendChild(t)}}},{key:"isInterestingUrl_",value:function(e){return 0==e.indexOf("https:")||0==e.indexOf("http:")?!0:!1}},{key:"preconnectPolyfill_",value:function(e){if(this.platform_.isSafari()){this.origins_[e]=o.timer.now()+l;var t=e+"/amp_preconnect_polyfill?"+Math.random(),i=new XMLHttpRequest;i.open("HEAD",t,!0),i.send()}}}]),e}()},{"./platform":81,"./service":87,"./timer":95,"./url":97}],84:[function(e,t,i){function n(e){"0"==(0,s.viewerFor)(e).getParam("p2r")&&(0,r.platformFor)(e).isChrome()&&new a(e.document,(0,o.viewportFor)(e))}Object.defineProperty(i,"__esModule",{value:!0}),i.installPullToRefreshBlocker=n;var r=e("./platform"),s=e("./viewer"),o=e("./viewport"),a=function(){function e(t,i){babelHelpers.classCallCheck(this,e),this.doc_=t,this.viewport_=i,this.tracking_=!1,this.startPos_=0,this.boundTouchStart_=this.onTouchStart_.bind(this),this.boundTouchMove_=this.onTouchMove_.bind(this),this.boundTouchEnd_=this.onTouchEnd_.bind(this),this.boundTouchCancel_=this.onTouchCancel_.bind(this),this.doc_.addEventListener("touchstart",this.boundTouchStart_,!0)}return babelHelpers.createClass(e,[{key:"cleanup",value:function(){this.stopTracking_(),this.doc_.removeEventListener("touchstart",this.boundTouchStart_,!0)}},{key:"onTouchStart_",value:function(e){this.tracking_||!e.touches||1!=e.touches.length||this.viewport_.getTop()>0||this.startTracking_(e.touches[0].clientY)}},{key:"startTracking_",value:function(e){this.tracking_=!0,this.startPos_=e,this.doc_.addEventListener("touchmove",this.boundTouchMove_,!0),this.doc_.addEventListener("touchend",this.boundTouchEnd_,!0),this.doc_.addEventListener("touchcancel",this.boundTouchCancel_,!0)}},{key:"stopTracking_",value:function(){this.tracking_=!1,this.startPos_=0,this.doc_.removeEventListener("touchmove",this.boundTouchMove_,!0),this.doc_.removeEventListener("touchend",this.boundTouchEnd_,!0),this.doc_.removeEventListener("touchcancel",this.boundTouchCancel_,!0)}},{key:"onTouchMove_",value:function(e){if(this.tracking_){var t=e.touches[0].clientY-this.startPos_;t>0&&e.preventDefault(),0!=t&&this.stopTracking_()}}},{key:"onTouchEnd_",value:function(e){this.stopTracking_()}},{key:"onTouchCancel_",value:function(e){this.stopTracking_()}}]),e}();i.PullToRefreshBlocker=a},{"./platform":81,"./viewer":99,"./viewport":100}],85:[function(e,t,i){function n(e){return e=e.toLowerCase(),"amp-ad"==e?2:"amp-pixel"==e?1:0}function r(e){return void 0!==e.length?e:[e]}function s(e){return(0,d.getService)(e,"resources",function(){return new I(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.getElementPriority=n,i.resourcesFor=s;var o=e("./focus-history"),a=e("./pass"),l=e("./asserts"),u=e("./dom"),c=e("./document-state"),h=e("./layout-rect"),d=e("./service"),p=e("./input"),f=e("./log"),v=(e("./styles"),e("./error")),m=e("./timer"),_=e("./viewer"),g=e("./viewport"),y=e("./vsync"),b="Resources",w="__AMP__RESOURCE",k="__AMP__OWNER",E="L",C=0,S="P",T=2,O=10,P=1e3,L=1e3,A=500,x=6e4,I=function(){function e(t){var i=this;babelHelpers.classCallCheck(this,e),this.win=t,this.viewer_=(0,_.viewerFor)(t),this.isRuntimeOn_=this.viewer_.isRuntimeOn(),this.maxDpr_=this.win.devicePixelRatio||1,this.resourceIdCounter_=0,this.resources_=[],this.visible_=this.viewer_.isVisible(),this.prerenderSize_=this.viewer_.getPrerenderSize(),this.documentReady_=!1,this.firstPassAfterDocumentReady_=!0,this.relayoutAll_=!1,this.relayoutTop_=-1,this.forceBuild_=!1,this.lastScrollTime_=0,this.lastVelocity_=0,this.pass_=new a.Pass(function(){return i.doPass_()}),this.exec_=new H,this.queue_=new H,this.requestsChangeHeight_=[],this.deferredMutates_=[],this.scrollHeight_=0,this.viewport_=(0,g.viewportFor)(this.win),this.vsync_=(0,y.vsyncFor)(this.win),this.docState_=(0,c.documentStateFor)(this.win),this.activeHistory_=new o.FocusHistory(this.win,x),this.vsyncScheduled_=!1,this.viewport_.onChanged(function(e){i.lastScrollTime_=m.timer.now(),i.lastVelocity_=e.velocity,i.relayoutAll_=i.relayoutAll_||e.relayoutAll,i.schedulePass()}),this.viewport_.onScroll(function(){i.lastScrollTime_=m.timer.now()}),this.docState_.onReady(function(){i.documentReady_=!0,i.forceBuild_=!0,i.relayoutAll_=!0,i.schedulePass(),i.monitorInput_()}),this.viewer_.onVisibilityChanged(function(){i.schedulePass()}),this.viewer_.onRuntimeState(function(e){f.log.fine(b,"Runtime state:",e),i.isRuntimeOn_=e,i.schedulePass(1)}),this.activeHistory_.onFocus(function(e){i.checkPendingChangeHeight_(e)}),this.relayoutAll_=!0,this.schedulePass()}return babelHelpers.createClass(e,[{key:"get",value:function(){return this.resources_.slice(0)}},{key:"monitorInput_",value:function(){var e=this,t=(0,p.inputFor)(this.win);t.onTouchDetected(function(t){e.toggleInputClass_("amp-mode-touch",t)},!0),t.onMouseDetected(function(t){e.toggleInputClass_("amp-mode-mouse",t)},!0),t.onKeyboardStateChanged(function(t){e.toggleInputClass_("amp-mode-keyboard-active",t)},!0)}},{key:"toggleInputClass_",value:function(e,t){var i=this;this.vsync_.mutate(function(){i.win.document.body.classList.toggle(e,t)})}},{key:"updateScrollHeight_",value:function(){if(this.win.document.body){var e=this.win.document.body.scrollHeight;e!=this.scrollHeight_&&(this.scrollHeight_=e,this.viewer_.postDocumentResized(this.viewport_.getSize().width,e))}}},{key:"getMaxDpr",value:function(){return this.maxDpr_}},{key:"getDpr",value:function(){return this.maxDpr_}},{key:"getResourceForElement",value:function(e){return(0,l.assert)(e[w],"Missing resource prop on %s",e)}},{key:"add",value:function(e){var t=new M(++this.resourceIdCounter_,e,this);e.id||(e.id="AMP_"+t.getId()),e[w]=t,this.resources_.push(t),this.isRuntimeOn_&&(t.build(this.forceBuild_),this.schedulePass()),f.log.fine(b,"element added:",t.debugid)}},{key:"remove",value:function(e){var t=this.getResourceForElement(e),i=t?this.resources_.indexOf(t):-1;-1!=i&&this.resources_.splice(i,1),f.log.fine(b,"element removed:",t.debugid)}},{key:"upgraded",value:function(e){var t=this.getResourceForElement(e);this.isRuntimeOn_?(t.build(this.forceBuild_),this.schedulePass()):t.onUpgraded_&&t.onUpgraded_(),f.log.fine(b,"element upgraded:",t.debugid)}},{key:"setOwner",value:function(e,t){(0,l.assert)(t.contains(e),"Owner must contain the element"),e[k]=t}},{key:"scheduleLayout",value:function(e,t){this.scheduleLayoutOrPreloadForSubresources_(this.getResourceForElement(e),!0,r(t))}},{key:"schedulePreload",value:function(e,t){this.scheduleLayoutOrPreloadForSubresources_(this.getResourceForElement(e),!1,r(t))}},{key:"updateInViewport",value:function(e,t,i){this.updateInViewportForSubresources_(this.getResourceForElement(e),r(t),i)}},{key:"changeHeight",value:function(e,t){this.scheduleChangeHeight_(this.getResourceForElement(e),t,!0)}},{key:"requestChangeHeight",value:function(e,t){this.scheduleChangeHeight_(this.getResourceForElement(e),t,!1)}},{key:"deferMutate",value:function(e,t){this.scheduleDeferredMutate_(this.getResourceForElement(e),t),this.schedulePassVsync()}},{key:"schedulePass",value:function(e){this.pass_.schedule(e)}},{key:"schedulePassVsync",value:function(){var e=this;this.vsyncScheduled_||(this.vsyncScheduled_=!0,this.vsync_.mutate(function(){return e.doPass_()}))}},{key:"doPass_",value:function(){if(!this.isRuntimeOn_)return void f.log.fine(b,"runtime is off");var e=this.visible_;this.visible_=this.viewer_.isVisible(),this.prerenderSize_=this.viewer_.getPrerenderSize(),this.documentReady_&&this.firstPassAfterDocumentReady_&&(this.firstPassAfterDocumentReady_=!1,this.viewer_.postDocumentReady(this.viewport_.getSize().width,this.win.document.body.scrollHeight),this.updateScrollHeight_());var t=this.viewport_.getSize(),i=m.timer.now();if(f.log.fine(b,"PASS: at "+i+", visible=",this.visible_,", forceBuild=",this.forceBuild_,", relayoutAll=",this.relayoutAll_,", relayoutTop=",this.relayoutTop_,", viewportSize=",t.width,t.height,", prerenderSize=",this.prerenderSize_),this.pass_.cancel(),this.vsyncScheduled_=!1,e&&!this.visible_)return f.log.fine(b,"document become inactive"),void this.documentBecameInactive_();if(t.height>0&&t.width>0){this.hasMutateWork_()&&this.mutateWork_(),this.discoverWork_();var n=this.work_();this.hasMutateWork_()&&(n=Math.min(n,A)),this.visible_?(f.log.fine(b,"next pass:",n),this.schedulePass(n),this.updateScrollHeight_()):f.log.fine(b,"document is not visible: no scheduling")}}},{key:"hasMutateWork_",value:function(){return this.deferredMutates_.length>0||this.requestsChangeHeight_.length>0}},{key:"mutateWork_",value:function(){var e=this,t=m.timer.now(),i=this.viewport_.getRect(),n=i.height/10,r=i.height/4,s=Math.abs(this.lastVelocity_)<.01&&t-this.lastScrollTime_>A||t-this.lastScrollTime_>2*A;if(this.deferredMutates_.length>0){f.log.fine(b,"deferred mutates:",this.deferredMutates_.length);var o=this.deferredMutates_;this.deferredMutates_=[];for(var a=0;a<o.length;a++)o[a]()}this.requestsChangeHeight_.length>0&&!function(){f.log.fine(b,"change height requests:",e.requestsChangeHeight_.length);var t=e.requestsChangeHeight_;e.requestsChangeHeight_=[];for(var o=-1,a=[],l=0;l<t.length;l++){var u=t[l],c=u.resource,h=u.resource.getLayoutBox();if(h.height!=u.newHeight){var d=!1;u.force||!e.visible_?d=!0:e.activeHistory_.hasDescendantsOf(c.element)?d=!0:h.bottom>=i.bottom-r?d=!0:h.bottom<=i.top+n?s?(d=!1,
a.push(u)):e.requestsChangeHeight_.push(u):u.newHeight<h.height?d=!1:u.resource.overflowCallback(!0,u.newHeight),d&&(h.top>=0&&(o=-1==o?h.top:Math.min(o,h.top)),u.resource.changeHeight(u.newHeight),u.resource.overflowCallback(!1,u.newHeight))}}-1!=o&&(e.relayoutTop_=o),a.length>0&&e.vsync_.run({measure:function(t){t.scrollHeight=e.viewport_.getScrollHeight(),t.scrollTop=e.viewport_.getScrollTop()},mutate:function(t){var i=-1;a.forEach(function(e){var t=e.resource.getLayoutBox();i=-1==i?t.top:Math.min(i,t.top),e.resource.changeHeight(e.newHeight)}),-1!=i&&(e.relayoutTop_=i);var n=e.viewport_.getScrollHeight();n>t.scrollHeight&&e.viewport_.setScrollTop(t.scrollTop+(n-t.scrollHeight))}})}()}},{key:"checkPendingChangeHeight_",value:function(e){var t=(0,u.closest)(e,function(e){return e[w]});if(t){var i=this.getResourceForElement(t),n=i.getPendingChangeHeight();void 0!==n&&this.scheduleChangeHeight_(i,n,!0)}}},{key:"discoverWork_",value:function(){var e=m.timer.now(),t=this.relayoutAll_;this.relayoutAll_=!1;var i=this.relayoutTop_;this.relayoutTop_=-1;for(var n=0,r=0;r<this.resources_.length;r++){var s=this.resources_[r];s.getState()==R.NOT_BUILT&&s.build(this.forceBuild_),(s.getState()==R.NOT_LAID_OUT||t)&&(s.applySizesAndMediaQuery(),n++)}if(n>0||t||-1!=i)for(var r=0;r<this.resources_.length;r++){var s=this.resources_[r];s.getState()==R.NOT_BUILT||s.hasOwner()||(t||s.getState()==R.NOT_LAID_OUT||-1!=i&&s.getLayoutBox().bottom>=i)&&s.measure()}var o=this.viewport_.getRect(),a=void 0;a=this.visible_?(0,h.expandLayoutRect)(o,.25,2):this.prerenderSize_>0?(0,h.expandLayoutRect)(o,.25,this.prerenderSize_-1+.25):null;var l=(0,h.expandLayoutRect)(o,.25,.25);if(a)for(var r=0;r<this.resources_.length;r++){var s=this.resources_[r];s.getState()!=R.READY_FOR_LAYOUT||s.hasOwner()||s.isDisplayed()&&s.overlaps(a)&&this.scheduleLayoutOrPreload_(s,!0)}for(var r=0;r<this.resources_.length;r++){var s=this.resources_[r];if(!s.hasOwner()){var u=this.visible_&&s.isDisplayed()&&s.overlaps(l);s.isInViewport()!=u&&s.setInViewport(u)}}if(this.visible_&&0==this.exec_.getSize()&&0==this.queue_.getSize()&&e>this.exec_.getLastDequeueTime()+5e3)for(var c=0,r=0;r<this.resources_.length;r++){var s=this.resources_[r];if(s.getState()==R.READY_FOR_LAYOUT&&!s.hasOwner()&&s.isDisplayed()&&(f.log.fine(b,"idle layout:",s.debugid),this.scheduleLayoutOrPreload_(s,!1),c++,c>=4))break}}},{key:"documentBecameInactive_",value:function(){for(var e=0;e<this.resources_.length;e++){var t=this.resources_[e];t.documentBecameInactive()}}},{key:"work_",value:function(){var e=m.timer.now(),t=this.calcTaskScore_.bind(this,this.viewport_.getRect(),Math.sign(this.lastVelocity_)),i=-1,n=this.queue_.peek(t);if(n)do{if(i=this.calcTaskTimeout_(n),f.log.fine(b,"peek from queue:",n.id,"sched at",n.scheduleTime,"score",t(n),"timeout",i),i>16)break;this.queue_.dequeue(n);var r=this.exec_.getTaskById(n.id);r?r.promise.then(this.reschedule_.bind(this,n),this.reschedule_.bind(this,n)):(n.promise=n.callback(this.visible_),n.startTime=e,f.log.fine(b,"exec:",n.id,"at",n.startTime),this.exec_.enqueue(n),n.promise.then(this.taskComplete_.bind(this,n,!0),this.taskComplete_.bind(this,n,!1))["catch"](v.reportError)),n=this.queue_.peek(t),i=-1}while(n);if(f.log.fine(b,"queue size:",this.queue_.getSize()),f.log.fine(b,"exec size:",this.exec_.getSize()),i>=0)return i;var s=2*(e-this.exec_.getLastDequeueTime());return s=Math.max(Math.min(3e4,s),5e3)}},{key:"calcTaskScore_",value:function(e,t,i){var n=i.resource.getLayoutBox(),r=Math.floor((n.top-e.top)/e.height);return 0!=r&&Math.sign(r)!=(t||1)&&(r*=2),r=Math.abs(r),i.priority*O+r}},{key:"calcTaskTimeout_",value:function(e){if(0==this.exec_.getSize())return 0;var t=m.timer.now(),i=0;return this.exec_.forEach(function(n){var r=Math.max((e.priority-n.priority)*P,0);i=Math.max(i,r-(t-n.startTime))}),i}},{key:"reschedule_",value:function(e){this.queue_.getTaskById(e.id)||this.queue_.enqueue(e)}},{key:"taskComplete_",value:function(e,t,i){return this.exec_.dequeue(e),this.schedulePass(L),t?void 0:(f.log.error(b,"task failed:",e.id,e.resource.debugid,i),Promise.reject(i))}},{key:"scheduleChangeHeight_",value:function(e,t,i){if(e.resetPendingChangeHeight(),e.getLayoutBox().height!=t){for(var n=null,r=0;r<this.requestsChangeHeight_.length;r++)if(this.requestsChangeHeight_[r].resource==e){n=this.requestsChangeHeight_[r];break}n?(n.newHeight=t,n.force=i||n.force):this.requestsChangeHeight_.push({resource:e,newHeight:t,force:i}),this.schedulePassVsync()}}},{key:"scheduleDeferredMutate_",value:function(e,t){this.deferredMutates_.push(t)}},{key:"scheduleLayoutOrPreload_",value:function(e,t,i){(0,l.assert)(e.getState()!=R.NOT_BUILT&&e.isDisplayed(),"Not ready for layout: %s (%s)",e.debugid,e.getState()),(this.visible_||e.prerenderAllowed())&&(e.isInViewport()||e.renderOutsideViewport())&&(t?this.schedule_(e,E,C,i||0,e.startLayout.bind(e)):this.schedule_(e,S,T,i||0,e.startLayout.bind(e)))}},{key:"scheduleLayoutOrPreloadForSubresources_",value:function(e,t,i){var n=this,r=[];this.discoverResourcesForArray_(e,i,function(e){e.getState()!=R.NOT_BUILT&&r.push(e)}),r.length>0&&r.forEach(function(i){i.measure(),i.getState()==R.READY_FOR_LAYOUT&&i.isDisplayed()&&n.scheduleLayoutOrPreload_(i,t,e.getPriority())})}},{key:"schedule_",value:function(e,t,i,n,r){var s=e.debugid+"#"+t,o={id:s,resource:e,priority:Math.max(e.getPriority(),n)+i,callback:r,scheduleTime:m.timer.now()};f.log.fine(b,"schedule:",o.id,"at",o.scheduleTime);var a=this.queue_.getTaskById(s);(!a||o.priority<a.priority)&&(a&&this.queue_.dequeue(a),this.queue_.enqueue(o),this.schedulePass(this.calcTaskTimeout_(o))),o.resource.layoutScheduled()}},{key:"updateInViewportForSubresources_",value:function(e,t,i){var n=e.isInViewport()&&i;this.discoverResourcesForArray_(e,t,function(e){e.setInViewport(n)})}},{key:"discoverResourcesForArray_",value:function(e,t,i){var n=this;t.forEach(function(t){(0,l.assert)(e.element.contains(t)),n.discoverResourcesForElement_(t,i)})}},{key:"discoverResourcesForElement_",value:function(e,t){if(e.classList.contains("-amp-element"))t(this.getResourceForElement(e));else for(var i=e.getElementsByClassName("-amp-element"),n=[],r=0;r<i.length;r++){for(var s=i[r],o=!1,a=0;a<n.length;a++)if(n[a].contains(s)){o=!0;break}o||(n.push(s),t(this.getResourceForElement(s)))}}}]),e}();i.Resources=I;var M=function(){function e(t,i,r){babelHelpers.classCallCheck(this,e),this.id_=t,this.element=i,this.debugid=i.tagName.toLowerCase()+"#"+t,this.resources_=r,this.blacklisted_=!1,this.owner_=void 0,this.priority_=n(i.tagName),this.state_=i.isBuilt()?R.NOT_LAID_OUT:R.NOT_BUILT,this.layoutCount_=0,this.layoutBox_=(0,h.layoutRectLtwh)(-1e4,-1e4,0,0),this.isInViewport_=!1,this.onUpgraded_,this.pendingChangeHeight_}return babelHelpers.createClass(e,[{key:"getId",value:function(){return this.id_}},{key:"getOwner",value:function(){if(void 0===this.owner_){for(var e=(this.element,this.element);e;e=e.parentElement)if(e[k]){this.owner_=e[k];break}void 0===this.owner_&&(this.owner_=null)}return this.owner_}},{key:"hasOwner",value:function(){return!!this.getOwner()}},{key:"getPriority",value:function(){return this.priority_}},{key:"getState",value:function(){return this.state_}},{key:"build",value:function(e){if(this.blacklisted_||!this.element.isUpgraded())return!1;var t=void 0;try{t=this.element.build(e)}catch(i){f.log.error(b,"failed to build:",this.debugid,i),t=!1,this.blacklisted_=!0}return t?(this.state_=R.NOT_LAID_OUT,!0):!1}},{key:"applySizesAndMediaQuery",value:function(){this.element.applySizesAndMediaQuery()}},{key:"changeHeight",value:function(e){this.element.changeHeight(e),this.state_!=R.NOT_BUILT&&(this.state_=R.NOT_LAID_OUT)}},{key:"overflowCallback",value:function(e,t){e&&(this.pendingChangeHeight_=t),this.element.overflowCallback(e,t)}},{key:"resetPendingChangeHeight",value:function(){this.pendingChangeHeight_=void 0}},{key:"getPendingChangeHeight",value:function(){return this.pendingChangeHeight_}},{key:"measure",value:function(){if((0,l.assert)(this.element.isUpgraded(),"Must be upgraded to measure: %s",this.debugid),this.state_!=R.NOT_BUILT){var e=this.resources_.viewport_.getLayoutRect(this.element);(this.state_==R.NOT_LAID_OUT||this.layoutBox_.top!=e.top||this.layoutBox_.width!=e.width||this.layoutBox_.height!=e.height)&&(this.state_==R.NOT_LAID_OUT||this.element.isRelayoutNeeded())&&(this.state_=R.READY_FOR_LAYOUT),this.layoutBox_=e,this.element.updateLayoutBox(e)}}},{key:"getLayoutBox",value:function(){return this.layoutBox_}},{key:"isDisplayed",value:function(){return this.layoutBox_.height>0&&this.layoutBox_.width>0}},{key:"overlaps",value:function(e){return(0,h.layoutRectsOverlap)(this.layoutBox_,e)}},{key:"prerenderAllowed",value:function(){return this.element.prerenderAllowed()}},{key:"renderOutsideViewport",value:function(){return this.element.renderOutsideViewport()}},{key:"layoutScheduled",value:function(){this.state_=R.LAYOUT_SCHEDULED}},{key:"startLayout",value:function(e){var t=this;if(this.layoutPromise_)return this.layoutPromise_;if(this.state_==R.LAYOUT_COMPLETE)return Promise.resolve();if(this.state_==R.LAYOUT_FAILED)return Promise.reject("already failed");if((0,l.assert)(this.state_!=R.NOT_BUILT,"Not ready to start layout: %s (%s)",this.debugid,this.state_),!e&&!this.prerenderAllowed())return f.log.fine(b,"layout canceled due to non pre-renderable element:",this.debugid,this.state_),this.state_=R.READY_FOR_LAYOUT,Promise.resolve();if(!this.renderOutsideViewport()&&!this.isInViewport())return f.log.fine(b,"layout canceled due to element not being in viewport:",this.debugid,this.state_),this.state_=R.READY_FOR_LAYOUT,Promise.resolve();if(this.measure(),!this.isDisplayed())return f.log.fine(b,"layout canceled due to element loosing display:",this.debugid,this.state_),Promise.resolve();if(this.layoutCount_>0&&!this.element.isRelayoutNeeded())return f.log.fine(b,"layout canceled since it wasn't requested:",this.debugid,this.state_),this.state_=R.LAYOUT_COMPLETE,Promise.resolve();f.log.fine(b,"start layout:",this.debugid,"count:",this.layoutCount_),this.layoutCount_++,this.state_=R.LAYOUT_SCHEDULED;var i=void 0;try{i=this.element.layoutCallback()}catch(n){return Promise.reject(n)}return this.layoutPromise_=i.then(function(){return t.layoutComplete_(!0)},function(e){return t.layoutComplete_(!1,e)}),this.layoutPromise_}},{key:"layoutComplete_",value:function(e,t){return this.layoutPromise_=null,this.state_=e?R.LAYOUT_COMPLETE:R.LAYOUT_FAILED,e?void f.log.fine(b,"layout complete:",this.debugid):(f.log.fine(b,"loading failed:",this.debugid,t),Promise.reject(t))}},{key:"isInViewport",value:function(){return this.isInViewport_}},{key:"setInViewport",value:function(e){e!=this.isInViewport_&&(f.log.fine(b,"inViewport:",this.debugid,e),this.isInViewport_=e,this.element.viewportCallback(e))}},{key:"documentBecameInactive",value:function(){this.state_!=R.NOT_BUILT&&(this.isInViewport()&&this.setInViewport(!1),this.element.documentInactiveCallback()&&(this.state_=R.NOT_LAID_OUT))}},{key:"forceAll",value:function(){var e=this;(0,l.assert)(!this.resources_.isRuntimeOn_);var t=Promise.resolve();return this.state_==R.NOT_BUILT&&(this.element.isUpgraded()||(t=t.then(function(){return new Promise(function(t){e.onUpgraded_=t})})),t=t.then(function(){e.onUpgraded_=void 0,e.build(!0)})),t.then(function(){if(e.applySizesAndMediaQuery(),e.measure(),e.layoutPromise_)return e.layoutPromise_;if(e.state_==R.LAYOUT_COMPLETE||e.state_==R.LAYOUT_FAILED||e.layoutCount_>0)return Promise.resolve();if(!e.isDisplayed())return Promise.resolve();e.layoutCount_++;try{return e.element.layoutCallback()}catch(t){return Promise.reject(t)}})}}]),e}();i.Resource=M;var H=function(){function e(){babelHelpers.classCallCheck(this,e),this.tasks_=[],this.taskIdMap_={},this.lastEnqueueTime_=0,this.lastDequeueTime_=0}return babelHelpers.createClass(e,[{key:"getSize",value:function(){return this.tasks_.length}},{key:"getLastEnqueueTime",value:function(){return this.lastEnqueueTime_}},{key:"getLastDequeueTime",value:function(){return this.lastDequeueTime_}},{key:"getTaskById",value:function(e){return this.taskIdMap_[e]||null}},{key:"enqueue",value:function(e){(0,l.assert)(!this.taskIdMap_[e.id],"Task already enqueued: %s",e.id),this.tasks_.push(e),this.taskIdMap_[e.id]=e,this.lastEnqueueTime_=m.timer.now()}},{key:"dequeue",value:function(e){var t=this.taskIdMap_[e.id];return t?(this.tasks_.splice(this.tasks_.indexOf(t),1),delete this.taskIdMap_[e.id],this.lastDequeueTime_=m.timer.now(),!0):!1}},{key:"peek",value:function(e){for(var t=1e6,i=null,n=0;n<this.tasks_.length;n++){var r=this.tasks_[n],s=e(r);t>s&&(t=s,i=r)}return i}},{key:"forEach",value:function(e){this.tasks_.forEach(e)}}]),e}();i.TaskQueue_=H;var R={NOT_BUILT:0,NOT_LAID_OUT:1,READY_FOR_LAYOUT:2,LAYOUT_SCHEDULED:3,LAYOUT_COMPLETE:4,LAYOUT_FAILED:5};i.ResourceState_=R},{"./asserts":54,"./document-state":62,"./dom":63,"./error":65,"./focus-history":70,"./input":71,"./layout-rect":73,"./log":76,"./pass":79,"./service":87,"./styles":93,"./timer":95,"./viewer":99,"./viewport":100,"./vsync":101}],86:[function(e,t,i){function n(e){if(!e.AMP_TAG){e.AMP_TAG=!0;var t=e.AMP||[];e.AMP={win:e},e.AMP.registerElement=function(t,i,n){var r=function(){(0,p.registerExtendedElement)(e,t,i),g.push({name:t,implementationClass:i})};n?(0,u.installStyles)(e.document,n,r):r()},e.AMP.BaseElement=s.BaseElement,e.AMP.BaseTemplate=o.BaseTemplate,e.AMP.registerTemplate=function(t,i){(0,o.registerExtendedTemplate)(e,t,i)},e.AMP.assert=a.assert;var i=(0,m.viewerFor)(e);e.AMP.viewer=i,(0,l.getMode)().development&&(e.AMP.toggleRuntime=i.toggleRuntime.bind(i),e.AMP.resources=(0,f.resourcesFor)(e),e.AMP.isExperimentOn=c.isExperimentOn.bind(null,e),e.AMP.toggleExperiment=c.toggleExperiment.bind(null,e));var n=(0,_.viewportFor)(e);e.AMP.viewport={},e.AMP.viewport.getScrollLeft=n.getScrollLeft.bind(n),e.AMP.viewport.getScrollWidth=n.getScrollWidth.bind(n),e.AMP.viewport.getWidth=n.getWidth.bind(n),e.AMP.push=function(i){t.push(i),i(e.AMP)},e.AMP.setTickFunction=function(t,i){var n=(0,h.performanceFor)(e);n.setTickFunction(t,i)};for(var r=0;r<t.length;r++){var d=t[r];try{d(e.AMP)}catch(y){v.timer.delay(function(){throw y},1)}}}}function r(e){for(var t=0;t<g.length;t++){var i=g[t];(0,d.registerElement)(e,i.name,i.implementationClass)}}Object.defineProperty(i,"__esModule",{value:!0}),i.adopt=n,i.registerForUnitTest=r;var s=e("./base-element"),o=e("./template"),a=e("./asserts"),l=e("./mode"),u=e("./styles"),c=e("./experiments"),h=e("./performance"),d=e("./custom-element"),p=e("./extended-element"),f=e("./resources"),v=e("./timer"),m=e("./viewer"),_=e("./viewport"),g=[]},{"./asserts":54,"./base-element":55,"./custom-element":59,"./experiments":67,"./extended-element":69,"./mode":77,"./performance":80,"./resources":85,"./styles":93,"./template":94,"./timer":95,"./viewer":99,"./viewport":100}],87:[function(e,t,i){function n(e,t,i){var n=a(e,t),r=n[t];return r&&r.obj||((0,u.assert)(i,"Factory not given and service missing %s",t),r||(r=n[t]={}),r.obj=i(e),r.resolve&&r.resolve(r.obj)),r.obj}function r(e,t,i){(0,u.assert)(s(e,i),"Service %s was requested to be provided through %s, but %s is not loaded in the current page. To fix this problem load the JavaScript file for %s in this page.",t,i,i,i);var n=a(e,t),r=n[t];if(r){if(r.promise)return r.promise;if(r.obj)return r.promise=Promise.resolve(r.obj)}var o=void 0,l=new Promise(function(e){o=e});return n[t]={obj:null,promise:l,resolve:o},l}function s(e,t){return(0,u.assert)(e.ampExtendedElements,"win.ampExtendedElements not created yet"),!!e.ampExtendedElements[t]}function o(e,t){e.ampExtendedElements||(e.ampExtendedElements={}),e.ampExtendedElements[t]=!0}function a(e){var t=e.services;return t||(t=e.services={}),t}function l(e,t){e.services&&(e.services[t]=null)}Object.defineProperty(i,"__esModule",{value:!0}),i.getService=n,i.getElementService=r,i.markElementScheduledForTesting=o,i.resetServiceForTesting=l;var u=e("./asserts")},{"./asserts":54}],88:[function(e,t,i){function n(e){var t={};return t[p]=e,t}function r(e){var t=(0,h.viewerFor)(e),i=void 0;return i=t.isOvertakeHistory()?new m(t):new v(e),new f(i)}function s(e){(0,l.getService)(e,"history",function(){return r(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.installHistoryService=s;var o=e("../pass"),a=e("../asserts"),l=e("../service"),u=e("../log"),c=e("../timer"),h=e("../viewer"),d="History",p="AMP.History",f=function(){function e(t){babelHelpers.classCallCheck(this,e),this.binding_=t,this.stackIndex_=0,this.stackOnPop_=[],this.queue_=[],this.binding_.setOnStackIndexUpdated(this.onStackIndexUpdated_.bind(this))}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){this.binding_.cleanup_()}},{key:"push",value:function(e){var t=this;return this.enque_(function(){return t.binding_.push().then(function(i){return t.onStackIndexUpdated_(i),e&&(t.stackOnPop_[i]=e),i})})}},{key:"pop",value:function(e){var t=this;return this.enque_(function(){return t.binding_.pop(e).then(function(e){t.onStackIndexUpdated_(e)})})}},{key:"onStackIndexUpdated_",value:function(e){this.stackIndex_=e,this.doPop_()}},{key:"doPop_",value:function(){if(!(this.stackIndex_>=this.stackOnPop_.length-1)){for(var e=[],t=this.stackOnPop_.length-1;t>this.stackIndex_;t--)this.stackOnPop_[t]&&(e.push(this.stackOnPop_[t]),this.stackOnPop_[t]=void 0);if(this.stackOnPop_.splice(this.stackIndex_+1),e.length>0)for(var t=0;t<e.length;t++)c.timer.delay(e[t],1)}}},{key:"enque_",value:function(e){var t=void 0,i=void 0,n=new Promise(function(e,n){t=e,i=n});return this.queue_.push({callback:e,resolve:t,reject:i}),1==this.queue_.length&&this.deque_(),n}},{key:"deque_",value:function(){var e=this;if(0!=this.queue_.length){var t=this.queue_[0],i=void 0;try{i=t.callback()}catch(n){i=Promise.reject(n)}i.then(function(e){t.resolve(e)},function(e){u.log.error(d,"failed to execute a task:",e),t.reject(e)}).then(function(){e.queue_.splice(0,1),e.deque_()})}}}]),e}();i.History=f;var v=(function(){function e(){babelHelpers.classCallCheck(this,e)}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){}},{key:"setOnStackIndexUpdated",value:function(e){}},{key:"push",value:function(){}},{key:"pop",value:function(e){}}]),e}(),function(){function e(t){var i=this;babelHelpers.classCallCheck(this,e),this.win=t;var r=this.win.history;this.startIndex_=r.length-1,r.state&&void 0!==r.state[p]&&(this.startIndex_=Math.min(r.state[p],this.startIndex_)),this.stackIndex_=this.startIndex_,this.waitingState_,this.onStackIndexUpdated_=null,this.supportsState_="state"in r,this.unsupportedState_=n(this.stackIndex_);var s=void 0,a=void 0;r.pushState&&r.replaceState?(this.origPushState_=r.pushState.bind(r),this.origReplaceState_=r.replaceState.bind(r),s=function(e,t,n){i.unsupportedState_=e,i.origPushState_(e,t,n)},a=function(e,t,n){i.unsupportedState_=e,void 0!==n?i.origReplaceState_(e,t,n):i.origReplaceState_(e,t)}):(s=function(e,t,n){i.unsupportedState_=e},a=function(e,t,n){i.unsupportedState_=e}),this.pushState_=s,this.replaceState_=a;try{this.replaceState_(n(this.stackIndex_))}catch(l){u.log.error(d,"Initial replaceState failed: "+l.message)}r.pushState=this.historyPushState_.bind(this),r.replaceState=this.historyReplaceState_.bind(this);var c=new o.Pass(this.onHistoryEvent_.bind(this),50);this.popstateHandler_=function(e){u.log.fine(d,"popstate event: "+i.win.history.length+", "+JSON.stringify(e.state)),c.schedule()},this.hashchangeHandler_=function(){u.log.fine(d,"hashchange event: "+i.win.history.length+", "+i.win.location.hash),c.schedule()},this.win.addEventListener("popstate",this.popstateHandler_),this.win.addEventListener("hashchange",this.hashchangeHandler_)}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){this.origPushState_&&(this.win.history.pushState=this.origPushState_),this.origReplaceState_&&(this.win.history.replaceState=this.origReplaceState_),this.win.removeEventListener("popstate",this.popstateHandler_),this.win.removeEventListener("hashchange",this.hashchangeHandler_)}},{key:"setOnStackIndexUpdated",value:function(e){this.onStackIndexUpdated_=e}},{key:"push",value:function(){var e=this;return this.whenReady_(function(){return e.historyPushState_(),Promise.resolve(e.stackIndex_)})}},{key:"pop",value:function(e){var t=this;return e=Math.max(e,this.startIndex_),this.whenReady_(function(){return t.back_(t.stackIndex_-e+1)})}},{key:"backTo",value:function(e){var t=this;return e=Math.max(e,this.startIndex_),this.whenReady_(function(){return t.back_(t.stackIndex_-e)})}},{key:"onHistoryEvent_",value:function(){var e=this.getState_();u.log.fine(d,"history event: "+this.win.history.length+", "+JSON.stringify(e));var t=e?e[p]:void 0,i=this.stackIndex_,n=this.waitingState_;this.waitingState_=void 0,i>this.win.history.length-2&&(i=this.win.history.length-2,this.updateStackIndex_(i)),void 0==t?i+=1:i=t<this.win.history.length?t:this.win.history.length-1,e||(e={}),e[p]=i,this.replaceState_(e,void 0,void 0),i!=this.stackIndex_&&this.updateStackIndex_(i),i<this.startIndex_&&(this.startIndex_=i),n&&n.resolve()}},{key:"getState_",value:function(){return this.supportsState_?this.win.history.state:this.unsupportedState_}},{key:"assertReady_",value:function(){(0,a.assert)(!this.waitingState_,"The history must not be in the waiting state")}},{key:"whenReady_",value:function(e){return this.waitingState_?this.waitingState_.promise.then(e,e):e()}},{key:"wait_",value:function(){this.assertReady_();var e=void 0,t=void 0,i=c.timer.timeoutPromise(500,new Promise(function(i,n){e=i,t=n}));return this.waitingState_={promise:i,resolve:e,reject:t},i}},{key:"back_",value:function(e){var t=this;if(this.assertReady_(),0>=e)return Promise.resolve(this.stackIndex_);this.unsupportedState_=n(this.stackIndex_-e);var i=this.wait_();return this.win.history.go(-e),i.then(function(){return Promise.resolve(t.stackIndex_)})}},{key:"historyPushState_",value:function(e,t,i){this.assertReady_(),e||(e={});var n=(this.win.history.length,this.stackIndex_+1);e[p]=n,this.pushState_(e,t,i),n!=this.win.history.length-1&&(n=this.win.history.length-1,e[p]=n,this.replaceState_(e)),this.updateStackIndex_(n)}},{key:"historyReplaceState_",value:function(e,t,i){this.assertReady_(),e||(e={});var n=Math.min(this.stackIndex_,this.win.history.length-1);e[p]=n,this.replaceState_(e,t,i),this.updateStackIndex_(n)}},{key:"updateStackIndex_",value:function(e){this.assertReady_(),e=Math.min(e,this.win.history.length-1),this.stackIndex_!=e&&(u.log.fine(d,"stack index changed: "+this.stackIndex_+" -> "+e),this.stackIndex_=e,this.onStackIndexUpdated_&&this.onStackIndexUpdated_(e))}}]),e}());i.HistoryBindingNatural_=v;var m=function(){function e(t){babelHelpers.classCallCheck(this,e),this.viewer_=t,this.stackIndex_=0,this.onStackIndexUpdated_=null,this.unlistenOnHistoryPopped_=this.viewer_.onHistoryPoppedEvent(this.onHistoryPopped_.bind(this))}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){this.unlistenOnHistoryPopped_()}},{key:"setOnStackIndexUpdated",value:function(e){this.onStackIndexUpdated_=e}},{key:"push",value:function(){return this.updateStackIndex_(this.stackIndex_+1),this.viewer_.postPushHistory(this.stackIndex_),Promise.resolve(this.stackIndex_)}},{key:"pop",value:function(e){return e>this.stackIndex_?Promise.resolve(this.stackIndex_):(this.viewer_.postPopHistory(e),this.updateStackIndex_(e-1),Promise.resolve(this.stackIndex_))}},{key:"onHistoryPopped_",value:function(e){this.updateStackIndex_(e.newStackIndex)}},{key:"updateStackIndex_",value:function(e){this.stackIndex_!=e&&(u.log.fine(d,"stack index changed: "+this.stackIndex_+" -> "+e),this.stackIndex_=e,this.onStackIndexUpdated_&&this.onStackIndexUpdated_(e))}}]),e}();i.HistoryBindingVirtual_=m},{"../asserts":54,"../log":76,"../pass":79,"../service":87,"../timer":95,"../viewer":99}],89:[function(e,t,i){function n(e){var t=e.split(",");(0,r.assert)(t.length>0,"sizes has to have at least one size");var i=[];return t.forEach(function(e){if(e=e.replace(/\s+/g," ").trim(),0!=e.length){var t=void 0,n=void 0,r=e.lastIndexOf(" ");-1!=r?(t=e.substring(0,r).trim(),n=e.substring(r+1).trim()):(n=e,t=void 0),i.push({mediaQuery:t,size:(0,s.assertLength)(n)})}}),new o(i)}Object.defineProperty(i,"__esModule",{value:!0}),i.parseSizeList=n;var r=e("./asserts"),s=e("./layout"),o=function(){function e(t){babelHelpers.classCallCheck(this,e),(0,r.assert)(t.length>0,"SizeList must have at least one option"),this.sizes_=t;for(var i=0;i<t.length;i++){var n=t[i];i<t.length-1?(0,r.assert)(n.mediaQuery,"All options except for the last must have a media condition"):(0,r.assert)(!n.mediaQuery,"The last option must not have a media condition")}}return babelHelpers.createClass(e,[{key:"select",value:function(e){for(var t=0;t<this.sizes_.length-1;t++){var i=this.sizes_[t];if(e.matchMedia(i.mediaQuery).matches)return i.size}return this.getLast()}},{key:"getLast",value:function(){return this.sizes_[this.sizes_.length-1].size}}]),e}();i.SizeList=o},{"./asserts":54,"./layout":74}],90:[function(e,t,i){function n(e){var t=e.match(/\s*([^\s]*)(\s+(-?(\d+(\.(\d+)?)?|\.\d+)[a-zA-Z]))?(\s*,)?/g);(0,r.assert)(t.length>0,"srcset has to have at least one source");var i=[];return t.forEach(function(e){e=e.trim(),","==e.substr(-1)&&(e=e.substr(0,e.length-1).trim());var t=e.split(/\s+/,2);if(0!=t.length&&(1!=t.length||t[0])&&(2!=t.length||t[0]||t[1])){var n=t[0].trim();if(1==t.length||2==t.length&&!t[1])i.push({url:n,dpr:1});else{var r=t[1].trim().toLowerCase(),s=r.substring(r.length-1);"w"==s?i.push({url:n,width:parseFloat(r)}):"x"==s&&i.push({url:n,dpr:parseFloat(r)})}}}),new s(i)}Object.defineProperty(i,"__esModule",{value:!0}),i.parseSrcset=n;var r=e("./asserts"),s=function(){function e(t){babelHelpers.classCallCheck(this,e),(0,r.assert)(t.length>0,"Srcset must have at least one source"),this.sources_=t;var i=!1,n=!1;this.sources_.forEach(function(e){(0,r.assert)((e.width||e.dpr)&&(!e.width||!e.dpr),"Either dpr or width must be specified"),i=i||!!e.width,n=n||!!e.dpr}),(0,r.assert)(!i||!n,"Srcset cannot have both width and dpr sources"),i?this.sources_.sort(function(e,t){return(0,r.assert)(e.width!=t.width,"Duplicate width: %s",e.width),t.width-e.width}):this.sources_.sort(function(e,t){return(0,r.assert)(e.dpr!=t.dpr,"Duplicate dpr: %s",e.dpr),t.dpr-e.dpr}),this.widthBased_=i,this.dprBased_=n}return babelHelpers.createClass(e,[{key:"select",value:function(e,t){(0,r.assert)(e,"width=%s",e),(0,r.assert)(t,"dpr=%s",t);var i=-1;return this.widthBased_?i=this.selectByWidth_(e,t):this.dprBased_&&(i=this.selectByDpr_(e,t)),-1!=i?this.sources_[i]:this.getLast()}},{key:"selectByWidth_",value:function(e,t){for(var i=-1,n=1e6,r=1e6,s=0;s<this.sources_.length;s++){var o=this.sources_[s],a=void 0;a=o.width?o.width/t:n/2,n=Math.min(n,a);var l=Math.abs((a-e)/e-.2);r>l&&(r=l,i=s)}return i}},{key:"selectByDpr_",value:function(e,t){for(var i=-1,n=1e6,r=0;r<this.sources_.length;r++){var s=this.sources_[r],o=s.dpr||1,a=Math.abs(o-t);n>a&&(n=a,i=r)}return i}},{key:"getLast",value:function(){return this.sources_[this.sources_.length-1]}}]),e}();i.Srcset=s},{"./asserts":54}],91:[function(e,t,i){function n(e){return e.replace(/-([a-z])/g,function(e,t){return t.toUpperCase()})}function r(e,t,i){for(var n=i||1,r=function(i){var n=0;return e=e.replace(/\${([^}]*)}/g,function(e,i){return n++,t(i)}),n?void 0:"break"},s=0;n>s;s++){var o=r(s);if("break"===o)break}return e}Object.defineProperty(i,"__esModule",{value:!0}),i.dashToCamelCase=n,i.expandTemplate=r},{}],92:[function(e,t,i){function n(e){return e.charAt(0).toUpperCase()+e.slice(1)}function r(e,t){for(var i=0;i<v.length;i++){var n=v[i]+t;if(void 0!==e[n])return n}return""}function s(e,t,i){var s=f[t];if(!s||i){if(s=t,void 0===e[t]){var o=n(t),a=r(e,o);void 0!==e[a]&&(s=a)}i||(f[t]=s)}return s}function o(e,t,i,n,r){var o=s(e.style,t,r);o&&(e.style[o]=n?i+n:i)}function a(e,t,i){var n=s(e.style,t,i);if(n)return e.style[n]}function l(e,t){for(var i in t)o(e,i,t[i])}function u(e,t){void 0===t&&(t=!("none"!=e.style.display)),e.style.display=t?"":"none"}function c(e){return e+"px"}function h(e){return"string"==typeof e?"translateX("+e+")":"translateX("+c(e)+")"}function d(e,t){return"number"==typeof e&&(e=c(e)),void 0===t?"translate("+e+")":("number"==typeof t&&(t=c(t)),"translate("+e+","+t+")")}function p(e){return"scale("+e+")"}Object.defineProperty(i,"__esModule",{value:!0}),i.camelCaseToTitleCase=n,i.getVendorJsPropertyName=s,i.setStyle=o,i.getStyle=a,i.setStyles=l,i.toggle=u,i.px=c,i.translateX=h,i.translate=d,i.scale=p;var f=Object.create(null),v=["Webkit","webkit","Moz","moz","ms","O","o"]},{}],93:[function(e,t,i){function n(e,t,i,n){var r=(e.styleSheets.length,e.createElement("style"));r.textContent=t;var o=null;n?r.setAttribute("amp-runtime",""):o=e.querySelector("style[amp-runtime]"),s(e.head,r,o);var a=function(){for(var t=e.styleSheets,i=0;i<t.length;i++){var n=t[i];if(n.ownerNode==r)return!0}return!1};if(a())return void i();var l=setInterval(function(){a()&&(clearInterval(l),i())},4)}function r(e){var t=void 0,i=function(){e.body&&((0,o.setStyles)(e.body,{opacity:1,visibility:"visible",animation:"none"}),clearInterval(t))};t=setInterval(i,4),i()}function s(e,t,i){i?i.nextSibling?e.insertBefore(t,i.nextSibling):e.appendChild(t):e.insertBefore(t,e.firstChild)}Object.defineProperty(i,"__esModule",{value:!0}),i.installStyles=n,i.makeBodyVisible=r;var o=e("./style")},{"./style":92}],94:[function(e,t,i){function n(e,t,i){return r(e).registerTemplate_(t,i)}function r(e){return(0,a.getService)(e,"templates",function(){return new h(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.registerExtendedTemplate=n,i.templatesFor=r;var s=e("./asserts"),o=e("./dom"),a=e("./service"),l="__AMP_IMPL_",u="__AMP_WAIT_",c=function(){function e(t){babelHelpers.classCallCheck(this,e),this.element=t,this.compileCallback()}return babelHelpers.createClass(e,[{key:"getWin",value:function(){return this.element.ownerDocument.defaultView}},{key:"compileCallback",value:function(){}},{key:"render",value:function(e){throw new Error("Not implemented")}},{key:"unwrap",value:function(e){for(var t=null,i=e.firstChild;null!=i;i=i.nextSibling)if(3==i.nodeType){if(i.textContent.trim()){t=null;break}}else if(8==i.nodeType);else if(1==i.nodeType){if(t){t=null;break}t=i}else t=null;return t||e}}]),e}();i.BaseTemplate=c;var h=function(){function e(t){babelHelpers.classCallCheck(this,e),this.win_=t,this.templateClassMap_={},this.templateClassResolvers_={},this.declaredTemplates_}return babelHelpers.createClass(e,[{key:"renderTemplate",value:function(e,t){return this.getImplementation_(e).then(function(e){return e.render(t)})}},{key:"renderTemplateArray",value:function(e,t){return 0==t.length?Promise.resolve([]):this.getImplementation_(e).then(function(e){return t.map(function(t){return e.render(t)})})}},{key:"findAndRenderTemplate",value:function(e,t){return this.renderTemplate(this.findTemplate_(e),t)}},{key:"findAndRenderTemplateArray",value:function(e,t){return this.renderTemplateArray(this.findTemplate_(e),t)}},{key:"findTemplate_",value:function(e){var t=null,i=e.getAttribute("template");return t=i?e.ownerDocument.getElementById(i):(0,o.childElementByTag)(e,"template"),(0,s.assert)(t,"Template not found for %s",e),(0,s.assert)("TEMPLATE"==t.tagName,'Template element must be a "template" tag %s',t),t}},{key:"getImplementation_",value:function(e){var t=e[l];if(t)return Promise.resolve(t);var i=(0,s.assert)(e.getAttribute("type"),"Type must be specified: %s",e),n=e[u];return n?n:(n=this.waitForTemplateClass_(e,i).then(function(t){var i=e[l]=new t(e);return delete e[u],i}),e[u]=n,n)}},{key:"waitForTemplateClass_",value:function(e,t){if(this.templateClassMap_[t])return this.templateClassMap_[t];this.checkTemplateDeclared_(e,t);var i=void 0,n=new Promise(function(e,t){i=e});return this.templateClassMap_[t]=n,this.templateClassResolvers_[t]=i,n}},{key:"checkTemplateDeclared_",value:function(e,t){if(!this.declaredTemplates_){this.declaredTemplates_=this.win_.Object.create(null);
for(var i=this.win_.document.querySelectorAll("script[custom-template]"),n=0;n<i.length;n++)this.declaredTemplates_[i[n].getAttribute("custom-template")]=!0}(0,s.assert)(this.declaredTemplates_[t],"Template must be declared for %s as <script custom-template=%s>",e,t)}},{key:"registerTemplate_",value:function(e,t){if(this.templateClassMap_[e]){var i=this.templateClassResolvers_[e];(0,s.assert)(i,"Duplicate template type: %s",e),delete this.templateClassResolvers_[e],i(t)}else this.templateClassMap_[e]=Promise.resolve(t)}}]),e}();i.Templates=h},{"./asserts":54,"./dom":63,"./service":87}],95:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(t){babelHelpers.classCallCheck(this,e),this.win=t,this.resolved_=Promise.resolve(),this.taskCount_=0,this.canceled_={},this.startTime_=this.now()}return babelHelpers.createClass(e,[{key:"now",value:function(){return Number(new Date)}},{key:"timeSinceStart",value:function(){return this.now()-this.startTime_}},{key:"delay",value:function(e,t){var i=this;if(!t){var n=function(){var t="p"+i.taskCount_++;return i.resolved_.then(function(){return i.canceled_[t]?void delete i.canceled_[t]:void e()}),{v:t}}();if("object"==typeof n)return n.v}return this.win.setTimeout(e,t)}},{key:"cancel",value:function(e){return"string"==typeof e?void(this.canceled_[e]=!0):void this.win.clearTimeout(e)}},{key:"promise",value:function(e,t){var i=this,n=null;return new Promise(function(r,s){n=i.delay(function(){n=-1,r(t)},e),-1==n&&s(new Error("Failed to schedule timer."))})["catch"](function(e){return-1!=n&&i.cancel(n),Promise.reject(e)})}},{key:"timeoutPromise",value:function(e,t){var i=this,n=null,r=new Promise(function(t,r){n=i.delay(function(){n=-1,r("timeout")},e),-1==n&&r(new Error("Failed to schedule timer."))})["catch"](function(e){return-1!=n&&i.cancel(n),Promise.reject(e)});return t?new Promise(function(e,i){r.then(e,i),t.then(e,i)}):r}}]),e}();i.Timer=n;var r=new n(window);i.timer=r},{}],96:[function(e,t,i){function n(e){return(0,o.getService)(e,"url-replace",function(){return new d(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.urlReplacementsFor=n;var r=(e("./asserts"),e("./cid")),s=e("./document-info"),o=e("./service"),a=e("./log"),l=e("./url"),u=e("./viewport"),c=e("./vsync"),h="UrlReplacements",d=function(){function e(t){var i=this;babelHelpers.classCallCheck(this,e),this.win_=t,this.replacementExpr_,this.replacements_=this.win_.Object.create(null),this.set_("RANDOM",function(){return Math.random()}),this.set_("CANONICAL_URL",function(){return(0,s.documentInfoFor)(i.win_).canonicalUrl}),this.set_("CANONICAL_HOST",function(){var e=(0,l.parseUrl)((0,s.documentInfoFor)(i.win_).canonicalUrl);return e&&e.hostname}),this.set_("CANONICAL_PATH",function(){var e=(0,l.parseUrl)((0,s.documentInfoFor)(i.win_).canonicalUrl);return e&&e.pathname}),this.set_("DOCUMENT_REFERRER",function(){return i.win_.document.referrer}),this.set_("TITLE",function(){return i.win_.document.title}),this.set_("AMPDOC_URL",function(){return(0,l.removeFragment)(i.win_.location.href)}),this.set_("AMPDOC_HOST",function(){var e=(0,l.parseUrl)(i.win_.location.href);return e&&e.hostname}),this.set_("PAGE_VIEW_ID",function(){return(0,s.documentInfoFor)(i.win_).pageViewId}),this.set_("CLIENT_ID",function(e,t){return(0,r.cidFor)(i.win_).then(function(e){return e.get(t,Promise.resolve())})}),this.set_("TIMESTAMP",function(){return(new Date).getTime()}),this.set_("TIMEZONE",function(){return(new Date).getTimezoneOffset()}),this.set_("SCROLL_TOP",function(){return(0,c.vsyncFor)(i.win_).measurePromise(function(){return(0,u.viewportFor)(i.win_).getScrollTop()})}),this.set_("SCROLL_LEFT",function(){return(0,c.vsyncFor)(i.win_).measurePromise(function(){return(0,u.viewportFor)(i.win_).getScrollLeft()})}),this.set_("SCROLL_HEIGHT",function(){return(0,c.vsyncFor)(i.win_).measurePromise(function(){return(0,u.viewportFor)(i.win_).getScrollHeight()})}),this.set_("SCREEN_WIDTH",function(){return i.win_.screen.width}),this.set_("SCREEN_HEIGHT",function(){return i.win_.screen.height})}return babelHelpers.createClass(e,[{key:"set_",value:function(e,t){return this.replacements_[e]=t,this.replacementExpr_=void 0,this}},{key:"expand",value:function(e,t){var i=this,n=this.getExpr_(),r=void 0,s=function(e){return e||0===e||(e=""),encodeURIComponent(e)};return e=e.replace(n,function(n,o,l){var u=i.replacements_[o](t,l);if(u&&u.then){var c=function(){var t=u.then(function(t){e=e.replace(n,s(t))},function(e){a.log.error(h,"Failed to expand: "+o,e)});return r=r?r.then(function(){return t}):t,{v:n}}();if("object"==typeof c)return c.v}return s(u)}),r&&(r=r.then(function(){return e})),r||Promise.resolve(e)}},{key:"getExpr_",value:function(){if(!this.replacementExpr_){var e="";for(var t in this.replacements_)e+=(e.length>0?"|":"")+t;this.replacementExpr_=new RegExp("\\$?("+e+")(?:\\(([a-zA-Z-_]+)\\))?","g")}return this.replacementExpr_}}]),e}()},{"./asserts":54,"./cid":56,"./document-info":61,"./log":76,"./service":87,"./url":97,"./viewport":100,"./vsync":101}],97:[function(e,t,i){function n(e){var t=document.createElement("a");t.href=e;var i={href:t.href,protocol:t.protocol,host:t.host,hostname:t.hostname,port:"0"==t.port?"":t.port,pathname:t.pathname,search:t.search,hash:t.hash};return i.origin=t.origin&&"null"!=t.origin?t.origin:o(i),(0,l.assert)(i.origin,"Origin must exist"),i}function r(e,t){var i=n(e);return(0,l.assert)("https:"==i.protocol||/^(\/\/)/.test(e)||"localhost"==i.hostname||i.hostname.lastIndexOf(".localhost")==i.hostname.length-".localhost".length,'%s source must start with "https://" or "//" or be relative and served from https. Invalid value: %s',t,e),e}function s(e){var t=Object.create(null);if(!e)return t;(0==e.indexOf("?")||0==e.indexOf("#"))&&(e=e.substr(1));for(var i=e.split("&"),n=0;n<i.length;n++){var r=i[n],s=r.indexOf("="),o=void 0,a=void 0;-1!=s?(o=decodeURIComponent(r.substring(0,s)).trim(),a=decodeURIComponent(r.substring(s+1)).trim()):(o=decodeURIComponent(r).trim(),a=""),o&&(t[o]=a)}return t}function o(e){return"data:"!=e.protocol&&e.host?e.protocol+"//"+e.host:e.href}function a(e){var t=e.indexOf("#");return-1==t?e:e.substring(0,t)}Object.defineProperty(i,"__esModule",{value:!0}),i.parseUrl=n,i.assertHttpsUrl=r,i.parseQueryString=s,i.getOrigin=o,i.removeFragment=a;var l=e("./asserts")},{"./asserts":54}],98:[function(e,t,i){function n(e){if((0,r.getMode)().development){var t=e.location.href;if(0!=t.indexOf("about:")){var i=document.createElement("script");i.src="https://www.gstatic.com/amphtml/v0/validator.js",i.onload=function(){e.document.head.removeChild(i),amp.validator.validateUrlAndLog(t,e.document)},e.document.head.appendChild(i)}}}Object.defineProperty(i,"__esModule",{value:!0}),i.maybeValidate=n;var r=e("./mode")},{"./mode":77}],99:[function(e,t,i){function n(e,t){var i=(0,c.parseQueryString)(e);for(var n in i)t[n]=i[n]}function r(e){return(0,l.getService)(e,"viewer",function(){return new m(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.parseParams_=n,i.viewerFor=r;var s=e("./observable"),o=e("./asserts"),a=e("./document-state"),l=e("./service"),u=e("./log"),c=e("./url"),h=e("./platform"),d="Viewer",p="__AMP__",f={NATURAL:"natural",VIRTUAL:"virtual",NATURAL_IOS_EMBED:"natural-ios-embed"};i.ViewportType=f;var v={VISIBLE:"visible",HIDDEN:"hidden"};i.VisibilityState=v;var m=function(){function e(t){var i=this;if(babelHelpers.classCallCheck(this,e),this.win=t,this.isEmbedded_=this.win.parent&&this.win.parent!=this.win,this.docState_=(0,a.documentStateFor)(window),this.isRuntimeOn_=!0,this.overtakeHistory_=!1,this.visibilityState_=v.VISIBLE,this.prerenderSize_=1,this.viewportType_=f.NATURAL,this.viewportWidth_=0,this.viewportHeight_=0,this.scrollTop_=0,this.paddingTop_=0,this.runtimeOnObservable_=new s.Observable,this.visibilityObservable_=new s.Observable,this.viewportObservable_=new s.Observable,this.historyPoppedObservable_=new s.Observable,this.messageDeliverer_=null,this.messageQueue_=[],this.params_={},this.win.name&&0==this.win.name.indexOf(p)&&n(this.win.name.substring(p.length),this.params_),this.win.location.hash&&n(this.win.location.hash,this.params_),u.log.fine(d,"Viewer params:",this.params_),this.isRuntimeOn_=!parseInt(this.params_.off,10),u.log.fine(d,"- runtimeOn:",this.isRuntimeOn_),this.overtakeHistory_=parseInt(this.params_.history,10)||this.overtakeHistory_,u.log.fine(d,"- history:",this.overtakeHistory_),this.visibilityState_=this.params_.visibilityState||this.visibilityState_,u.log.fine(d,"- visibilityState:",this.visibilityState_),this.prerenderSize_=parseInt(this.params_.prerenderSize,10)||this.prerenderSize_,u.log.fine(d,"- prerenderSize:",this.prerenderSize_),this.viewportType_=this.params_.viewportType||this.viewportType_,this.viewportType_==f.NATURAL&&this.isEmbedded_&&h.platform.isIos()&&(this.viewportType_=f.NATURAL_IOS_EMBED),u.log.fine(d,"- viewportType:",this.viewportType_),this.viewportWidth_=parseInt(this.params_.width,10)||this.viewportWidth_,u.log.fine(d,"- viewportWidth:",this.viewportWidth_),this.viewportHeight_=parseInt(this.params_.height,10)||this.viewportHeight_,u.log.fine(d,"- viewportHeight:",this.viewportHeight_),this.scrollTop_=parseInt(this.params_.scrollTop,10)||this.scrollTop_,u.log.fine(d,"- scrollTop:",this.scrollTop_),this.paddingTop_=parseInt(this.params_.paddingTop,10)||this.paddingTop_,u.log.fine(d,"- padding-top:",this.paddingTop_),this.docState_.onVisibilityChanged(function(){i.visibilityObservable_.fire()}),this.isEmbedded_){var r=(0,c.removeFragment)(this.win.location.href);r!=this.win.location.href&&this.win.history.replaceState&&(this.win.history.replaceState({},"",r),u.log.fine(d,"replace url:"+this.win.location.href))}}return babelHelpers.createClass(e,[{key:"getParam",value:function(e){return this.params_[e]}},{key:"isEmbedded",value:function(){return this.isEmbedded_}},{key:"isRuntimeOn",value:function(){return this.isRuntimeOn_}},{key:"toggleRuntime",value:function(){this.isRuntimeOn_=!this.isRuntimeOn_,u.log.fine(d,"Runtime state:",this.isRuntimeOn_),this.runtimeOnObservable_.fire(this.isRuntimeOn_)}},{key:"onRuntimeState",value:function(e){return this.runtimeOnObservable_.add(e)}},{key:"isOvertakeHistory",value:function(){return this.overtakeHistory_}},{key:"getVisibilityState",value:function(){return this.visibilityState_}},{key:"isVisible",value:function(){return this.visibilityState_==v.VISIBLE&&!this.docState_.isHidden()}},{key:"getPrerenderSize",value:function(){return this.prerenderSize_}},{key:"getViewportType",value:function(){return this.viewportType_}},{key:"getViewportWidth",value:function(){return this.viewportWidth_}},{key:"getViewportHeight",value:function(){return this.viewportHeight_}},{key:"getScrollTop",value:function(){return this.scrollTop_}},{key:"getPaddingTop",value:function(){return this.paddingTop_}},{key:"onVisibilityChanged",value:function(e){return this.visibilityObservable_.add(e)}},{key:"onViewportEvent",value:function(e){return this.viewportObservable_.add(e)}},{key:"onHistoryPoppedEvent",value:function(e){return this.historyPoppedObservable_.add(e)}},{key:"postDocumentReady",value:function(e,t){this.sendMessage_("documentLoaded",{width:e,height:t},!1)}},{key:"postDocumentResized",value:function(e,t){this.sendMessage_("documentResized",{width:e,height:t},!1)}},{key:"requestFullOverlay",value:function(){return this.sendMessage_("requestFullOverlay",{},!0)}},{key:"cancelFullOverlay",value:function(){return this.sendMessage_("cancelFullOverlay",{},!0)}},{key:"postPushHistory",value:function(e){return this.sendMessage_("pushHistory",{stackIndex:e},!0)}},{key:"postPopHistory",value:function(e){return this.sendMessage_("popHistory",{stackIndex:e},!0)}},{key:"getBaseCid",value:function(){return this.sendMessage_("cid",void 0,!0)}},{key:"receiveMessage",value:function(e,t,i){return"viewport"==e?(void 0!==t.width&&(this.viewportWidth_=t.width),void 0!==t.height&&(this.viewportHeight_=t.height),void 0!==t.paddingTop&&(this.paddingTop_=t.paddingTop),void 0!==t.scrollTop&&(this.scrollTop_=t.scrollTop),void this.viewportObservable_.fire()):"historyPopped"==e?(this.historyPoppedObservable_.fire({newStackIndex:t.newStackIndex}),Promise.resolve()):"visibilitychange"==e?(void 0!==t.state&&(this.visibilityState_=t.state),void 0!==t.prerenderSize&&(this.prerenderSize_=t.prerenderSize),u.log.fine(d,"visibilitychange event:",this.visibilityState_,this.prerenderSize_),this.visibilityObservable_.fire(),Promise.resolve()):void u.log.fine(d,"unknown message:",e)}},{key:"setMessageDeliverer",value:function(e){var t=this;if((0,o.assert)(!this.messageDeliverer_,"message deliverer can only be set once"),this.messageDeliverer_=e,this.messageQueue_.length>0){var i=this.messageQueue_.slice(0);this.messageQueue_=[],i.forEach(function(e){t.messageDeliverer_(e.eventType,e.data,!1)})}}},{key:"sendMessage_",value:function(e,t,i){if(this.messageDeliverer_)return this.messageDeliverer_(e,t,i);for(var n=null,r=0;r<this.messageQueue_.length;r++)if(this.messageQueue_[r].eventType==e){n=this.messageQueue_[r];break}return n?n.data=t:this.messageQueue_.push({eventType:e,data:t}),i?Promise.resolve():void 0}}]),e}();i.Viewer=m},{"./asserts":54,"./document-state":62,"./log":76,"./observable":78,"./platform":81,"./service":87,"./url":97}],100:[function(e,t,i){function n(e){var t=Object.create(null);if(!e)return t;for(var i=e.split(","),n=0;n<i.length;n++){var r=i[n],s=r.split("="),o=s[0].trim(),a=s[1];a=(a||"").trim(),o&&(t[o]=a)}return t}function r(e){var t="";for(var i in e)t.length>0&&(t+=","),t+=e[i]?i+"="+e[i]:i;return t}function s(e,t){var i=n(e),s=!1;for(var o in t)i[o]!==t[o]&&(s=!0,void 0!==t[o]?i[o]=t[o]:delete i[o]);return s?r(i):e}function o(e){var t=(0,m.viewerFor)(e),i=void 0;return i="virtual"==t.getViewportType()?new w(e,t):"natural-ios-embed"==t.getViewportType()?new b(e):new y(e),new g(e,i,t)}function a(e){return(0,u.getService)(e,"viewport",function(){return o(e)})}Object.defineProperty(i,"__esModule",{value:!0}),i.parseViewportMeta=n,i.stringifyViewportMeta=r,i.updateViewportMetaString=s,i.viewportFor=a;var l=e("./observable"),u=(e("./asserts.js"),e("./service")),c=e("./layout-rect"),h=e("./log"),d=e("./document-state"),p=e("./platform"),f=e("./style"),v=e("./timer"),m=e("./viewer"),_="Viewport",g=function(){function e(t,i,n){var r=this;babelHelpers.classCallCheck(this,e),this.win_=t,this.binding_=i,this.viewer_=n,this.size_=null,this.scrollTop_=null,this.scrollLeft_=null,this.paddingTop_=n.getPaddingTop(),this.scrollMeasureTime_=0,this.scrollTracking_=!1,this.scrollCount_=0,this.changeObservable_=new l.Observable,this.scrollObservable_=new l.Observable,this.viewportMeta_=void 0,this.originalViewportMetaString_=void 0,this.viewer_.onViewportEvent(function(){r.binding_.updateViewerViewport(r.viewer_);var e=r.viewer_.getPaddingTop();e!=r.paddingTop_&&(r.paddingTop_=e,r.binding_.updatePaddingTop(r.paddingTop_))}),this.binding_.updateViewerViewport(this.viewer_),this.binding_.updatePaddingTop(this.paddingTop_),this.binding_.onScroll(this.scroll_.bind(this)),this.binding_.onResize(this.resize_.bind(this))}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){this.binding_.cleanup_()}},{key:"getPaddingTop",value:function(){return this.paddingTop_}},{key:"getTop",value:function(){return this.getScrollTop()}},{key:"getScrollTop",value:function(){return null==this.scrollTop_&&(this.scrollTop_=this.binding_.getScrollTop()),this.scrollTop_}},{key:"getScrollLeft",value:function(){return null==this.scrollleft_&&(this.scrollLeft_=this.binding_.getScrollLeft()),this.scrollLeft_}},{key:"setScrollTop",value:function(e){this.scrollTop_=null,this.binding_.setScrollTop(e)}},{key:"getSize",value:function(){return this.size_?this.size_:this.size_=this.binding_.getSize()}},{key:"getWidth",value:function(){return this.getSize().width}},{key:"getScrollWidth",value:function(){return this.binding_.getScrollWidth()}},{key:"getScrollHeight",value:function(){return this.binding_.getScrollHeight()}},{key:"getRect",value:function(){var e=this.getScrollTop(),t=this.getScrollLeft(),i=this.getSize();return(0,c.layoutRectLtwh)(t,e,i.width,i.height)}},{key:"getLayoutRect",value:function(e){return this.binding_.getLayoutRect(e)}},{key:"scrollIntoView",value:function(e){var t=this.binding_.getLayoutRect(e).top,i=Math.max(0,t-this.paddingTop_);this.binding_.setScrollTop(i)}},{key:"onChanged",value:function(e){return this.changeObservable_.add(e)}},{key:"onScroll",value:function(e){return this.scrollObservable_.add(e)}},{key:"resetTouchZoom",value:function(){var e=this,t=this.win_.innerHeight,i=this.win_.document.documentElement.clientHeight;t&&i&&t===i||this.disableTouchZoom()&&v.timer.delay(function(){e.restoreOriginalTouchZoom()},50)}},{key:"disableTouchZoom",value:function(){var e=this.getViewportMeta_();if(!e)return!1;var t=s(e.content,{"maximum-scale":"1","user-scalable":"no"});return this.setViewportMetaString_(t)}},{key:"restoreOriginalTouchZoom",value:function(){return void 0!==this.originalViewportMetaString_?this.setViewportMetaString_(this.originalViewportMetaString_):!1}},{key:"hasScrolled",value:function(){return this.scrollCount_>0}},{key:"setViewportMetaString_",value:function(e){var t=this.getViewportMeta_();return t&&t.content!=e?(h.log.fine(_,"changed viewport meta to:",e),t.content=e,!0):!1}},{key:"getViewportMeta_",value:function(){return this.viewer_.isEmbedded()?null:(void 0===this.viewportMeta_&&(this.viewportMeta_=this.win_.document.querySelector("meta[name=viewport]"),this.viewportMeta_&&(this.originalViewportMetaString_=this.viewportMeta_.content)),this.viewportMeta_)}},{key:"changed_",value:function(e,t){var i=this.getSize(),n=this.getScrollTop();h.log.fine(_,"changed event:","relayoutAll=",e,"top=",n,"bottom=",n+i.height,"velocity=",t),this.changeObservable_.fire({relayoutAll:e,top:n,width:i.width,height:i.height,velocity:t})}},{key:"scroll_",value:function(){var e=this;if(this.scrollCount_++,this.scrollObservable_.fire(),this.scrollLeft_=this.binding_.getScrollLeft(),!this.scrollTracking_){var t=this.binding_.getScrollTop();0>t||(this.scrollTracking_=!0,this.scrollTop_=t,this.scrollMeasureTime_=v.timer.now(),v.timer.delay(function(){return e.scrollDeferred_()},500))}}},{key:"scrollDeferred_",value:function(){var e=this;this.scrollTracking_=!1;var t=this.binding_.getScrollTop();null===this.scrollTop_&&(this.scrollTop_=t);var i=v.timer.now(),n=0;i!=this.scrollMeasureTime_&&(n=(t-this.scrollTop_)/(i-this.scrollMeasureTime_)),h.log.fine(_,"scroll: scrollTop="+t+"; velocity="+n),this.scrollTop_=t,this.scrollMeasureTime_=i,Math.abs(n)<.02?this.changed_(!1,n):v.timer.delay(function(){e.scrollTracking_||e.scrollDeferred_()},250)}},{key:"resize_",value:function(){var e=this.size_;this.size_=null;var t=this.getSize();this.changed_(!e||e.width!=t.width,0)}}]),e}();i.Viewport=g;var y=(function(){function e(){babelHelpers.classCallCheck(this,e)}return babelHelpers.createClass(e,[{key:"onScroll",value:function(e){}},{key:"onResize",value:function(e){}},{key:"updateViewerViewport",value:function(e){}},{key:"updatePaddingTop",value:function(e){}},{key:"getSize",value:function(){}},{key:"getScrollTop",value:function(){}},{key:"setScrollTop",value:function(e){}},{key:"getScrollLeft",value:function(){}},{key:"getScrollWidth",value:function(){}},{key:"getScrollHeight",value:function(){}},{key:"getLayoutRect",value:function(e){}},{key:"cleanup_",value:function(){}}]),e}(),function(){function e(t){var i=this;babelHelpers.classCallCheck(this,e),this.win=t,this.scrollObservable_=new l.Observable,this.resizeObservable_=new l.Observable,this.win.addEventListener("scroll",function(){return i.scrollObservable_.fire()}),this.win.addEventListener("resize",function(){return i.resizeObservable_.fire()}),h.log.fine(_,"initialized natural viewport")}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){}},{key:"onScroll",value:function(e){this.scrollObservable_.add(e)}},{key:"onResize",value:function(e){this.resizeObservable_.add(e)}},{key:"updateViewerViewport",value:function(e){}},{key:"updatePaddingTop",value:function(e){this.win.document.documentElement.style.paddingTop=(0,f.px)(e)}},{key:"getSize",value:function(){if(p.platform.isIos()&&!p.platform.isChrome()){var e=this.win.innerWidth,t=this.win.innerHeight;if(e&&t)return{width:e,height:t}}var i=this.win.document.documentElement;return{width:i.clientWidth,height:i.clientHeight}}},{key:"getScrollTop",value:function(){return this.getScrollingElement_().scrollTop||this.win.pageYOffset}},{key:"getScrollLeft",value:function(){return this.getScrollingElement_().scrollLeft||this.win.pageXOffset}},{key:"getScrollWidth",value:function(){return this.getScrollingElement_().scrollWidth}},{key:"getScrollHeight",value:function(){return this.getScrollingElement_().scrollHeight}},{key:"getLayoutRect",value:function(e){var t=this.getScrollTop(),i=this.getScrollLeft(),n=e.getBoundingClientRect();return(0,c.layoutRectLtwh)(Math.round(n.left+i),Math.round(n.top+t),Math.round(n.width),Math.round(n.height))}},{key:"setScrollTop",value:function(e){this.getScrollingElement_().scrollTop=e}},{key:"getScrollingElement_",value:function(){var e=this.win.document;return e.scrollingElement?e.scrollingElement:e.body?e.body:e.documentElement}}]),e}());i.ViewportBindingNatural_=y;var b=function(){function e(t){var i=this;babelHelpers.classCallCheck(this,e),this.win=t,this.scrollWidth_=0,this.scrollPosEl_=null,this.scrollMoveEl_=null,this.pos_={x:0,y:0},this.scrollObservable_=new l.Observable,this.resizeObservable_=new l.Observable,(0,d.onDocumentReady)(this.win.document,function(){v.timer.delay(function(){i.setup_()},0)}),this.win.addEventListener("resize",function(){return i.resizeObservable_.fire()}),h.log.fine(_,"initialized natural viewport for iOS embeds")}return babelHelpers.createClass(e,[{key:"setup_",value:function(){var e=this.win.document.documentElement,t=this.win.document.body;this.scrollWidth_=t.scrollWidth||0,(0,f.setStyles)(e,{overflow:"auto",webkitOverflowScrolling:"touch"}),(0,f.setStyles)(t,{overflow:"auto",webkitOverflowScrolling:"touch",position:"absolute",top:0,left:0,right:0,bottom:0}),this.scrollPosEl_=this.win.document.createElement("div"),this.scrollPosEl_.id="-amp-scrollpos",(0,f.setStyles)(this.scrollPosEl_,{position:"absolute",top:0,left:0,width:0,height:0,visibility:"hidden"}),t.appendChild(this.scrollPosEl_),this.scrollMoveEl_=this.win.document.createElement("div"),this.scrollMoveEl_.id="-amp-scrollmove",(0,f.setStyles)(this.scrollMoveEl_,{position:"absolute",top:0,left:0,width:0,height:0,visibility:"hidden"}),t.appendChild(this.scrollMoveEl_),this.endPosEl_=this.win.document.createElement("div"),this.endPosEl_.id="-amp-endpos",(0,f.setStyles)(this.endPosEl_,{width:0,height:0,visibility:"hidden"}),t.appendChild(this.endPosEl_),t.addEventListener("scroll",this.onScrolled_.bind(this))}},{key:"updateViewerViewport",value:function(e){}},{key:"updatePaddingTop",value:function(e){var t=this;(0,d.onDocumentReady)(this.win.document,function(){t.win.document.body.style.paddingTop=(0,f.px)(e)})}},{key:"cleanup_",value:function(){}},{key:"onScroll",value:function(e){this.scrollObservable_.add(e)}},{key:"onResize",value:function(e){this.resizeObservable_.add(e)}},{key:"getSize",value:function(){return{width:this.win.innerWidth,height:this.win.innerHeight}}},{key:"getScrollTop",value:function(){return Math.round(this.pos_.y)}},{key:"getScrollLeft",value:function(){return Math.round(this.pos_.x)}},{key:"getScrollWidth",value:function(){return Math.max(this.scrollWidth_,this.win.innerWidth)}},{key:"getScrollHeight",value:function(){return this.endPosEl_?Math.round(this.endPosEl_.getBoundingClientRect().top-this.scrollPosEl_.getBoundingClientRect().top):0}},{key:"getLayoutRect",value:function(e){var t=e.getBoundingClientRect();return(0,c.layoutRectLtwh)(Math.round(t.left+this.pos_.x),Math.round(t.top+this.pos_.y),Math.round(t.width),Math.round(t.height))}},{key:"setScrollTop",value:function(e){this.setScrollPos_(e||1)}},{key:"onScrolled_",value:function(e){if(this.scrollPosEl_){this.adjustScrollPos_(e);var t=this.scrollPosEl_.getBoundingClientRect();(this.pos_.x!=-t.left||this.pos_.y!=-t.top)&&(this.pos_.x=-t.left,this.pos_.y=-t.top,this.scrollObservable_.fire())}}},{key:"setScrollPos_",value:function(e){this.scrollMoveEl_&&((0,f.setStyle)(this.scrollMoveEl_,"transform","translateY("+e+"px)"),this.scrollMoveEl_.scrollIntoView(!0))}},{key:"adjustScrollPos_",value:function(e){if(this.scrollPosEl_&&this.scrollMoveEl_){var t=-this.scrollPosEl_.getBoundingClientRect().top;return 0==t?(this.setScrollPos_(1),void(e&&e.preventDefault())):void 0}}}]),e}();i.ViewportBindingNaturalIosEmbed_=b;var w=function(){function e(t,i){babelHelpers.classCallCheck(this,e),this.win=t,this.width_=i.getViewportWidth(),this.height_=i.getViewportHeight(),this.scrollTop_=i.getScrollTop(),this.scrollObservable_=new l.Observable,this.resizeObservable_=new l.Observable,h.log.fine(_,"initialized virtual viewport")}return babelHelpers.createClass(e,[{key:"cleanup_",value:function(){}},{key:"updateViewerViewport",value:function(e){e.getScrollTop()!=this.scrollTop_&&(this.scrollTop_=e.getScrollTop(),this.scrollObservable_.fire()),(e.getViewportWidth()!=this.width_||e.getViewportHeight()!=this.height_)&&(this.width_=e.getViewportWidth(),this.height_=e.getViewportHeight(),this.resizeObservable_.fire())}},{key:"updatePaddingTop",value:function(e){this.win.document.documentElement.style.paddingTop=(0,f.px)(e)}},{key:"onScroll",value:function(e){this.scrollObservable_.add(e)}},{key:"onResize",value:function(e){this.resizeObservable_.add(e)}},{key:"getSize",value:function(){return{width:this.width_,height:this.height_}}},{key:"getScrollTop",value:function(){return this.scrollTop_}},{key:"getScrollLeft",value:function(){return 0}},{key:"getScrollWidth",value:function(){return this.win.document.documentElement.scrollWidth}},{key:"getScrollHeight",value:function(){return this.win.document.documentElement.scrollHeight}},{key:"getLayoutRect",value:function(e){var t=e.getBoundingClientRect();return(0,c.layoutRectLtwh)(Math.round(t.left),Math.round(t.top),Math.round(t.width),Math.round(t.height))}},{key:"setScrollTop",value:function(e){}}]),e}();i.ViewportBindingVirtual_=w;var k=a(window);i.viewport=k},{"./asserts.js":54,"./document-state":62,"./layout-rect":73,"./log":76,"./observable":78,"./platform":81,"./service":87,"./style":92,"./timer":95,"./viewer":99}],101:[function(e,t,i){function n(e){return(0,s.getService)(e,"vsync",function(){return new c(e,(0,l.viewerFor)(e))})}Object.defineProperty(i,"__esModule",{value:!0}),i.vsyncFor=n;var r=e("./pass"),s=e("./service"),o=e("./log"),a=e("./timer"),l=e("./viewer"),u=16,c=function(){function e(t,i){var n=this;babelHelpers.classCallCheck(this,e),this.win=t,this.viewer_=i,this.raf_=this.getRaf_(),this.tasks_=[],this.states_=[],this.scheduled_=!1,this.boundRunScheduledTasks_=this.runScheduledTasks_.bind(this),this.pass_=new r.Pass(this.boundRunScheduledTasks_,u),this.viewer_.onVisibilityChanged(function(){n.scheduled_&&n.forceSchedule_()})}return babelHelpers.createClass(e,[{key:"run",value:function(e,t){this.tasks_.push(e),this.states_.push(t||{}),this.schedule_()}},{key:"createTask",value:function(e){var t=this;return function(i){t.run(e,i)}}},{key:"mutate",value:function(e){this.run({mutate:e})}},{key:"measure",value:function(e){this.run({measure:e})}},{key:"measurePromise",value:function(e){var t=this;return new Promise(function(i){t.measure(function(){i(e())})})}},{key:"canAnimate",value:function(){return this.viewer_.isVisible()}},{key:"runAnim",value:function(e,t){return this.canAnimate()?(this.run(e,t),!0):(o.log.warn("Vsync","Did not schedule a vsync request, because document was invisible"),!1)}},{key:"createAnimTask",value:function(e){var t=this;return function(i){return t.runAnim(e,i)}}},{key:"runAnimMutateSeries",value:function(e,t){var i=this;return this.canAnimate()?new Promise(function(n,r){var s=a.timer.now(),o=0,l=i.createAnimTask({mutate:function(i){var u=a.timer.now()-s,c=e(u,u-o,i);c?t&&u>t?r("timeout"):(o=u,l(i)):n()}});l({})}):Promise.reject()}},{key:"schedule_",value:function(){this.scheduled_||(this.scheduled_=!0,this.forceSchedule_())}},{key:"forceSchedule_",value:function(){this.canAnimate()?this.raf_(this.boundRunScheduledTasks_):this.pass_.schedule()}},{key:"runScheduledTasks_",value:function(){this.scheduled_=!1;var e=this.tasks_,t=this.states_;this.tasks_=[],this.states_=[];for(var i=0;i<e.length;i++)e[i].measure&&e[i].measure(t[i]);for(var i=0;i<e.length;i++)e[i].mutate&&e[i].mutate(t[i])}},{key:"getRaf_",value:function(){var e=this,t=this.win.requestAnimationFrame||this.win.webkitRequestAnimationFrame;if(t)return t.bind(this.win);var i=0;return function(t){var n=(new Date).getTime(),r=Math.max(0,u-(n-i));i=n+r,e.win.setTimeout(t,r)}}}]),e}();i.Vsync=c},{"./log":76,"./pass":79,"./service":87,"./timer":95,"./viewer":99}],102:[function(e,t,i){(function(e){!function(e){var t=e.babelHelpers={};t.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},t.createClass=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),t.slice=Array.prototype.slice,t.bind=Function.prototype.bind,t.interopRequireWildcard=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t},t.get=function(e,t,i){for(var n=!0;n;){var r=e,s=t,o=i;a=u=l=void 0,n=!1,null===r&&(r=Function.prototype);var a=Object.getOwnPropertyDescriptor(r,s);if(void 0!==a){if("value"in a)return a.value;var l=a.get;if(void 0===l)return;return l.call(o)}var u=Object.getPrototypeOf(r);if(null===u)return;e=u,t=s,i=o,n=!0}},t.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}}("undefined"==typeof e?self:e)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[53])}catch(e){throw setTimeout(function(){document.body.style.opacity=1},1e3),e}
//# sourceMappingURL=v0.js.map