amp-lightbox-0.1.js 26.0 KB
;
(self.AMP=self.AMP||[]).push({m:0,v:"2402231941000",n:"amp-lightbox",ev:"0.1",l:!0,f:function(t,i){!function(){function i(t,i){(null==i||i>t.length)&&(i=t.length);for(var n=0,r=new Array(i);n<i;n++)r[n]=t[n];return r}function n(t,n){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,n){if(t){if("string"==typeof t)return i(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var s=0;return function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=function(){var t=this;this.promise=new Promise((function(i,n){t.resolve=i,t.reject=n}))};function o(t,i){return(o=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,i)}function h(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&o(t,i)}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,i){if(i&&("object"===u(i)||"function"==typeof i))return i;if(void 0!==i)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(t){var i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=e(t);if(i){var s=e(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return a(this,n)}}var c=Array.isArray,l=Object.prototype,v=l.hasOwnProperty;function d(t){var i=Object.create(null);return t&&Object.assign(i,t),i}function m(t,i){return v.call(t,i)}function p(t,i,n,r,s,o,h,e,u,a,f){return t}function b(t){return(t.ownerDocument||t).defaultView}function y(t){try{t.focus()}catch(t){}}function g(t){var i=Object.getOwnPropertyDescriptor(t,"message");if(null!=i&&i.writable)return t;var n=t.message,r=t.stack,s=new Error(n);for(var o in t)s[o]=t[o];return s.stack=r,s}function w(t){for(var i,r=null,s="",o=n(arguments,!0);!(i=o()).done;){var h=i.value;h instanceof Error&&!r?r=g(h):(s&&(s+=" "),s+=h)}return r?s&&(r.message=s+": "+r.message):r=new Error(s),r}function x(t){var i,n;null===(i=(n=self).__AMP_REPORT_ERROR)||void 0===i||i.call(n,t)}function k(t){var i=w.apply(null,arguments);setTimeout((function(){throw x(i),i}))}function S(t){try{for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return t.apply(null,n)}catch(t){k(t)}}l.toString;var O,j,A="i-amphtml-element",M=function(t){return t.unmount()};function E(t,i,n,r){for(var s,o=c(s=t)?s:[s],h=0;h<o.length;h++)D(o[h],i,n,r)}function D(t,i,n,r){if(i&&t.classList.contains(A)){var s=t;if(S(r,s),!n){var o=s.getPlaceholder();return void(o&&D(o,!0,!1,r))}}for(var h=t.getElementsByClassName(A),e=null,u=0;u<h.length;u++){var a=h[u];if(n)S(r,a);else{e=e||[];for(var f=!1,c=0;c<e.length;c++)if(e[c].contains(a)){f=!0;break}f||(e.push(a),S(r,a))}}}function C(t){return function(t,i){if(p(1===i.length),p(Array.isArray(i)||m(i,"raw")),self.trustedTypes&&self.trustedTypes.createPolicy){var n=self.trustedTypes.createPolicy("static-template#createNode",{createHTML:function(t){return i[0]}});t.innerHTML=n.createHTML("ignored")}else t.innerHTML=i[0];var r=t.firstElementChild;return p(r),p(!r.nextElementSibling),t.removeChild(r),r}(O,t)}var R=["Webkit","webkit","Moz","moz","ms","O","o"],z={"getPropertyPriority":function(){return""},"getPropertyValue":function(){return""}};function I(t){var i=t.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}));return R.some((function(t){return i.startsWith(t+"-")}))?"-".concat(i):i}function P(t,i,n){if(i.startsWith("--"))return i;j||(j=d());var r=j[i];if(!r||n){if(r=i,void 0===t[i]){var s=function(t){return t.charAt(0).toUpperCase()+t.slice(1)}(i),o=function(t,i){for(var n=0;n<R.length;n++){var r=R[n]+i;if(void 0!==t[r])return r}return""}(t,s);void 0!==t[o]&&(r=o)}n||(j[i]=r)}return r}function T(t,i){var n=t.style;for(var r in i)n.setProperty(I(P(n,r)),String(i[r]),"important")}function Y(t,i,n,r,s){var o=P(t.style,i,s);if(o){var h=r?n+r:n;t.style.setProperty(I(o),h)}}function L(t,i){for(var n in i)Y(t,n,i[n])}function X(t){return"".concat(t,"px")}function _(t){return"display"in t&&function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];var s=w.apply(null,n);s.name=t||s.name,x(s)}("STYLE","`display` style detected. You must use toggle instead."),t}var H=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;function B(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{return decodeURIComponent(t)}catch(t){return i}}function U(t){var i=(t||self).location;return function(t){var i,n=d();if(!t)return n;for(;i=H.exec(t);){var r=B(i[1],i[1]),s=i[2]?B(i[2].replace(/\+/g," "),i[2]):"";n[r]=s}return n}(i.originalHash||i.hash)}var W="";function G(t){var i=t||self;return i.__AMP_MODE?i.__AMP_MODE:i.__AMP_MODE=function(t){return{localDev:!1,development:V(t,U(t)),esm:!1,test:!1,rtvVersion:N(t),ssrReady:!1}}(i)}function N(t){var i;return W||(W=(null===(i=t.AMP_CONFIG)||void 0===i?void 0:i.v)||"01".concat("2402231941000")),W}function V(t,i){var n=i||U(t);return["1","actions","amp","amp4ads","amp4email"].includes(n.development)||!!t.AMP_DEV_MODE}self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var F=self.__AMP_LOG;function Z(t,i){throw new Error("failed to call initLogConstructor")}function $(t){return F.user||(F.user=q()),function(t,i){return i&&i.ownerDocument.defaultView!=t}(F.user.win,t)?F.userForEmbed||(F.userForEmbed=q()):F.user}function q(t){return Z()}function J(){return F.dev||(F.dev=Z())}function K(t,i,n,r,s,o,h,e,u,a,f){return t}function Q(t,i){return rt(t=function(t){return t.__AMP_TOP||(t.__AMP_TOP=t)}(t),i)}function tt(t,i){return rt(nt(it(t)),i)}function it(t){return t.nodeType?(i=b(t),Q(i,"ampdoc")).getAmpDoc(t):t;var i}function nt(t){var i=it(t);return i.isSingleDoc()?i.win:i}function rt(t,i){K(st(t,i));var n=function(t){var i=t.__AMP_SERVICES;return i||(i=t.__AMP_SERVICES={}),i}(t)[i];return n.obj||(K(n.ctor),K(n.context),n.obj=new n.ctor(n.context),K(n.obj),n.context=null,n.resolve&&n.resolve(n.obj)),n.obj}function st(t,i){var n=t.__AMP_SERVICES&&t.__AMP_SERVICES[i];return!(!n||!n.ctor)}var ot,ht=function(t){return tt(t,"owners")},et=function(t){return rt(t,"timer")},ut=function(){function t(t,i){var n=this,r=t.win;if(this.t=r,this.De=i,this.CZ=null,this.To=null,this.BY=-1,this.KY=null,"function"==typeof r.CloseWatcher)try{this.CZ=new r.CloseWatcher}catch(t){J().error("CloseWatcherImpl","CloseWatcher failed:",t)}this.CZ?this.CZ.onclose=function(){i(),n.destroy()}:(this.To=tt(t,"history"),this.To.push((function(){return i()})).then((function(t){n.BY=t})),this.KY=this.QY.bind(this),r.document.documentElement.addEventListener("keydown",this.KY))}var i=t.prototype;return i.signalClosed=function(){this.CZ?this.CZ.signalClosed():this.De&&((0,this.De)(),this.destroy())},i.destroy=function(){this.De=null,this.CZ?(this.CZ.destroy(),this.CZ=null):-1!=this.BY&&(K(this.To).pop(this.BY),this.BY=-1,this.To=null,this.t.document.documentElement.removeEventListener("keydown",this.KY))},i.QY=function(t){"Escape"==t.key&&(t.preventDefault(),this.signalClosed())},t}();function at(t){if(void 0!==ot)return ot;ot=!1;try{var i={get passive(){return ot=!0,!1}};t.addEventListener("test-options",null,i),t.removeEventListener("test-options",null,i)}catch(t){}return ot}var ft=function(){function t(){this.fn=null}var i=t.prototype;return i.add=function(t){var i=this;return this.fn||(this.fn=[]),this.fn.push(t),function(){i.remove(t)}},i.remove=function(t){var i,n,r;this.fn&&(n=t,-1!=(r=(i=this.fn).indexOf(n))&&i.splice(r,1))},i.removeAll=function(){this.fn&&(this.fn.length=0)},i.fire=function(t){if(this.fn)for(var i,r=n(this.fn.slice(),!0);!(i=r()).done;)(0,i.value)(t)},i.getHandlerCount=function(){var t,i;return null!==(t=null===(i=this.fn)||void 0===i?void 0:i.length)&&void 0!==t?t:0},t}(),ct=function(){function t(t,i,n){var r=this;this.je=et(t),this.De=i,this.Ue=n||0,this.ze=-1,this.Le=0,this.He=!1,this.Ge=function(){r.Ve()}}var i=t.prototype;return i.isPending=function(){return-1!=this.ze},i.schedule=function(t){var i=t||this.Ue;this.He&&i<10&&(i=10);var n=Date.now()+i;return(!this.isPending()||n-this.Le<-10)&&(this.cancel(),this.Le=n,this.ze=this.je.delay(this.Ge,i),!0)},i.Ve=function(){this.ze=-1,this.Le=0,this.He=!0,this.De(),this.He=!1},i.cancel=function(){this.isPending()&&(this.je.cancel(this.ze),this.ze=-1)},t}(),lt="__AMP_Gestures",vt=function(t,i,n,r){this.type=t,this.data=i,this.time=n,this.event=r},dt=function(){function t(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.el=t,this.XM=[],this.zm=[],this.wi=[],this.qM=[],this.$M=null;var r=t.ownerDocument.defaultView,s=at(r);this.KM=i||s,this.JM=n,this.QM=!1,this.Ve=new ct(b(t),this.ov.bind(this)),this.tI=new ft,this.iI=Object.create(null),this.nI=this.zp.bind(this),this.rI=this._p.bind(this),this.oI=this.qp.bind(this),this.aI=this.qm.bind(this),this.el.addEventListener("touchstart",this.nI,!!s&&{passive:!0}),this.el.addEventListener("touchend",this.rI),this.el.addEventListener("touchmove",this.oI,!!s&&{passive:!0}),this.el.addEventListener("touchcancel",this.aI),this.sI=!1}t.get=function(i){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=i[lt];return s||(s=new t(i,n,r),i[lt]=s),s};var i=t.prototype;return i.cleanup=function(){this.el.removeEventListener("touchstart",this.nI),this.el.removeEventListener("touchend",this.rI),this.el.removeEventListener("touchmove",this.oI),this.el.removeEventListener("touchcancel",this.aI),delete this.el[lt],this.Ve.cancel()},i.onGesture=function(t,i){var n=new t(this),r=n.getType(),s=this.iI[r];return s||(this.XM.push(n),s=new ft,this.iI[r]=s),s.add(i)},i.removeGesture=function(t){var i=new t(this).getType(),n=this.iI[i];if(n){n.removeAll();var r=function(t,n){for(var r=0;r<t.length;r++)if(t[r].getType()==i)return r;return-1}(this.XM);return!(r<0||(this.XM.splice(r,1),this.wi.splice(r,1),this.qM.splice(r,1),this.zm.splice(r,1),delete this.iI[i],0))}return!1},i.onPointerDown=function(t){return this.tI.add(t)},i.zp=function(t){var i=Date.now();this.QM=!1,this.tI.fire(t);for(var n=0;n<this.XM.length;n++)this.wi[n]||(this.qM[n]&&this.qM[n]<i&&this.$m(n),this.XM[n].onTouchStart(t)&&this.Wm(n));this.eI(t)},i.qp=function(t){for(var i=Date.now(),n=0;n<this.XM.length;n++)this.zm[n]&&(this.qM[n]&&this.qM[n]<i?this.$m(n):this.XM[n].onTouchMove(t)||this.$m(n));this.eI(t)},i._p=function(t){for(var i=Date.now(),n=0;n<this.XM.length;n++)if(this.zm[n])if(this.qM[n]&&this.qM[n]<i)this.$m(n);else{this.XM[n].onTouchEnd(t);var r=!this.qM[n],s=this.qM[n]<i;this.$M==this.XM[n]||!r&&!s||this.$m(n)}this.eI(t)},i.qm=function(t){for(var i=0;i<this.XM.length;i++)this.uI(i);this.eI(t)},i.Op=function(t,i){if(this.$M)t.acceptCancel();else{for(var n=Date.now(),r=0;r<this.XM.length;r++)this.XM[r]==t&&(this.wi[r]=n+i,this.qM[r]=0);this.sI=!0}},i.hI=function(t,i){if(this.$M)t.acceptCancel();else for(var n=Date.now(),r=0;r<this.XM.length;r++)this.XM[r]==t&&(this.qM[r]=n+i)},i.cI=function(t){this.$M==t&&(this.$M=null,this.QM=!0)},i.lI=function(t,i,n){p(this.$M==t);var r=this.iI[t.getType()];r&&r.fire(new vt(t.getType(),i,Date.now(),n))},i.eI=function(t){var i=!!this.$M||this.QM;if(this.QM=!1,!i)for(var n=Date.now(),r=0;r<this.XM.length;r++)if(this.wi[r]||this.qM[r]&&this.qM[r]>=n){i=!0;break}i?(t.stopPropagation(),this.KM||t.preventDefault()):this.JM&&t.stopPropagation(),this.sI&&(this.sI=!1,this.ov())},i.ov=function(){for(var t=Date.now(),i=-1,n=0;n<this.XM.length;n++)this.wi[n]?(-1==i||this.wi[n]>this.wi[i])&&(i=n):this.qM[n]&&this.qM[n]<t&&this.$m(n);if(-1!=i){for(var r=0,s=0;s<this.XM.length;s++)!this.wi[s]&&this.zm[s]&&(r=Math.max(r,this.qM[s]-t));r<2?this.mI(i):this.Ve.schedule(r)}},i.mI=function(t){for(var i=this.XM[t],n=0;n<this.XM.length;n++)n!=t&&this.uI(n);this.wi[t]=0,this.qM[t]=0,this.$M=i,i.acceptStart()},i.Wm=function(t){this.zm[t]=!0,this.qM[t]=0},i.$m=function(t){this.zm[t]=!1,this.qM[t]=0,this.wi[t]||this.XM[t].acceptCancel()},i.uI=function(t){this.wi[t]=0,this.$m(t)},t}(),mt=function(){function t(t,i){this.pI=t,this.Fy=i}var i=t.prototype;return i.getType=function(){return this.pI},i.signalReady=function(t){this.Fy.Op(this,t)},i.signalPending=function(t){this.Fy.hI(this,t)},i.signalEnd=function(){this.Fy.cI(this)},i.signalEmit=function(t,i){this.Fy.lI(this,t,i)},i.acceptStart=function(){},i.acceptCancel=function(){},i.onTouchStart=function(t){return!1},i.onTouchMove=function(t){return!1},i.onTouchEnd=function(t){},t}();function pt(t,i,n){i<1&&(i=1);var r=t/i,s=.5+Math.min(i/33.34,.5);return r*s+n*(1-s)}Math.round(-16.67/Math.log(.95));var bt=function(t){h(n,t);var i=f(n);function n(t){return i.call(this,"swipe-xy",t,!0,!0)}return n}(function(t){h(n,t);var i=f(n);function n(t,n,r,s){var o;return(o=i.call(this,t,n)).fI=r,o.dI=s,o.$M=!1,o.vI=0,o.yI=0,o.gI=0,o.bI=0,o.xI=0,o.wI=0,o.fa=0,o.kI=0,o.AI=0,o.TI=0,o.SI=0,o}var r=n.prototype;return r.onTouchStart=function(t){var i=t.touches;return!!(this.$M&&i&&i.length>1)||!(!i||1!=i.length)&&(this.fa=Date.now(),this.vI=i[0].clientX,this.yI=i[0].clientY,!0)},r.onTouchMove=function(t){var i=t.touches;if(i&&i.length>=1){var n=i[0],r=n.clientX,s=n.clientY;if(this.gI=r,this.bI=s,this.$M)this.EI(!1,!1,t);else{var o=Math.abs(r-this.vI),h=Math.abs(s-this.yI);if(this.fI&&this.dI)(o>=8||h>=8)&&this.signalReady(-10);else if(this.fI){if(o>=8&&o>h)this.signalReady(-10);else if(h>=8)return!1}else{if(!this.dI)return!1;if(h>=8&&h>o)this.signalReady(-10);else if(o>=8)return!1}}return!0}return!1},r.onTouchEnd=function(t){var i=t.touches;i&&0==i.length&&this.OI(t)},r.acceptStart=function(){this.$M=!0,this.xI=this.vI,this.wI=this.yI,this.AI=this.fa,this.vI=this.gI,this.yI=this.bI,this.EI(!0,!1,null)},r.acceptCancel=function(){this.$M=!1},r.EI=function(t,i,n){this.kI=Date.now();var r=this.kI-this.AI;if(!i&&r>4||i&&r>16){var s=pt(this.gI-this.xI,r,this.TI),o=pt(this.bI-this.wI,r,this.SI);(!i||r>32||0!=s||0!=o)&&(this.TI=Math.abs(s)>1e-4?s:0,this.SI=Math.abs(o)>1e-4?o:0),this.xI=this.gI,this.wI=this.bI,this.AI=this.kI}this.signalEmit({first:t,last:i,time:this.kI,deltaX:this.gI-this.vI,deltaY:this.bI-this.yI,startX:this.vI,startY:this.yI,lastX:this.gI,lastY:this.bI,velocityX:this.TI,velocityY:this.SI},n)},r.OI=function(t){this.$M&&(this.$M=!1,this.EI(!1,!0,t),this.signalEnd())},n}(mt));function yt(t){return t.classList.contains("i-amphtml-fie")||!!function(t,i){return t.closest?t.closest(".i-amphtml-fie"):function(t,i,n){var r;for(r=t;r&&void 0!==r;r=r.parentElement)if(i(r))return r;return null}(t,(function(t){return function(t,i){var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector;return!!n&&n.call(t,".i-amphtml-fie")}(t)}))}(t)}var gt=['<i-amphtml-ad-close-header role=button tabindex=0 aria-label="Close Ad"><div>Ad</div><i-amphtml-ad-close-button class=amp-ad-close-button></i-amphtml-ad-close-button></i-amphtml-ad-close-header>'],wt="amp-lightbox",xt={"fade-in":{openStyle:{"opacity":1},closedStyle:{"opacity":0},durationSeconds:.1},"fly-in-bottom":{openStyle:{"transform":"translate(0, 0)"},closedStyle:{"transform":"translate(0, 100%)"},durationSeconds:.2},"fly-in-top":{openStyle:{"transform":"translate(0, 0)"},closedStyle:{"transform":"translate(0, -100%)"},durationSeconds:.2}};function kt(t){return(n=(i=t).ownerDocument||i,O&&O.ownerDocument===n||(O=n.createElement("div")),C)(gt);var i,n}var St=function(t){h(n,t);var i=f(n);function n(t){var n;(n=i.call(this,t)).Ht=null,n.mb=null,n.Qf=n.win.document,n.Ye=null,n.zZ=null,n.FY=!1,n.TZ=null,n.LZ=null,n._Z=null,n.HZ=null,n.BZ=!1,n.UZ=0,n.WZ=0,n.GZ=null,n.VZ=(t.getAttribute("animate-in")||"fade-in").toLowerCase(),n.FZ=null,n.ZZ=null,n.$Z=null;var r=Q(n.win,"platform");return n.qZ=r.isIos(),n.JZ=function(t,i,n){var r=0,s=0,o=null;function h(){r=0;var n,e=500-(t.Date.now()-s);e>0?r=t.setTimeout(h,e):(n=o,o=null,i.apply(null,n))}return function(){s=t.Date.now();for(var i=arguments.length,n=new Array(i),e=0;e<i;e++)n[e]=arguments[e];o=n,r||(r=t.setTimeout(h,500))}}(n.win,(function(){var t=$().assertElement(n.mb,"E#19457 this.container_"),i=ht(n.element);i.scheduleLayout(n.element,t),i.scheduleResume(n.element,t)})),n}var o=n.prototype;return o.buildCallback=function(){var t,i,n,r=this;this.user().assert(m(xt,this.VZ),"Invalid `animate-in` value %s",this.VZ),this.element.classList.add("i-amphtml-overlay"),this.Ye=(t=this.element,i="action",st(n=nt(it(t)),i)?rt(n,i):null),this.KZ(),this.registerDefaultAction((function(t){return r.dX(t.trust,t.caller)}),"open"),this.registerAction("close",(function(t){return r.close(t.trust)})),this.Ye.addToAllowlist("AMP-LIGHTBOX",["open","close"],["email"])},o.QZ=function(){var t=this;K(this.BZ),this.hQ().forEach((function(i){ht(t.element).setOwner(i,t.element)}))},o.hQ=function(){return(t=this.element.getElementsByClassName("i-amphtml-element"))?Array.prototype.slice.call(t):[];var t},o.Pe=function(){var t=this;if(!this.mb){var i=this.element;this.BZ=i.hasAttribute("scrollable");var n=function(t){return function(t,i){for(var n=[],r=t.firstElementChild;r;r=r.nextElementSibling)void 0,h=void 0,e=void 0,"string"==typeof(o=s=r)?h=o:1==(null==(e=o)?void 0:e.nodeType)&&(h=o.tagName),!(h&&h.toLowerCase().startsWith("i-")||s.nodeType===Node.ELEMENT_NODE&&(s.hasAttribute("placeholder")||s.hasAttribute("fallback")||s.hasAttribute("overflow")))&&n.push(r);var s,o,h,e;return n}(t)}(this.element);this.mb=i.ownerDocument.createElement("div"),this.BZ||function(t,i){t.classList.add("i-amphtml-fill-content")}(this.mb),i.appendChild(this.mb),n.forEach((function(i){t.mb.appendChild(i)})),this.BZ&&(this.QZ(),i.classList.add("i-amphtml-scrollable"),i.addEventListener("amp:dom-update",(function(){t.QZ(),t.aQ(t.UZ)})),i.addEventListener("scroll",this.$l.bind(this))),this.BZ||dt.get(i).onGesture(bt,(function(){})),this.fQ()}},o.layoutCallback=function(){return r||(r=Promise.resolve(void 0))},o.dX=function(t,i){var n=this;if(!this.FY){this.Pe(),this.LZ=this.cQ.bind(this),this.Qf.documentElement.addEventListener("focusin",this.LZ),i&&(this.HZ=i);var r=new s,o=r.promise,h=r.resolve;return this.getViewport().enterLightboxMode(this.element,o).then((function(){return n.lQ(h,t)}))}},o.mutatedAttributesCallback=function(t){var i=t.open;void 0!==i&&(i?this.dX(2,document.activeElement):this.close(2))},o.vQ=function(){var t=this.mb.querySelector("[autofocus]");t&&y(t)},o.lQ=function(t,i){var n=this,r=this.element,s=this.dQ(),o=s.closedStyle,h=s.durationSeconds,e=s.openStyle,u=Object.keys(e).map((function(t){return"".concat(t," ").concat(h,"s ease-in")})).join(",");this.WZ++,this.BZ&&Y(r,"webkitOverflowScrolling","touch"),Y(r,"transition",u),L(r,_(o)),function(t,i){void 0===i&&(i=t.hasAttribute("hidden")),i?t.removeAttribute("hidden"):t.setAttribute("hidden","")}(r,!0),this.mutateElement((function(){r.scrollTop=0})),this.vQ(),this.mutateElement((function(){L(r,_(e))}));var a=this.mb;this.BZ&&(this.$l(),this.aQ(this.UZ));var f=function(){n.JZ(),t()};r.addEventListener("transitionend",f),r.addEventListener("animationend",f),this.setAsContainer();var c=ht(this.element);c.scheduleLayout(this.element,a),c.scheduleResume(this.element,a),this.fD("lightboxOpen",i),this.zZ=new ut(this.getAmpDoc(),(function(){return n.close(3)})),this.mQ(),this.pQ(),this.bQ(),this.FY=!0},o.fQ=function(){var t=this.element;null!=t.getAttribute("close-button")&&(this.FZ=kt(t),t.insertBefore(this.FZ,this.mb))},o.mQ=function(){var t,i=this;this.FZ&&(this.TZ=this.yQ.bind(this),this.FZ.addEventListener("keydown",this.TZ),this.measureMutateElement((function(){t=i.FZ.getBoundingClientRect().height}),(function(){i.gQ(),T(i.mb,{"margin-top":X(t),"min-height":"calc(100vh - ".concat(X(t),")")})})))},o.gQ=function(){this.FZ.classList.add("amp-ad-close-header")},o.bQ=function(){(this.$Z||this.FZ)&&(this._Z=this.wQ.bind(this),this.ZZ.addEventListener("click",this._Z))},o.xQ=function(){(this.$Z||this.FZ)&&(this.ZZ.removeEventListener("click",this._Z),this._Z=null,this.FZ&&(this.FZ.removeEventListener("keydown",this.TZ),this.TZ=null))},o.dQ=function(){return xt[this.VZ]},o.wQ=function(){this.close(3)},o.yQ=function(t){"Enter"==t.key&&(t.preventDefault(),this.close(3))},o.close=function(t){var i=this;this.FY&&(this.BZ&&Y(this.element,"webkitOverflowScrolling",""),this.getViewport().leaveLightboxMode(this.element).then((function(){return i.kQ(t)})))},o.kQ=function(t){var i=this,n=this.element,r=++this.WZ,s=function(){r==i.WZ&&(i.collapse(),i.JZ())};this.SQ()?(function(t,i){for(var n=0;n<i.length;n++)Y(t,i[n],null)}(n,["transition"]),s()):(n.addEventListener("transitionend",s),n.addEventListener("animationend",s)),L(n,_(this.dQ().closedStyle)),this.zZ&&(this.zZ.destroy(),this.zZ=null),this.Qf.documentElement.removeEventListener("focusin",this.LZ),this.LZ=null,this.xQ(),this.removeAsContainer(),function(t){E(t,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],!0,M)}(this.element,!1),ht(this.element).schedulePause(this.element,this.mb),this.FY=!1,this.fD("lightboxClose",t),this.HZ&&y(this.HZ)},o.SQ=function(){return"inabox"==G(this.win).runtime||yt(this.element)},o.OQ=function(){return!!this.element.contains(document.activeElement)},o.cQ=function(){this.OQ()||this.close(3)},o.pQ=function(){this.OQ()||(this.ZZ=this.jQ(),this.ZZ||(this.$Z=this.bW(),this.element.insertBefore(this.$Z,this.element.firstChild),this.ZZ=this.$Z),y(this.ZZ))},o.jQ=function(){if(this.ZZ)return this.ZZ;if(this.FZ)return this.FZ;for(var t=this.element,i=t.querySelectorAll("[on]"),n=0;n<i.length;n++){var r=i[n];if(this.Ye.hasResolvableActionForTarget(r,"tap",t,K(r.parentElement)))return r}},o.bW=function(){var t=this.element.getAttribute("data-close-button-aria-label")||"Close the modal",i=this.Qf.createElement("button");return i.textContent=t,i.classList.add("i-amphtml-screen-reader"),i.tabIndex=-1,i},o.$l=function(){var t=this.element.scrollTop;this.qZ&&(0==t?this.element.scrollTop=1:this.element.scrollHeight==t+this.element.offsetHeight&&(this.element.scrollTop=t-1)),this.UZ=t,null===this.GZ&&this.AQ(t)},o.AQ=function(t){var i=this;this.GZ=et(this.win).delay((function(){Math.abs(t-i.UZ)<30?(J().fine(wt,"slow scrolling: %s - %s",t,i.UZ),i.GZ=null,i.ln(i.UZ)):(J().fine(wt,"fast scrolling: %s - %s",t,i.UZ),i.AQ(i.UZ))}),100)},o.ln=function(t){J().fine(wt,"update_"),this.aQ(t),this.UZ=t},o.aQ=function(t){var i=this,n=[];this.MQ(t,(function(t){n.push(t),ht(i.element).scheduleLayout(i.element,t)}))},o.MQ=function(t,i){for(var n=this.EQ().height,r=this.hQ(),s=0;s<r.length;s++){for(var o=r[s],h=0,e=o;e&&this.element.contains(e);e=e.offsetParent)h+=e.offsetTop;var u=2*n;h+o.offsetHeight>=t-u&&h<=t+u&&i(o)}},o.EQ=function(){return this.Ht||(this.Ht={width:this.element.clientWidth,height:this.element.clientHeight}),this.Ht},o.KZ=function(){var t=this.element,i=this.win;yt(t)&&Ot(i,i.document.body)},o.fD=function(t,i){var n=function(t,i,n,r){var s={detail:n};if(Object.assign(s,void 0),"function"==typeof t.CustomEvent)return new t.CustomEvent(i,s);var o=t.document.createEvent("CustomEvent");return o.initCustomEvent(i,!!s.bubbles,!!s.cancelable,n),o}(this.win,"".concat(wt,".").concat(t),{});this.Ye.trigger(this.element,t,n,i)},n}(t.BaseElement);function Ot(t,i){var n,r={},s=function(t){return Q(t,"ampdoc")}(t).getAmpDoc(i);(n=s,tt(n,"mutator")).measureMutateElement(i,(function(){r.alreadyTransparent="rgba(0, 0, 0, 0)"==function(t,i){return t.getComputedStyle(i)||z}(t,i)["background-color"]}),(function(){r.alreadyTransparent||$().warn(wt,"The background of the <body> element has been forced to transparent. If you need to set background, use an intermediate container."),T(i,{background:"transparent"})}))}"inabox"==G().runtime&&Ot(window,K(document.body)),t.registerElement(wt,St,'amp-lightbox{display:none;position:fixed!important;z-index:1000;top:0!important;left:0!important;bottom:0!important;right:0!important}amp-lightbox[scrollable]{overflow-y:auto!important;overflow-x:hidden!important}amp-lightbox i-amphtml-ad-close-header{height:60px!important;display:block!important;visibility:visible!important;opacity:0;position:fixed!important;top:0!important;left:0!important;right:0!important;z-index:1000!important;display:-ms-flexbox!important;display:flex!important;-ms-flex-align:center!important;align-items:center!important;-ms-flex-pack:right!important;justify-content:right!important;transition:opacity 0.1s ease-in}[animate-in=fly-in-bottom]>i-amphtml-ad-close-header,[animate-in=fly-in-top]>i-amphtml-ad-close-header{transition-delay:0.2s}amp-lightbox .amp-ad-close-header{opacity:1!important;box-sizing:border-box;padding:5px;line-height:40px;background-color:#000;color:#fff;font-family:Helvetica,sans-serif;font-size:12px;cursor:pointer}amp-lightbox .amp-ad-close-header>:first-child{margin-left:auto!important;pointer-events:none!important}amp-lightbox .amp-ad-close-button{display:block!important;background:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="%23fff"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/><path fill="none" d="M0 0h24v24H0z"/></svg>\') no-repeat;background-position:50%;width:40px;height:40px;pointer-events:none!important;border-radius:40px;margin-left:5px}amp-lightbox .amp-ad-close-header:active>.amp-ad-close-button{background-color:hsla(0,0%,100%,.3)}\n/*# sourceURL=/extensions/amp-lightbox/0.1/amp-lightbox.css*/')}();
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */}});
//# sourceMappingURL=amp-lightbox-0.1.js.map