@ampproject/amp-accordion
Advanced tools
Comparing version 1.2106182132.0 to 1.2106212012.0
@@ -1,3 +0,3 @@ | ||
var Be=Object.create,Z=Object.defineProperty,er=Object.getOwnPropertyDescriptor,rr=Object.getOwnPropertyNames,tr=Object.getPrototypeOf,nr=Object.prototype.hasOwnProperty,Se=function(e){return Z(e,"__esModule",{value:!0})},or=function(e,r){for(var n in r)Z(e,n,{get:r[n],enumerable:!0})},ir=function(e,r,n){if(r&&"object"==typeof r||"function"==typeof r)for(var t,o=rr(r),i=0,a=o.length;i<a;i++)t=o[i],!nr.call(e,t)&&"default"!==t&&Z(e,t,{get:function(e){return r[e]}.bind(null,t),enumerable:!(n=er(r,t))||n.enumerable});return e},q=function(e){return ir(Se(Z(null!=e?Be(tr(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};Se(exports),or(exports,{Accordion:function(){return qe},AccordionContent:function(){return Ur},AccordionHeader:function(){return Lr},AccordionSection:function(){return Hr}});var K,J="section-child-00fce3c",Ee="header-00fce3c",_e="content-hidden-00fce3c";function Q(){return K||(K=Promise.resolve(void 0))}var H,v=q(require("preact/hooks")),N=q(require("preact")),Oe=q(require("preact"));function C(e,r,n){return N.createElement.apply(void 0,arguments)}function F(e){return N.createContext(e,void 0)}function T(e){return v.useState(e)}function Y(e){return v.useRef(e)}function ce(e,r){v.useEffect(e,r)}function k(e,r){v.useLayoutEffect(e,r)}function D(e){return v.useContext(e)}function G(e,r){return v.useMemo(e,r)}function M(e,r){return v.useCallback(e,r)}function Pe(e,r,n){return v.useImperativeHandle(e,r,n)}function B(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var Ce,S={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ar=[S.AUTO,S.LAZY,S.EAGER,S.UNLOAD],Ie=(B(H={},S.AUTO,0),B(H,S.LAZY,1),B(H,S.EAGER,2),B(H,S.UNLOAD,3),H);function de(e,r){var n=Ie[e]||0,t=Ie[r]||0,o=Math.max(n,t);return ar[o]}function we(){return Ce||(Ce=F({renderable:!0,playable:!0,loading:S.AUTO}))}function Te(e){var r=e.children,n=e.loading,t=void 0===n?"auto":n,o=e.notify,i=e.playable,a=void 0===i||i,u=e.renderable,c=void 0===u||u,l=ur(),f=c&&l.renderable,d=f&&a&&l.playable,v=de(f?S.AUTO:S.LAZY,de(t,l.loading)),s=o||l.notify,p=G((function(){return{renderable:f,playable:d,loading:v,notify:s}}),[f,d,v,s]);return C(we().Provider,{children:r,value:p})}function ur(){return D(we())}var Me=Array.isArray,Re=Object.prototype,Qr=Re.hasOwnProperty,Br=Re.toString;function Ne(e){var r=Object.create(null);return e&&Object.assign(r,e),r}function le(e,r){return Object.keys(e).reduce((function(n,t){return r.includes(t)||(n[t]=e[t]),n}),{})}var ee,$e=["Webkit","webkit","Moz","moz","ms","O","o"];function gr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function yr(e,r){for(var n=0;n<$e.length;n++){var t=$e[n]+r;if(void 0!==e[t])return t}return""}function De(e,r,n){if(me(r))return r;ee||(ee=Ne());var t=ee[r];if(!t||n){if(t=r,void 0===e[r]){var o=yr(e,gr(r));void 0!==e[o]&&(t=o)}n||(ee[r]=t)}return t}function br(e,r,n,t,o){var i=De(e.style,r,o);if(i){var a=t?n+t:n;me(i)?e.style.setProperty(i,a):e.style[i]=a}}function re(e,r,n){var t=De(e.style,r,n);if(t)return me(t)?e.style.getPropertyValue(t):e.style[t]}function pe(e,r){for(var n in r)br(e,n,r[n])}function me(e){return e.startsWith("--")}var He=500,Ar=200,Sr="cubic-bezier(0.47, 0, 0.745, 0.715)",Er="cubic-bezier(0.39, 0.575, 0.565, 1)";function Le(e){return Fe(e,(function(){var r=re(e,"height"),n=re(e,"opacity"),t=re(e,"overflowY");pe(e,{height:0,opacity:0,overflowY:"auto"});var o=e.scrollHeight;pe(e,{height:r,opacity:n,overflowY:t});var i=Ye(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:Sr,duration:i})}))}function Ue(e){return Fe(e,(function(){var r=e.offsetHeight,n=Ye(r);return e.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:Er,duration:n})}))}function Fe(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;e.classList.add("i-amphtml-animating");var t=r();return t.onfinish=t.oncancel=function(){t=null,n&&n(),e.classList.remove("i-amphtml-animating")},function(){t&&t.cancel()}}function Ye(e){var r=window.innerHeight,n=Math.abs(e)/r*He;return Math.min(Math.max(n,Ar),He)}var te=q(require("preact/compat"));function ke(e){return te.forwardRef(e)}function Ge(){var e=0;return function(){return String(++e)}}function Ve(e){return function(){return String(Math.floor(Math.random()*e))}}var _r=["animate","as","children","expandSingleSection","id"],Or=["animate","as","children","expanded","id","onExpandStateChange"],Pr=["as","children","className","id","role","tabIndex"],Ir=["as","children","className","id","role"];function We(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function _(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?We(Object(n),!0).forEach((function(r){ne(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function ne(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function j(e,r){return Mr(e)||Tr(e,r)||wr(e,r)||Cr()}function Cr(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function wr(e,r){if(e){if("string"==typeof e)return ze(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ze(e,r)}}function ze(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function Tr(e,r){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var t,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{!a&&null!=n.return&&n.return()}finally{if(u)throw o}}return i}}function Mr(e){if(Array.isArray(e))return e}function oe(e,r){if(null==e)return{};var n,t,o=Rr(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)n=i[t],!(r.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function Rr(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n=i[t],!(r.indexOf(n)>=0)&&(o[n]=e[n]);return o}var Xe=F({}),ve=F({}),Nr={},jr={},$r=Ge(),Ze=Ve(1e5);function Dr(e,r){var n=e.animate,t=void 0!==n&&n,o=e.as,i=void 0===o?"section":o,a=e.children,u=e.expandSingleSection,c=void 0!==u&&u,l=e.id,f=oe(e,_r),d=j(T(Nr),2),v=d[0],s=d[1],p=Y(jr),b=j(T(Ze),1)[0],y=l||"a".concat(b);ce((function(){!c||s((function(e){var r={},n=0;for(var t in e)r[t]=e[t]&&0==n++;return r}))}),[c]);var h=M((function(e,r,n){var t=n.current;return s((function(n){return Je(e,r,n,c)})),p.current=_(_({},p.current),{},ne({},e,t)),function(){s((function(r){return le(r,e)})),p.current=le(p.current,e)}}),[c]),g=M((function(e,r){s((function(n){var t=null!=r?r:!n[e],o=Je(e,t,n,c);return Q().then((function(){for(var e in n){var r=p.current[e];r&&n[e]!=o[e]&&r(o[e])}})),o}))}),[c]),m=M((function(e,r){var n;return null!==(n=v[e])&&void 0!==n?n:r}),[v]),O=M((function(e){if(e)e in v&&g(e);else if(!c)for(var r in v)g(r)}),[v,g,c]),S=M((function(e){if(e)m(e,!0)||g(e);else if(!c)for(var r in v)m(r,!0)||g(r)}),[v,g,m,c]),w=M((function(e){if(e)m(e,!1)&&g(e);else for(var r in v)m(r,!1)&&g(r)}),[v,g,m]);Pe(r,(function(){return{toggle:O,expand:S,collapse:w}}),[O,w,S]);var x=G((function(){return{registerSection:h,toggleExpanded:g,isExpanded:m,animate:t,prefix:y}}),[h,g,m,t,y]);return C(i,_({id:l},f),C(Xe.Provider,{value:x},a))}var qe=ke(Dr);function Je(e,r,n,t){var o;if(t&&r)for(var i in o=ne({},e,r),n)i!=e&&(o[i]=!1);else o=_(_({},n),{},ne({},e,r));return o}function Hr(e){var r=e.animate,n=void 0!==r&&r,t=e.as,o=void 0===t?"section":t,i=e.children,a=e.expanded,u=void 0!==a&&a,c=e.id,l=e.onExpandStateChange,f=oe(e,Or),d=j(T($r),1)[0],v=c||d,s=j(T(Ze),1)[0],p=j(T(u),2),b=p[0],y=p[1],h=j(T(null),2),g=h[0],m=h[1],O=j(T(null),2),S=O[0],w=O[1],x=D(Xe),A=x.animate,P=x.isExpanded,E=x.prefix,I=x.registerSection,H=x.toggleExpanded,N=P?P(v,u):b,L=null!=A?A:n,U=g||"".concat(E||"a","-content-").concat(v,"-").concat(s),q=S||"".concat(E||"a","-header-").concat(v,"-").concat(s),Z=Y(null);Z.current=l,k((function(){if(I)return I(v,u,Z)}),[I,v,u]);var R=M((function(e){H?H(v,e):y((function(r){var n=null!=e?e:!r;return Q().then((function(){var e=Z.current;e&&e(n)})),n}))}),[v,H]),z=G((function(){return{animate:L,contentId:U,headerId:q,expanded:N,toggleHandler:R,setContentId:m,setHeaderId:w}}),[L,U,q,N,R]);return C(o,_(_({},f),{},{expanded:N}),C(ve.Provider,{value:z},i))}function Lr(e){var r=e.as,n=void 0===r?"div":r,t=e.children,o=e.className,i=void 0===o?"":o,a=e.id,u=e.role,c=void 0===u?"button":u,l=e.tabIndex,f=void 0===l?0:l,d=oe(e,Pr),v=D(ve),s=v.contentId,p=v.expanded,b=v.headerId,y=v.setHeaderId,h=v.toggleHandler;return k((function(){y&&y(a)}),[y,a]),C(n,_(_({},d),{},{id:b,role:c,className:"".concat(i," ").concat(J," ").concat(Ee),tabIndex:f,"aria-controls":s,onClick:function(){return h()},"aria-expanded":String(p)}),t)}function Ur(e){var r=e.as,n=void 0===r?"div":r,t=e.children,o=e.className,i=void 0===o?"":o,a=e.id,u=e.role,c=void 0===u?"region":u,l=oe(e,Ir),f=Y(null),d=Y(!1),v=D(ve),s=v.animate,p=v.contentId,b=v.expanded,y=v.headerId,h=v.setContentId;return ce((function(){return d.current=!0,function(){return d.current=!1}}),[]),k((function(){h&&h(a)}),[h,a]),k((function(){var e=d.current,r=f.current;if(s&&e&&r&&r.animate)return b?Le(r):Ue(r)}),[b,s]),C(Te,{renderable:b},C(n,_(_({},l),{},{ref:f,className:i+(" "+J)+(b?"":" "+_e),id:p,"aria-labelledby":y,role:c}),t))} | ||
var Be=Object.create,Z=Object.defineProperty,er=Object.getOwnPropertyDescriptor,rr=Object.getOwnPropertyNames,tr=Object.getPrototypeOf,nr=Object.prototype.hasOwnProperty,Se=function(e){return Z(e,"__esModule",{value:!0})},or=function(e,r){for(var n in Se(e),r)Z(e,n,{get:r[n],enumerable:!0})},ir=function(e,r,n){if(r&&"object"==typeof r||"function"==typeof r)for(var t,o=rr(r),i=0,a=o.length;i<a;i++)t=o[i],!nr.call(e,t)&&"default"!==t&&Z(e,t,{get:function(e){return r[e]}.bind(null,t),enumerable:!(n=er(r,t))||n.enumerable});return e},q=function(e){return ir(Se(Z(null!=e?Be(tr(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};or(exports,{Accordion:function(){return qe},AccordionContent:function(){return Ur},AccordionHeader:function(){return Lr},AccordionSection:function(){return Hr}});var K,J="section-child-00fce3c",Ee="header-00fce3c",_e="content-hidden-00fce3c";function Q(){return K||(K=Promise.resolve(void 0))}var H,v=q(require("preact/hooks")),N=q(require("preact")),Oe=q(require("preact"));function C(e,r,n){return N.createElement.apply(void 0,arguments)}function F(e){return N.createContext(e,void 0)}function T(e){return v.useState(e)}function Y(e){return v.useRef(e)}function ce(e,r){v.useEffect(e,r)}function k(e,r){v.useLayoutEffect(e,r)}function D(e){return v.useContext(e)}function G(e,r){return v.useMemo(e,r)}function M(e,r){return v.useCallback(e,r)}function Pe(e,r,n){return v.useImperativeHandle(e,r,n)}function B(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var Ce,S={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ar=[S.AUTO,S.LAZY,S.EAGER,S.UNLOAD],Ie=(B(H={},S.AUTO,0),B(H,S.LAZY,1),B(H,S.EAGER,2),B(H,S.UNLOAD,3),H);function de(e,r){var n=Ie[e]||0,t=Ie[r]||0,o=Math.max(n,t);return ar[o]}function we(){return Ce||(Ce=F({renderable:!0,playable:!0,loading:S.AUTO}))}function Te(e){var r=e.children,n=e.loading,t=void 0===n?"auto":n,o=e.notify,i=e.playable,a=void 0===i||i,u=e.renderable,c=void 0===u||u,l=ur(),f=c&&l.renderable,d=f&&a&&l.playable,v=de(f?S.AUTO:S.LAZY,de(t,l.loading)),s=o||l.notify,p=G((function(){return{renderable:f,playable:d,loading:v,notify:s}}),[f,d,v,s]);return C(we().Provider,{children:r,value:p})}function ur(){return D(we())}var Me=Array.isArray,Re=Object.prototype,Qr=Re.hasOwnProperty,Br=Re.toString;function Ne(e){var r=Object.create(null);return e&&Object.assign(r,e),r}function le(e,r){return Object.keys(e).reduce((function(n,t){return r.includes(t)||(n[t]=e[t]),n}),{})}var ee,$e=["Webkit","webkit","Moz","moz","ms","O","o"];function gr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function yr(e,r){for(var n=0;n<$e.length;n++){var t=$e[n]+r;if(void 0!==e[t])return t}return""}function De(e,r,n){if(me(r))return r;ee||(ee=Ne());var t=ee[r];if(!t||n){if(t=r,void 0===e[r]){var o=yr(e,gr(r));void 0!==e[o]&&(t=o)}n||(ee[r]=t)}return t}function br(e,r,n,t,o){var i=De(e.style,r,o);if(i){var a=t?n+t:n;me(i)?e.style.setProperty(i,a):e.style[i]=a}}function re(e,r,n){var t=De(e.style,r,n);if(t)return me(t)?e.style.getPropertyValue(t):e.style[t]}function pe(e,r){for(var n in r)br(e,n,r[n])}function me(e){return e.startsWith("--")}var He=500,Ar=200,Sr="cubic-bezier(0.47, 0, 0.745, 0.715)",Er="cubic-bezier(0.39, 0.575, 0.565, 1)";function Le(e){return Fe(e,(function(){var r=re(e,"height"),n=re(e,"opacity"),t=re(e,"overflowY");pe(e,{height:0,opacity:0,overflowY:"auto"});var o=e.scrollHeight;pe(e,{height:r,opacity:n,overflowY:t});var i=Ye(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:Sr,duration:i})}))}function Ue(e){return Fe(e,(function(){var r=e.offsetHeight,n=Ye(r);return e.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:Er,duration:n})}))}function Fe(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;e.classList.add("i-amphtml-animating");var t=r();return t.onfinish=t.oncancel=function(){t=null,n&&n(),e.classList.remove("i-amphtml-animating")},function(){t&&t.cancel()}}function Ye(e){var r=window.innerHeight,n=Math.abs(e)/r*He;return Math.min(Math.max(n,Ar),He)}var te=q(require("preact/compat"));function ke(e){return te.forwardRef(e)}function Ge(){var e=0;return function(){return String(++e)}}function Ve(e){return function(){return String(Math.floor(Math.random()*e))}}var _r=["animate","as","children","expandSingleSection","id"],Or=["animate","as","children","expanded","id","onExpandStateChange"],Pr=["as","children","className","id","role","tabIndex"],Ir=["as","children","className","id","role"];function We(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function _(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?We(Object(n),!0).forEach((function(r){ne(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function ne(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function j(e,r){return Mr(e)||Tr(e,r)||wr(e,r)||Cr()}function Cr(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function wr(e,r){if(e){if("string"==typeof e)return ze(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ze(e,r)}}function ze(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function Tr(e,r){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var t,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{!a&&null!=n.return&&n.return()}finally{if(u)throw o}}return i}}function Mr(e){if(Array.isArray(e))return e}function oe(e,r){if(null==e)return{};var n,t,o=Rr(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)n=i[t],!(r.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function Rr(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n=i[t],!(r.indexOf(n)>=0)&&(o[n]=e[n]);return o}var Xe=F({}),ve=F({}),Nr={},jr={},$r=Ge(),Ze=Ve(1e5);function Dr(e,r){var n=e.animate,t=void 0!==n&&n,o=e.as,i=void 0===o?"section":o,a=e.children,u=e.expandSingleSection,c=void 0!==u&&u,l=e.id,f=oe(e,_r),d=j(T(Nr),2),v=d[0],s=d[1],p=Y(jr),b=j(T(Ze),1)[0],y=l||"a".concat(b);ce((function(){!c||s((function(e){var r={},n=0;for(var t in e)r[t]=e[t]&&0==n++;return r}))}),[c]);var h=M((function(e,r,n){var t=n.current;return s((function(n){return Je(e,r,n,c)})),p.current=_(_({},p.current),{},ne({},e,t)),function(){s((function(r){return le(r,e)})),p.current=le(p.current,e)}}),[c]),g=M((function(e,r){s((function(n){var t=null!=r?r:!n[e],o=Je(e,t,n,c);return Q().then((function(){for(var e in n){var r=p.current[e];r&&n[e]!=o[e]&&r(o[e])}})),o}))}),[c]),m=M((function(e,r){var n;return null!==(n=v[e])&&void 0!==n?n:r}),[v]),O=M((function(e){if(e)e in v&&g(e);else if(!c)for(var r in v)g(r)}),[v,g,c]),S=M((function(e){if(e)m(e,!0)||g(e);else if(!c)for(var r in v)m(r,!0)||g(r)}),[v,g,m,c]),w=M((function(e){if(e)m(e,!1)&&g(e);else for(var r in v)m(r,!1)&&g(r)}),[v,g,m]);Pe(r,(function(){return{toggle:O,expand:S,collapse:w}}),[O,w,S]);var x=G((function(){return{registerSection:h,toggleExpanded:g,isExpanded:m,animate:t,prefix:y}}),[h,g,m,t,y]);return C(i,_({id:l},f),C(Xe.Provider,{value:x},a))}var qe=ke(Dr);function Je(e,r,n,t){var o;if(t&&r)for(var i in o=ne({},e,r),n)i!=e&&(o[i]=!1);else o=_(_({},n),{},ne({},e,r));return o}function Hr(e){var r=e.animate,n=void 0!==r&&r,t=e.as,o=void 0===t?"section":t,i=e.children,a=e.expanded,u=void 0!==a&&a,c=e.id,l=e.onExpandStateChange,f=oe(e,Or),d=j(T($r),1)[0],v=c||d,s=j(T(Ze),1)[0],p=j(T(u),2),b=p[0],y=p[1],h=j(T(null),2),g=h[0],m=h[1],O=j(T(null),2),S=O[0],w=O[1],x=D(Xe),A=x.animate,P=x.isExpanded,E=x.prefix,I=x.registerSection,H=x.toggleExpanded,N=P?P(v,u):b,L=null!=A?A:n,U=g||"".concat(E||"a","-content-").concat(v,"-").concat(s),q=S||"".concat(E||"a","-header-").concat(v,"-").concat(s),Z=Y(null);Z.current=l,k((function(){if(I)return I(v,u,Z)}),[I,v,u]);var R=M((function(e){H?H(v,e):y((function(r){var n=null!=e?e:!r;return Q().then((function(){var e=Z.current;e&&e(n)})),n}))}),[v,H]),z=G((function(){return{animate:L,contentId:U,headerId:q,expanded:N,toggleHandler:R,setContentId:m,setHeaderId:w}}),[L,U,q,N,R]);return C(o,_(_({},f),{},{expanded:N}),C(ve.Provider,{value:z},i))}function Lr(e){var r=e.as,n=void 0===r?"div":r,t=e.children,o=e.className,i=void 0===o?"":o,a=e.id,u=e.role,c=void 0===u?"button":u,l=e.tabIndex,f=void 0===l?0:l,d=oe(e,Pr),v=D(ve),s=v.contentId,p=v.expanded,b=v.headerId,y=v.setHeaderId,h=v.toggleHandler;return k((function(){y&&y(a)}),[y,a]),C(n,_(_({},d),{},{id:b,role:c,className:"".concat(i," ").concat(J," ").concat(Ee),tabIndex:f,"aria-controls":s,onClick:function(){return h()},"aria-expanded":String(p)}),t)}function Ur(e){var r=e.as,n=void 0===r?"div":r,t=e.children,o=e.className,i=void 0===o?"":o,a=e.id,u=e.role,c=void 0===u?"region":u,l=oe(e,Ir),f=Y(null),d=Y(!1),v=D(ve),s=v.animate,p=v.contentId,b=v.expanded,y=v.headerId,h=v.setContentId;return ce((function(){return d.current=!0,function(){return d.current=!1}}),[]),k((function(){h&&h(a)}),[h,a]),k((function(){var e=d.current,r=f.current;if(s&&e&&r&&r.animate)return b?Le(r):Ue(r)}),[b,s]),C(Te,{renderable:b},C(n,_(_({},l),{},{ref:f,className:i+(" "+J)+(b?"":" "+_e),id:p,"aria-labelledby":y,role:c}),t))} | ||
//# sourceMappingURL=component-preact.js.map | ||
qe.displayName="Accordion"; |
@@ -11,2 +11,3 @@ var __create = Object.create; | ||
var __export = function(target, all) { | ||
__markAsModule(target); | ||
for (var name in all) | ||
@@ -33,3 +34,2 @@ __defProp(target, name, { get: all[name], enumerable: true }); | ||
// extensions/amp-accordion/1.0/component.js | ||
__markAsModule(exports); | ||
__export(exports, { | ||
@@ -36,0 +36,0 @@ Accordion: function() { |
@@ -1,3 +0,3 @@ | ||
var Be=Object.create,Z=Object.defineProperty,er=Object.getOwnPropertyDescriptor,rr=Object.getOwnPropertyNames,tr=Object.getPrototypeOf,nr=Object.prototype.hasOwnProperty,Se=function(e){return Z(e,"__esModule",{value:!0})},or=function(e,r){for(var n in r)Z(e,n,{get:r[n],enumerable:!0})},ir=function(e,r,n){if(r&&"object"==typeof r||"function"==typeof r)for(var t,o=rr(r),i=0,a=o.length;i<a;i++)t=o[i],!nr.call(e,t)&&"default"!==t&&Z(e,t,{get:function(e){return r[e]}.bind(null,t),enumerable:!(n=er(r,t))||n.enumerable});return e},q=function(e){return ir(Se(Z(null!=e?Be(tr(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};Se(exports),or(exports,{Accordion:function(){return qe},AccordionContent:function(){return Ur},AccordionHeader:function(){return Lr},AccordionSection:function(){return Hr}});var K,J="section-child-00fce3c",Ee="header-00fce3c",_e="content-hidden-00fce3c";function Q(){return K||(K=Promise.resolve(void 0))}var H,v=q(require("react")),N=q(require("react")),Oe=q(require("react-dom"));function C(e,r,n){return N.createElement.apply(void 0,arguments)}function F(e){return N.createContext(e,void 0)}function T(e){return v.useState(e)}function Y(e){return v.useRef(e)}function ce(e,r){v.useEffect(e,r)}function k(e,r){v.useLayoutEffect(e,r)}function D(e){return v.useContext(e)}function G(e,r){return v.useMemo(e,r)}function M(e,r){return v.useCallback(e,r)}function Pe(e,r,n){return v.useImperativeHandle(e,r,n)}function B(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var Ce,S={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ar=[S.AUTO,S.LAZY,S.EAGER,S.UNLOAD],Ie=(B(H={},S.AUTO,0),B(H,S.LAZY,1),B(H,S.EAGER,2),B(H,S.UNLOAD,3),H);function de(e,r){var n=Ie[e]||0,t=Ie[r]||0,o=Math.max(n,t);return ar[o]}function we(){return Ce||(Ce=F({renderable:!0,playable:!0,loading:S.AUTO}))}function Te(e){var r=e.children,n=e.loading,t=void 0===n?"auto":n,o=e.notify,i=e.playable,a=void 0===i||i,u=e.renderable,c=void 0===u||u,l=ur(),f=c&&l.renderable,d=f&&a&&l.playable,v=de(f?S.AUTO:S.LAZY,de(t,l.loading)),s=o||l.notify,p=G((function(){return{renderable:f,playable:d,loading:v,notify:s}}),[f,d,v,s]);return C(we().Provider,{children:r,value:p})}function ur(){return D(we())}var Me=Array.isArray,Re=Object.prototype,Qr=Re.hasOwnProperty,Br=Re.toString;function Ne(e){var r=Object.create(null);return e&&Object.assign(r,e),r}function le(e,r){return Object.keys(e).reduce((function(n,t){return r.includes(t)||(n[t]=e[t]),n}),{})}var ee,$e=["Webkit","webkit","Moz","moz","ms","O","o"];function gr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function yr(e,r){for(var n=0;n<$e.length;n++){var t=$e[n]+r;if(void 0!==e[t])return t}return""}function De(e,r,n){if(me(r))return r;ee||(ee=Ne());var t=ee[r];if(!t||n){if(t=r,void 0===e[r]){var o=yr(e,gr(r));void 0!==e[o]&&(t=o)}n||(ee[r]=t)}return t}function br(e,r,n,t,o){var i=De(e.style,r,o);if(i){var a=t?n+t:n;me(i)?e.style.setProperty(i,a):e.style[i]=a}}function re(e,r,n){var t=De(e.style,r,n);if(t)return me(t)?e.style.getPropertyValue(t):e.style[t]}function pe(e,r){for(var n in r)br(e,n,r[n])}function me(e){return e.startsWith("--")}var He=500,Ar=200,Sr="cubic-bezier(0.47, 0, 0.745, 0.715)",Er="cubic-bezier(0.39, 0.575, 0.565, 1)";function Le(e){return Fe(e,(function(){var r=re(e,"height"),n=re(e,"opacity"),t=re(e,"overflowY");pe(e,{height:0,opacity:0,overflowY:"auto"});var o=e.scrollHeight;pe(e,{height:r,opacity:n,overflowY:t});var i=Ye(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:Sr,duration:i})}))}function Ue(e){return Fe(e,(function(){var r=e.offsetHeight,n=Ye(r);return e.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:Er,duration:n})}))}function Fe(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;e.classList.add("i-amphtml-animating");var t=r();return t.onfinish=t.oncancel=function(){t=null,n&&n(),e.classList.remove("i-amphtml-animating")},function(){t&&t.cancel()}}function Ye(e){var r=window.innerHeight,n=Math.abs(e)/r*He;return Math.min(Math.max(n,Ar),He)}var te=q(require("react"));function ke(e){return te.forwardRef(e)}function Ge(){var e=0;return function(){return String(++e)}}function Ve(e){return function(){return String(Math.floor(Math.random()*e))}}var _r=["animate","as","children","expandSingleSection","id"],Or=["animate","as","children","expanded","id","onExpandStateChange"],Pr=["as","children","className","id","role","tabIndex"],Ir=["as","children","className","id","role"];function We(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function _(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?We(Object(n),!0).forEach((function(r){ne(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function ne(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function j(e,r){return Mr(e)||Tr(e,r)||wr(e,r)||Cr()}function Cr(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function wr(e,r){if(e){if("string"==typeof e)return ze(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ze(e,r)}}function ze(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function Tr(e,r){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var t,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{!a&&null!=n.return&&n.return()}finally{if(u)throw o}}return i}}function Mr(e){if(Array.isArray(e))return e}function oe(e,r){if(null==e)return{};var n,t,o=Rr(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)n=i[t],!(r.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function Rr(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n=i[t],!(r.indexOf(n)>=0)&&(o[n]=e[n]);return o}var Xe=F({}),ve=F({}),Nr={},jr={},$r=Ge(),Ze=Ve(1e5);function Dr(e,r){var n=e.animate,t=void 0!==n&&n,o=e.as,i=void 0===o?"section":o,a=e.children,u=e.expandSingleSection,c=void 0!==u&&u,l=e.id,f=oe(e,_r),d=j(T(Nr),2),v=d[0],s=d[1],p=Y(jr),b=j(T(Ze),1)[0],y=l||"a".concat(b);ce((function(){!c||s((function(e){var r={},n=0;for(var t in e)r[t]=e[t]&&0==n++;return r}))}),[c]);var h=M((function(e,r,n){var t=n.current;return s((function(n){return Je(e,r,n,c)})),p.current=_(_({},p.current),{},ne({},e,t)),function(){s((function(r){return le(r,e)})),p.current=le(p.current,e)}}),[c]),g=M((function(e,r){s((function(n){var t=null!=r?r:!n[e],o=Je(e,t,n,c);return Q().then((function(){for(var e in n){var r=p.current[e];r&&n[e]!=o[e]&&r(o[e])}})),o}))}),[c]),m=M((function(e,r){var n;return null!==(n=v[e])&&void 0!==n?n:r}),[v]),O=M((function(e){if(e)e in v&&g(e);else if(!c)for(var r in v)g(r)}),[v,g,c]),S=M((function(e){if(e)m(e,!0)||g(e);else if(!c)for(var r in v)m(r,!0)||g(r)}),[v,g,m,c]),w=M((function(e){if(e)m(e,!1)&&g(e);else for(var r in v)m(r,!1)&&g(r)}),[v,g,m]);Pe(r,(function(){return{toggle:O,expand:S,collapse:w}}),[O,w,S]);var x=G((function(){return{registerSection:h,toggleExpanded:g,isExpanded:m,animate:t,prefix:y}}),[h,g,m,t,y]);return C(i,_({id:l},f),C(Xe.Provider,{value:x},a))}var qe=ke(Dr);function Je(e,r,n,t){var o;if(t&&r)for(var i in o=ne({},e,r),n)i!=e&&(o[i]=!1);else o=_(_({},n),{},ne({},e,r));return o}function Hr(e){var r=e.animate,n=void 0!==r&&r,t=e.as,o=void 0===t?"section":t,i=e.children,a=e.expanded,u=void 0!==a&&a,c=e.id,l=e.onExpandStateChange,f=oe(e,Or),d=j(T($r),1)[0],v=c||d,s=j(T(Ze),1)[0],p=j(T(u),2),b=p[0],y=p[1],h=j(T(null),2),g=h[0],m=h[1],O=j(T(null),2),S=O[0],w=O[1],x=D(Xe),A=x.animate,P=x.isExpanded,E=x.prefix,I=x.registerSection,H=x.toggleExpanded,N=P?P(v,u):b,L=null!=A?A:n,U=g||"".concat(E||"a","-content-").concat(v,"-").concat(s),q=S||"".concat(E||"a","-header-").concat(v,"-").concat(s),Z=Y(null);Z.current=l,k((function(){if(I)return I(v,u,Z)}),[I,v,u]);var R=M((function(e){H?H(v,e):y((function(r){var n=null!=e?e:!r;return Q().then((function(){var e=Z.current;e&&e(n)})),n}))}),[v,H]),z=G((function(){return{animate:L,contentId:U,headerId:q,expanded:N,toggleHandler:R,setContentId:m,setHeaderId:w}}),[L,U,q,N,R]);return C(o,_(_({},f),{},{expanded:N}),C(ve.Provider,{value:z},i))}function Lr(e){var r=e.as,n=void 0===r?"div":r,t=e.children,o=e.className,i=void 0===o?"":o,a=e.id,u=e.role,c=void 0===u?"button":u,l=e.tabIndex,f=void 0===l?0:l,d=oe(e,Pr),v=D(ve),s=v.contentId,p=v.expanded,b=v.headerId,y=v.setHeaderId,h=v.toggleHandler;return k((function(){y&&y(a)}),[y,a]),C(n,_(_({},d),{},{id:b,role:c,className:"".concat(i," ").concat(J," ").concat(Ee),tabIndex:f,"aria-controls":s,onClick:function(){return h()},"aria-expanded":String(p)}),t)}function Ur(e){var r=e.as,n=void 0===r?"div":r,t=e.children,o=e.className,i=void 0===o?"":o,a=e.id,u=e.role,c=void 0===u?"region":u,l=oe(e,Ir),f=Y(null),d=Y(!1),v=D(ve),s=v.animate,p=v.contentId,b=v.expanded,y=v.headerId,h=v.setContentId;return ce((function(){return d.current=!0,function(){return d.current=!1}}),[]),k((function(){h&&h(a)}),[h,a]),k((function(){var e=d.current,r=f.current;if(s&&e&&r&&r.animate)return b?Le(r):Ue(r)}),[b,s]),C(Te,{renderable:b},C(n,_(_({},l),{},{ref:f,className:i+(" "+J)+(b?"":" "+_e),id:p,"aria-labelledby":y,role:c}),t))} | ||
var Be=Object.create,Z=Object.defineProperty,er=Object.getOwnPropertyDescriptor,rr=Object.getOwnPropertyNames,tr=Object.getPrototypeOf,nr=Object.prototype.hasOwnProperty,Se=function(e){return Z(e,"__esModule",{value:!0})},or=function(e,r){for(var n in Se(e),r)Z(e,n,{get:r[n],enumerable:!0})},ir=function(e,r,n){if(r&&"object"==typeof r||"function"==typeof r)for(var t,o=rr(r),i=0,a=o.length;i<a;i++)t=o[i],!nr.call(e,t)&&"default"!==t&&Z(e,t,{get:function(e){return r[e]}.bind(null,t),enumerable:!(n=er(r,t))||n.enumerable});return e},q=function(e){return ir(Se(Z(null!=e?Be(tr(e)):{},"default",e&&e.__esModule&&"default"in e?{get:function(){return e.default},enumerable:!0}:{value:e,enumerable:!0})),e)};or(exports,{Accordion:function(){return qe},AccordionContent:function(){return Ur},AccordionHeader:function(){return Lr},AccordionSection:function(){return Hr}});var K,J="section-child-00fce3c",Ee="header-00fce3c",_e="content-hidden-00fce3c";function Q(){return K||(K=Promise.resolve(void 0))}var H,v=q(require("react")),N=q(require("react")),Oe=q(require("react-dom"));function C(e,r,n){return N.createElement.apply(void 0,arguments)}function F(e){return N.createContext(e,void 0)}function T(e){return v.useState(e)}function Y(e){return v.useRef(e)}function ce(e,r){v.useEffect(e,r)}function k(e,r){v.useLayoutEffect(e,r)}function D(e){return v.useContext(e)}function G(e,r){return v.useMemo(e,r)}function M(e,r){return v.useCallback(e,r)}function Pe(e,r,n){return v.useImperativeHandle(e,r,n)}function B(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var Ce,S={AUTO:"auto",LAZY:"lazy",EAGER:"eager",UNLOAD:"unload"},ar=[S.AUTO,S.LAZY,S.EAGER,S.UNLOAD],Ie=(B(H={},S.AUTO,0),B(H,S.LAZY,1),B(H,S.EAGER,2),B(H,S.UNLOAD,3),H);function de(e,r){var n=Ie[e]||0,t=Ie[r]||0,o=Math.max(n,t);return ar[o]}function we(){return Ce||(Ce=F({renderable:!0,playable:!0,loading:S.AUTO}))}function Te(e){var r=e.children,n=e.loading,t=void 0===n?"auto":n,o=e.notify,i=e.playable,a=void 0===i||i,u=e.renderable,c=void 0===u||u,l=ur(),f=c&&l.renderable,d=f&&a&&l.playable,v=de(f?S.AUTO:S.LAZY,de(t,l.loading)),s=o||l.notify,p=G((function(){return{renderable:f,playable:d,loading:v,notify:s}}),[f,d,v,s]);return C(we().Provider,{children:r,value:p})}function ur(){return D(we())}var Me=Array.isArray,Re=Object.prototype,Qr=Re.hasOwnProperty,Br=Re.toString;function Ne(e){var r=Object.create(null);return e&&Object.assign(r,e),r}function le(e,r){return Object.keys(e).reduce((function(n,t){return r.includes(t)||(n[t]=e[t]),n}),{})}var ee,$e=["Webkit","webkit","Moz","moz","ms","O","o"];function gr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function yr(e,r){for(var n=0;n<$e.length;n++){var t=$e[n]+r;if(void 0!==e[t])return t}return""}function De(e,r,n){if(me(r))return r;ee||(ee=Ne());var t=ee[r];if(!t||n){if(t=r,void 0===e[r]){var o=yr(e,gr(r));void 0!==e[o]&&(t=o)}n||(ee[r]=t)}return t}function br(e,r,n,t,o){var i=De(e.style,r,o);if(i){var a=t?n+t:n;me(i)?e.style.setProperty(i,a):e.style[i]=a}}function re(e,r,n){var t=De(e.style,r,n);if(t)return me(t)?e.style.getPropertyValue(t):e.style[t]}function pe(e,r){for(var n in r)br(e,n,r[n])}function me(e){return e.startsWith("--")}var He=500,Ar=200,Sr="cubic-bezier(0.47, 0, 0.745, 0.715)",Er="cubic-bezier(0.39, 0.575, 0.565, 1)";function Le(e){return Fe(e,(function(){var r=re(e,"height"),n=re(e,"opacity"),t=re(e,"overflowY");pe(e,{height:0,opacity:0,overflowY:"auto"});var o=e.scrollHeight;pe(e,{height:r,opacity:n,overflowY:t});var i=Ye(o);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:Sr,duration:i})}))}function Ue(e){return Fe(e,(function(){var r=e.offsetHeight,n=Ye(r);return e.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:Er,duration:n})}))}function Fe(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;e.classList.add("i-amphtml-animating");var t=r();return t.onfinish=t.oncancel=function(){t=null,n&&n(),e.classList.remove("i-amphtml-animating")},function(){t&&t.cancel()}}function Ye(e){var r=window.innerHeight,n=Math.abs(e)/r*He;return Math.min(Math.max(n,Ar),He)}var te=q(require("react"));function ke(e){return te.forwardRef(e)}function Ge(){var e=0;return function(){return String(++e)}}function Ve(e){return function(){return String(Math.floor(Math.random()*e))}}var _r=["animate","as","children","expandSingleSection","id"],Or=["animate","as","children","expanded","id","onExpandStateChange"],Pr=["as","children","className","id","role","tabIndex"],Ir=["as","children","className","id","role"];function We(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function _(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?We(Object(n),!0).forEach((function(r){ne(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function ne(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function j(e,r){return Mr(e)||Tr(e,r)||wr(e,r)||Cr()}function Cr(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function wr(e,r){if(e){if("string"==typeof e)return ze(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ze(e,r)}}function ze(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function Tr(e,r){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var t,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{!a&&null!=n.return&&n.return()}finally{if(u)throw o}}return i}}function Mr(e){if(Array.isArray(e))return e}function oe(e,r){if(null==e)return{};var n,t,o=Rr(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)n=i[t],!(r.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,n)||(o[n]=e[n]))}return o}function Rr(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)n=i[t],!(r.indexOf(n)>=0)&&(o[n]=e[n]);return o}var Xe=F({}),ve=F({}),Nr={},jr={},$r=Ge(),Ze=Ve(1e5);function Dr(e,r){var n=e.animate,t=void 0!==n&&n,o=e.as,i=void 0===o?"section":o,a=e.children,u=e.expandSingleSection,c=void 0!==u&&u,l=e.id,f=oe(e,_r),d=j(T(Nr),2),v=d[0],s=d[1],p=Y(jr),b=j(T(Ze),1)[0],y=l||"a".concat(b);ce((function(){!c||s((function(e){var r={},n=0;for(var t in e)r[t]=e[t]&&0==n++;return r}))}),[c]);var h=M((function(e,r,n){var t=n.current;return s((function(n){return Je(e,r,n,c)})),p.current=_(_({},p.current),{},ne({},e,t)),function(){s((function(r){return le(r,e)})),p.current=le(p.current,e)}}),[c]),g=M((function(e,r){s((function(n){var t=null!=r?r:!n[e],o=Je(e,t,n,c);return Q().then((function(){for(var e in n){var r=p.current[e];r&&n[e]!=o[e]&&r(o[e])}})),o}))}),[c]),m=M((function(e,r){var n;return null!==(n=v[e])&&void 0!==n?n:r}),[v]),O=M((function(e){if(e)e in v&&g(e);else if(!c)for(var r in v)g(r)}),[v,g,c]),S=M((function(e){if(e)m(e,!0)||g(e);else if(!c)for(var r in v)m(r,!0)||g(r)}),[v,g,m,c]),w=M((function(e){if(e)m(e,!1)&&g(e);else for(var r in v)m(r,!1)&&g(r)}),[v,g,m]);Pe(r,(function(){return{toggle:O,expand:S,collapse:w}}),[O,w,S]);var x=G((function(){return{registerSection:h,toggleExpanded:g,isExpanded:m,animate:t,prefix:y}}),[h,g,m,t,y]);return C(i,_({id:l},f),C(Xe.Provider,{value:x},a))}var qe=ke(Dr);function Je(e,r,n,t){var o;if(t&&r)for(var i in o=ne({},e,r),n)i!=e&&(o[i]=!1);else o=_(_({},n),{},ne({},e,r));return o}function Hr(e){var r=e.animate,n=void 0!==r&&r,t=e.as,o=void 0===t?"section":t,i=e.children,a=e.expanded,u=void 0!==a&&a,c=e.id,l=e.onExpandStateChange,f=oe(e,Or),d=j(T($r),1)[0],v=c||d,s=j(T(Ze),1)[0],p=j(T(u),2),b=p[0],y=p[1],h=j(T(null),2),g=h[0],m=h[1],O=j(T(null),2),S=O[0],w=O[1],x=D(Xe),A=x.animate,P=x.isExpanded,E=x.prefix,I=x.registerSection,H=x.toggleExpanded,N=P?P(v,u):b,L=null!=A?A:n,U=g||"".concat(E||"a","-content-").concat(v,"-").concat(s),q=S||"".concat(E||"a","-header-").concat(v,"-").concat(s),Z=Y(null);Z.current=l,k((function(){if(I)return I(v,u,Z)}),[I,v,u]);var R=M((function(e){H?H(v,e):y((function(r){var n=null!=e?e:!r;return Q().then((function(){var e=Z.current;e&&e(n)})),n}))}),[v,H]),z=G((function(){return{animate:L,contentId:U,headerId:q,expanded:N,toggleHandler:R,setContentId:m,setHeaderId:w}}),[L,U,q,N,R]);return C(o,_(_({},f),{},{expanded:N}),C(ve.Provider,{value:z},i))}function Lr(e){var r=e.as,n=void 0===r?"div":r,t=e.children,o=e.className,i=void 0===o?"":o,a=e.id,u=e.role,c=void 0===u?"button":u,l=e.tabIndex,f=void 0===l?0:l,d=oe(e,Pr),v=D(ve),s=v.contentId,p=v.expanded,b=v.headerId,y=v.setHeaderId,h=v.toggleHandler;return k((function(){y&&y(a)}),[y,a]),C(n,_(_({},d),{},{id:b,role:c,className:"".concat(i," ").concat(J," ").concat(Ee),tabIndex:f,"aria-controls":s,onClick:function(){return h()},"aria-expanded":String(p)}),t)}function Ur(e){var r=e.as,n=void 0===r?"div":r,t=e.children,o=e.className,i=void 0===o?"":o,a=e.id,u=e.role,c=void 0===u?"region":u,l=oe(e,Ir),f=Y(null),d=Y(!1),v=D(ve),s=v.animate,p=v.contentId,b=v.expanded,y=v.headerId,h=v.setContentId;return ce((function(){return d.current=!0,function(){return d.current=!1}}),[]),k((function(){h&&h(a)}),[h,a]),k((function(){var e=d.current,r=f.current;if(s&&e&&r&&r.animate)return b?Le(r):Ue(r)}),[b,s]),C(Te,{renderable:b},C(n,_(_({},l),{},{ref:f,className:i+(" "+J)+(b?"":" "+_e),id:p,"aria-labelledby":y,role:c}),t))} | ||
//# sourceMappingURL=component-react.js.map | ||
qe.displayName="Accordion"; |
@@ -11,2 +11,3 @@ var __create = Object.create; | ||
var __export = function(target, all) { | ||
__markAsModule(target); | ||
for (var name in all) | ||
@@ -33,3 +34,2 @@ __defProp(target, name, { get: all[name], enumerable: true }); | ||
// extensions/amp-accordion/1.0/component.js | ||
__markAsModule(exports); | ||
__export(exports, { | ||
@@ -36,0 +36,0 @@ Accordion: function() { |
{ | ||
"name": "@ampproject/amp-accordion", | ||
"version": "1.2106182132.0", | ||
"version": "1.2106212012.0", | ||
"description": "AMP HTML amp-accordion Component", | ||
@@ -5,0 +5,0 @@ "author": "The AMP HTML Authors", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
405673