@bentoproject/accordion
Advanced tools
Comparing version 1.2203281422.0 to 1.2204121632.0
; | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=function(n){return t(n,"__esModule",{value:!0})},a=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var c,a=i(r),f=0,l=a.length;f<l;f++)c=a[f],u.call(n,c)||"default"===c||t(n,c,{get:function(n){return r[n]}.bind(null,c),enumerable:!(o=e(r,c))||o.enumerable});return n}(c(t(null!=n?r(o(n)):{},"default",n&&n.__esModule&&"default"in n?{get:function(){return n.default},enumerable:!0}:{value:n,enumerable:!0})),n)};function f(n){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function l(n){var r=function(n,r){if("object"!==f(n)||null===n)return n;var t=n[Symbol.toPrimitive];if(void 0!==t){var e=t.call(n,"string");if("object"!==f(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===f(r)?r:String(r)}function v(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t<r;t++)e[t]=n[t];return e}function d(){return n||(n=Promise.resolve(void 0))}function b(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function p(n,r){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),t.push.apply(t,e)}return t}function s(n){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))}))}return n}function h(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var e,i,o=[],u=!0,c=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(c)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return v(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?v(n,r):void 0}}(n,r)||function(){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 y(n,r){if(null==n)return{};var t,e,i={},o=Object.keys(n);for(e=0;e<o.length;e++)t=o[e],r.indexOf(t)>=0||(i[t]=n[t]);return i}!function(n,r){for(var e in c(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return D},BentoAccordionContent:function(){return K},BentoAccordionHeader:function(){return J},BentoAccordionSection:function(){return G}});var m=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}m.hasOwnProperty,m.toString;var j=a(require("@bentoproject/core")),O=a(require("@bentoproject/core")),S=a(require("@bentoproject/core")),w=a(require("@bentoproject/core"));function x(n){var r,t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(t=n.tabindex)&&void 0!==t?t:n.tabIndex)&&void 0!==r?r:e}a(require("@bentoproject/core")),a(require("@bentoproject/core")),Array.isArray;var A,M=["Webkit","webkit","Moz","moz","ms","O","o"];function I(n,r,t){if(E(r))return r;var e;A||(e=Object.create(null),A=e);var i=A[r];if(!i||t){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var t=0;t<M.length;t++){var e=M[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(A[r]=i)}return i}function Y(n,r,t,e,i){var o=I(n.style,r,i);if(o){var u,c=e?t+e:t;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),M.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function q(n,r,t){var e=I(n.style,r,t);if(e)return E(e)?n.style.getPropertyValue(e):n.style[e]}function C(n,r){for(var t in r)Y(n,t,r[t])}function E(n){return n.startsWith("--")}function z(n,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var e=r();return e.onfinish=e.oncancel=function(){e=null,t&&t(),n.classList.remove("i-amphtml-animating")},function(){e&&e.cancel()}}function B(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var k,H=["animate","as","children","expandSingleSection","id"],P=["animate","as","children","expanded","id","onExpandStateChange"],T=j.createContext({}),_=j.createContext({}),U={},W={},Z=(k=0,function(){return String(++k)}),$=function(){return String(Math.floor(1e5*Math.random()))},D=(0,S.forwardRef)((function(n,r){var t=n.animate,e=void 0!==t&&t,i=n.as,o=void 0===i?"section":i,u=n.children,c=n.expandSingleSection,a=void 0!==c&&c,f=n.id,l=y(n,H),v=h((0,O.useState)(U),2),p=v[0],m=v[1],S=(0,O.useRef)(W),w=h((0,O.useState)($),1)[0],x=f||"a".concat(w);(0,O.useEffect)((function(){a&&m((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[a]);var A=(0,O.useCallback)((function(n,r,t){var e=t.current;return m((function(t){return F(n,r,t,a)})),S.current=s(s({},S.current),{},b({},n,e)),function(){m((function(r){return g(r,n)})),S.current=g(S.current,n)}}),[a]),M=(0,O.useCallback)((function(n,r){m((function(t){var e=null!=r?r:!t[n],i=F(n,e,t,a);return d().then((function(){for(var n in t){var r=S.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[a]),I=(0,O.useCallback)((function(n,r){var t;return null!==(t=p[n])&&void 0!==t?t:r}),[p]),Y=(0,O.useCallback)((function(n){if(n)n in p&&M(n);else if(!a)for(var r in p)M(r)}),[p,M,a]),q=(0,O.useCallback)((function(n){if(n)I(n,!0)||M(n);else if(!a)for(var r in p)I(r,!0)||M(r)}),[p,M,I,a]),C=(0,O.useCallback)((function(n){if(n)I(n,!1)&&M(n);else for(var r in p)I(r,!1)&&M(r)}),[p,M,I]);(0,O.useImperativeHandle)(r,(function(){return{toggle:Y,expand:q,collapse:C}}),[Y,C,q]);var E=(0,O.useMemo)((function(){return{registerSection:A,toggleExpanded:M,isExpanded:I,animate:e,prefix:x}}),[A,M,I,e,x]);return j.createElement(o,s({id:f},l),j.createElement(T.Provider,{value:E},u))}));function F(n,r,t,e){var i;if(e&&r)for(var o in i=b({},n,r),t)o!=n&&(i[o]=!1);else i=s(s({},t),{},b({},n,r));return i}function G(n){var r=n.animate,t=void 0!==r&&r,e=n.as,i=void 0===e?"section":e,o=n.children,u=n.expanded,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,l=y(n,P),v=h((0,O.useState)(Z),1)[0],b=a||v,p=h((0,O.useState)($),1)[0],m=h((0,O.useState)(c),2),g=m[0],S=m[1],w=h((0,O.useState)(null),2),x=w[0],A=w[1],M=h((0,O.useState)(null),2),I=M[0],Y=M[1],q=(0,O.useContext)(T),C=q.animate,E=q.isExpanded,z=q.prefix,B=q.registerSection,k=q.toggleExpanded,H=E?E(b,c):g,U=null!=C?C:t,W=x||"".concat(z||"a","-content-").concat(b,"-").concat(p),D=I||"".concat(z||"a","-header-").concat(b,"-").concat(p),F=(0,O.useRef)(null);F.current=f,(0,O.useLayoutEffect)((function(){if(B)return B(b,c,F)}),[B,b,c]);var G=(0,O.useCallback)((function(n){k?k(b,n):S((function(r){var t=null!=n?n:!r;return d().then((function(){var n=F.current;n&&n(t)})),t}))}),[b,k]),J=(0,O.useMemo)((function(){return{animate:U,contentId:W,headerId:D,expanded:H,toggleHandler:G,setContentId:A,setHeaderId:Y}}),[U,W,D,H,G]);return j.createElement(i,s({},l),j.createElement(_.Provider,{value:J},o))}function J(n){var r="class",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,v=y(n,["as","children","id","role",r].map(l)),d=(0,O.useContext)(_),b=d.contentId,p=d.expanded,h=d.headerId,m=d.setHeaderId,g=d.toggleHandler;return(0,O.useLayoutEffect)((function(){m&&m(o)}),[m,o]),j.createElement(e,s(s({},v),{},{id:h,role:c,class:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabindex:x(v),"aria-controls":b,onClick:function(){return g()},"aria-expanded":String(p)}),i)}function K(n){var r="class",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,v=y(n,["as","children","id","role",r].map(l)),d=(0,O.useRef)(null),b=(0,O.useRef)(!1),p=(0,O.useContext)(_),h=p.animate,m=p.contentId,g=p.expanded,S=p.headerId,x=p.setContentId;return(0,O.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,O.useLayoutEffect)((function(){x&&x(o)}),[x,o]),(0,O.useLayoutEffect)((function(){var n=b.current,r=d.current;if(h&&n&&r&&r.animate)return g?function(n){return z(n,(function(){var r=q(n,"height"),t=q(n,"opacity"),e=q(n,"overflowY");C(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;C(n,{height:r,opacity:t,overflowY:e});var o=B(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return z(n,(function(){var r=n.offsetHeight,t=B(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(r)}),[g,h]),j.createElement(w.WithAmpContext,{renderable:g},j.createElement(e,s(s({},v),{},{ref:d,class:f+" section-child-76fac82"+(g?"":" content-hidden-76fac82"),id:m,"aria-labelledby":S,role:c}),i))}D.displayName="Accordion"; | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=function(n){return t(n,"__esModule",{value:!0})},a=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var c,a=i(r),f=0,l=a.length;f<l;f++)c=a[f],u.call(n,c)||"default"===c||t(n,c,{get:function(n){return r[n]}.bind(null,c),enumerable:!(o=e(r,c))||o.enumerable});return n}(c(t(null!=n?r(o(n)):{},"default",n&&n.__esModule&&"default"in n?{get:function(){return n.default},enumerable:!0}:{value:n,enumerable:!0})),n)};function f(n){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function l(n){var r=function(n,r){if("object"!==f(n)||null===n)return n;var t=n[Symbol.toPrimitive];if(void 0!==t){var e=t.call(n,"string");if("object"!==f(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===f(r)?r:String(r)}function v(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t<r;t++)e[t]=n[t];return e}function d(){return n||(n=Promise.resolve(void 0))}function b(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function p(n,r){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),t.push.apply(t,e)}return t}function s(n){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))}))}return n}function h(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var e,i,o=[],u=!0,c=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(c)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return v(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?v(n,r):void 0}}(n,r)||function(){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 y(n,r){if(null==n)return{};var t,e,i={},o=Object.keys(n);for(e=0;e<o.length;e++)t=o[e],r.indexOf(t)>=0||(i[t]=n[t]);return i}!function(n,r){for(var e in c(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return D},BentoAccordionContent:function(){return K},BentoAccordionHeader:function(){return J},BentoAccordionSection:function(){return G}});var m=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}m.hasOwnProperty,m.toString;var j=a(require("./@bentoproject/core")),O=a(require("./@bentoproject/core")),S=a(require("./@bentoproject/core")),w=a(require("./@bentoproject/core"));function x(n){var r,t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(t=n.tabindex)&&void 0!==t?t:n.tabIndex)&&void 0!==r?r:e}a(require("./@bentoproject/core")),a(require("./@bentoproject/core")),Array.isArray;var A,M=["Webkit","webkit","Moz","moz","ms","O","o"];function I(n,r,t){if(E(r))return r;var e;A||(e=Object.create(null),A=e);var i=A[r];if(!i||t){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var t=0;t<M.length;t++){var e=M[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(A[r]=i)}return i}function Y(n,r,t,e,i){var o=I(n.style,r,i);if(o){var u,c=e?t+e:t;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),M.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function q(n,r,t){var e=I(n.style,r,t);if(e)return E(e)?n.style.getPropertyValue(e):n.style[e]}function C(n,r){for(var t in r)Y(n,t,r[t])}function E(n){return n.startsWith("--")}function z(n,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var e=r();return e.onfinish=e.oncancel=function(){e=null,t&&t(),n.classList.remove("i-amphtml-animating")},function(){e&&e.cancel()}}function B(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var k,H=["animate","as","children","expandSingleSection","id"],P=["animate","as","children","expanded","id","onExpandStateChange"],T=j.createContext({}),_=j.createContext({}),U={},W={},Z=(k=0,function(){return String(++k)}),$=function(){return String(Math.floor(1e5*Math.random()))},D=(0,S.forwardRef)((function(n,r){var t=n.animate,e=void 0!==t&&t,i=n.as,o=void 0===i?"section":i,u=n.children,c=n.expandSingleSection,a=void 0!==c&&c,f=n.id,l=y(n,H),v=h((0,O.useState)(U),2),p=v[0],m=v[1],S=(0,O.useRef)(W),w=h((0,O.useState)($),1)[0],x=f||"a".concat(w);(0,O.useEffect)((function(){a&&m((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[a]);var A=(0,O.useCallback)((function(n,r,t){var e=t.current;return m((function(t){return F(n,r,t,a)})),S.current=s(s({},S.current),{},b({},n,e)),function(){m((function(r){return g(r,n)})),S.current=g(S.current,n)}}),[a]),M=(0,O.useCallback)((function(n,r){m((function(t){var e=null!=r?r:!t[n],i=F(n,e,t,a);return d().then((function(){for(var n in t){var r=S.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[a]),I=(0,O.useCallback)((function(n,r){var t;return null!==(t=p[n])&&void 0!==t?t:r}),[p]),Y=(0,O.useCallback)((function(n){if(n)n in p&&M(n);else if(!a)for(var r in p)M(r)}),[p,M,a]),q=(0,O.useCallback)((function(n){if(n)I(n,!0)||M(n);else if(!a)for(var r in p)I(r,!0)||M(r)}),[p,M,I,a]),C=(0,O.useCallback)((function(n){if(n)I(n,!1)&&M(n);else for(var r in p)I(r,!1)&&M(r)}),[p,M,I]);(0,O.useImperativeHandle)(r,(function(){return{toggle:Y,expand:q,collapse:C}}),[Y,C,q]);var E=(0,O.useMemo)((function(){return{registerSection:A,toggleExpanded:M,isExpanded:I,animate:e,prefix:x}}),[A,M,I,e,x]);return j.createElement(o,s({id:f},l),j.createElement(T.Provider,{value:E},u))}));function F(n,r,t,e){var i;if(e&&r)for(var o in i=b({},n,r),t)o!=n&&(i[o]=!1);else i=s(s({},t),{},b({},n,r));return i}function G(n){var r=n.animate,t=void 0!==r&&r,e=n.as,i=void 0===e?"section":e,o=n.children,u=n.expanded,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,l=y(n,P),v=h((0,O.useState)(Z),1)[0],b=a||v,p=h((0,O.useState)($),1)[0],m=h((0,O.useState)(c),2),g=m[0],S=m[1],w=h((0,O.useState)(null),2),x=w[0],A=w[1],M=h((0,O.useState)(null),2),I=M[0],Y=M[1],q=(0,O.useContext)(T),C=q.animate,E=q.isExpanded,z=q.prefix,B=q.registerSection,k=q.toggleExpanded,H=E?E(b,c):g,U=null!=C?C:t,W=x||"".concat(z||"a","-content-").concat(b,"-").concat(p),D=I||"".concat(z||"a","-header-").concat(b,"-").concat(p),F=(0,O.useRef)(null);F.current=f,(0,O.useLayoutEffect)((function(){if(B)return B(b,c,F)}),[B,b,c]);var G=(0,O.useCallback)((function(n){k?k(b,n):S((function(r){var t=null!=n?n:!r;return d().then((function(){var n=F.current;n&&n(t)})),t}))}),[b,k]),J=(0,O.useMemo)((function(){return{animate:U,contentId:W,headerId:D,expanded:H,toggleHandler:G,setContentId:A,setHeaderId:Y}}),[U,W,D,H,G]);return j.createElement(i,s({},l),j.createElement(_.Provider,{value:J},o))}function J(n){var r="class",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,v=y(n,["as","children","id","role",r].map(l)),d=(0,O.useContext)(_),b=d.contentId,p=d.expanded,h=d.headerId,m=d.setHeaderId,g=d.toggleHandler;return(0,O.useLayoutEffect)((function(){m&&m(o)}),[m,o]),j.createElement(e,s(s({},v),{},{id:h,role:c,class:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabindex:x(v),"aria-controls":b,onClick:function(){return g()},"aria-expanded":String(p)}),i)}function K(n){var r="class",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,v=y(n,["as","children","id","role",r].map(l)),d=(0,O.useRef)(null),b=(0,O.useRef)(!1),p=(0,O.useContext)(_),h=p.animate,m=p.contentId,g=p.expanded,S=p.headerId,x=p.setContentId;return(0,O.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,O.useLayoutEffect)((function(){x&&x(o)}),[x,o]),(0,O.useLayoutEffect)((function(){var n=b.current,r=d.current;if(h&&n&&r&&r.animate)return g?function(n){return z(n,(function(){var r=q(n,"height"),t=q(n,"opacity"),e=q(n,"overflowY");C(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;C(n,{height:r,opacity:t,overflowY:e});var o=B(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return z(n,(function(){var r=n.offsetHeight,t=B(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(r)}),[g,h]),j.createElement(w.WithAmpContext,{renderable:g},j.createElement(e,s(s({},v),{},{ref:d,class:f+" section-child-76fac82"+(g?"":" content-hidden-76fac82"),id:m,"aria-labelledby":S,role:c}),i))}D.displayName="Accordion"; | ||
//# sourceMappingURL=component-preact.js.map |
@@ -109,10 +109,10 @@ var __create = Object.create; | ||
// src/bento/components/bento-accordion/1.0/component.js | ||
var Preact = __toModule(require("@bentoproject/core")); | ||
var import_preact = __toModule(require("@bentoproject/core")); | ||
var import_compat = __toModule(require("@bentoproject/core")); | ||
var import_context2 = __toModule(require("@bentoproject/core")); | ||
var Preact = __toModule(require("./@bentoproject/core")); | ||
var import_preact = __toModule(require("./@bentoproject/core")); | ||
var import_compat = __toModule(require("./@bentoproject/core")); | ||
var import_context2 = __toModule(require("./@bentoproject/core")); | ||
// src/preact/utils.js | ||
var import__ = __toModule(require("@bentoproject/core")); | ||
var import_context = __toModule(require("@bentoproject/core")); | ||
var import__ = __toModule(require("./@bentoproject/core")); | ||
var import_context = __toModule(require("./@bentoproject/core")); | ||
function propName(name) { | ||
@@ -119,0 +119,0 @@ return name; |
@@ -62,10 +62,10 @@ // src/bento/components/bento-accordion/1.0/component.jss.js | ||
createElement | ||
} from "@bentoproject/core"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "@bentoproject/core"; | ||
import { forwardRef } from "@bentoproject/core"; | ||
import { WithAmpContext } from "@bentoproject/core"; | ||
} from "./@bentoproject/core"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "./@bentoproject/core"; | ||
import { forwardRef } from "./@bentoproject/core"; | ||
import { WithAmpContext } from "./@bentoproject/core"; | ||
// src/preact/utils.js | ||
import { useCallback, useLayoutEffect } from "@bentoproject/core"; | ||
import { useAmpContext } from "@bentoproject/core"; | ||
import { useCallback, useLayoutEffect } from "./@bentoproject/core"; | ||
import { useAmpContext } from "./@bentoproject/core"; | ||
function propName(name) { | ||
@@ -72,0 +72,0 @@ return name; |
; | ||
var n;function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function e(n){var e=function(n,e){if("object"!==t(n)||null===n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var o=r.call(n,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===t(e)?e:String(e)}function r(){return n||(n=Promise.resolve(void 0))}function o(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function i(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),e.push.apply(e,r)}return e}function c(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?i(Object(e),!0).forEach((function(t){o(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function a(n,t){if(null==n)return{};var e,r,o={},i=Object.keys(n);for(r=0;r<i.length;r++)e=i[r],t.indexOf(e)>=0||(o[e]=n[e]);return o}var u,{hasOwnProperty:l,toString:d}=Object.prototype;function f(n,t){return Object.keys(n).reduce(((e,r)=>(t.includes(r)||(e[r]=n[r]),e)),{})}import{createContext as s,createElement as p}from"@bentoproject/core";import{useCallback as b,useContext as h,useEffect as m,useImperativeHandle as g,useLayoutEffect as v,useMemo as y,useRef as j,useState as x}from"@bentoproject/core";import{forwardRef as S}from"@bentoproject/core";import{WithAmpContext as O}from"@bentoproject/core";import{useCallback as w,useLayoutEffect as I}from"@bentoproject/core";import{useAmpContext as $}from"@bentoproject/core";function E(n,t=0){var e,r;return null!==(e=null!==(r=n.tabindex)&&void 0!==r?r:n.tabIndex)&&void 0!==e?e:t}var Y=["Webkit","webkit","Moz","moz","ms","O","o"];function C(n,t,e){if(H(t))return t;u||(u=Object.create(null));let r=u[t];if(!r||e){if(r=t,void 0===n[t]){const e=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(t),o=function(n,t){for(let e=0;e<Y.length;e++){const r=Y[e]+t;if(void 0!==n[r])return r}return""}(n,e);void 0!==n[o]&&(r=o)}e||(u[t]=r)}return r}function M(n,t,e,r,o){const i=C(n.style,t,o);if(!i)return;const c=r?e+r:e;n.style.setProperty(function(n){const t=n.replace(/[A-Z]/g,(n=>"-"+n.toLowerCase()));return Y.some((n=>t.startsWith(n+"-")))?`-${t}`:t}(i),c)}function k(n,t,e){const r=C(n.style,t,e);if(r)return H(r)?n.style.getPropertyValue(r):n.style[r]}function z(n,t){for(const e in t)M(n,e,t[e])}function H(n){return n.startsWith("--")}function P(n,t,e){n.classList.add("i-amphtml-animating");let r=t();return r.onfinish=r.oncancel=()=>{r=null,e&&e(),n.classList.remove("i-amphtml-animating")},()=>{r&&r.cancel()}}function A(n){const t=window.innerHeight,e=Math.abs(n)/t*500;return Math.min(Math.max(e,200),500)}var L=["animate","as","children","expandSingleSection","id"],T=["animate","as","children","expanded","id","onExpandStateChange"],W=s({}),Z=s({}),q={},B={},D=function(){let n=0;return()=>String(++n)}(),F=()=>String(Math.floor(1e5*Math.random())),G=S((function(n,t){let{animate:e=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,d=a(n,L);const[s,h]=x(q),v=j(B),[S]=x(F),O=l||`a${S}`;m((()=>{u&&h((n=>{const t={};let e=0;for(const r in n)t[r]=n[r]&&0==e++;return t}))}),[u]);const w=b(((n,t,{current:e})=>(h((e=>J(n,t,e,u))),v.current=c(c({},v.current),{},{[n]:e}),()=>{h((t=>f(t,n))),v.current=f(v.current,n)})),[u]),I=b(((n,t)=>{h((e=>{const o=null!=t?t:!e[n],i=J(n,o,e,u);return r().then((()=>{for(const n in e){const t=v.current[n];t&&e[n]!=i[n]&&t(i[n])}})),i}))}),[u]),$=b(((n,t)=>{var e;return null!==(e=s[n])&&void 0!==e?e:t}),[s]),E=b((n=>{if(n)n in s&&I(n);else if(!u)for(const n in s)I(n)}),[s,I,u]),Y=b((n=>{if(n)$(n,!0)||I(n);else if(!u)for(const n in s)$(n,!0)||I(n)}),[s,I,$,u]),C=b((n=>{if(n)$(n,!1)&&I(n);else for(const n in s)$(n,!1)&&I(n)}),[s,I,$]);g(t,(()=>({toggle:E,expand:Y,collapse:C})),[E,C,Y]);const M=y((()=>({registerSection:w,toggleExpanded:I,isExpanded:$,animate:e,prefix:O})),[w,I,$,e,O]);return p(o,c({id:l},d),p(W.Provider,{value:M},i))}));function J(n,t,e,r){let o;if(r&&t){o={[n]:t};for(const t in e)t!=n&&(o[t]=!1)}else o=c(c({},e),{},{[n]:t});return o}function K(n){let{animate:t=!1,as:e="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,T);const[f]=x(D),s=u||f,[m]=x(F),[g,S]=x(i),[O,w]=x(null),[I,$]=x(null),{animate:E,isExpanded:Y,prefix:C,registerSection:M,toggleExpanded:k}=h(W),z=Y?Y(s,i):g,H=null!=E?E:t,P=O||`${C||"a"}-content-${s}-${m}`,A=I||`${C||"a"}-header-${s}-${m}`,L=j(null);L.current=l,v((()=>{if(M)return M(s,i,L)}),[M,s,i]);const q=b((n=>{k?k(s,n):S((t=>{const e=null!=n?n:!t;return r().then((()=>{const n=L.current;n&&n(e)})),e}))}),[s,k]),B=y((()=>({animate:H,contentId:P,headerId:A,expanded:z,toggleHandler:q,setContentId:w,setHeaderId:$})),[H,P,A,z,q]);return p(e,c({},d),p(Z.Provider,{value:B},o))}function N(n){let t="class",{as:r="div",children:o,id:i,role:u="button",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const{contentId:f,expanded:s,headerId:b,setHeaderId:m,toggleHandler:g}=h(Z);return v((()=>{m&&m(i)}),[m,i]),p(r,c(c({},d),{},{id:b,role:u,class:`${l} section-child-76fac82 header-76fac82`,tabindex:E(d),"aria-controls":f,onClick:()=>g(),"aria-expanded":String(s)}),o)}function Q(n){let t="class",{as:r="div",children:o,id:i,role:u="region",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const f=j(null),s=j(!1),{animate:b,contentId:g,expanded:y,headerId:x,setContentId:S}=h(Z);return m((()=>(s.current=!0,()=>s.current=!1)),[]),v((()=>{S&&S(i)}),[S,i]),v((()=>{const n=s.current,t=f.current;if(b&&n&&t&&t.animate)return y?function(n){return P(n,(()=>{const t=k(n,"height"),e=k(n,"opacity"),r=k(n,"overflowY");z(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;z(n,{height:t,opacity:e,overflowY:r});const i=A(o);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(t):function(n){return P(n,(()=>{const t=n.offsetHeight,e=A(t);return n.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(t)}),[y,b]),p(O,{renderable:y},p(r,c(c({},d),{},{ref:f,class:l+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:g,"aria-labelledby":x,role:u}),o))}G.displayName="Accordion";export{G as BentoAccordion,Q as BentoAccordionContent,N as BentoAccordionHeader,K as BentoAccordionSection}; | ||
var n;function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function e(n){var e=function(n,e){if("object"!==t(n)||null===n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var o=r.call(n,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===t(e)?e:String(e)}function r(){return n||(n=Promise.resolve(void 0))}function o(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function i(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),e.push.apply(e,r)}return e}function c(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?i(Object(e),!0).forEach((function(t){o(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function a(n,t){if(null==n)return{};var e,r,o={},i=Object.keys(n);for(r=0;r<i.length;r++)e=i[r],t.indexOf(e)>=0||(o[e]=n[e]);return o}var u,{hasOwnProperty:l,toString:d}=Object.prototype;function f(n,t){return Object.keys(n).reduce(((e,r)=>(t.includes(r)||(e[r]=n[r]),e)),{})}import{createContext as s,createElement as p}from"./@bentoproject/core";import{useCallback as b,useContext as h,useEffect as m,useImperativeHandle as g,useLayoutEffect as v,useMemo as y,useRef as j,useState as x}from"./@bentoproject/core";import{forwardRef as S}from"./@bentoproject/core";import{WithAmpContext as O}from"./@bentoproject/core";import{useCallback as w,useLayoutEffect as I}from"./@bentoproject/core";import{useAmpContext as $}from"./@bentoproject/core";function E(n,t=0){var e,r;return null!==(e=null!==(r=n.tabindex)&&void 0!==r?r:n.tabIndex)&&void 0!==e?e:t}var Y=["Webkit","webkit","Moz","moz","ms","O","o"];function C(n,t,e){if(H(t))return t;u||(u=Object.create(null));let r=u[t];if(!r||e){if(r=t,void 0===n[t]){const e=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(t),o=function(n,t){for(let e=0;e<Y.length;e++){const r=Y[e]+t;if(void 0!==n[r])return r}return""}(n,e);void 0!==n[o]&&(r=o)}e||(u[t]=r)}return r}function M(n,t,e,r,o){const i=C(n.style,t,o);if(!i)return;const c=r?e+r:e;n.style.setProperty(function(n){const t=n.replace(/[A-Z]/g,(n=>"-"+n.toLowerCase()));return Y.some((n=>t.startsWith(n+"-")))?`-${t}`:t}(i),c)}function k(n,t,e){const r=C(n.style,t,e);if(r)return H(r)?n.style.getPropertyValue(r):n.style[r]}function z(n,t){for(const e in t)M(n,e,t[e])}function H(n){return n.startsWith("--")}function P(n,t,e){n.classList.add("i-amphtml-animating");let r=t();return r.onfinish=r.oncancel=()=>{r=null,e&&e(),n.classList.remove("i-amphtml-animating")},()=>{r&&r.cancel()}}function A(n){const t=window.innerHeight,e=Math.abs(n)/t*500;return Math.min(Math.max(e,200),500)}var L=["animate","as","children","expandSingleSection","id"],T=["animate","as","children","expanded","id","onExpandStateChange"],W=s({}),Z=s({}),q={},B={},D=function(){let n=0;return()=>String(++n)}(),F=()=>String(Math.floor(1e5*Math.random())),G=S((function(n,t){let{animate:e=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,d=a(n,L);const[s,h]=x(q),v=j(B),[S]=x(F),O=l||`a${S}`;m((()=>{u&&h((n=>{const t={};let e=0;for(const r in n)t[r]=n[r]&&0==e++;return t}))}),[u]);const w=b(((n,t,{current:e})=>(h((e=>J(n,t,e,u))),v.current=c(c({},v.current),{},{[n]:e}),()=>{h((t=>f(t,n))),v.current=f(v.current,n)})),[u]),I=b(((n,t)=>{h((e=>{const o=null!=t?t:!e[n],i=J(n,o,e,u);return r().then((()=>{for(const n in e){const t=v.current[n];t&&e[n]!=i[n]&&t(i[n])}})),i}))}),[u]),$=b(((n,t)=>{var e;return null!==(e=s[n])&&void 0!==e?e:t}),[s]),E=b((n=>{if(n)n in s&&I(n);else if(!u)for(const n in s)I(n)}),[s,I,u]),Y=b((n=>{if(n)$(n,!0)||I(n);else if(!u)for(const n in s)$(n,!0)||I(n)}),[s,I,$,u]),C=b((n=>{if(n)$(n,!1)&&I(n);else for(const n in s)$(n,!1)&&I(n)}),[s,I,$]);g(t,(()=>({toggle:E,expand:Y,collapse:C})),[E,C,Y]);const M=y((()=>({registerSection:w,toggleExpanded:I,isExpanded:$,animate:e,prefix:O})),[w,I,$,e,O]);return p(o,c({id:l},d),p(W.Provider,{value:M},i))}));function J(n,t,e,r){let o;if(r&&t){o={[n]:t};for(const t in e)t!=n&&(o[t]=!1)}else o=c(c({},e),{},{[n]:t});return o}function K(n){let{animate:t=!1,as:e="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,T);const[f]=x(D),s=u||f,[m]=x(F),[g,S]=x(i),[O,w]=x(null),[I,$]=x(null),{animate:E,isExpanded:Y,prefix:C,registerSection:M,toggleExpanded:k}=h(W),z=Y?Y(s,i):g,H=null!=E?E:t,P=O||`${C||"a"}-content-${s}-${m}`,A=I||`${C||"a"}-header-${s}-${m}`,L=j(null);L.current=l,v((()=>{if(M)return M(s,i,L)}),[M,s,i]);const q=b((n=>{k?k(s,n):S((t=>{const e=null!=n?n:!t;return r().then((()=>{const n=L.current;n&&n(e)})),e}))}),[s,k]),B=y((()=>({animate:H,contentId:P,headerId:A,expanded:z,toggleHandler:q,setContentId:w,setHeaderId:$})),[H,P,A,z,q]);return p(e,c({},d),p(Z.Provider,{value:B},o))}function N(n){let t="class",{as:r="div",children:o,id:i,role:u="button",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const{contentId:f,expanded:s,headerId:b,setHeaderId:m,toggleHandler:g}=h(Z);return v((()=>{m&&m(i)}),[m,i]),p(r,c(c({},d),{},{id:b,role:u,class:`${l} section-child-76fac82 header-76fac82`,tabindex:E(d),"aria-controls":f,onClick:()=>g(),"aria-expanded":String(s)}),o)}function Q(n){let t="class",{as:r="div",children:o,id:i,role:u="region",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const f=j(null),s=j(!1),{animate:b,contentId:g,expanded:y,headerId:x,setContentId:S}=h(Z);return m((()=>(s.current=!0,()=>s.current=!1)),[]),v((()=>{S&&S(i)}),[S,i]),v((()=>{const n=s.current,t=f.current;if(b&&n&&t&&t.animate)return y?function(n){return P(n,(()=>{const t=k(n,"height"),e=k(n,"opacity"),r=k(n,"overflowY");z(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;z(n,{height:t,opacity:e,overflowY:r});const i=A(o);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(t):function(n){return P(n,(()=>{const t=n.offsetHeight,e=A(t);return n.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(t)}),[y,b]),p(O,{renderable:y},p(r,c(c({},d),{},{ref:f,class:l+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:g,"aria-labelledby":x,role:u}),o))}G.displayName="Accordion";export{G as BentoAccordion,Q as BentoAccordionContent,N as BentoAccordionHeader,K as BentoAccordionSection}; | ||
//# sourceMappingURL=component-preact.module.js.map |
; | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=function(n){return t(n,"__esModule",{value:!0})},a=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var c,a=i(r),f=0,l=a.length;f<l;f++)c=a[f],u.call(n,c)||"default"===c||t(n,c,{get:function(n){return r[n]}.bind(null,c),enumerable:!(o=e(r,c))||o.enumerable});return n}(c(t(null!=n?r(o(n)):{},"default",n&&n.__esModule&&"default"in n?{get:function(){return n.default},enumerable:!0}:{value:n,enumerable:!0})),n)};function f(n){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function l(n){var r=function(n,r){if("object"!==f(n)||null===n)return n;var t=n[Symbol.toPrimitive];if(void 0!==t){var e=t.call(n,"string");if("object"!==f(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===f(r)?r:String(r)}function v(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t<r;t++)e[t]=n[t];return e}function d(){return n||(n=Promise.resolve(void 0))}function b(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function s(n,r){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),t.push.apply(t,e)}return t}function h(n){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?s(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))}))}return n}function m(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var e,i,o=[],u=!0,c=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(c)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return v(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?v(n,r):void 0}}(n,r)||function(){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 p(n,r){if(null==n)return{};var t,e,i={},o=Object.keys(n);for(e=0;e<o.length;e++)t=o[e],r.indexOf(t)>=0||(i[t]=n[t]);return i}!function(n,r){for(var e in c(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return $},BentoAccordionContent:function(){return J},BentoAccordionHeader:function(){return G},BentoAccordionSection:function(){return F}});var y=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}y.hasOwnProperty,y.toString;var j=a(require("@bentoproject/core")),O=a(require("@bentoproject/core")),S=a(require("react")),w=a(require("@bentoproject/core"));function x(n){var r,t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(t=n.tabindex)&&void 0!==t?t:n.tabIndex)&&void 0!==r?r:e}a(require("@bentoproject/core")),a(require("@bentoproject/core")),Array.isArray;var A,I=["Webkit","webkit","Moz","moz","ms","O","o"];function M(n,r,t){if(E(r))return r;var e;A||(e=Object.create(null),A=e);var i=A[r];if(!i||t){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var t=0;t<I.length;t++){var e=I[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(A[r]=i)}return i}function Y(n,r,t,e,i){var o=M(n.style,r,i);if(o){var u,c=e?t+e:t;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),I.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function q(n,r,t){var e=M(n.style,r,t);if(e)return E(e)?n.style.getPropertyValue(e):n.style[e]}function C(n,r){for(var t in r)Y(n,t,r[t])}function E(n){return n.startsWith("--")}function z(n,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var e=r();return e.onfinish=e.oncancel=function(){e=null,t&&t(),n.classList.remove("i-amphtml-animating")},function(){e&&e.cancel()}}function B(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var N,k=["animate","as","children","expandSingleSection","id"],H=["animate","as","children","expanded","id","onExpandStateChange"],P=j.createContext({}),T=j.createContext({}),_={},U={},W=(N=0,function(){return String(++N)}),Z=function(){return String(Math.floor(1e5*Math.random()))},$=(0,S.forwardRef)((function(n,r){var t=n.animate,e=void 0!==t&&t,i=n.as,o=void 0===i?"section":i,u=n.children,c=n.expandSingleSection,a=void 0!==c&&c,f=n.id,l=p(n,k),v=m((0,O.useState)(_),2),s=v[0],y=v[1],S=(0,O.useRef)(U),w=m((0,O.useState)(Z),1)[0],x=f||"a".concat(w);(0,O.useEffect)((function(){a&&y((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[a]);var A=(0,O.useCallback)((function(n,r,t){var e=t.current;return y((function(t){return D(n,r,t,a)})),S.current=h(h({},S.current),{},b({},n,e)),function(){y((function(r){return g(r,n)})),S.current=g(S.current,n)}}),[a]),I=(0,O.useCallback)((function(n,r){y((function(t){var e=null!=r?r:!t[n],i=D(n,e,t,a);return d().then((function(){for(var n in t){var r=S.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[a]),M=(0,O.useCallback)((function(n,r){var t;return null!==(t=s[n])&&void 0!==t?t:r}),[s]),Y=(0,O.useCallback)((function(n){if(n)n in s&&I(n);else if(!a)for(var r in s)I(r)}),[s,I,a]),q=(0,O.useCallback)((function(n){if(n)M(n,!0)||I(n);else if(!a)for(var r in s)M(r,!0)||I(r)}),[s,I,M,a]),C=(0,O.useCallback)((function(n){if(n)M(n,!1)&&I(n);else for(var r in s)M(r,!1)&&I(r)}),[s,I,M]);(0,O.useImperativeHandle)(r,(function(){return{toggle:Y,expand:q,collapse:C}}),[Y,C,q]);var E=(0,O.useMemo)((function(){return{registerSection:A,toggleExpanded:I,isExpanded:M,animate:e,prefix:x}}),[A,I,M,e,x]);return j.createElement(o,h({id:f},l),j.createElement(P.Provider,{value:E},u))}));function D(n,r,t,e){var i;if(e&&r)for(var o in i=b({},n,r),t)o!=n&&(i[o]=!1);else i=h(h({},t),{},b({},n,r));return i}function F(n){var r=n.animate,t=void 0!==r&&r,e=n.as,i=void 0===e?"section":e,o=n.children,u=n.expanded,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,l=p(n,H),v=m((0,O.useState)(W),1)[0],b=a||v,s=m((0,O.useState)(Z),1)[0],y=m((0,O.useState)(c),2),g=y[0],S=y[1],w=m((0,O.useState)(null),2),x=w[0],A=w[1],I=m((0,O.useState)(null),2),M=I[0],Y=I[1],q=(0,O.useContext)(P),C=q.animate,E=q.isExpanded,z=q.prefix,B=q.registerSection,N=q.toggleExpanded,k=E?E(b,c):g,_=null!=C?C:t,U=x||"".concat(z||"a","-content-").concat(b,"-").concat(s),$=M||"".concat(z||"a","-header-").concat(b,"-").concat(s),D=(0,O.useRef)(null);D.current=f,(0,O.useLayoutEffect)((function(){if(B)return B(b,c,D)}),[B,b,c]);var F=(0,O.useCallback)((function(n){N?N(b,n):S((function(r){var t=null!=n?n:!r;return d().then((function(){var n=D.current;n&&n(t)})),t}))}),[b,N]),G=(0,O.useMemo)((function(){return{animate:_,contentId:U,headerId:$,expanded:k,toggleHandler:F,setContentId:A,setHeaderId:Y}}),[_,U,$,k,F]);return j.createElement(i,h({},l),j.createElement(T.Provider,{value:G},o))}function G(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,v=p(n,["as","children","id","role",r].map(l)),d=(0,O.useContext)(T),b=d.contentId,s=d.expanded,m=d.headerId,y=d.setHeaderId,g=d.toggleHandler;return(0,O.useLayoutEffect)((function(){y&&y(o)}),[y,o]),j.createElement(e,h(h({},v),{},{id:m,role:c,className:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabIndex:x(v),"aria-controls":b,onClick:function(){return g()},"aria-expanded":String(s)}),i)}function J(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,v=p(n,["as","children","id","role",r].map(l)),d=(0,O.useRef)(null),b=(0,O.useRef)(!1),s=(0,O.useContext)(T),m=s.animate,y=s.contentId,g=s.expanded,S=s.headerId,x=s.setContentId;return(0,O.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,O.useLayoutEffect)((function(){x&&x(o)}),[x,o]),(0,O.useLayoutEffect)((function(){var n=b.current,r=d.current;if(m&&n&&r&&r.animate)return g?function(n){return z(n,(function(){var r=q(n,"height"),t=q(n,"opacity"),e=q(n,"overflowY");C(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;C(n,{height:r,opacity:t,overflowY:e});var o=B(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return z(n,(function(){var r=n.offsetHeight,t=B(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(r)}),[g,m]),j.createElement(w.WithAmpContext,{renderable:g},j.createElement(e,h(h({},v),{},{ref:d,className:f+" section-child-76fac82"+(g?"":" content-hidden-76fac82"),id:y,"aria-labelledby":S,role:c}),i))}$.displayName="Accordion"; | ||
var n,r=Object.create,t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=function(n){return t(n,"__esModule",{value:!0})},a=function(n){return function(n,r,o){if(r&&"object"==typeof r||"function"==typeof r)for(var c,a=i(r),f=0,l=a.length;f<l;f++)c=a[f],u.call(n,c)||"default"===c||t(n,c,{get:function(n){return r[n]}.bind(null,c),enumerable:!(o=e(r,c))||o.enumerable});return n}(c(t(null!=n?r(o(n)):{},"default",n&&n.__esModule&&"default"in n?{get:function(){return n.default},enumerable:!0}:{value:n,enumerable:!0})),n)};function f(n){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function l(n){var r=function(n,r){if("object"!==f(n)||null===n)return n;var t=n[Symbol.toPrimitive];if(void 0!==t){var e=t.call(n,"string");if("object"!==f(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===f(r)?r:String(r)}function v(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t<r;t++)e[t]=n[t];return e}function d(){return n||(n=Promise.resolve(void 0))}function b(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function s(n,r){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),t.push.apply(t,e)}return t}function h(n){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?s(Object(t),!0).forEach((function(r){b(n,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))}))}return n}function m(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var e,i,o=[],u=!0,c=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(o.push(e.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==t.return||t.return()}finally{if(c)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return v(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?v(n,r):void 0}}(n,r)||function(){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 p(n,r){if(null==n)return{};var t,e,i={},o=Object.keys(n);for(e=0;e<o.length;e++)t=o[e],r.indexOf(t)>=0||(i[t]=n[t]);return i}!function(n,r){for(var e in c(n),r)t(n,e,{get:r[e],enumerable:!0})}(exports,{BentoAccordion:function(){return $},BentoAccordionContent:function(){return J},BentoAccordionHeader:function(){return G},BentoAccordionSection:function(){return F}});var y=Object.prototype;function g(n,r){return Object.keys(n).reduce((function(t,e){return r.includes(e)||(t[e]=n[e]),t}),{})}y.hasOwnProperty,y.toString;var j=a(require("./@bentoproject/core")),O=a(require("./@bentoproject/core")),S=a(require("react")),w=a(require("./@bentoproject/core"));function x(n){var r,t,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(t=n.tabindex)&&void 0!==t?t:n.tabIndex)&&void 0!==r?r:e}a(require("./@bentoproject/core")),a(require("./@bentoproject/core")),Array.isArray;var A,I=["Webkit","webkit","Moz","moz","ms","O","o"];function M(n,r,t){if(E(r))return r;var e;A||(e=Object.create(null),A=e);var i=A[r];if(!i||t){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var t=0;t<I.length;t++){var e=I[t]+r;if(void 0!==n[e])return e}return""}(n,o);void 0!==n[u]&&(i=u)}t||(A[r]=i)}return i}function Y(n,r,t,e,i){var o=M(n.style,r,i);if(o){var u,c=e?t+e:t;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),I.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function q(n,r,t){var e=M(n.style,r,t);if(e)return E(e)?n.style.getPropertyValue(e):n.style[e]}function C(n,r){for(var t in r)Y(n,t,r[t])}function E(n){return n.startsWith("--")}function z(n,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var e=r();return e.onfinish=e.oncancel=function(){e=null,t&&t(),n.classList.remove("i-amphtml-animating")},function(){e&&e.cancel()}}function B(n){var r=window.innerHeight,t=Math.abs(n)/r*500;return Math.min(Math.max(t,200),500)}var N,k=["animate","as","children","expandSingleSection","id"],H=["animate","as","children","expanded","id","onExpandStateChange"],P=j.createContext({}),T=j.createContext({}),_={},U={},W=(N=0,function(){return String(++N)}),Z=function(){return String(Math.floor(1e5*Math.random()))},$=(0,S.forwardRef)((function(n,r){var t=n.animate,e=void 0!==t&&t,i=n.as,o=void 0===i?"section":i,u=n.children,c=n.expandSingleSection,a=void 0!==c&&c,f=n.id,l=p(n,k),v=m((0,O.useState)(_),2),s=v[0],y=v[1],S=(0,O.useRef)(U),w=m((0,O.useState)(Z),1)[0],x=f||"a".concat(w);(0,O.useEffect)((function(){a&&y((function(n){var r={},t=0;for(var e in n)r[e]=n[e]&&0==t++;return r}))}),[a]);var A=(0,O.useCallback)((function(n,r,t){var e=t.current;return y((function(t){return D(n,r,t,a)})),S.current=h(h({},S.current),{},b({},n,e)),function(){y((function(r){return g(r,n)})),S.current=g(S.current,n)}}),[a]),I=(0,O.useCallback)((function(n,r){y((function(t){var e=null!=r?r:!t[n],i=D(n,e,t,a);return d().then((function(){for(var n in t){var r=S.current[n];r&&t[n]!=i[n]&&r(i[n])}})),i}))}),[a]),M=(0,O.useCallback)((function(n,r){var t;return null!==(t=s[n])&&void 0!==t?t:r}),[s]),Y=(0,O.useCallback)((function(n){if(n)n in s&&I(n);else if(!a)for(var r in s)I(r)}),[s,I,a]),q=(0,O.useCallback)((function(n){if(n)M(n,!0)||I(n);else if(!a)for(var r in s)M(r,!0)||I(r)}),[s,I,M,a]),C=(0,O.useCallback)((function(n){if(n)M(n,!1)&&I(n);else for(var r in s)M(r,!1)&&I(r)}),[s,I,M]);(0,O.useImperativeHandle)(r,(function(){return{toggle:Y,expand:q,collapse:C}}),[Y,C,q]);var E=(0,O.useMemo)((function(){return{registerSection:A,toggleExpanded:I,isExpanded:M,animate:e,prefix:x}}),[A,I,M,e,x]);return j.createElement(o,h({id:f},l),j.createElement(P.Provider,{value:E},u))}));function D(n,r,t,e){var i;if(e&&r)for(var o in i=b({},n,r),t)o!=n&&(i[o]=!1);else i=h(h({},t),{},b({},n,r));return i}function F(n){var r=n.animate,t=void 0!==r&&r,e=n.as,i=void 0===e?"section":e,o=n.children,u=n.expanded,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,l=p(n,H),v=m((0,O.useState)(W),1)[0],b=a||v,s=m((0,O.useState)(Z),1)[0],y=m((0,O.useState)(c),2),g=y[0],S=y[1],w=m((0,O.useState)(null),2),x=w[0],A=w[1],I=m((0,O.useState)(null),2),M=I[0],Y=I[1],q=(0,O.useContext)(P),C=q.animate,E=q.isExpanded,z=q.prefix,B=q.registerSection,N=q.toggleExpanded,k=E?E(b,c):g,_=null!=C?C:t,U=x||"".concat(z||"a","-content-").concat(b,"-").concat(s),$=M||"".concat(z||"a","-header-").concat(b,"-").concat(s),D=(0,O.useRef)(null);D.current=f,(0,O.useLayoutEffect)((function(){if(B)return B(b,c,D)}),[B,b,c]);var F=(0,O.useCallback)((function(n){N?N(b,n):S((function(r){var t=null!=n?n:!r;return d().then((function(){var n=D.current;n&&n(t)})),t}))}),[b,N]),G=(0,O.useMemo)((function(){return{animate:_,contentId:U,headerId:$,expanded:k,toggleHandler:F,setContentId:A,setHeaderId:Y}}),[_,U,$,k,F]);return j.createElement(i,h({},l),j.createElement(T.Provider,{value:G},o))}function G(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,v=p(n,["as","children","id","role",r].map(l)),d=(0,O.useContext)(T),b=d.contentId,s=d.expanded,m=d.headerId,y=d.setHeaderId,g=d.toggleHandler;return(0,O.useLayoutEffect)((function(){y&&y(o)}),[y,o]),j.createElement(e,h(h({},v),{},{id:m,role:c,className:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabIndex:x(v),"aria-controls":b,onClick:function(){return g()},"aria-expanded":String(s)}),i)}function J(n){var r="className",t=n.as,e=void 0===t?"div":t,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,v=p(n,["as","children","id","role",r].map(l)),d=(0,O.useRef)(null),b=(0,O.useRef)(!1),s=(0,O.useContext)(T),m=s.animate,y=s.contentId,g=s.expanded,S=s.headerId,x=s.setContentId;return(0,O.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,O.useLayoutEffect)((function(){x&&x(o)}),[x,o]),(0,O.useLayoutEffect)((function(){var n=b.current,r=d.current;if(m&&n&&r&&r.animate)return g?function(n){return z(n,(function(){var r=q(n,"height"),t=q(n,"opacity"),e=q(n,"overflowY");C(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;C(n,{height:r,opacity:t,overflowY:e});var o=B(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return z(n,(function(){var r=n.offsetHeight,t=B(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(r)}),[g,m]),j.createElement(w.WithAmpContext,{renderable:g},j.createElement(e,h(h({},v),{},{ref:d,className:f+" section-child-76fac82"+(g?"":" content-hidden-76fac82"),id:y,"aria-labelledby":S,role:c}),i))}$.displayName="Accordion"; | ||
//# sourceMappingURL=component-react.js.map |
@@ -109,10 +109,10 @@ var __create = Object.create; | ||
// src/bento/components/bento-accordion/1.0/component.js | ||
var Preact = __toModule(require("@bentoproject/core")); | ||
var import_preact = __toModule(require("@bentoproject/core")); | ||
var Preact = __toModule(require("./@bentoproject/core")); | ||
var import_preact = __toModule(require("./@bentoproject/core")); | ||
var import_compat = __toModule(require("react")); | ||
var import_context2 = __toModule(require("@bentoproject/core")); | ||
var import_context2 = __toModule(require("./@bentoproject/core")); | ||
// src/preact/utils.js | ||
var import__ = __toModule(require("@bentoproject/core")); | ||
var import_context = __toModule(require("@bentoproject/core")); | ||
var import__ = __toModule(require("./@bentoproject/core")); | ||
var import_context = __toModule(require("./@bentoproject/core")); | ||
function tabindexFromProps(props, fallback) { | ||
@@ -119,0 +119,0 @@ var _ref, _props$tabindex; |
@@ -62,10 +62,10 @@ // src/bento/components/bento-accordion/1.0/component.jss.js | ||
createElement | ||
} from "@bentoproject/core"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "@bentoproject/core"; | ||
} from "./@bentoproject/core"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "./@bentoproject/core"; | ||
import { forwardRef } from "react"; | ||
import { WithAmpContext } from "@bentoproject/core"; | ||
import { WithAmpContext } from "./@bentoproject/core"; | ||
// src/preact/utils.js | ||
import { useCallback, useLayoutEffect } from "@bentoproject/core"; | ||
import { useAmpContext } from "@bentoproject/core"; | ||
import { useCallback, useLayoutEffect } from "./@bentoproject/core"; | ||
import { useAmpContext } from "./@bentoproject/core"; | ||
function tabindexFromProps(props, fallback = 0) { | ||
@@ -72,0 +72,0 @@ var _ref, _props$tabindex; |
; | ||
var n;function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function e(n){var e=function(n,e){if("object"!==t(n)||null===n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var o=r.call(n,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===t(e)?e:String(e)}function r(){return n||(n=Promise.resolve(void 0))}function o(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function i(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),e.push.apply(e,r)}return e}function c(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?i(Object(e),!0).forEach((function(t){o(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function a(n,t){if(null==n)return{};var e,r,o={},i=Object.keys(n);for(r=0;r<i.length;r++)e=i[r],t.indexOf(e)>=0||(o[e]=n[e]);return o}var u,{hasOwnProperty:l,toString:d}=Object.prototype;function f(n,t){return Object.keys(n).reduce(((e,r)=>(t.includes(r)||(e[r]=n[r]),e)),{})}import{createContext as s,createElement as p}from"@bentoproject/core";import{useCallback as b,useContext as m,useEffect as h,useImperativeHandle as g,useLayoutEffect as v,useMemo as y,useRef as j,useState as x}from"@bentoproject/core";import{forwardRef as S}from"react";import{WithAmpContext as O}from"@bentoproject/core";import{useCallback as w,useLayoutEffect as I}from"@bentoproject/core";import{useAmpContext as $}from"@bentoproject/core";function E(n,t=0){var e,r;return null!==(e=null!==(r=n.tabindex)&&void 0!==r?r:n.tabIndex)&&void 0!==e?e:t}var Y=["Webkit","webkit","Moz","moz","ms","O","o"];function C(n,t,e){if(H(t))return t;u||(u=Object.create(null));let r=u[t];if(!r||e){if(r=t,void 0===n[t]){const e=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(t),o=function(n,t){for(let e=0;e<Y.length;e++){const r=Y[e]+t;if(void 0!==n[r])return r}return""}(n,e);void 0!==n[o]&&(r=o)}e||(u[t]=r)}return r}function M(n,t,e,r,o){const i=C(n.style,t,o);if(!i)return;const c=r?e+r:e;n.style.setProperty(function(n){const t=n.replace(/[A-Z]/g,(n=>"-"+n.toLowerCase()));return Y.some((n=>t.startsWith(n+"-")))?`-${t}`:t}(i),c)}function k(n,t,e){const r=C(n.style,t,e);if(r)return H(r)?n.style.getPropertyValue(r):n.style[r]}function z(n,t){for(const e in t)M(n,e,t[e])}function H(n){return n.startsWith("--")}function N(n,t,e){n.classList.add("i-amphtml-animating");let r=t();return r.onfinish=r.oncancel=()=>{r=null,e&&e(),n.classList.remove("i-amphtml-animating")},()=>{r&&r.cancel()}}function P(n){const t=window.innerHeight,e=Math.abs(n)/t*500;return Math.min(Math.max(e,200),500)}var A=["animate","as","children","expandSingleSection","id"],L=["animate","as","children","expanded","id","onExpandStateChange"],T=s({}),W=s({}),Z={},q={},B=function(){let n=0;return()=>String(++n)}(),D=()=>String(Math.floor(1e5*Math.random())),F=S((function(n,t){let{animate:e=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,d=a(n,A);const[s,m]=x(Z),v=j(q),[S]=x(D),O=l||`a${S}`;h((()=>{u&&m((n=>{const t={};let e=0;for(const r in n)t[r]=n[r]&&0==e++;return t}))}),[u]);const w=b(((n,t,{current:e})=>(m((e=>G(n,t,e,u))),v.current=c(c({},v.current),{},{[n]:e}),()=>{m((t=>f(t,n))),v.current=f(v.current,n)})),[u]),I=b(((n,t)=>{m((e=>{const o=null!=t?t:!e[n],i=G(n,o,e,u);return r().then((()=>{for(const n in e){const t=v.current[n];t&&e[n]!=i[n]&&t(i[n])}})),i}))}),[u]),$=b(((n,t)=>{var e;return null!==(e=s[n])&&void 0!==e?e:t}),[s]),E=b((n=>{if(n)n in s&&I(n);else if(!u)for(const n in s)I(n)}),[s,I,u]),Y=b((n=>{if(n)$(n,!0)||I(n);else if(!u)for(const n in s)$(n,!0)||I(n)}),[s,I,$,u]),C=b((n=>{if(n)$(n,!1)&&I(n);else for(const n in s)$(n,!1)&&I(n)}),[s,I,$]);g(t,(()=>({toggle:E,expand:Y,collapse:C})),[E,C,Y]);const M=y((()=>({registerSection:w,toggleExpanded:I,isExpanded:$,animate:e,prefix:O})),[w,I,$,e,O]);return p(o,c({id:l},d),p(T.Provider,{value:M},i))}));function G(n,t,e,r){let o;if(r&&t){o={[n]:t};for(const t in e)t!=n&&(o[t]=!1)}else o=c(c({},e),{},{[n]:t});return o}function J(n){let{animate:t=!1,as:e="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,L);const[f]=x(B),s=u||f,[h]=x(D),[g,S]=x(i),[O,w]=x(null),[I,$]=x(null),{animate:E,isExpanded:Y,prefix:C,registerSection:M,toggleExpanded:k}=m(T),z=Y?Y(s,i):g,H=null!=E?E:t,N=O||`${C||"a"}-content-${s}-${h}`,P=I||`${C||"a"}-header-${s}-${h}`,A=j(null);A.current=l,v((()=>{if(M)return M(s,i,A)}),[M,s,i]);const Z=b((n=>{k?k(s,n):S((t=>{const e=null!=n?n:!t;return r().then((()=>{const n=A.current;n&&n(e)})),e}))}),[s,k]),q=y((()=>({animate:H,contentId:N,headerId:P,expanded:z,toggleHandler:Z,setContentId:w,setHeaderId:$})),[H,N,P,z,Z]);return p(e,c({},d),p(W.Provider,{value:q},o))}function K(n){let t="className",{as:r="div",children:o,id:i,role:u="button",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const{contentId:f,expanded:s,headerId:b,setHeaderId:h,toggleHandler:g}=m(W);return v((()=>{h&&h(i)}),[h,i]),p(r,c(c({},d),{},{id:b,role:u,className:`${l} section-child-76fac82 header-76fac82`,tabIndex:E(d),"aria-controls":f,onClick:()=>g(),"aria-expanded":String(s)}),o)}function Q(n){let t="className",{as:r="div",children:o,id:i,role:u="region",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const f=j(null),s=j(!1),{animate:b,contentId:g,expanded:y,headerId:x,setContentId:S}=m(W);return h((()=>(s.current=!0,()=>s.current=!1)),[]),v((()=>{S&&S(i)}),[S,i]),v((()=>{const n=s.current,t=f.current;if(b&&n&&t&&t.animate)return y?function(n){return N(n,(()=>{const t=k(n,"height"),e=k(n,"opacity"),r=k(n,"overflowY");z(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;z(n,{height:t,opacity:e,overflowY:r});const i=P(o);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(t):function(n){return N(n,(()=>{const t=n.offsetHeight,e=P(t);return n.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(t)}),[y,b]),p(O,{renderable:y},p(r,c(c({},d),{},{ref:f,className:l+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:g,"aria-labelledby":x,role:u}),o))}F.displayName="Accordion";export{F as BentoAccordion,Q as BentoAccordionContent,K as BentoAccordionHeader,J as BentoAccordionSection}; | ||
var n;function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function e(n){var e=function(n,e){if("object"!==t(n)||null===n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var o=r.call(n,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===t(e)?e:String(e)}function r(){return n||(n=Promise.resolve(void 0))}function o(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function i(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),e.push.apply(e,r)}return e}function c(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?i(Object(e),!0).forEach((function(t){o(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function a(n,t){if(null==n)return{};var e,r,o={},i=Object.keys(n);for(r=0;r<i.length;r++)e=i[r],t.indexOf(e)>=0||(o[e]=n[e]);return o}var u,{hasOwnProperty:l,toString:d}=Object.prototype;function f(n,t){return Object.keys(n).reduce(((e,r)=>(t.includes(r)||(e[r]=n[r]),e)),{})}import{createContext as s,createElement as p}from"./@bentoproject/core";import{useCallback as b,useContext as m,useEffect as h,useImperativeHandle as g,useLayoutEffect as v,useMemo as y,useRef as j,useState as x}from"./@bentoproject/core";import{forwardRef as S}from"react";import{WithAmpContext as O}from"./@bentoproject/core";import{useCallback as w,useLayoutEffect as I}from"./@bentoproject/core";import{useAmpContext as $}from"./@bentoproject/core";function E(n,t=0){var e,r;return null!==(e=null!==(r=n.tabindex)&&void 0!==r?r:n.tabIndex)&&void 0!==e?e:t}var Y=["Webkit","webkit","Moz","moz","ms","O","o"];function C(n,t,e){if(H(t))return t;u||(u=Object.create(null));let r=u[t];if(!r||e){if(r=t,void 0===n[t]){const e=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(t),o=function(n,t){for(let e=0;e<Y.length;e++){const r=Y[e]+t;if(void 0!==n[r])return r}return""}(n,e);void 0!==n[o]&&(r=o)}e||(u[t]=r)}return r}function M(n,t,e,r,o){const i=C(n.style,t,o);if(!i)return;const c=r?e+r:e;n.style.setProperty(function(n){const t=n.replace(/[A-Z]/g,(n=>"-"+n.toLowerCase()));return Y.some((n=>t.startsWith(n+"-")))?`-${t}`:t}(i),c)}function k(n,t,e){const r=C(n.style,t,e);if(r)return H(r)?n.style.getPropertyValue(r):n.style[r]}function z(n,t){for(const e in t)M(n,e,t[e])}function H(n){return n.startsWith("--")}function N(n,t,e){n.classList.add("i-amphtml-animating");let r=t();return r.onfinish=r.oncancel=()=>{r=null,e&&e(),n.classList.remove("i-amphtml-animating")},()=>{r&&r.cancel()}}function P(n){const t=window.innerHeight,e=Math.abs(n)/t*500;return Math.min(Math.max(e,200),500)}var A=["animate","as","children","expandSingleSection","id"],L=["animate","as","children","expanded","id","onExpandStateChange"],T=s({}),W=s({}),Z={},q={},B=function(){let n=0;return()=>String(++n)}(),D=()=>String(Math.floor(1e5*Math.random())),F=S((function(n,t){let{animate:e=!1,as:o="section",children:i,expandSingleSection:u=!1,id:l}=n,d=a(n,A);const[s,m]=x(Z),v=j(q),[S]=x(D),O=l||`a${S}`;h((()=>{u&&m((n=>{const t={};let e=0;for(const r in n)t[r]=n[r]&&0==e++;return t}))}),[u]);const w=b(((n,t,{current:e})=>(m((e=>G(n,t,e,u))),v.current=c(c({},v.current),{},{[n]:e}),()=>{m((t=>f(t,n))),v.current=f(v.current,n)})),[u]),I=b(((n,t)=>{m((e=>{const o=null!=t?t:!e[n],i=G(n,o,e,u);return r().then((()=>{for(const n in e){const t=v.current[n];t&&e[n]!=i[n]&&t(i[n])}})),i}))}),[u]),$=b(((n,t)=>{var e;return null!==(e=s[n])&&void 0!==e?e:t}),[s]),E=b((n=>{if(n)n in s&&I(n);else if(!u)for(const n in s)I(n)}),[s,I,u]),Y=b((n=>{if(n)$(n,!0)||I(n);else if(!u)for(const n in s)$(n,!0)||I(n)}),[s,I,$,u]),C=b((n=>{if(n)$(n,!1)&&I(n);else for(const n in s)$(n,!1)&&I(n)}),[s,I,$]);g(t,(()=>({toggle:E,expand:Y,collapse:C})),[E,C,Y]);const M=y((()=>({registerSection:w,toggleExpanded:I,isExpanded:$,animate:e,prefix:O})),[w,I,$,e,O]);return p(o,c({id:l},d),p(T.Provider,{value:M},i))}));function G(n,t,e,r){let o;if(r&&t){o={[n]:t};for(const t in e)t!=n&&(o[t]=!1)}else o=c(c({},e),{},{[n]:t});return o}function J(n){let{animate:t=!1,as:e="section",children:o,expanded:i=!1,id:u,onExpandStateChange:l}=n,d=a(n,L);const[f]=x(B),s=u||f,[h]=x(D),[g,S]=x(i),[O,w]=x(null),[I,$]=x(null),{animate:E,isExpanded:Y,prefix:C,registerSection:M,toggleExpanded:k}=m(T),z=Y?Y(s,i):g,H=null!=E?E:t,N=O||`${C||"a"}-content-${s}-${h}`,P=I||`${C||"a"}-header-${s}-${h}`,A=j(null);A.current=l,v((()=>{if(M)return M(s,i,A)}),[M,s,i]);const Z=b((n=>{k?k(s,n):S((t=>{const e=null!=n?n:!t;return r().then((()=>{const n=A.current;n&&n(e)})),e}))}),[s,k]),q=y((()=>({animate:H,contentId:N,headerId:P,expanded:z,toggleHandler:Z,setContentId:w,setHeaderId:$})),[H,N,P,z,Z]);return p(e,c({},d),p(W.Provider,{value:q},o))}function K(n){let t="className",{as:r="div",children:o,id:i,role:u="button",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const{contentId:f,expanded:s,headerId:b,setHeaderId:h,toggleHandler:g}=m(W);return v((()=>{h&&h(i)}),[h,i]),p(r,c(c({},d),{},{id:b,role:u,className:`${l} section-child-76fac82 header-76fac82`,tabIndex:E(d),"aria-controls":f,onClick:()=>g(),"aria-expanded":String(s)}),o)}function Q(n){let t="className",{as:r="div",children:o,id:i,role:u="region",[t]:l=""}=n,d=a(n,["as","children","id","role",t].map(e));const f=j(null),s=j(!1),{animate:b,contentId:g,expanded:y,headerId:x,setContentId:S}=m(W);return h((()=>(s.current=!0,()=>s.current=!1)),[]),v((()=>{S&&S(i)}),[S,i]),v((()=>{const n=s.current,t=f.current;if(b&&n&&t&&t.animate)return y?function(n){return N(n,(()=>{const t=k(n,"height"),e=k(n,"opacity"),r=k(n,"overflowY");z(n,{height:0,opacity:0,overflowY:"auto"});const o=n.scrollHeight;z(n,{height:t,opacity:e,overflowY:r});const i=P(o);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:o+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(t):function(n){return N(n,(()=>{const t=n.offsetHeight,e=P(t);return n.animate([{height:t+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(t)}),[y,b]),p(O,{renderable:y},p(r,c(c({},d),{},{ref:f,className:l+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:g,"aria-labelledby":x,role:u}),o))}F.displayName="Accordion";export{F as BentoAccordion,Q as BentoAccordionContent,K as BentoAccordionHeader,J as BentoAccordionSection}; | ||
//# sourceMappingURL=component-react.module.js.map |
; | ||
var n=Object.create,r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,i=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,u=function(n){return r(n,"__esModule",{value:!0})},c=function(c){return function(n,i,u){if(i&&"object"==typeof i||"function"==typeof i)for(var c,a=t(i),f=0,l=a.length;f<l;f++)c=a[f],o.call(n,c)||"default"===c||r(n,c,{get:function(n){return i[n]}.bind(null,c),enumerable:!(u=e(i,c))||u.enumerable});return n}(u(r(null!=c?n(i(c)):{},"default",c&&c.__esModule&&"default"in c?{get:function(){return c.default},enumerable:!0}:{value:c,enumerable:!0})),c)};function a(n,r,e){return r in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}function f(n,r){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),e.push.apply(e,t)}return e}function l(n){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?f(Object(e),!0).forEach((function(r){a(n,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):f(Object(e)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))}))}return n}function d(n,r){return(d=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n})(n,r)}function v(n){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function b(n){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function p(n,r){if(r&&("object"===b(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n)}function s(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,t=new Array(r);e<r;e++)t[e]=n[e];return t}!function(n,e){for(var t in u(n),e)r(n,t,{get:e[t],enumerable:!0})}(exports,{defineElement:function(){return sn}}),Array.isArray;var h,y=Object.prototype;function m(n,r){return Object.keys(n).reduce((function(e,t){return r.includes(t)||(e[t]=n[t]),e}),{})}function j(n,r,e){var t=n[r];return void 0===t&&(t=e(n,r),n[r]=t),t}function g(n,r,e,t,i,o,u,c,a,f,l){return n}function O(n,r){return n.replace(/^|,/g,"$&".concat(r," "))}y.hasOwnProperty,y.toString;var S,w=c(require("@bentoproject/core")),x=c(require("@bentoproject/core")),M=c(require("@bentoproject/core")),_=c(require("@bentoproject/core")),A=c(require("@bentoproject/core")),q=c(require("@bentoproject/core"));function E(n){var r=function(n,r){if("object"!==b(n)||null===n)return n;var e=n[Symbol.toPrimitive];if(void 0!==e){var t=e.call(n,"string");if("object"!==b(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===b(r)?r:String(r)}function I(){return S||(S=Promise.resolve(void 0))}function P(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var e=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=e){var t,i,o=[],u=!0,c=!1;try{for(e=e.call(n);!(u=(t=e.next()).done)&&(o.push(t.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==e.return||e.return()}finally{if(c)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return s(n,r);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(n,r):void 0}}(n,r)||function(){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 Y(n,r){if(null==n)return{};var e,t,i={},o=Object.keys(n);for(t=0;t<o.length;t++)e=o[t],r.indexOf(e)>=0||(i[e]=n[e]);return i}var k,C=c(require("@bentoproject/core")),H=c(require("@bentoproject/core")),R=c(require("@bentoproject/core")),T=c(require("@bentoproject/core"));function z(n){var r,e,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(e=n.tabindex)&&void 0!==e?e:n.tabIndex)&&void 0!==r?r:t}c(require("@bentoproject/core")),c(require("@bentoproject/core"));var $=["Webkit","webkit","Moz","moz","ms","O","o"];function B(n,r,e){if(N(r))return r;var t;k||(t=Object.create(null),k=t);var i=k[r];if(!i||e){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var e=0;e<$.length;e++){var t=$[e]+r;if(void 0!==n[t])return t}return""}(n,o);void 0!==n[u]&&(i=u)}e||(k[r]=i)}return i}function D(n,r,e,t,i){var o=B(n.style,r,i);if(o){var u,c=t?e+t:e;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),$.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function F(n,r,e){var t=B(n.style,r,e);if(t)return N(t)?n.style.getPropertyValue(t):n.style[t]}function L(n,r){for(var e in r)D(n,e,r[e])}function N(n){return n.startsWith("--")}function U(n,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var t=r();return t.onfinish=t.oncancel=function(){t=null,e&&e(),n.classList.remove("i-amphtml-animating")},function(){t&&t.cancel()}}function W(n){var r=window.innerHeight,e=Math.abs(n)/r*500;return Math.min(Math.max(e,200),500)}var X,Z=["animate","as","children","expandSingleSection","id"],G=["animate","as","children","expanded","id","onExpandStateChange"],J=C.createContext({}),K=C.createContext({}),Q={},V={},nn=(X=0,function(){return String(++X)}),rn=function(){return String(Math.floor(1e5*Math.random()))},en=(0,R.forwardRef)((function(n,r){var e=n.animate,t=void 0!==e&&e,i=n.as,o=void 0===i?"section":i,u=n.children,c=n.expandSingleSection,f=void 0!==c&&c,d=n.id,v=Y(n,Z),b=P((0,H.useState)(Q),2),p=b[0],s=b[1],h=(0,H.useRef)(V),y=P((0,H.useState)(rn),1)[0],j=d||"a".concat(y);(0,H.useEffect)((function(){f&&s((function(n){var r={},e=0;for(var t in n)r[t]=n[t]&&0==e++;return r}))}),[f]);var g=(0,H.useCallback)((function(n,r,e){var t=e.current;return s((function(e){return tn(n,r,e,f)})),h.current=l(l({},h.current),{},a({},n,t)),function(){s((function(r){return m(r,n)})),h.current=m(h.current,n)}}),[f]),O=(0,H.useCallback)((function(n,r){s((function(e){var t=null!=r?r:!e[n],i=tn(n,t,e,f);return I().then((function(){for(var n in e){var r=h.current[n];r&&e[n]!=i[n]&&r(i[n])}})),i}))}),[f]),S=(0,H.useCallback)((function(n,r){var e;return null!==(e=p[n])&&void 0!==e?e:r}),[p]),w=(0,H.useCallback)((function(n){if(n)n in p&&O(n);else if(!f)for(var r in p)O(r)}),[p,O,f]),x=(0,H.useCallback)((function(n){if(n)S(n,!0)||O(n);else if(!f)for(var r in p)S(r,!0)||O(r)}),[p,O,S,f]),M=(0,H.useCallback)((function(n){if(n)S(n,!1)&&O(n);else for(var r in p)S(r,!1)&&O(r)}),[p,O,S]);(0,H.useImperativeHandle)(r,(function(){return{toggle:w,expand:x,collapse:M}}),[w,M,x]);var _=(0,H.useMemo)((function(){return{registerSection:g,toggleExpanded:O,isExpanded:S,animate:t,prefix:j}}),[g,O,S,t,j]);return C.createElement(o,l({id:d},v),C.createElement(J.Provider,{value:_},u))}));function tn(n,r,e,t){var i;if(t&&r)for(var o in i=a({},n,r),e)o!=n&&(i[o]=!1);else i=l(l({},e),{},a({},n,r));return i}function on(n){var r=n.animate,e=void 0!==r&&r,t=n.as,i=void 0===t?"section":t,o=n.children,u=n.expanded,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,d=Y(n,G),v=P((0,H.useState)(nn),1)[0],b=a||v,p=P((0,H.useState)(rn),1)[0],s=P((0,H.useState)(c),2),h=s[0],y=s[1],m=P((0,H.useState)(null),2),j=m[0],g=m[1],O=P((0,H.useState)(null),2),S=O[0],w=O[1],x=(0,H.useContext)(J),M=x.animate,_=x.isExpanded,A=x.prefix,q=x.registerSection,E=x.toggleExpanded,k=_?_(b,c):h,R=null!=M?M:e,T=j||"".concat(A||"a","-content-").concat(b,"-").concat(p),z=S||"".concat(A||"a","-header-").concat(b,"-").concat(p),$=(0,H.useRef)(null);$.current=f,(0,H.useLayoutEffect)((function(){if(q)return q(b,c,$)}),[q,b,c]);var B=(0,H.useCallback)((function(n){E?E(b,n):y((function(r){var e=null!=n?n:!r;return I().then((function(){var n=$.current;n&&n(e)})),e}))}),[b,E]),D=(0,H.useMemo)((function(){return{animate:R,contentId:T,headerId:z,expanded:k,toggleHandler:B,setContentId:g,setHeaderId:w}}),[R,T,z,k,B]);return C.createElement(i,l({},d),C.createElement(K.Provider,{value:D},o))}function un(n){var r="class",e=n.as,t=void 0===e?"div":e,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,d=Y(n,["as","children","id","role",r].map(E)),v=(0,H.useContext)(K),b=v.contentId,p=v.expanded,s=v.headerId,h=v.setHeaderId,y=v.toggleHandler;return(0,H.useLayoutEffect)((function(){h&&h(o)}),[h,o]),C.createElement(t,l(l({},d),{},{id:s,role:c,class:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabindex:z(d),"aria-controls":b,onClick:function(){return y()},"aria-expanded":String(p)}),i)}function cn(n){var r="class",e=n.as,t=void 0===e?"div":e,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,d=Y(n,["as","children","id","role",r].map(E)),v=(0,H.useRef)(null),b=(0,H.useRef)(!1),p=(0,H.useContext)(K),s=p.animate,h=p.contentId,y=p.expanded,m=p.headerId,j=p.setContentId;return(0,H.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,H.useLayoutEffect)((function(){j&&j(o)}),[j,o]),(0,H.useLayoutEffect)((function(){var n=b.current,r=v.current;if(s&&n&&r&&r.animate)return y?function(n){return U(n,(function(){var r=F(n,"height"),e=F(n,"opacity"),t=F(n,"overflowY");L(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;L(n,{height:r,opacity:e,overflowY:t});var o=W(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return U(n,(function(){var r=n.offsetHeight,e=W(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(r)}),[y,s]),C.createElement(T.WithAmpContext,{renderable:y},C.createElement(t,l(l({},d),{},{ref:v,class:f+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:h,"aria-labelledby":m,role:c}),i))}en.displayName="Accordion";var an=function(n){!function(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(r&&r.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),r&&d(n,r)}(i,M.PreactBaseElement);var r,e,t=(r=i,e=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(n){return!1}}(),function(){var n,t=v(r);if(e){var i=v(this).constructor;n=Reflect.construct(t,arguments,i)}else n=t.apply(this,arguments);return p(this,n)});function i(){return t.apply(this,arguments)}return i.prototype.init=function(){var n=this,r=function(r){return function(e){var t;!function(n,r,e){var t=n.hasAttribute(r),i=void 0!==e?e:!t;i!==t&&(i?n.setAttribute(r,""):n.removeAttribute(r))}(r,"expanded",e),null===(t=r.__AMP_PR)||void 0===t||t.call(r),n.triggerEvent(r,e?"expand":"collapse")}},e=this.element,t=new MutationObserver((function(){n.mutateProps(fn(e,t,r))}));return t.observe(e,{attributeFilter:["expanded","id"],subtree:!0,childList:!0}),{"children":fn(e,t,r).children}},i}();function fn(n,r,e){var t,i,o,u,c;return{"children":(i=n,o="section",g(/^[\w-]+$/.test(o)),u=i,c="> ".concat(o),(t=(void 0!==h?h:h=function(n){try{var r=n.ownerDocument,e=r.createElement("div"),t=r.createElement("div");return e.appendChild(t),e.querySelector(":scope div")===t}catch(n){return!1}}(u))?u.querySelectorAll(O(c,":scope")):function(n,r){var e=n.classList,t="i-amphtml-scoped";e.add(t);var i=O(r,".".concat(t)),o=n.querySelectorAll(i);return e.remove(t),o}(u,c))?Array.prototype.slice.call(t):[]).map((function(n){n.__AMP_PR||(n.__AMP_PR=function(){return r.takeRecords()});var t=j(n,"__AMP_H_SHIM",dn),i=j(n,"__AMP_C_SHIM",bn),o=j(n,"__AMP_EXPAND_STATE_SHIM",e),u={"key":n,"expanded":n.hasAttribute("expanded"),"id":n.getAttribute("id"),"onExpandStateChange":o},c={"as":t,"id":n.firstElementChild.getAttribute("id"),"role":n.firstElementChild.getAttribute("role")||void 0},a={"as":i,"id":n.lastElementChild.getAttribute("id"),"role":n.lastElementChild.getAttribute("role")||void 0};return w.createElement(on,l({},u),w.createElement(un,l({},c)),w.createElement(cn,l({},a)))}))}}function ln(n,r){var e=r["aria-controls"],t=r["aria-expanded"],i=r.id,o=r.onClick,u=r.role,c=n.firstElementChild;return(0,x.useLayoutEffect)((function(){if(c&&o)return c.setAttribute("id",i),c.classList.add("i-amphtml-accordion-header"),c.addEventListener("click",o),c.hasAttribute("tabindex")||c.setAttribute("tabindex",0),c.setAttribute("aria-expanded",t),c.setAttribute("aria-controls",e),c.setAttribute("role",u),n.__AMP_PR&&n.__AMP_PR(),function(){c.removeEventListener("click",g(o))}}),[n,c,i,u,o,e,t]),w.createElement("header",null)}var dn=function(n){return ln.bind(null,n)};function vn(n,r,e){var t=r["aria-labelledby"],i=r.id,o=r.role,u=n.lastElementChild,c=(0,x.useRef)();return c.current=u,(0,q.useSlotContext)(c),(0,A.useDOMHandle)(e,u),(0,x.useLayoutEffect)((function(){u&&(u.classList.add("i-amphtml-accordion-content"),u.setAttribute("id",i),u.setAttribute("role",o),u.setAttribute("aria-labelledby",t),n.__AMP_PR&&n.__AMP_PR())}),[n,u,i,o,t]),w.createElement("div",null)}var bn=function(n){return(0,_.forwardRef)(vn.bind(null,n))};an.Component=en,an.detached=!0,an.props={"animate":{attr:"animate",type:"boolean",media:!0},"expandSingleSection":{attr:"expand-single-section",type:"boolean"}};var pn=c(require("@bentoproject/core"));function sn(n){(0,pn.defineBentoElement)("bento-accordion",an,n)} | ||
var n=Object.create,r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,i=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,u=function(n){return r(n,"__esModule",{value:!0})},c=function(c){return function(n,i,u){if(i&&"object"==typeof i||"function"==typeof i)for(var c,a=t(i),f=0,l=a.length;f<l;f++)c=a[f],o.call(n,c)||"default"===c||r(n,c,{get:function(n){return i[n]}.bind(null,c),enumerable:!(u=e(i,c))||u.enumerable});return n}(u(r(null!=c?n(i(c)):{},"default",c&&c.__esModule&&"default"in c?{get:function(){return c.default},enumerable:!0}:{value:c,enumerable:!0})),c)};function a(n,r,e){return r in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}function f(n,r){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),e.push.apply(e,t)}return e}function l(n){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?f(Object(e),!0).forEach((function(r){a(n,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):f(Object(e)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))}))}return n}function d(n,r){return(d=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n})(n,r)}function v(n){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function b(n){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function p(n,r){if(r&&("object"===b(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n)}function s(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,t=new Array(r);e<r;e++)t[e]=n[e];return t}!function(n,e){for(var t in u(n),e)r(n,t,{get:e[t],enumerable:!0})}(exports,{defineElement:function(){return sn}}),Array.isArray;var h,y=Object.prototype;function m(n,r){return Object.keys(n).reduce((function(e,t){return r.includes(t)||(e[t]=n[t]),e}),{})}function j(n,r,e){var t=n[r];return void 0===t&&(t=e(n,r),n[r]=t),t}function g(n,r,e,t,i,o,u,c,a,f,l){return n}function O(n,r){return n.replace(/^|,/g,"$&".concat(r," "))}y.hasOwnProperty,y.toString;var S,w=c(require("./@bentoproject/core")),x=c(require("./@bentoproject/core")),M=c(require("./@bentoproject/core")),_=c(require("./@bentoproject/core")),A=c(require("./@bentoproject/core")),q=c(require("./@bentoproject/core"));function E(n){var r=function(n,r){if("object"!==b(n)||null===n)return n;var e=n[Symbol.toPrimitive];if(void 0!==e){var t=e.call(n,"string");if("object"!==b(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"===b(r)?r:String(r)}function I(){return S||(S=Promise.resolve(void 0))}function P(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var e=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=e){var t,i,o=[],u=!0,c=!1;try{for(e=e.call(n);!(u=(t=e.next()).done)&&(o.push(t.value),!r||o.length!==r);u=!0);}catch(n){c=!0,i=n}finally{try{u||null==e.return||e.return()}finally{if(c)throw i}}return o}}(n,r)||function(n,r){if(n){if("string"==typeof n)return s(n,r);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(n,r):void 0}}(n,r)||function(){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 Y(n,r){if(null==n)return{};var e,t,i={},o=Object.keys(n);for(t=0;t<o.length;t++)e=o[t],r.indexOf(e)>=0||(i[e]=n[e]);return i}var k,C=c(require("./@bentoproject/core")),H=c(require("./@bentoproject/core")),R=c(require("./@bentoproject/core")),T=c(require("./@bentoproject/core"));function z(n){var r,e,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return null!==(r=null!==(e=n.tabindex)&&void 0!==e?e:n.tabIndex)&&void 0!==r?r:t}c(require("./@bentoproject/core")),c(require("./@bentoproject/core"));var $=["Webkit","webkit","Moz","moz","ms","O","o"];function B(n,r,e){if(N(r))return r;var t;k||(t=Object.create(null),k=t);var i=k[r];if(!i||e){if(i=r,void 0===n[r]){var o=function(n){return n.charAt(0).toUpperCase()+n.slice(1)}(r),u=function(n,r){for(var e=0;e<$.length;e++){var t=$[e]+r;if(void 0!==n[t])return t}return""}(n,o);void 0!==n[u]&&(i=u)}e||(k[r]=i)}return i}function D(n,r,e,t,i){var o=B(n.style,r,i);if(o){var u,c=t?e+t:e;n.style.setProperty((u=o.replace(/[A-Z]/g,(function(n){return"-"+n.toLowerCase()})),$.some((function(n){return u.startsWith(n+"-")}))?"-".concat(u):u),c)}}function F(n,r,e){var t=B(n.style,r,e);if(t)return N(t)?n.style.getPropertyValue(t):n.style[t]}function L(n,r){for(var e in r)D(n,e,r[e])}function N(n){return n.startsWith("--")}function U(n,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n.classList.add("i-amphtml-animating");var t=r();return t.onfinish=t.oncancel=function(){t=null,e&&e(),n.classList.remove("i-amphtml-animating")},function(){t&&t.cancel()}}function W(n){var r=window.innerHeight,e=Math.abs(n)/r*500;return Math.min(Math.max(e,200),500)}var X,Z=["animate","as","children","expandSingleSection","id"],G=["animate","as","children","expanded","id","onExpandStateChange"],J=C.createContext({}),K=C.createContext({}),Q={},V={},nn=(X=0,function(){return String(++X)}),rn=function(){return String(Math.floor(1e5*Math.random()))},en=(0,R.forwardRef)((function(n,r){var e=n.animate,t=void 0!==e&&e,i=n.as,o=void 0===i?"section":i,u=n.children,c=n.expandSingleSection,f=void 0!==c&&c,d=n.id,v=Y(n,Z),b=P((0,H.useState)(Q),2),p=b[0],s=b[1],h=(0,H.useRef)(V),y=P((0,H.useState)(rn),1)[0],j=d||"a".concat(y);(0,H.useEffect)((function(){f&&s((function(n){var r={},e=0;for(var t in n)r[t]=n[t]&&0==e++;return r}))}),[f]);var g=(0,H.useCallback)((function(n,r,e){var t=e.current;return s((function(e){return tn(n,r,e,f)})),h.current=l(l({},h.current),{},a({},n,t)),function(){s((function(r){return m(r,n)})),h.current=m(h.current,n)}}),[f]),O=(0,H.useCallback)((function(n,r){s((function(e){var t=null!=r?r:!e[n],i=tn(n,t,e,f);return I().then((function(){for(var n in e){var r=h.current[n];r&&e[n]!=i[n]&&r(i[n])}})),i}))}),[f]),S=(0,H.useCallback)((function(n,r){var e;return null!==(e=p[n])&&void 0!==e?e:r}),[p]),w=(0,H.useCallback)((function(n){if(n)n in p&&O(n);else if(!f)for(var r in p)O(r)}),[p,O,f]),x=(0,H.useCallback)((function(n){if(n)S(n,!0)||O(n);else if(!f)for(var r in p)S(r,!0)||O(r)}),[p,O,S,f]),M=(0,H.useCallback)((function(n){if(n)S(n,!1)&&O(n);else for(var r in p)S(r,!1)&&O(r)}),[p,O,S]);(0,H.useImperativeHandle)(r,(function(){return{toggle:w,expand:x,collapse:M}}),[w,M,x]);var _=(0,H.useMemo)((function(){return{registerSection:g,toggleExpanded:O,isExpanded:S,animate:t,prefix:j}}),[g,O,S,t,j]);return C.createElement(o,l({id:d},v),C.createElement(J.Provider,{value:_},u))}));function tn(n,r,e,t){var i;if(t&&r)for(var o in i=a({},n,r),e)o!=n&&(i[o]=!1);else i=l(l({},e),{},a({},n,r));return i}function on(n){var r=n.animate,e=void 0!==r&&r,t=n.as,i=void 0===t?"section":t,o=n.children,u=n.expanded,c=void 0!==u&&u,a=n.id,f=n.onExpandStateChange,d=Y(n,G),v=P((0,H.useState)(nn),1)[0],b=a||v,p=P((0,H.useState)(rn),1)[0],s=P((0,H.useState)(c),2),h=s[0],y=s[1],m=P((0,H.useState)(null),2),j=m[0],g=m[1],O=P((0,H.useState)(null),2),S=O[0],w=O[1],x=(0,H.useContext)(J),M=x.animate,_=x.isExpanded,A=x.prefix,q=x.registerSection,E=x.toggleExpanded,k=_?_(b,c):h,R=null!=M?M:e,T=j||"".concat(A||"a","-content-").concat(b,"-").concat(p),z=S||"".concat(A||"a","-header-").concat(b,"-").concat(p),$=(0,H.useRef)(null);$.current=f,(0,H.useLayoutEffect)((function(){if(q)return q(b,c,$)}),[q,b,c]);var B=(0,H.useCallback)((function(n){E?E(b,n):y((function(r){var e=null!=n?n:!r;return I().then((function(){var n=$.current;n&&n(e)})),e}))}),[b,E]),D=(0,H.useMemo)((function(){return{animate:R,contentId:T,headerId:z,expanded:k,toggleHandler:B,setContentId:g,setHeaderId:w}}),[R,T,z,k,B]);return C.createElement(i,l({},d),C.createElement(K.Provider,{value:D},o))}function un(n){var r="class",e=n.as,t=void 0===e?"div":e,i=n.children,o=n.id,u=n.role,c=void 0===u?"button":u,a=n[r],f=void 0===a?"":a,d=Y(n,["as","children","id","role",r].map(E)),v=(0,H.useContext)(K),b=v.contentId,p=v.expanded,s=v.headerId,h=v.setHeaderId,y=v.toggleHandler;return(0,H.useLayoutEffect)((function(){h&&h(o)}),[h,o]),C.createElement(t,l(l({},d),{},{id:s,role:c,class:"".concat(f," ").concat("section-child-76fac82"," ").concat("header-76fac82"),tabindex:z(d),"aria-controls":b,onClick:function(){return y()},"aria-expanded":String(p)}),i)}function cn(n){var r="class",e=n.as,t=void 0===e?"div":e,i=n.children,o=n.id,u=n.role,c=void 0===u?"region":u,a=n[r],f=void 0===a?"":a,d=Y(n,["as","children","id","role",r].map(E)),v=(0,H.useRef)(null),b=(0,H.useRef)(!1),p=(0,H.useContext)(K),s=p.animate,h=p.contentId,y=p.expanded,m=p.headerId,j=p.setContentId;return(0,H.useEffect)((function(){return b.current=!0,function(){return b.current=!1}}),[]),(0,H.useLayoutEffect)((function(){j&&j(o)}),[j,o]),(0,H.useLayoutEffect)((function(){var n=b.current,r=v.current;if(s&&n&&r&&r.animate)return y?function(n){return U(n,(function(){var r=F(n,"height"),e=F(n,"opacity"),t=F(n,"overflowY");L(n,{height:0,opacity:0,overflowY:"auto"});var i=n.scrollHeight;L(n,{height:r,opacity:e,overflowY:t});var o=W(i);return n.animate([{height:0,opacity:0,overflowY:"hidden"},{height:i+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:o})}))}(r):function(n){return U(n,(function(){var r=n.offsetHeight,e=W(r);return n.animate([{height:r+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:e})}))}(r)}),[y,s]),C.createElement(T.WithAmpContext,{renderable:y},C.createElement(t,l(l({},d),{},{ref:v,class:f+" section-child-76fac82"+(y?"":" content-hidden-76fac82"),id:h,"aria-labelledby":m,role:c}),i))}en.displayName="Accordion";var an=function(n){!function(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(r&&r.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),r&&d(n,r)}(i,M.PreactBaseElement);var r,e,t=(r=i,e=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(n){return!1}}(),function(){var n,t=v(r);if(e){var i=v(this).constructor;n=Reflect.construct(t,arguments,i)}else n=t.apply(this,arguments);return p(this,n)});function i(){return t.apply(this,arguments)}return i.prototype.init=function(){var n=this,r=function(r){return function(e){var t;!function(n,r,e){var t=n.hasAttribute(r),i=void 0!==e?e:!t;i!==t&&(i?n.setAttribute(r,""):n.removeAttribute(r))}(r,"expanded",e),null===(t=r.__AMP_PR)||void 0===t||t.call(r),n.triggerEvent(r,e?"expand":"collapse")}},e=this.element,t=new MutationObserver((function(){n.mutateProps(fn(e,t,r))}));return t.observe(e,{attributeFilter:["expanded","id"],subtree:!0,childList:!0}),{"children":fn(e,t,r).children}},i}();function fn(n,r,e){var t,i,o,u,c;return{"children":(i=n,o="section",g(/^[\w-]+$/.test(o)),u=i,c="> ".concat(o),(t=(void 0!==h?h:h=function(n){try{var r=n.ownerDocument,e=r.createElement("div"),t=r.createElement("div");return e.appendChild(t),e.querySelector(":scope div")===t}catch(n){return!1}}(u))?u.querySelectorAll(O(c,":scope")):function(n,r){var e=n.classList,t="i-amphtml-scoped";e.add(t);var i=O(r,".".concat(t)),o=n.querySelectorAll(i);return e.remove(t),o}(u,c))?Array.prototype.slice.call(t):[]).map((function(n){n.__AMP_PR||(n.__AMP_PR=function(){return r.takeRecords()});var t=j(n,"__AMP_H_SHIM",dn),i=j(n,"__AMP_C_SHIM",bn),o=j(n,"__AMP_EXPAND_STATE_SHIM",e),u={"key":n,"expanded":n.hasAttribute("expanded"),"id":n.getAttribute("id"),"onExpandStateChange":o},c={"as":t,"id":n.firstElementChild.getAttribute("id"),"role":n.firstElementChild.getAttribute("role")||void 0},a={"as":i,"id":n.lastElementChild.getAttribute("id"),"role":n.lastElementChild.getAttribute("role")||void 0};return w.createElement(on,l({},u),w.createElement(un,l({},c)),w.createElement(cn,l({},a)))}))}}function ln(n,r){var e=r["aria-controls"],t=r["aria-expanded"],i=r.id,o=r.onClick,u=r.role,c=n.firstElementChild;return(0,x.useLayoutEffect)((function(){if(c&&o)return c.setAttribute("id",i),c.classList.add("i-amphtml-accordion-header"),c.addEventListener("click",o),c.hasAttribute("tabindex")||c.setAttribute("tabindex",0),c.setAttribute("aria-expanded",t),c.setAttribute("aria-controls",e),c.setAttribute("role",u),n.__AMP_PR&&n.__AMP_PR(),function(){c.removeEventListener("click",g(o))}}),[n,c,i,u,o,e,t]),w.createElement("header",null)}var dn=function(n){return ln.bind(null,n)};function vn(n,r,e){var t=r["aria-labelledby"],i=r.id,o=r.role,u=n.lastElementChild,c=(0,x.useRef)();return c.current=u,(0,q.useSlotContext)(c),(0,A.useDOMHandle)(e,u),(0,x.useLayoutEffect)((function(){u&&(u.classList.add("i-amphtml-accordion-content"),u.setAttribute("id",i),u.setAttribute("role",o),u.setAttribute("aria-labelledby",t),n.__AMP_PR&&n.__AMP_PR())}),[n,u,i,o,t]),w.createElement("div",null)}var bn=function(n){return(0,_.forwardRef)(vn.bind(null,n))};an.Component=en,an.detached=!0,an.props={"animate":{attr:"animate",type:"boolean",media:!0},"expandSingleSection":{attr:"expand-single-section",type:"boolean"}};var pn=c(require("./@bentoproject/core"));function sn(n){(0,pn.defineBentoElement)("bento-accordion",an,n)} | ||
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */ | ||
//# sourceMappingURL=web-component.js.map |
@@ -230,8 +230,8 @@ var __create = Object.create; | ||
// src/bento/components/bento-accordion/1.0/base-element.js | ||
var Preact2 = __toModule(require("@bentoproject/core")); | ||
var import_preact2 = __toModule(require("@bentoproject/core")); | ||
var import_base_element = __toModule(require("@bentoproject/core")); | ||
var import_compat2 = __toModule(require("@bentoproject/core")); | ||
var import_component6 = __toModule(require("@bentoproject/core")); | ||
var import_slot = __toModule(require("@bentoproject/core")); | ||
var Preact2 = __toModule(require("./@bentoproject/core")); | ||
var import_preact2 = __toModule(require("./@bentoproject/core")); | ||
var import_base_element = __toModule(require("./@bentoproject/core")); | ||
var import_compat2 = __toModule(require("./@bentoproject/core")); | ||
var import_component6 = __toModule(require("./@bentoproject/core")); | ||
var import_slot = __toModule(require("./@bentoproject/core")); | ||
@@ -279,10 +279,10 @@ // src/bento/components/bento-accordion/1.0/component.jss.js | ||
// src/bento/components/bento-accordion/1.0/component.js | ||
var Preact = __toModule(require("@bentoproject/core")); | ||
var import_preact = __toModule(require("@bentoproject/core")); | ||
var import_compat = __toModule(require("@bentoproject/core")); | ||
var import_context2 = __toModule(require("@bentoproject/core")); | ||
var Preact = __toModule(require("./@bentoproject/core")); | ||
var import_preact = __toModule(require("./@bentoproject/core")); | ||
var import_compat = __toModule(require("./@bentoproject/core")); | ||
var import_context2 = __toModule(require("./@bentoproject/core")); | ||
// src/preact/utils.js | ||
var import__ = __toModule(require("@bentoproject/core")); | ||
var import_context = __toModule(require("@bentoproject/core")); | ||
var import__ = __toModule(require("./@bentoproject/core")); | ||
var import_context = __toModule(require("./@bentoproject/core")); | ||
function propName(name) { | ||
@@ -910,3 +910,3 @@ return name; | ||
// src/bento/components/bento-accordion/1.0/build/web-component.js | ||
var import_bento_ce = __toModule(require("@bentoproject/core")); | ||
var import_bento_ce = __toModule(require("./@bentoproject/core")); | ||
function defineElement(win) { | ||
@@ -913,0 +913,0 @@ (0, import_bento_ce.defineBentoElement)("bento-accordion", BaseElement, win); |
@@ -191,8 +191,8 @@ // src/core/mode/prod.js | ||
createElement as createElement2 | ||
} from "@bentoproject/core"; | ||
import { useLayoutEffect as useLayoutEffect3, useRef as useRef2 } from "@bentoproject/core"; | ||
import { PreactBaseElement } from "@bentoproject/core"; | ||
import { forwardRef as forwardRef2 } from "@bentoproject/core"; | ||
import { useDOMHandle } from "@bentoproject/core"; | ||
import { useSlotContext } from "@bentoproject/core"; | ||
} from "./@bentoproject/core"; | ||
import { useLayoutEffect as useLayoutEffect3, useRef as useRef2 } from "./@bentoproject/core"; | ||
import { PreactBaseElement } from "./@bentoproject/core"; | ||
import { forwardRef as forwardRef2 } from "./@bentoproject/core"; | ||
import { useDOMHandle } from "./@bentoproject/core"; | ||
import { useSlotContext } from "./@bentoproject/core"; | ||
@@ -239,10 +239,10 @@ // src/bento/components/bento-accordion/1.0/component.jss.js | ||
createElement | ||
} from "@bentoproject/core"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "@bentoproject/core"; | ||
import { forwardRef } from "@bentoproject/core"; | ||
import { WithAmpContext } from "@bentoproject/core"; | ||
} from "./@bentoproject/core"; | ||
import { useCallback as useCallback2, useContext, useEffect, useImperativeHandle, useLayoutEffect as useLayoutEffect2, useMemo, useRef, useState } from "./@bentoproject/core"; | ||
import { forwardRef } from "./@bentoproject/core"; | ||
import { WithAmpContext } from "./@bentoproject/core"; | ||
// src/preact/utils.js | ||
import { useCallback, useLayoutEffect } from "@bentoproject/core"; | ||
import { useAmpContext } from "@bentoproject/core"; | ||
import { useCallback, useLayoutEffect } from "./@bentoproject/core"; | ||
import { useAmpContext } from "./@bentoproject/core"; | ||
function propName(name) { | ||
@@ -883,3 +883,3 @@ return name; | ||
// src/bento/components/bento-accordion/1.0/build/web-component.js | ||
import { defineBentoElement } from "@bentoproject/core"; | ||
import { defineBentoElement } from "./@bentoproject/core"; | ||
function defineElement(win) { | ||
@@ -886,0 +886,0 @@ defineBentoElement("bento-accordion", BaseElement, win); |
; | ||
function e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function n(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function t(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?n(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var o,r,{hasOwnProperty:i,toString:c}=Object.prototype;function a(e,n){return Object.keys(e).reduce(((t,o)=>(n.includes(o)||(t[o]=e[o]),t)),{})}function l(e,n,t){let o=e[n];return void 0===o&&(o=t(e,n),e[n]=o),o}function d(e,n,t,o,r,i,c,a,l,d,u){return e}import{createElement as u}from"@bentoproject/core";import{useLayoutEffect as f,useRef as s}from"@bentoproject/core";import{PreactBaseElement as p}from"@bentoproject/core";import{forwardRef as b}from"@bentoproject/core";import{useDOMHandle as m}from"@bentoproject/core";import{useSlotContext as h}from"@bentoproject/core";function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e){var n=function(e,n){if("object"!==v(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==v(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===v(n)?n:String(n)}function x(){return o||(o=Promise.resolve(void 0))}function y(e,n){if(null==e)return{};var t,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],n.indexOf(t)>=0||(r[t]=e[t]);return r}import{createContext as j,createElement as S}from"@bentoproject/core";import{useCallback as O,useContext as w,useEffect as E,useImperativeHandle as I,useLayoutEffect as M,useMemo as _,useRef as $,useState as C}from"@bentoproject/core";import{forwardRef as k}from"@bentoproject/core";import{WithAmpContext as A}from"@bentoproject/core";import{useCallback as H,useLayoutEffect as P}from"@bentoproject/core";import{useAmpContext as Y}from"@bentoproject/core";function z(e,n=0){var t,o;return null!==(t=null!==(o=e.tabindex)&&void 0!==o?o:e.tabIndex)&&void 0!==t?t:n}var L=["Webkit","webkit","Moz","moz","ms","O","o"];function T(e,n,t){if(N(n))return n;r||(r=Object.create(null));let o=r[n];if(!o||t){if(o=n,void 0===e[n]){const t=function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(n),r=function(e,n){for(let t=0;t<L.length;t++){const o=L[t]+n;if(void 0!==e[o])return o}return""}(e,t);void 0!==e[r]&&(o=r)}t||(r[n]=o)}return o}function R(e,n,t,o,r){const i=T(e.style,n,r);if(!i)return;const c=o?t+o:t;e.style.setProperty(function(e){const n=e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()));return L.some((e=>n.startsWith(e+"-")))?`-${n}`:n}(i),c)}function D(e,n,t){const o=T(e.style,n,t);if(o)return N(o)?e.style.getPropertyValue(o):e.style[o]}function F(e,n){for(const t in n)R(e,t,n[t])}function N(e){return e.startsWith("--")}function W(e,n,t){e.classList.add("i-amphtml-animating");let o=n();return o.onfinish=o.oncancel=()=>{o=null,t&&t(),e.classList.remove("i-amphtml-animating")},()=>{o&&o.cancel()}}function X(e){const n=window.innerHeight,t=Math.abs(e)/n*500;return Math.min(Math.max(t,200),500)}var Z=["animate","as","children","expandSingleSection","id"],q=["animate","as","children","expanded","id","onExpandStateChange"],B=j({}),G=j({}),J={},K={},Q=function(){let e=0;return()=>String(++e)}(),U=()=>String(Math.floor(1e5*Math.random())),V=k((function(e,n){let{animate:o=!1,as:r="section",children:i,expandSingleSection:c=!1,id:l}=e,d=y(e,Z);const[u,f]=C(J),s=$(K),[p]=C(U),b=l||`a${p}`;E((()=>{c&&f((e=>{const n={};let t=0;for(const o in e)n[o]=e[o]&&0==t++;return n}))}),[c]);const m=O(((e,n,{current:o})=>(f((t=>ee(e,n,t,c))),s.current=t(t({},s.current),{},{[e]:o}),()=>{f((n=>a(n,e))),s.current=a(s.current,e)})),[c]),h=O(((e,n)=>{f((t=>{const o=null!=n?n:!t[e],r=ee(e,o,t,c);return x().then((()=>{for(const e in t){const n=s.current[e];n&&t[e]!=r[e]&&n(r[e])}})),r}))}),[c]),v=O(((e,n)=>{var t;return null!==(t=u[e])&&void 0!==t?t:n}),[u]),g=O((e=>{if(e)e in u&&h(e);else if(!c)for(const e in u)h(e)}),[u,h,c]),j=O((e=>{if(e)v(e,!0)||h(e);else if(!c)for(const e in u)v(e,!0)||h(e)}),[u,h,v,c]),w=O((e=>{if(e)v(e,!1)&&h(e);else for(const e in u)v(e,!1)&&h(e)}),[u,h,v]);I(n,(()=>({toggle:g,expand:j,collapse:w})),[g,w,j]);const M=_((()=>({registerSection:m,toggleExpanded:h,isExpanded:v,animate:o,prefix:b})),[m,h,v,o,b]);return S(r,t({id:l},d),S(B.Provider,{value:M},i))}));function ee(e,n,o,r){let i;if(r&&n){i={[e]:n};for(const n in o)n!=e&&(i[n]=!1)}else i=t(t({},o),{},{[e]:n});return i}function ne(e){let{animate:n=!1,as:o="section",children:r,expanded:i=!1,id:c,onExpandStateChange:a}=e,l=y(e,q);const[d]=C(Q),u=c||d,[f]=C(U),[s,p]=C(i),[b,m]=C(null),[h,v]=C(null),{animate:g,isExpanded:j,prefix:E,registerSection:I,toggleExpanded:k}=w(B),A=j?j(u,i):s,H=null!=g?g:n,P=b||`${E||"a"}-content-${u}-${f}`,Y=h||`${E||"a"}-header-${u}-${f}`,z=$(null);z.current=a,M((()=>{if(I)return I(u,i,z)}),[I,u,i]);const L=O((e=>{k?k(u,e):p((n=>{const t=null!=e?e:!n;return x().then((()=>{const e=z.current;e&&e(t)})),t}))}),[u,k]),T=_((()=>({animate:H,contentId:P,headerId:Y,expanded:A,toggleHandler:L,setContentId:m,setHeaderId:v})),[H,P,Y,A,L]);return S(o,t({},l),S(G.Provider,{value:T},r))}function te(e){let n="class",{as:o="div",children:r,id:i,role:c="button",[n]:a=""}=e,l=y(e,["as","children","id","role",n].map(g));const{contentId:d,expanded:u,headerId:f,setHeaderId:s,toggleHandler:p}=w(G);return M((()=>{s&&s(i)}),[s,i]),S(o,t(t({},l),{},{id:f,role:c,class:`${a} section-child-76fac82 header-76fac82`,tabindex:z(l),"aria-controls":d,onClick:()=>p(),"aria-expanded":String(u)}),r)}function oe(e){let n="class",{as:o="div",children:r,id:i,role:c="region",[n]:a=""}=e,l=y(e,["as","children","id","role",n].map(g));const d=$(null),u=$(!1),{animate:f,contentId:s,expanded:p,headerId:b,setContentId:m}=w(G);return E((()=>(u.current=!0,()=>u.current=!1)),[]),M((()=>{m&&m(i)}),[m,i]),M((()=>{const e=u.current,n=d.current;if(f&&e&&n&&n.animate)return p?function(e){return W(e,(()=>{const n=D(e,"height"),t=D(e,"opacity"),o=D(e,"overflowY");F(e,{height:0,opacity:0,overflowY:"auto"});const r=e.scrollHeight;F(e,{height:n,opacity:t,overflowY:o});const i=X(r);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:r+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(n):function(e){return W(e,(()=>{const n=e.offsetHeight,t=X(n);return e.animate([{height:n+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(n)}),[p,f]),S(A,{renderable:p},S(o,t(t({},l),{},{ref:d,class:a+" section-child-76fac82"+(p?"":" content-hidden-76fac82"),id:s,"aria-labelledby":b,role:c}),r))}V.displayName="Accordion";var re=class extends p{init(){const e=e=>n=>{var t;!function(e,n,t){const o=e.hasAttribute(n),r=void 0!==t?t:!o;r!==o&&(r?e.setAttribute(n,""):e.removeAttribute(n))}(e,"expanded",n),null===(t=e.__AMP_PR)||void 0===t||t.call(e),this.triggerEvent(e,n?"expand":"collapse")},{element:n}=this,t=new MutationObserver((()=>{this.mutateProps(ie(n,t,e))}));t.observe(n,{attributeFilter:["expanded","id"],subtree:!0,childList:!0});const{"children":o}=ie(n,t,e);return{"children":o}}};function ie(e,n,o){var r,i,c;return{"children":(i=e,c="section",d(/^[\w-]+$/.test(c)),"> section",(r=i.querySelectorAll(function(e,n){return e.replace(/^|,/g,"$&:scope ")}("> section")))?Array.prototype.slice.call(r):[]).map((e=>{e.__AMP_PR||(e.__AMP_PR=()=>n.takeRecords());const r=l(e,"__AMP_H_SHIM",ae),i=l(e,"__AMP_C_SHIM",de),c=l(e,"__AMP_EXPAND_STATE_SHIM",o),a={"key":e,"expanded":e.hasAttribute("expanded"),"id":e.getAttribute("id"),"onExpandStateChange":c},d={"as":r,"id":e.firstElementChild.getAttribute("id"),"role":e.firstElementChild.getAttribute("role")||void 0},f={"as":i,"id":e.lastElementChild.getAttribute("id"),"role":e.lastElementChild.getAttribute("role")||void 0};return u(ne,t({},a),u(te,t({},d)),u(oe,t({},f)))}))}}function ce(e,{"aria-controls":n,"aria-expanded":t,id:o,onClick:r,role:i}){const c=e.firstElementChild;return f((()=>{if(c&&r)return c.setAttribute("id",o),c.classList.add("i-amphtml-accordion-header"),c.addEventListener("click",r),c.hasAttribute("tabindex")||c.setAttribute("tabindex",0),c.setAttribute("aria-expanded",t),c.setAttribute("aria-controls",n),c.setAttribute("role",i),e.__AMP_PR&&e.__AMP_PR(),()=>{c.removeEventListener("click",d(r))}}),[e,c,o,i,r,n,t]),u("header",null)}var ae=e=>ce.bind(null,e);function le(e,{"aria-labelledby":n,id:t,role:o},r){const i=e.lastElementChild,c=s();return c.current=i,h(c),m(r,i),f((()=>{i&&(i.classList.add("i-amphtml-accordion-content"),i.setAttribute("id",t),i.setAttribute("role",o),i.setAttribute("aria-labelledby",n),e.__AMP_PR&&e.__AMP_PR())}),[e,i,t,o,n]),u("div",null)}var de=e=>b(le.bind(null,e));re.Component=V,re.detached=!0,re.props={"animate":{attr:"animate",type:"boolean",media:!0},"expandSingleSection":{attr:"expand-single-section",type:"boolean"}};import{defineBentoElement as ue}from"@bentoproject/core";function fe(e){ue("bento-accordion",re,e)}export{fe as defineElement}; | ||
function e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function n(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function t(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?n(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var o,r,{hasOwnProperty:i,toString:c}=Object.prototype;function a(e,n){return Object.keys(e).reduce(((t,o)=>(n.includes(o)||(t[o]=e[o]),t)),{})}function l(e,n,t){let o=e[n];return void 0===o&&(o=t(e,n),e[n]=o),o}function d(e,n,t,o,r,i,c,a,l,d,u){return e}import{createElement as u}from"./@bentoproject/core";import{useLayoutEffect as f,useRef as s}from"./@bentoproject/core";import{PreactBaseElement as p}from"./@bentoproject/core";import{forwardRef as b}from"./@bentoproject/core";import{useDOMHandle as m}from"./@bentoproject/core";import{useSlotContext as h}from"./@bentoproject/core";function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e){var n=function(e,n){if("object"!==v(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==v(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===v(n)?n:String(n)}function x(){return o||(o=Promise.resolve(void 0))}function y(e,n){if(null==e)return{};var t,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],n.indexOf(t)>=0||(r[t]=e[t]);return r}import{createContext as j,createElement as S}from"./@bentoproject/core";import{useCallback as O,useContext as w,useEffect as E,useImperativeHandle as I,useLayoutEffect as M,useMemo as _,useRef as $,useState as C}from"./@bentoproject/core";import{forwardRef as k}from"./@bentoproject/core";import{WithAmpContext as A}from"./@bentoproject/core";import{useCallback as H,useLayoutEffect as P}from"./@bentoproject/core";import{useAmpContext as Y}from"./@bentoproject/core";function z(e,n=0){var t,o;return null!==(t=null!==(o=e.tabindex)&&void 0!==o?o:e.tabIndex)&&void 0!==t?t:n}var L=["Webkit","webkit","Moz","moz","ms","O","o"];function T(e,n,t){if(N(n))return n;r||(r=Object.create(null));let o=r[n];if(!o||t){if(o=n,void 0===e[n]){const t=function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(n),r=function(e,n){for(let t=0;t<L.length;t++){const o=L[t]+n;if(void 0!==e[o])return o}return""}(e,t);void 0!==e[r]&&(o=r)}t||(r[n]=o)}return o}function R(e,n,t,o,r){const i=T(e.style,n,r);if(!i)return;const c=o?t+o:t;e.style.setProperty(function(e){const n=e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()));return L.some((e=>n.startsWith(e+"-")))?`-${n}`:n}(i),c)}function D(e,n,t){const o=T(e.style,n,t);if(o)return N(o)?e.style.getPropertyValue(o):e.style[o]}function F(e,n){for(const t in n)R(e,t,n[t])}function N(e){return e.startsWith("--")}function W(e,n,t){e.classList.add("i-amphtml-animating");let o=n();return o.onfinish=o.oncancel=()=>{o=null,t&&t(),e.classList.remove("i-amphtml-animating")},()=>{o&&o.cancel()}}function X(e){const n=window.innerHeight,t=Math.abs(e)/n*500;return Math.min(Math.max(t,200),500)}var Z=["animate","as","children","expandSingleSection","id"],q=["animate","as","children","expanded","id","onExpandStateChange"],B=j({}),G=j({}),J={},K={},Q=function(){let e=0;return()=>String(++e)}(),U=()=>String(Math.floor(1e5*Math.random())),V=k((function(e,n){let{animate:o=!1,as:r="section",children:i,expandSingleSection:c=!1,id:l}=e,d=y(e,Z);const[u,f]=C(J),s=$(K),[p]=C(U),b=l||`a${p}`;E((()=>{c&&f((e=>{const n={};let t=0;for(const o in e)n[o]=e[o]&&0==t++;return n}))}),[c]);const m=O(((e,n,{current:o})=>(f((t=>ee(e,n,t,c))),s.current=t(t({},s.current),{},{[e]:o}),()=>{f((n=>a(n,e))),s.current=a(s.current,e)})),[c]),h=O(((e,n)=>{f((t=>{const o=null!=n?n:!t[e],r=ee(e,o,t,c);return x().then((()=>{for(const e in t){const n=s.current[e];n&&t[e]!=r[e]&&n(r[e])}})),r}))}),[c]),v=O(((e,n)=>{var t;return null!==(t=u[e])&&void 0!==t?t:n}),[u]),g=O((e=>{if(e)e in u&&h(e);else if(!c)for(const e in u)h(e)}),[u,h,c]),j=O((e=>{if(e)v(e,!0)||h(e);else if(!c)for(const e in u)v(e,!0)||h(e)}),[u,h,v,c]),w=O((e=>{if(e)v(e,!1)&&h(e);else for(const e in u)v(e,!1)&&h(e)}),[u,h,v]);I(n,(()=>({toggle:g,expand:j,collapse:w})),[g,w,j]);const M=_((()=>({registerSection:m,toggleExpanded:h,isExpanded:v,animate:o,prefix:b})),[m,h,v,o,b]);return S(r,t({id:l},d),S(B.Provider,{value:M},i))}));function ee(e,n,o,r){let i;if(r&&n){i={[e]:n};for(const n in o)n!=e&&(i[n]=!1)}else i=t(t({},o),{},{[e]:n});return i}function ne(e){let{animate:n=!1,as:o="section",children:r,expanded:i=!1,id:c,onExpandStateChange:a}=e,l=y(e,q);const[d]=C(Q),u=c||d,[f]=C(U),[s,p]=C(i),[b,m]=C(null),[h,v]=C(null),{animate:g,isExpanded:j,prefix:E,registerSection:I,toggleExpanded:k}=w(B),A=j?j(u,i):s,H=null!=g?g:n,P=b||`${E||"a"}-content-${u}-${f}`,Y=h||`${E||"a"}-header-${u}-${f}`,z=$(null);z.current=a,M((()=>{if(I)return I(u,i,z)}),[I,u,i]);const L=O((e=>{k?k(u,e):p((n=>{const t=null!=e?e:!n;return x().then((()=>{const e=z.current;e&&e(t)})),t}))}),[u,k]),T=_((()=>({animate:H,contentId:P,headerId:Y,expanded:A,toggleHandler:L,setContentId:m,setHeaderId:v})),[H,P,Y,A,L]);return S(o,t({},l),S(G.Provider,{value:T},r))}function te(e){let n="class",{as:o="div",children:r,id:i,role:c="button",[n]:a=""}=e,l=y(e,["as","children","id","role",n].map(g));const{contentId:d,expanded:u,headerId:f,setHeaderId:s,toggleHandler:p}=w(G);return M((()=>{s&&s(i)}),[s,i]),S(o,t(t({},l),{},{id:f,role:c,class:`${a} section-child-76fac82 header-76fac82`,tabindex:z(l),"aria-controls":d,onClick:()=>p(),"aria-expanded":String(u)}),r)}function oe(e){let n="class",{as:o="div",children:r,id:i,role:c="region",[n]:a=""}=e,l=y(e,["as","children","id","role",n].map(g));const d=$(null),u=$(!1),{animate:f,contentId:s,expanded:p,headerId:b,setContentId:m}=w(G);return E((()=>(u.current=!0,()=>u.current=!1)),[]),M((()=>{m&&m(i)}),[m,i]),M((()=>{const e=u.current,n=d.current;if(f&&e&&n&&n.animate)return p?function(e){return W(e,(()=>{const n=D(e,"height"),t=D(e,"opacity"),o=D(e,"overflowY");F(e,{height:0,opacity:0,overflowY:"auto"});const r=e.scrollHeight;F(e,{height:n,opacity:t,overflowY:o});const i=X(r);return e.animate([{height:0,opacity:0,overflowY:"hidden"},{height:r+"px",opacity:1,overflowY:"hidden"}],{easing:"cubic-bezier(0.47, 0, 0.745, 0.715)",duration:i})}))}(n):function(e){return W(e,(()=>{const n=e.offsetHeight,t=X(n);return e.animate([{height:n+"px",opacity:1,overflowY:"hidden"},{height:"0",opacity:0,overflowY:"hidden"}],{easing:"cubic-bezier(0.39, 0.575, 0.565, 1)",duration:t})}))}(n)}),[p,f]),S(A,{renderable:p},S(o,t(t({},l),{},{ref:d,class:a+" section-child-76fac82"+(p?"":" content-hidden-76fac82"),id:s,"aria-labelledby":b,role:c}),r))}V.displayName="Accordion";var re=class extends p{init(){const e=e=>n=>{var t;!function(e,n,t){const o=e.hasAttribute(n),r=void 0!==t?t:!o;r!==o&&(r?e.setAttribute(n,""):e.removeAttribute(n))}(e,"expanded",n),null===(t=e.__AMP_PR)||void 0===t||t.call(e),this.triggerEvent(e,n?"expand":"collapse")},{element:n}=this,t=new MutationObserver((()=>{this.mutateProps(ie(n,t,e))}));t.observe(n,{attributeFilter:["expanded","id"],subtree:!0,childList:!0});const{"children":o}=ie(n,t,e);return{"children":o}}};function ie(e,n,o){var r,i,c;return{"children":(i=e,c="section",d(/^[\w-]+$/.test(c)),"> section",(r=i.querySelectorAll(function(e,n){return e.replace(/^|,/g,"$&:scope ")}("> section")))?Array.prototype.slice.call(r):[]).map((e=>{e.__AMP_PR||(e.__AMP_PR=()=>n.takeRecords());const r=l(e,"__AMP_H_SHIM",ae),i=l(e,"__AMP_C_SHIM",de),c=l(e,"__AMP_EXPAND_STATE_SHIM",o),a={"key":e,"expanded":e.hasAttribute("expanded"),"id":e.getAttribute("id"),"onExpandStateChange":c},d={"as":r,"id":e.firstElementChild.getAttribute("id"),"role":e.firstElementChild.getAttribute("role")||void 0},f={"as":i,"id":e.lastElementChild.getAttribute("id"),"role":e.lastElementChild.getAttribute("role")||void 0};return u(ne,t({},a),u(te,t({},d)),u(oe,t({},f)))}))}}function ce(e,{"aria-controls":n,"aria-expanded":t,id:o,onClick:r,role:i}){const c=e.firstElementChild;return f((()=>{if(c&&r)return c.setAttribute("id",o),c.classList.add("i-amphtml-accordion-header"),c.addEventListener("click",r),c.hasAttribute("tabindex")||c.setAttribute("tabindex",0),c.setAttribute("aria-expanded",t),c.setAttribute("aria-controls",n),c.setAttribute("role",i),e.__AMP_PR&&e.__AMP_PR(),()=>{c.removeEventListener("click",d(r))}}),[e,c,o,i,r,n,t]),u("header",null)}var ae=e=>ce.bind(null,e);function le(e,{"aria-labelledby":n,id:t,role:o},r){const i=e.lastElementChild,c=s();return c.current=i,h(c),m(r,i),f((()=>{i&&(i.classList.add("i-amphtml-accordion-content"),i.setAttribute("id",t),i.setAttribute("role",o),i.setAttribute("aria-labelledby",n),e.__AMP_PR&&e.__AMP_PR())}),[e,i,t,o,n]),u("div",null)}var de=e=>b(le.bind(null,e));re.Component=V,re.detached=!0,re.props={"animate":{attr:"animate",type:"boolean",media:!0},"expandSingleSection":{attr:"expand-single-section",type:"boolean"}};import{defineBentoElement as ue}from"./@bentoproject/core";function fe(e){ue("bento-accordion",re,e)}export{fe as defineElement}; | ||
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */ | ||
//# sourceMappingURL=web-component.module.js.map |
{ | ||
"name": "@bentoproject/accordion", | ||
"version": "1.2203281422.0", | ||
"version": "1.2204121632.0", | ||
"description": "Displays content sections that can be collapsed and expanded.", | ||
@@ -45,4 +45,4 @@ "author": "Bento Authors", | ||
"dependencies": { | ||
"@bentoproject/core": "0.2203281422.0" | ||
"@bentoproject/core": "0.2204121632.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
743842
4225
+ Added@bentoproject/core@0.2204121632.0(transitive)
- Removed@bentoproject/core@0.2203281422.0(transitive)