(self.AMP=self.AMP||[]).push({n:"amp-sidebar",v:"2007102309001",f:(function(AMP,_){ var h,aa="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b};function ba(a){for(var b=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global],c=0;c=d&&(b[c]=Math.random()b&&(b=10);var c=Date.now()+b;return!this.isPending()||-10>c-this.fa?(this.cancel(),this.fa=c,this.S=this.Ca.delay(this.Ga,b),!0):!1};G.prototype.$=function(){this.S=-1;this.fa=0;this.la=!0;this.Ja();this.la=!1}; G.prototype.cancel=function(){this.isPending()&&(this.Ca.cancel(this.S),this.S=-1)};function wa(a,b){for(var c=0;ca)return!1;this.c.splice(a,1);this.m.splice(a,1);this.h.splice(a,1);this.K.splice(a,1);delete this.R[b];return!0}return!1};h.onPointerDown=function(a){return this.Aa.add(a)}; h.Oa=function(a){var b=Date.now();this.ba=!1;this.Aa.fire(a);for(var c=0;c=d){c=!0;break}c?(b.stopPropagation(),a.Qa||b.preventDefault()):a.Ra&&b.stopPropagation();a.ha&&(a.ha=!1,a.wa())} h.wa=function(){for(var a=Date.now(),b=-1,c=0;cthis.m[b])b=c;if(-1!=b){var d=0;for(c=0;cd){a=b;c=this.c[a];for(var e=0;eb&&(b=1);var d=.5+Math.min(b/33.34,.5);return a/b*d+c*(1-d)};function L(a,b,c,d){K.call(this,a,b);this.xa=c;this.Fa=d;this.j=!1;this.oa=this.na=this.ia=this.W=this.Ba=this.ka=this.ja=this.F=this.D=this.J=this.I=0}t(L,K);h=L.prototype;h.onTouchStart=function(a){a=a.touches;return this.j&&a&&1b)this.signalReady(-10);else{if(8<=b)return!1}else if(this.Fa)if(8<=b&&b>a)this.signalReady(-10);else{if(8<=a)return!1}else return!1;return!0}return!1}; h.onTouchEnd=function(a){var b=a.touches;b&&0==b.length&&this.j&&(this.j=!1,M(this,!1,!0,a),this.signalEnd())};h.acceptStart=function(){this.j=!0;this.ja=this.I;this.ka=this.J;this.ia=this.Ba;this.I=this.D;this.J=this.F;M(this,!0,!1,null)};h.acceptCancel=function(){this.j=!1}; function M(a,b,c,d){a.W=Date.now();var e=a.W-a.ia;if(!c&&4g.length?0:0==g.lastIndexOf("--",0))f=g;else{O||(O=Object.create(null));var k=O[g];if(!k){k=g;if(void 0===f[g]){var l=g;l=l.charAt(0).toUpperCase()+l.slice(1);b:{for(var m=0;mf.length?0:0==f.lastIndexOf("--",0))?d.style.setProperty(f,e):d.style[f]=e)}} function Q(a,b){void 0===b&&(b=a.hasAttribute("hidden"));b?a.removeAttribute("hidden"):a.setAttribute("hidden","")};function R(a,b,c){this.pa=a;this.ea=b;this.Pa=c;this.da="backward";this.P="horizontal";this.Z=this.B=null}function S(a){return"horizontal"==a.P?a.B.offsetWidth:a.B.offsetHeight}function T(a,b,c){b="horizontal"==a.P?b:c;return"backward"==a.da?-Math.min(b,0):Math.max(b,0)}function U(a,b,c){c=void 0===c?"":c;var d="backward"==a.da?-b:b;return"translate("+("horizontal"==a.P?""+d+c:0)+", "+("horizontal"==a.P?0:""+d+c)+")"} R.prototype.startSwipe=function(a){var b=a.mask,c=a.direction,d=a.orientation;this.B=a.swipeElement;this.Z=b;this.da=c;this.P=d};R.prototype.swipeMove=function(a){Ea(this,a,!1)};R.prototype.endSwipe=function(a){Ea(this,a,!0)};function Fa(a,b,c){var d=.75*c;P(a.B,{transform:U(a,b,"px"),transition:d+"ms transform cubic-bezier(0.15, .55, .3, 0.95)"});return N(a.pa,d)} function Ga(a,b){var c=.8*b;return a.ea(function(){P(a.B,{transform:U(a,0),transition:c+"ms transform ease-in"});P(a.Z,{opacity:"",transition:c+"ms opacity ease-in"})}).then(function(){return N(a.pa,c)})}function Ha(a,b){var c=.75*(S(a)-b);return a.ea(function(){P(a.B,{transform:U(a,100,"%"),transition:c+"ms transform ease-out"});P(a.Z,{opacity:0,transition:c+"ms opacity ease-out"})}).then(function(){return N(a.pa,c)}).then(function(){return a.Pa()})} function Ia(a,b,c){b=void 0===b?"":b;c=void 0===c?"":c;P(a.B,{transform:b,transition:""});P(a.Z,{opacity:c,transition:""})}function Ja(a,b,c,d,e){var f=T(a,22.5*b+d,22.5*c+e),g=T(a,b,c),k=.5*S(a);return fg?Fa(a,f,g).then(function(){return Ga(a,f)}):Ha(a,f)}function Ea(a,b,c){var d=b.deltaX,e=b.deltaY,f=b.velocityX,g=b.velocityY;a.ea(function(){if(c)Ja(a,f,g,d,e).then(function(){Ia(a)});else{var b=T(a,d,e),l=b/S(a),m=Math.max(0,1-l);Ia(a,U(a,b,"px"),m)}})};function Ka(a,b){if(void 0!==E)var c=E;else{try{var d=b.ownerDocument,e=d.createElement("div"),f=d.createElement("div");e.appendChild(f);c=e.querySelector(":scope div")===f}catch(k){c=!1}c=E=c}c?c=b.querySelector(ra(":scope")):(b.classList.add("i-amphtml-scoped"),c=ra(".i-amphtml-scoped"),c=b.querySelectorAll(c),b.classList.remove("i-amphtml-scoped"),c=void 0===c[0]?null:c[0]);if(c){var g=(a.win.getComputedStyle(b)||Object.create(null))["overflow-y"];"scroll"!=g&&"auto"!=g?w().error("AMP-SIDEBAR", "for 'autoscroll', 'nav [toolbar]' element must be set to overflow\n 'scroll' or 'auto' for 'autoscroll' to work."):D(a,"viewport").animateScrollWithinParent(c,b,"center",0)}};function La(a,b){this.va=b;this.w=a;this.ca=b.getAmpDoc();this.Sa=this.w.getAttribute("toolbar");this.T=null;this.A=void 0;this.aa=!1;this.w.classList.add("amp-sidebar-toolbar-target-hidden");this.T=this.w.cloneNode(!0);a=this.w.getAttribute("toolbar-target");var c=this.w;a=w().assert(a,'"toolbar-target" is required',c,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0);if(c=this.ca.getElementById(a))this.A=c,this.T.classList.add("i-amphtml-toolbar"),Q(this.A,!1);else throw w().createError("Could not find the toolbar-target element with an id: "+ a);}La.prototype.onLayoutChange=function(){this.ca.win.matchMedia(this.Sa).matches?Ma(this):Na(this)};function Ma(a){a.aa?pa||(pa=Promise.resolve(void 0)):a.va.mutateElement(function(){a.A&&(Q(a.A,!0),a.A.contains(a.T)||a.A.appendChild(a.T),a.w.classList.add("amp-sidebar-toolbar-target-shown"),a.w.classList.remove("amp-sidebar-toolbar-target-hidden"),a.aa=!0,Ka(a.ca,a.T))})} function Na(a){a.aa&&a.va.mutateElement(function(){a.A&&(Q(a.A,!1),a.w.classList.add("amp-sidebar-toolbar-target-hidden"),a.w.classList.remove("amp-sidebar-toolbar-target-shown"),a.aa=!1)})};var V=[];function Oa(a){var b=[];a=Pa(a);for(var c={},d=0;d element to preserve a logical DOM order.");"left"!=this.H&&"right"!= this.H&&(this.H=Ta(this,va(this.C)?"right":"left"),b.setAttribute("side",this.H));Ua(this);b.addEventListener("amp:dom-update",function(){Ua(a)});this.getAmpDoc().whenReady().then(function(){fa(b.querySelectorAll("nav[toolbar]")).forEach(function(b){try{a.Da.push(new La(b,a))}catch(d){a.user().error("amp-sidebar toolbar","Failed to instantiate toolbar",d)}})});this.O&&Va(this);b.hasAttribute("role")||b.setAttribute("role","menu");b.tabIndex=-1;this.Ia.addEventListener("keydown",function(b){"Escape"== b.key&&X(a,!1,3)&&b.preventDefault()});this.N=Wa(this);this.N||(this.N=this.createScreenReaderCloseButton(),b.insertBefore(this.N,this.element.firstChild));b.appendChild(this.createScreenReaderCloseButton());this.registerDefaultAction(function(b){Xa(a,b.trust,b.caller)},"open");this.registerAction("close",function(b){X(a,!1,b.trust)});this.registerAction("toggle",function(b){var c=b.trust;b=b.caller;a.G?X(a,!1,c):Xa(a,c,b)});this.U.addToAllowlist("amp-sidebar",["open","close","toggle"],["email"]); b.addEventListener("click",function(c){if((c=F(c.target,"A"))&&c.href){var d=na(b,"url").parse(c.href),e=a.getAmpDoc().getUrl();ka(c.href)==ka(e)&&d.hash&&X(a,!1,3)}},!0);Ya(this,this.element)};function Ua(a){if(!a.za){var b=a.element.querySelector("amp-nested-menu");b&&(C(a.win,"extensions").installExtensionForDoc(a.getAmpDoc(),"amp-nested-menu"),a.za=b)}} function Wa(a){for(var b=a.element.querySelectorAll("[on]"),c=0;ca.element.scrollTop?(a.element.scrollTop=1,b.preventDefault()):a.element.scrollHeight==a.element.scrollTop+a.element.offsetHeight&&(--a.element.scrollTop,b.preventDefault()))})}function $a(a){if(!a.qa){var b=a.C.createElement("div");P(b,{height:"54px",width:"100%","background-color":"transparent"});a.element.appendChild(b);a.qa=!0}} function ab(a,b,c){var d=a.win;var e="amp-sidebar toolbar."+b;var f={};var g={detail:f};Object.assign(g,void 0);"function"==typeof d.CustomEvent?e=new d.CustomEvent(e,g):(d=d.document.createEvent("CustomEvent"),d.initCustomEvent(e,!!g.bubbles,!!g.cancelable,f),e=d);a.U.trigger(a.element,b,e,c)}(function(a){a.registerElement("amp-sidebar",W,"amp-sidebar{--story-page-vh:1vh;position:fixed!important;top:0;max-height:100vh!important;height:100vh;max-width:80vw;background-color:#efefef;min-width:45px!important;outline:none;overflow-x:hidden!important;overflow-y:auto!important;z-index:2147483647;-webkit-overflow-scrolling:touch;will-change:transform}amp-sidebar[side=left]{left:0!important;transform:translateX(-100%);animation-name:i-amphtml-sidebar-slide-out-left}amp-sidebar[side=left][open]{animation-name:i-amphtml-sidebar-slide-in-left}amp-sidebar[side=right]{right:0!important;transform:translateX(100%);animation-name:i-amphtml-sidebar-slide-out-right}amp-sidebar[side=right][open]{animation-name:i-amphtml-sidebar-slide-in-right}amp-sidebar[side][i-amphtml-sidebar-opened]{transform:none;animation:none}.i-amphtml-sidebar-mask,amp-sidebar[side]{animation-duration:233ms;animation-timing-function:cubic-bezier(0,0,.21,1);animation-fill-mode:forwards}.i-amphtml-toolbar>ol,.i-amphtml-toolbar>ul{display:-ms-flexbox;display:flex;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-wrap:wrap;flex-wrap:wrap;overflow:auto;list-style-type:none;padding:0;margin:0}.i-amphtml-sidebar-mask{position:fixed!important;top:0!important;left:0!important;width:100vw!important;height:100vh!important;background-image:none!important;background-color:rgba(0,0,0,0.5);animation-name:i-amphtml-sidebar-mask-fade-out;z-index:2147483646}.i-amphtml-sidebar-mask[open]{animation-name:i-amphtml-sidebar-mask-fade-in}.i-amphtml-sidebar-mask[i-amphtml-sidebar-opened]{animation:none}@keyframes i-amphtml-sidebar-slide-in-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes i-amphtml-sidebar-slide-out-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes i-amphtml-sidebar-slide-in-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes i-amphtml-sidebar-slide-out-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes i-amphtml-sidebar-mask-fade-in{0%{opacity:0}to{opacity:1}}@keyframes i-amphtml-sidebar-mask-fade-out{0%{opacity:1}to{opacity:0}}\n/*# sourceURL=/extensions/amp-sidebar/0.1/amp-sidebar.css*/")})(self.AMP); })}); //# sourceMappingURL=amp-sidebar-0.1.js.map