PageSourceSearch

https://www.hubspot.es/hubfs/hub_generated/template_assets/1/19528…/1787671276402/template_accordion.min.js

js hubspot.es collected 2026-09-24 07:52:33 UTC 8,303 bytes, 2 lines download raw bytes

1(()=>{"use strict";const n=(t,{container:n,strict:s=!1}={})=>{n=n instanceof Element?n:document.documentElement;let i=null;if(t instanceof Element?i=n.contains(t)?t:null:"string"==typeof t&&(i=((t,{container:e}={})=>((t,{container:e}={})=>(t=document.getElementById(t),e instanceof Element&&!e.contains(t)?null:t))(t,{container:e})||((t,{container:e}={})=>(e instanceof Element?e:document.documentElement).querySelector(t))(t,{container:e}))(t,{container:n})),s&&!i)throw new Error("[getElement]: No element found.",{elementArgument:t,container:n});return i};let s="data-cl-mounted";const i=class{element;id;settings={};ui={};static get defaultSettings(){return{}}get isMounted(){return this.element&&this.element.hasAttribute(s)}set isMounted(t){var e;e=this.element,t?e.setAttribute(s,""):e.removeAttribute(s)}constructor(e,s={}){this.element=n(e,{strict:!0}),this.element.clComponent&&console.warn(`Element ${this.element} was previously initialized as a ClComponent, using constructor ${this.element.clComponent?.constructor?.name}.\nWe recommend only using one component per element. Proceed with caution!`),this.element.id||=(({prefix:t="cl-id-"}={})=>""+t+(window.crypto&&"function"==typeof window.crypto.randomUUID?window.crypto.randomUUID():Math.random().toString(36).substring(2)))(),this.id=this.element.id,this.settings={...this.constructor.defaultSettings,...s},this.element.clComponent=this}update(t={}){this.settings={...this.settings,...t}}mount(){throw new Error("mount() must be implemented by the subclass extending ClComponent")}unmount(){throw new Error("unmount() must be implemented by the subclass extending ClComponent")}on(t,e,n){this.element.addEventListener(t,e,n)}destroy(){this.unmount(),delete this.element.clComponent,this.settings={},this.ui={},delete this.id,delete this.element}};let o_ESCAPE="Escape";class r extends i{static get EVENTS(){return{OPEN:"cl-disclosure:open",CLOSE:"cl-disclosure:close"}}static get defaultSettings(){return{buttonSelector:"button",contentSelector:"button + *",isOpen:null,openClass:null,openOnHover:!1,closeOnEscape:!1}}get isOpen(){return"true"===this.ui.button.getAttribute("aria-expanded")}set isOpen(t){this.ui.button.setAttribute("aria-expanded",t?"true":"false"),this.ui.content.setAttribute("aria-hidden",t?"false":"true"),this.ui.content.toggleAttribute("inert",!t),this.settings.openClass&&this.element.classList.toggle(this.settings.openClass,t)}get hasFocus(){return this.element.contains(document.activeElement)}constructor(t,e={}){if(super(t,e),this.ui.button=this.element.querySelector(this.settings.buttonSelector),!this.ui.button)throw new Error("No button element found matching selector: "+this.settings.buttonSelector);if(this.ui.content=this.element.querySelector(this.settings.contentSelector),!this.ui.content)throw new Error("No content element found matching selector: "+this.settings.contentSelector);this.ui.content.id||=this.id+"-content",this.ui.button.setAttribute("aria-controls",this.ui.content.id)}mount(){return this.isMounted||(this.isOpen=this.settings.isOpen??this.isOpen,this.ui.button.addEventListener("click",this.handleButtonClick),this.settings.openOnHover&&(this.element.addEventListener("mouseenter",this.handleMouseEnter),this.element.addEventListener("mouseleave",this.handleMouseLeave)),this.settings.closeOnEscape&&document.addEventListener("keyup",this.handleDocumentKeyUp),this.isMounted=!0),this}unmount(){return this.isMounted&&(this.ui.button.removeAttribute("aria-expanded"),this.ui.content.removeAttribute("aria-hidden"),this.ui.content.removeAttribute("inert"),this.ui.button.removeEventListener("click",this.handleButtonClick),this.element.removeEventListener("mouseenter",this.handleMouseEnter),this.element.removeEventListener("mouseleave",this.handleMouseLeave),document.removeEventListener("keyup",this.handleDocumentKeyUp),this.isMounted=!1),this}handleButtonClick=()=>{this.toggle()};handleMouseEnter=()=>{"function"==typeof this.settings.openOnHover&&!this.settings.openOnHover()||this.hasFocus||this.open()};handleMouseLeave=()=>{"function"==typeof this.settings.openOnHover&&!this.settings.openOnHover()||this.hasFocus||this.close()};handleDocumentKeyUp=t=>{t.key===o_ESCAPE&&this.close()};toggle(t=!this.isOpen){this.isOpen=t,!this.isOpen&&this.hasFocus&&this.ui.button.focus(),t=new CustomEvent(this.isOpen?r.EVENTS.OPEN:r.EVENTS.CLOSE,{bubbles:!0}),this.element.dispatchEvent(t)}open(){this.toggle(!0)}close(){this.toggle(!1)}}const l=r;class u{static get LAZY_SRC_ATTRIBUTE(){return"data-cl-lazy-src"}get elements(){return u.getElements(this.container)}constructor(t=document.documentElement,e={}){this.container=t,this.settings=e,this.hasElements()&&(("function"==typeof e.eager?e.eager():Boolean(e.eager))?this.loadElements():this.addTriggers())}static getElements(t){return t.querySelectorAll(`[${u.LAZY_SRC_ATTRIBUTE}]`)}hasElements(){return 0<this.elements.length}addTriggers(t){this.toggleTriggers(t,!0)}addTrigger({element:t,eventType:e}){this.toggleTrigger({element:t,eventType:e},!0)}toggleTriggers(t=this.settings?.triggers,e=!1){t&&(Array.isArray(t)?t.forEach(t=>{this.toggleTrigger(t,e)}
1):t.elements.forEach(n=>{t.eventTypes.forEach(t=>{this.toggleTrigger({element:n,eventType:t},e)})}))}toggleTrigger({element:t,eventType:e},n){n?t.addEventListener(e,this.loadElements,{once:!0}):t.removeEventListener(e,this.loadElements)}loadElements=()=>{u.loadElements(this.elements)};static loadElements(t=document.documentElement){(t instanceof NodeList||Array.isArray(t)?t:u.getElements(t)).forEach(u.loadElement)}static loadElement(t){var e=t.getAttribute(u.LAZY_SRC_ATTRIBUTE);t.setAttribute("src",e),t.removeAttribute(u.LAZY_SRC_ATTRIBUTE)}removeTriggers(t){this.toggleTriggers(t,!1)}destroy(){this.removeTriggers(),this.container=null,this.settings=null}}const h=u;class c extends l{mount(){return this.isMounted?this:(this.setupLazySrcElementLoading(),this.addContentTransitionEndListener(),super.mount())}setupLazySrcElementLoading(){this.lazySrcLoader=new h(this.ui.content,{eager:this.isOpen,triggers:{elements:[this.ui.button],eventTypes:["mouseenter","focus","touchstart"]}})}toggle(t=!this.isOpen){clearTimeout(this._toggleTimeout),this.setContentMaxHeight(),this._toggleTimeout=setTimeout(()=>{super.toggle(t),t&&this.lazySrcLoader?.loadElements(),this.setContentMaxHeight()})}setContentMaxHeight(){this.ui.content.style.maxHeight=this.isOpen?this.ui.content.scrollHeight+"px":"0"}removeContentMaxHeight(){this.ui.content.style.maxHeight=""}addContentTransitionEndListener(){this.ui.content.addEventListener("transitionend",this.handleContentTransitionEnd)}removeContentTransitionEndListener(){this.ui.content.removeEventListener("transitionend",this.handleContentTransitionEnd)}handleContentTransitionEnd=t=>{"max-height"===t.propertyName&&this.removeContentMaxHeight()};unmount(){return this.isMounted?(clearTimeout(this._toggleTimeout),this.removeContentTransitionEndListener(),this.lazySrcLoader?.destroy(),super.unmount()):this}}const a=class extends i{items=[];static get defaultSettings(){return{itemSelector:".cl-accordion-item",contentSelector:".cl-accordion-content-container",buttonSelector:".cl-accordion-button",singleOpen:!0}}constructor(t,e={}){super(t,e),this.ui.items=[...this.element.querySelectorAll(this.settings.itemSelector)],this.items=this.ui.items.map(t=>new c(t,this.settings))}get accordion(){return console.warn("[Accordion] accordion property is deprecated, use element instead"),this.element}mount(){return this.isMounted||(this.items.forEach(t=>{t.mount()}),this.settings.singleOpen&&this.element.addEventListener(c.EVENTS.OPEN,this.handleItemOpen),this.isMounted=!0),this}handleItemOpen=t=>{this.settings.singleOpen&&this.items.forEach(e=>{e!==t.target.clComponent&&e.close()})};unmount(){return this.isMounted&&(this.items.forEach(t=>{t.unmount()}),this.element.removeEventListener(c.EVENTS.OPEN,this.handleItemOpen)),this}destroy(){this.items.forEach(t=>{t.destroy()}),super.destroy()}};document.querySelectorAll('.csl-accordion[data-accordion-mounted="false"]').forEach(function(t){new a(t.id,{singleOpen:!1}).mount(),t.setAttribute("data-accordion-mounted","true")})})();
2//# sourceURL=https://53.fs1.hubspotusercontent-na1.net/hubfs/53/hub_generated/template_assets/1/195287048317/1787671276402/template_accordion.js

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.