var __awaiter=this&&this.__awaiter||function(t,e,s,n){return new(s||(s=Promise))(function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function l(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(a,l)}c((n=n.apply(t,e||[])).next())})};const COMMON_CONSTANTS_NUMBERS={N0:0,N1:1,N2:2,N3:3,N4:4,N320:320,N578:578,N1024:1024,N1280:1280,N1440:1440};class BcCommonConstants{}BcCommonConstants.PREFIX_LIB="bc",BcCommonConstants.DISABLED="disabled",BcCommonConstants.DISABLE_CLASS="bc-disable",BcCommonConstants.HIDDEN="hidden",BcCommonConstants.TEXT_GRAY="text-gray",BcCommonConstants.INVISIBLE_CLASS="bc-invisible",BcCommonConstants.X_SMALL_CLASS="bc-xs",BcCommonConstants.SMALL="small",BcCommonConstants.X_SMALL="xSmall",BcCommonConstants.EVENT_CANCEL="cancelSelection",BcCommonConstants.EVENT_RANGE="selectRange",BcCommonConstants.EVENT_SELECT="selectDate",BcCommonConstants.EVENT_CLICK="click",BcCommonConstants.EVENT_FOCUS="focus",BcCommonConstants.EVENT_FOCUSOUT="focusout",BcCommonConstants.EVENT_BLUR="blur",BcCommonConstants.EVENT_RESIZE="resize",BcCommonConstants.ICONS_CLASS="bc-icon",BcCommonConstants.ICON_MD_CLASS="bc-md",BcCommonConstants.ICON_SM_CLASS="bc-sm",BcCommonConstants.ICON_XS_CLASS="bc-xs",BcCommonConstants.ICON_ARROW_DOWN="arrow2-down",BcCommonConstants.ICON_ARROW_LEFT="arrow2-left",BcCommonConstants.ICON_ARROW_RIGHT="arrow2-right",BcCommonConstants.FADE_OUT_OPACITY="fade-out-opacity",BcCommonConstants.SLIDE_UP_REVERSE="slide-up-reverse",BcCommonConstants.BC_BTN_CLASS="bc-button",BcCommonConstants.BC_LINK_CLASS="bc-link",BcCommonConstants.BC_ALIGN_ITEMS_CENTER_CLASS="bc-align-items-center",BcCommonConstants.BTN_PRIMARY_CLASS="bc-button-primary",BcCommonConstants.BTN_SECONDARY_CLASS="bc-button-secondary",BcCommonConstants.BUTTON_SMALL_CLASS="bc-button-small",BcCommonConstants.BUTTON_FAB_CLASS="bc-fab-button",BcCommonConstants.BUTTON_FAB_MINI_CLASS="bc-fab-button-mini",BcCommonConstants.CONTAINER_CHECKBOX_CLASS="bc-container-checkbox",BcCommonConstants.CHECKBOX_CLASS="bc-checkbox",BcCommonConstants.CHECKED="checked",BcCommonConstants.NONE="none",BcCommonConstants.FLEX="flex",BcCommonConstants.EVENT_MOUSEDOWN="mousedown",BcCommonConstants.EVENT_MOUSEOVER="mouseover",BcCommonConstants.EVENT_MOUSEOUT="mouseout",BcCommonConstants.EVENT_MOUSEENTER="mouseenter",BcCommonConstants.EVENT_MOUSEUP="mouseup",BcCommonConstants.EVENT_MEMU_ITEMS="itemsEvent",BcCommonConstants.EVENT_HEADER_TOGGLE_MENU="toggleMenu",BcCommonConstants.EVENT_HEADER_EXIST="headerReady",BcCommonConstants.EVENT_MENU_EXIST="menuReady",BcCommonConstants.EVENT_MENU_ITEM_OPENED="itemOpened",BcCommonConstants.EVENT_KEY_DOWN="keydown",BcCommonConstants.EVENT_KEY_UP="keyup",BcCommonConstants.EVENT_KEY_PRESS="keypress",BcCommonConstants.EVENT_INPUT="input",BcCommonConstants.EVENT_CHANGE="change",BcCommonConstants.EVENT_LOAD="load",BcCommonConstants.KEY_EVENT_ARROW_DOWN="ArrowDown",BcCommonConstants.KEY_EVENT_ARROW_UP="ArrowUp",BcCommonConstants.KEY_EVENT_ENTER="Enter",BcCommonConstants.KEY_EVENT_ESCAPE="Escape",BcCommonConstants.KEY_EVENT_SPACE=" ",BcCommonConstants.KEY_EVENT_ARROW_RIGHT="ArrowRight",BcCommonConstants.KEY_EVENT_ARROW_LEFT="ArrowLeft",BcCommonConstants.KEY_EVENT_HOME="Home",BcCommonConstants.KEY_EVENT_END="End",BcCommonConstants.CLOSE_ALERT_EVENT="onCloseAlert",BcCommonConstants.CLOSE_NOTIFICATION_EVENT="onCloseNotification",BcCommonConstants.ARIA_CONTROL="aria-controls",BcCommonConstants.ARIA_LABEL="aria-label",BcCommonConstants.ARIA_CURRENT="aria-current",BcCommonConstants.BUTTON_TAG="button",BcCommonConstants.DIV_TAG="div",BcCommonConstants.ASIDE_TAG="aside",BcCommonConstants.SECTION_TAG="section",BcCommonConstants.OUTLINE_ELEMENT="outline-element",BcCommonConstants.ARTICLE_TAG="article",BcCommonConstants.INPUT_TAG="input",BcCommonConstants.SPAN_TAG="span",BcCommonConstants.LABEL_TAG="label",BcCommonConstants.IMG_TAG="img",BcCommonConstants.EM_TAG="em",BcCommonConstants.UL_TAG="ul",BcCommonConstants.LI_TAG="li",BcCommonConstants.P_TAG="p",BcCommonConstants.I_TAG="i",BcCommonConstants.H1_TAG="h1",BcCommonConstants.H2_TAG="h2",BcCommonConstants.H3_TAG="h3",BcCommonConstants.H4_TAG="h4",BcCommonConstants.H5_TAG="h5",BcCommonConstants.H6_TAG="h6",BcCommonConstants.TH_TAG="th",BcCommonConstants.HREF_TAG="a",BcCommonConstants.TEXTAREA_TAG="textarea",BcCommonConstants.ATTR_HREF="href",BcCommonConstants.BREAKPOINT_XS=COMMON_CONSTANTS_NUMBERS.N320,BcCommonConstants.BREAKPOINT_SM=COMMON_CONSTANTS_NUMBERS.N578,BcCommonConstants.BREAKPOINT_MD=COMMON_CONSTANTS_NUMBERS.N1024,BcCommonConstants.BREAKPOINT_LG=COMMON_CONSTANTS_NUMBERS.N1280,BcCommonConstants.BREAKPOINT_XL=COMMON_CONSTANTS_NUMBERS.N1440,BcCommonConstants.BC_DROPDOWN_CLASS="bc-dropdown",BcCommonConstants.BC_DROPDOWN_CUSTOM_CLASS="bc-dropdown-custom",BcCommonConstants.BC_DROPDOWN_UNDISMISS_CLASS="bc-dropdown-undismiss",BcCommonConstants.BC_DROPDOWN_CLOSE_BTN_CLASS="bc-dropdown-close-button",BcCommonConstants.BC_ARROW_DOWN_ICON="arrow-down",BcCommonConstants.BC_ARROW_UP_ICON="arrow-up",BcCommonConstants.INPUT_TEXT_TYPE="text",BcCommonConstants.CURSOR_POINTER="pointer",BcCommonConstants.MARGIN_LEFT="margin-left",BcCommonConstants.MARGIN_RIGHT="margin-right",BcCommonConstants.BORDER_LEFT_WIDTH="border-left-width",BcCommonConstants.BORDER_RIGHT_WIDTH="border-right-width",BcCommonConstants.PADDING_LEFT="padding-left",BcCommonConstants.PADDING_RIGHT="padding-right",BcCommonConstants.ARIA_SELECTED="aria-selected",BcCommonConstants.ARIA_POSINSET="aria-posinset",BcCommonConstants.ROLE="role";const METHOD_NOT_IMPLEMENTED="Method not implemented.",ID_NOT_FOUND="The given id is not present in the DOM",ELEMENT_IS_INVALID="The element inside in object is not valid.";class BcDefaultBehavior{constructor(){this.disabled=!1,this.isReady=!1}_setUp(){if(void 0===this.mySelf||null===this.mySelf)throw new Error(ELEMENT_IS_INVALID)}setId(t){if(this._id=t,this.mySelf=document.getElementById(this._id),null===this.mySelf)throw new Error(ID_NOT_FOUND);return this.setPlaceHolder(),this.mySelf}setElement(t){this.mySelf=t,this.setPlaceHolder()}getMySelf(){return this.mySelf}setUp(t=!1){if(!this.isReady||t)try{this._setUp(),this.isReady=!0}catch(t){this.isReady=!1,console.log(t)}}setDisable(t){t?this.mySelf.classList.add(BcCommonConstants.DISABLE_CLASS):this.mySelf.classList.remove(BcCommonConstants.DISABLE_CLASS)}setPlaceHolder(){const t=this.mySelf;(null==t?void 0:t.placeholder)||(t.placeholder=" ")}}const _DROPDOWN_TOGGLE_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown-toggle`,_DROPDOWN_TOGGLE_ACTIVE_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown-toggle-active`,_DROPDOWN_ITEM_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown-item`,_DROPDOWN_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown`,_DROPDOWN_ACTIVE_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown-active`,_DROPDOWN_CONTENT_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown-content`,_DROPDOWN_CONTENT_ACTIVE_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown-content-active`,_DROPDOWN_DROPTOP_CLASS=`${BcCommonConstants.PREFIX_LIB}-droptop`,_DROPDOWN_TRIANGLE_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown-triangle`,_DROPDOWN_UNDIMISS_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown-undismiss`,_DROPDOWN_CLOSE_BUTTON_CLASS=`${BcCommonConstants.PREFIX_LIB}-dropdown-close-button`,_DROPDOWN_OPENED_EVENT=`${BcCommonConstants.PREFIX_LIB}DropdownOpened`,_DROPDOWN_CLOSED_EVENT=`${BcCommonConstants.PREFIX_LIB}DropdownClosed`,_DROPDOWN_DISCARDED_EVENT=`${BcCommonConstants.PREFIX_LIB}DropdownDiscarded`,_DROPDOWN_NUMBER_0=0,_DROPDOWN_NUMBER_1=-1,_DROPDOWN_NUMBER_11=11,_DROPDOWN_NUMBER_14=14,_DROPDOWN_NUMBER_26=26,_DROPDOWN_NUMBER_243=243,_DROPDOWN_NUMBER_60=60;class BcDropdownHelper{getProperty(t,e,s){let n=null;if(e.length>0&&e[0]in t){const o=t[e[0]];n=e.length-1>0?this.getProperty(o,e.slice(1,e.length),s):o}else s&&(n=s);return n}isNullOrUndefined(t){return null==t}}class BcAbstractDropdownBehavior extends BcDefaultBehavior{constructor(){super(),this.toggleButton=null,this.dropdownContent=null,this.dropdownActive=null,this.dropdownItems=[],this.config={},this.topMarginContent=0,this.closeButton=null,this.toggleButtonEventsAdded=!1,this.helper=new BcDropdownHelper}setConfig(t){t&&(this.config=t),this.initConfiguration()}initConfiguration(){this.config={toggleClass:this.helper.getProperty(this.config,["toggleClass"],_DROPDOWN_TOGGLE_CLASS),toggleActiveClass:this.helper.getProperty(this.config,["toggleActiveClass"],_DROPDOWN_TOGGLE_ACTIVE_CLASS),contentClass:this.helper.getProperty(this.config,["contentClass"],_DROPDOWN_CONTENT_CLASS),contentActiveClass:this.helper.getProperty(this.config,["contentActiveClass"],_DROPDOWN_CONTENT_ACTIVE_CLASS),itemClass:this.helper.getProperty(this.config,["itemClass"],_DROPDOWN_ITEM_CLASS),triangleClass:this.helper.getProperty(this.config,["triangleClass"],_DROPDOWN_TRIANGLE_CLASS),toggleEvents:this.config.toggleEvents?this.config.toggleEvents:["click","input"],mainClass:this.helper.getProperty(this.config,["mainClass"],_DROPDOWN_CLASS),mainActiveClass:this.helper.getProperty(this.config,["mainActiveClass"],_DROPDOWN_ACTIVE_CLASS),static:!this.helper.isNullOrUndefined(this.config.static)&&this.config.static,isPopUp:!this.helper.isNullOrUndefined(this.config.isPopUp)&&this.config.isPopUp,isDisabled:!this.helper.isNullOrUndefined(this.config.isDisabled)&&this.config.isDisabled,parentWidth:!this.helper.isNullOrUndefined(this.config.parentWidth)&&this.config.parentWidth,contentAutoWidth:!this.helper.isNullOrUndefined(this.config.contentAutoWidth)&&this.config.contentAutoWidth,multiple:!this.helper.isNullOrUndefined(this.config.multiple)&&this.config.multiple,maxHeightContent:this.helper.isNullOrUndefined(this.config.maxHeightContent)?null:this.config.maxHeightContent,isAutoStyle:!!this.helper.isNullOrUndefined(this.config.isAutoStyle)||this.config.isAutoStyle,onlyBottomPosition:!this.helper.isNullOrUndefined(this.config.onlyBottomPosition)&&this.config.onlyBottomPosition}}initAccesibilityConfig(){addFocusable(this.dropdownContent,{expanded:"true",role:"listbox"})}_setUp(){this.initConfiguration(),this.getElements(),this.config.isPopUp&&this.addDropdownTriangle(),this.config.maxHeightContent&&this.configureMaxHeight(this.config.maxHeightContent),this.addEventClick(),this.config.static||this.mySelf.classList.contains(_DROPDOWN_UNDIMISS_CLASS)||this.addWindowEventClick(),window.addEventListener("resize",()=>{this.setDropdownContentPosition()}),window.addEventListener("scroll",t=>{this.dropdownContent!=t.target&&"hidden"!==document.querySelector("body").style.overflow&&this.setDropdownContentPosition()},!0),this.setAriaExpanded(!1)}openDrowndown(){setTimeout(()=>{this.setDropdownContentPosition()});const t=this.dropdownContent;this.setAriaExpanded(!0),replaceClass(t,this.config.contentClass,this.config.contentActiveClass),replaceClass(this.toggleButton,this.config.toggleClass,this.config.toggleActiveClass),replaceClass(this.mySelf,this.config.mainClass,this.config.mainActiveClass),this.dropdownActive=t,this.dropdownContent&&window.dispatchEvent(new CustomEvent(_DROPDOWN_OPENED_EVENT,{detail:this.dropdownContent.getAttribute("id")})),this.config.parentWidth&&this.setParentWidth()}closeDropdown(t){replaceClass(this.dropdownContent,this.config.contentActiveClass,this.config.contentClass),replaceClass(this.toggleButton,this.config.toggleActiveClass,this.config.toggleClass),replaceClass(this.mySelf,this.config.mainActiveClass,this.config.mainClass),this.dropdownActive=null,this.setAriaExpanded(!1),this.toggleButton&&this.toggleButton.classList.remove(_DROPDOWN_DROPTOP_CLASS),null===this.dropdownContent||t||window.dispatchEvent(new CustomEvent(_DROPDOWN_CLOSED_EVENT,{detail:this.dropdownContent.getAttribute("id")})),t&&window.dispatchEvent(new CustomEvent(_DROPDOWN_DISCARDED_EVENT,{detail:this.dropdownContent.getAttribute("id")}))}setAriaExpanded(t){var e;null===(e=this.dropdownContent)||void 0===e||e.setAttribute("aria-expanded",String(t))}setHeightContent(t){this.targetOffsetPos=this.mySelf.getBoundingClientRect(),this.dropdownOffsetPos=this.dropdownContent.getBoundingClientRect();const e=this.targetOffsetPos.top+this.targetOffsetPos.height;if(this.windowHeight=document.documentElement.clientHeight,this.bodyHeight=document.body.offsetHeight,"bottom"===t){if(e+this.dropdownOffsetPos.height>this.windowHeight&&this.targetOffsetPos.top>this.dropdownOffsetPos.height)return void this.configureMaxHeight(this.firstHeight);if(e+this.dropdownOffsetPos.height>this.windowHeight&&this.targetOffsetPos.topthis.windowHeight){if(e+this.dropdownOffsetPos.height>this.bodyHeight){const t=e+this.dropdownOffsetPos.height-this.windowHeight,s=this.firstHeight-t;return this.configureMaxHeight(s),t}return void this.configureMaxHeight(this.firstHeight)}if(e+this.dropdownOffsetPos.height>this.windowHeight&&this.targetOffsetPos.top{this.clickToggleEvent(t,e)};this.toggleButton&&!this.toggleButtonEventsAdded&&(this.config.toggleEvents.forEach(e=>{this.toggleButton.removeEventListener(e,t),this.toggleButton.addEventListener(e,t)}),this.toggleButtonEventsAdded=!0),this.configureExtraToggles(this.clickToggleEvent),addFocusable(this.toggleButton,{haspopup:"listbox"},{event:this.clickToggleEvent.bind(this)}),null!==this.closeButton&&(this.closeButton.addEventListener("click",e=>{t(e,!0)}),addFocusable(this.closeButton,{haspopup:"listbox"},{event:t}))}clickToggleEvent(t,e){null==t||t.preventDefault(),null==t||t.stopPropagation(),this&&this.disabled||this.toggleDropdown(e)}toggleDropdown(t,e){this.validateDropdownIsActive()||(this.dropdownActive=null),null==this.dropdownActive||e?this.openDrowndown():this.closeDropdown(t)}configureExtraToggles(t){if(this.config.extraToggles)for(const e of this.config.extraToggles){let s;if(s=e.id?this.mySelf.querySelector(`*[id='${e.id}']`):e.node)for(const n of e.events)s.addEventListener(n,e=>{t.bind(this,e)})}}getElements(){this.toggleButton=this.mySelf.querySelector(`.${this.config.toggleActiveClass},.${this.config.toggleClass}`),this.toggleButton||!this.mySelf.classList.contains(this.config.toggleActiveClass)&&!this.mySelf.classList.contains(this.config.toggleClass)||(this.toggleButton=this.mySelf),this.toggleButton&&(this.idContent=this.toggleButton.getAttribute("aria-controls")),this.dropdownContent=this.mySelf.querySelector(`*[id='${this.idContent}']`),null!==this.dropdownContent&&(this.dropdownItems=Array.from(this.dropdownContent.querySelectorAll(`*[class~='${this.config.itemClass}']`)),this.closeButton=this.dropdownContent.querySelector(`*[class~='${_DROPDOWN_CLOSE_BUTTON_CLASS}']`)),this.initAccesibilityConfig()}validateDropdownIsActive(){return null!==this.dropdownContent&&this.dropdownContent.classList.contains(this.config.contentActiveClass)}setDropdownContentPosition(){if(null!==this.dropdownActive&&this.config.isAutoStyle){this.validateFirstHeight(),this.targetOffsetPos=this.mySelf.getBoundingClientRect(),this.dropdownOffsetPos=this.dropdownContent.getBoundingClientRect(),this.windowWidth=document.documentElement.clientWidth,this.windowHeight=document.documentElement.clientHeight,this.triangle&&this.triangle.classList.remove(_DROPDOWN_DROPTOP_CLASS);let t=_DROPDOWN_NUMBER_0,e=_DROPDOWN_NUMBER_0,s=this.targetOffsetPos.left,n=this.targetOffsetPos.top+this.targetOffsetPos.height;({top:n,left:s,right:t,bottom:e}=this.position(n,s,t,e)),this.setPosition(s,t,n,e)}}position(t,e,s,n){return this.config.onlyBottomPosition?(e=_DROPDOWN_NUMBER_0,s=_DROPDOWN_NUMBER_0,t=_DROPDOWN_NUMBER_0,n=_DROPDOWN_NUMBER_60):(this.config.isPopUp&&(t+=_DROPDOWN_NUMBER_11),e+this.dropdownOffsetPos.width>=this.windowWidth&&(s=this.windowWidth-(e+this.targetOffsetPos.width),e=_DROPDOWN_NUMBER_1),t+this.dropdownOffsetPos.height>this.windowHeight&&this.dropdownOffsetPos.height+this.targetOffsetPos.height>t?(n=this.windowHeight-(this.targetOffsetPos.y+this.targetOffsetPos.height+this.dropdownOffsetPos.height-_DROPDOWN_NUMBER_26),t=_DROPDOWN_NUMBER_1):t+this.dropdownOffsetPos.height>=this.windowHeight&&(n=this.windowHeight-(this.targetOffsetPos.bottom-this.targetOffsetPos.height-_DROPDOWN_NUMBER_14),t=_DROPDOWN_NUMBER_1,this.triangle&&this.triangle.classList.add(_DROPDOWN_DROPTOP_CLASS))),{top:t,left:e,right:s,bottom:n}}validateFirstHeight(){this.firstHeight?this.configureMaxHeight(this.firstHeight):this.firstHeight=this.dropdownContent.clientHeight}setPosition(t,e,s,n){if(this.config.onlyBottomPosition)this.dropdownContent.style.position="absolute",this.dropdownContent.style.top="100%";else if(t!==_DROPDOWN_NUMBER_1?(this.dropdownContent.style.left=`${t}px`,this.dropdownContent.style.right="auto"):(this.dropdownContent.style.left="auto",this.dropdownContent.style.right=`${e}px`),s!==_DROPDOWN_NUMBER_1)this.dropdownContent.style.top=`${s}px`,this.dropdownContent.style.bottom="auto",this.setHeightContent();else{const t=this.setHeightContent("bottom");t?(this.dropdownContent.style.top="auto",this.dropdownContent.style.bottom=`${n+t}px`):(this.dropdownContent.style.top="auto",this.dropdownContent.style.bottom=`${n}px`)}}addDropdownTriangle(){this.triangle=document.createElement("div"),this.triangle.classList.add(this.config.triangleClass),this.mySelf.appendChild(this.triangle)}configureMaxHeight(t){this.dropdownContent.style.maxHeight=t-_DROPDOWN_NUMBER_1+"px"}addWindowEventClick(){window.addEventListener("click",t=>{t.stopPropagation();const e=-1!==t.target.className.indexOf(this.config.toggleClass),s=!!this.config.multiple&&-1!==t.target.className.indexOf(this.config.itemClass);!this.dropdownActive||e||s||this.closeDropdown()})}setParentWidth(){if(!this.config.contentAutoWidth){const t=this.mySelf.clientWidth;this.dropdownContent.style.width=t>=_DROPDOWN_NUMBER_243?`${t}px`:`${_DROPDOWN_NUMBER_243}px`}}}class BcDropdownBehavior extends BcAbstractDropdownBehavior{constructor(){super()}static setUpAll(t){const e=Array.from(document.querySelectorAll(`[class~='${_DROPDOWN_CLASS}']`)),s=[];for(const n of e){const e=new BcDropdownBehavior;e.setElement(n),t&&e.setConfig(t),e.setUp(),s.push(e)}return s}}class BcButtonGroupBehavior extends BcDefaultBehavior{constructor(){super(),this.buttonsState=[]}static setUpAll(){const t=Array.from(document.querySelectorAll(`${BcCommonConstants.ARTICLE_TAG}.${BC_BUTTON_GROUP.CONTAINER}`)),e=new BcButtonGroupBehavior,s=[];for(const n of t)e.setElement(n),e.setUp(),s.push(e);return s}_setUp(){this.setElements(),this.selectElements();try{if(this.inputElements.lengthCOMMON_CONSTANTS_NUMBERS.N4)throw this.mySelf.innerHTML="",Error(`There must be at least 2 and at most 4 buttons. Current count:${this.inputElements.length}`);this.setUpAllFeatures()}catch(t){console.error(t)}}selectElements(){for(let t=0;t{e.style.width=t+"px"})}setIndicatorDimensions(){this.indicator.style.width=Math.max(this.container.clientWidth)/this.labels.length+"px"}setIndicatorPosition(){this.indicator.style.left=this.getCheckedLabelAbsolutePosition().left,this.indicator.style.top=this.getCheckedLabelAbsolutePosition().top}getCheckedLabelAbsolutePosition(){const t=this.container.getBoundingClientRect().left,e=parseInt(getComputedStyle(this.container).paddingLeft),s=this.container.getBoundingClientRect().top,n=parseInt(getComputedStyle(this.container).paddingTop);return{left:this.checkedLabel.getBoundingClientRect().left-t-e+"px",top:this.checkedLabel.getBoundingClientRect().top-s-n+"px"}}setEventListeners(){this.inputElements.forEach(t=>{t.addEventListener(BcCommonConstants.EVENT_CHANGE,()=>{this.setIndicatorFeatures()})}),window.addEventListener(BcCommonConstants.EVENT_RESIZE,()=>{this.setIndicatorPosition(),this.setIndicatorDimensions(),this.setLabelWidth()})}setCheckedInput(){const t=`${BcCommonConstants.INPUT_TAG}.${BC_BUTTON_GROUP.INPUT}:${BcCommonConstants.CHECKED} + ${BcCommonConstants.LABEL_TAG}`;this.checkedLabel=this.mySelf.querySelector(t),this.indicator.querySelector(BcCommonConstants.SPAN_TAG).innerHTML=this.checkedLabel.innerHTML}addFontSizeClass(){const t=this.fontSize!==BcCommonConstants.SMALL&&this.fontSize?BC_BUTTON_GROUP.X_SMALL:BC_BUTTON_GROUP.SMALL;this.indicator.classList.add(t),this.labels.forEach(e=>{e.className=t})}setIndicatorColor(){if(this.indicatorColor)switch(this.indicatorColor){case BC_BUTTON_GROUP.BLACK_INDICATOR_INPUT:this.indicator.className=BC_BUTTON_GROUP.INDICATOR,this.indicator.classList.add(BC_BUTTON_GROUP.BLACK_INDICATOR_COLOR);break;default:this.indicator.className=BC_BUTTON_GROUP.INDICATOR,this.indicator.classList.add(BC_BUTTON_GROUP.DEFAULT_INDICATOR_COLOR)}else this.indicator.classList.add(BC_BUTTON_GROUP.DEFAULT_INDICATOR_COLOR);this.addFontSizeClass()}setInitialIndicator(){const t=`${BcCommonConstants.INPUT_TAG}.${BC_BUTTON_GROUP.INPUT}:${BcCommonConstants.CHECKED}`,e=this.mySelf.querySelector(t);this.indicator.querySelector(BcCommonConstants.SPAN_TAG).innerHTML=e.value}setFontSize(t){this.fontSize=t,this.addFontSizeClass()}setActiveButtonColor(t){this.indicatorColor=t,this.setIndicatorColor()}}const BC_BUTTON_GROUP=Object.freeze({INPUT:`${BcCommonConstants.PREFIX_LIB}-button-group-input`,INDICATOR:`${BcCommonConstants.PREFIX_LIB}-button-indicator`,CONTAINER:`${BcCommonConstants.PREFIX_LIB}-button-group-container`,DEFAULT_INDICATOR_COLOR:`${BcCommonConstants.PREFIX_LIB}-default-indicator`,BLACK_INDICATOR_COLOR:`${BcCommonConstants.PREFIX_LIB}-black-indicator`,BLACK_INDICATOR_INPUT:"blackActiveIndicator",DEFAULT_INDICATOR_INPUT:"defaultActiveIndicator",SMALL:`${BcCommonConstants.PREFIX_LIB}-button-group-font-size-small`,X_SMALL:`${BcCommonConstants.PREFIX_LIB}-button-group-font-size-xsmall`}),BC_AVATAR_NULL_SRC=`${BcCommonConstants.PREFIX_LIB}-avatar-null-src`,SRC_TAG="src",SVG_DEFAULT="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yMCAxMy4zMzMzQzIwIDcuODIgMjQuNDg2NyAzLjMzMzMzIDMwIDMuMzMzMzNDMzUuNTEzMyAzLjMzMzMzIDQwIDcuODIgNDAgMTMuMzMzM1YxOC4yNjMzQzQwIDIzLjE4MzMgMzcuNTU2NyAzMy4zMzY3IDMwIDMzLjMzNjdDMjIuNDQzMyAzMy4zMzY3IDIwIDIzLjE4MzMgMjAgMTguMjYzM1YxMy4zMzMzWk0xNi42NjY3IDE4LjI2MzNDMTYuNjY2NyAyNS45MDY3IDIwLjgwMzMgMzYuNjcgMzAgMzYuNjdDMzkuMTk2NyAzNi42NyA0My4zMzMzIDI1LjkwNjcgNDMuMzMzMyAxOC4yNjMzVjEzLjMzMzNDNDMuMzMzMyA1Ljk4IDM3LjM1MzMgMCAzMCAwQzIyLjY0NjcgMCAxNi42NjY3IDUuOTggMTYuNjY2NyAxMy4zMzMzVjE4LjI2MzNaTTU2LjY2NjcgNTVWNTYuNjY2N0gzLjMzMzMzVjU1QzMuMzMzMzMgNDguMzUgNy43NzMzMyA0Mi40OTMzIDE0LjA1MzMgNDAuNjIzM0MxNy4yODMzIDQ2LjM2MzMgMjMuNCA1MCAzMCA1MEMzNi42IDUwIDQyLjcxNjcgNDYuMzYzMyA0NS45NDY3IDQwLjYyMzNDNTIuMjI2NyA0Mi40OTMzIDU2LjY2NjcgNDguMzUgNTYuNjY2NyA1NVpNMCA2MEg2MFY1NUM2MCA0Ni4zNTY3IDUzLjg2MzMgMzguODEgNDUuNDA2NyAzNy4wNTMzTDQ0LjExNjcgMzYuNzg2N0w0My41NTY3IDM3Ljk4QzQxLjA5MzMgNDMuMjU2NyAzNS43NyA0Ni42NjY3IDMwIDQ2LjY2NjdDMjQuMjMgNDYuNjY2NyAxOC45MDY3IDQzLjI1NjcgMTYuNDQzMyAzNy45OEwxNS44ODMzIDM2Ljc4NjdMMTQuNTkzMyAzNy4wNTMzQzYuMTM2NjcgMzguODEgMCA0Ni4zNTY3IDAgNTVWNjBaIiBmaWxsPSIjMkMyQTI5Ii8+Cjwvc3ZnPgo=",AVATAR_SMALL=`${BcCommonConstants.PREFIX_LIB}-avatar-small`,AVATAR_PUFFY=`${BcCommonConstants.PREFIX_LIB}-avatar-puffy`,ELEMENT_AVATAR_CLASS=`${BcCommonConstants.PREFIX_LIB}-avatar`;class BcAvatarBehavior extends BcDefaultBehavior{static setUpAll(){const t=Array.from(document.querySelectorAll(`[class^='${ELEMENT_AVATAR_CLASS}']`)),e=[];for(const s of t){const t=s,n=new BcAvatarBehavior;n.setElement(t),n.setUp(),e.push(n)}return e}_setUp(){this.mySelf.getAttribute(SRC_TAG)||(this.mySelf.setAttribute(SRC_TAG,SVG_DEFAULT),this.mySelf.classList.add(BC_AVATAR_NULL_SRC))}}const BTN_GROUP_HTML=Object.freeze({VALID:'\n
\n \n \n \n \n \n \n \n \n \n
\n ',INVALID_MIN:'\n
\n \n \n \n
\n ',INVALID_MAX:'\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n '}),SCROLLER_SCROLLABLE_CLASS=`${BcCommonConstants.PREFIX_LIB}-scrollable`,SCROLLER_SCROLLABLE_CONTENT_CLASS=`${BcCommonConstants.PREFIX_LIB}-content-wrapper`,SCROLLER_CLASS=`${BcCommonConstants.PREFIX_LIB}-content-scroller`,SHOW_SCROLL_CLASS="showScroll";class BcScrollerBehavior extends BcDefaultBehavior{constructor(){super(),this.contentPosition=0,this.scrollerBeingDragged=!1}static setUpAll(){const t=Array.from(document.querySelectorAll(`[class^='${SCROLLER_SCROLLABLE_CLASS}']`)),e=[];for(let s=0;sthis.startDrag(t)),this.scrollContainer.addEventListener("mouseup",t=>this.stopDrag(t)),this.scrollContainer.addEventListener("mousemove",t=>this.scrollBarScroll(t)),this.scrollContentWrapper.addEventListener("scroll",t=>this.moveScroller(t)),this.scroller}}class BcSliderBehavior extends BcDefaultBehavior{constructor(){super()}static setUpAll(){const t=Array.from(document.querySelectorAll(`input[class^='${GROUP_SLIDER_SUFIX}']`)),e=[];for(let s of t){const t=new BcSliderBehavior;t.setElement(s),t.setUp(),e.push(t)}return e}setElement(t){this.isReady=!1,this.mySelf=t,this.mySelf.tagName!=TAG_NAME_SLIDER_EXPECTED&&(this.mySelf=this.mySelf.querySelector(`input[class^='${GROUP_SLIDER_SUFIX}']`)),this.thumb=this.mySelf.parentElement.querySelector(`[class='${THUMB_SLIDER_CLASS}']`),addFocusable(this.mySelf,null,null,[this.thumb])}setValue(t){if(t){this.mySelf.value=t,this.updateInput()}}_setUp(){this.mySelf.addEventListener("input",t=>{this.updateInput()}),this.updateInput()}updateInput(){const t=this.mySelf,e=parseInt(this.mySelf.getAttribute("min")),s=(parseInt(this.mySelf.getAttribute("max"))-e)/SLIDER_N100,n=(parseInt(this.mySelf.value)-e)/s;this.mySelf.style.setProperty("--value",n.toString()),this.outputFunction&&this.outputFunction(n),this.thumb||(this.thumb=this.mySelf.parentElement.querySelector(`[class='${THUMB_SLIDER_CLASS}']`)),this.thumb.style.left=(parseInt((n/SLIDER_N100*(t.offsetWidth-SLIDER_N24)).toString())+t.offsetLeft).toString()+"px"}}const SLIDER_N90=90,SLIDER_N14=14,SLIDER_N12=12,SLIDER_N24=24,SLIDER_N10=10,GROUP_SLIDER_SUFIX=`${BcCommonConstants.PREFIX_LIB}-slider`,THUMB_SLIDER_CLASS=`${BcCommonConstants.PREFIX_LIB}-slider-thumb`,TAG_NAME_SLIDER_EXPECTED="INPUT",SLIDER_N100=100,GROUP_SLIDER_DOUBLE_SUFIX=`${BcCommonConstants.PREFIX_LIB}-slider-double-container`,GROUP_SUFIX_LEFT="input-left",GROUP_SUFIX_RIGHT="input-right",THUMB_LEFT_SLIDER_CLASS=`${BcCommonConstants.PREFIX_LIB}-slider-thumb-left`,THUMB_RIGHT_SLIDER_CLASS=`${BcCommonConstants.PREFIX_LIB}-slider-thumb-right`,SLIDER_PERCENTAGE=100;class BcSliderDoubleBehavior extends BcDefaultBehavior{constructor(){super()}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class^='${GROUP_SLIDER_DOUBLE_SUFIX}']`)),e=[];for(let s=0;s{this.setLeftValue(),this.returnValue()}),this.thumbLeft=this.mySelf.querySelector(`[class='${THUMB_LEFT_SLIDER_CLASS}']`),addFocusable(this.inputL,null,null,[this.thumbLeft]),this.setLeftValue(),this.inputR.addEventListener("input",t=>{this.setRightValue(),this.returnValue()}),this.thumbRight=this.mySelf.querySelector(`[class='${THUMB_RIGHT_SLIDER_CLASS}']`),addFocusable(this.inputR,null,null,[this.thumbRight]),this.setRightValue()}setValue(t){if(t.min&&t.max){const e=this.mySelf.querySelector(".input-right");this.mySelf.querySelector(".input-left").value=t.min,e.value=t.max,this.setLeftValue(),this.setRightValue()}}returnValue(){this.valueL&&this.valueR&&this.outputFunction&&this.outputFunction({min:this.valueL,max:this.valueR})}setLeftValue(){const t=this.mySelf.querySelector(".input-right"),e=this.inputL,s=parseInt(e.min),n=parseInt(e.max),o=Math.min(parseInt(e.value),parseInt(t.value));e.value=o.toString();const i=(o-s)/(n-s)*SLIDER_PERCENTAGE,a=this.mySelf.querySelector(".slider > .thumb.left"),l=this.mySelf.querySelector(".slider > .range");if(a.style.left=i+"%",l.style.left=i+"%",this.inputL.style.zIndex=i>SLIDER_N90?"4":"3",this.thumbLeft){const t=parseInt(`${parseInt(a.style.left.replace("%",""))/SLIDER_PERCENTAGE*(this.inputL.offsetWidth-SLIDER_N24)}`);this.valueL=t,this.thumbLeft.style.left=`${t}px`}}setRightValue(){const t=this.mySelf.querySelector(".input-left"),e=this.inputR,s=parseInt(e.min),n=parseInt(e.max),o=Math.max(parseInt(e.value),parseInt(t.value));e.value=o.toString();const i=(o-s)/(n-s)*SLIDER_PERCENTAGE,a=this.mySelf.querySelector(".slider > .thumb.right"),l=this.mySelf.querySelector(".slider > .range");if(a.style.right=SLIDER_PERCENTAGE-i+"%",l.style.right=SLIDER_PERCENTAGE-i+"%",this.inputR.style.zIndex=i=0&&t{t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.click(e)})})}setValue(t){const e=t-this.getCurrentState();if(e>0)for(let t=0;t\n
\n \n
ok
\n `:e.innerHTML=`\n
\n
\n \n
ok
\n `,this.mySelf.appendChild(e),addFocusable(e.querySelector(`.${STEPPER_INNER_BULLET}`),{label:this.labels[t-1]},{event:()=>{this.click(t-1)}})}}accessibility(){this.mySelf.querySelectorAll(`*[class*="${STEPPER_PROGRESS_STEP}"]`).forEach((t,e)=>{addFocusable(t,{tabindex:"0"},{event:()=>this.decide(t,e)}),this.screenReader(t,e)})}decide(t,e){t.classList.contains(BcCommonConstants.OUTLINE_ELEMENT)&&(e===this.currentStep+1?this.next():e===this.currentStep-1&&this.back())}screenReader(t,e){t.addEventListener(BcCommonConstants.EVENT_KEY_UP,t=>{t.key===BcCommonConstants.KEY_EVENT_ARROW_RIGHT?this.focusNext(e):t.key===BcCommonConstants.KEY_EVENT_ARROW_LEFT?this.focusBack(e):t.key===BcCommonConstants.KEY_EVENT_HOME?this.focusHomeEnd(e,!0):t.key===BcCommonConstants.KEY_EVENT_END&&this.focusHomeEnd(e)})}focusHomeEnd(t,e=!1){null!==this.getCurrentElement(t)&&(this.getCurrentElement(t).classList.remove(BcCommonConstants.OUTLINE_ELEMENT),t=e?this.initialStep:this.labels.length-1,this.getCurrentElement(t).classList.add(BcCommonConstants.OUTLINE_ELEMENT),this.getCurrentElement(t).focus())}focusNext(t){null!==this.getCurrentElement(t)&&(this.getCurrentElement(t).classList.remove(BcCommonConstants.OUTLINE_ELEMENT),t0?t--:t=this.labels.length-1,this.getCurrentElement(t).classList.add(BcCommonConstants.OUTLINE_ELEMENT),this.getCurrentElement(t).focus(),this.getStatus(t))}getStatus(t){this.status[t]===STEPPER_IS_ACTIVE&&(this.currentStep=t)}getCurrentElement(t){return this.mySelf.querySelectorAll(`*[class*="${STEPPER_PROGRESS_STEP}"]`)[t]}progressHorizontal(){this.progressTrack.style.width=this.width*this.maxStep+"%"}progressVertical(){this.progressTrack.style.height=this.height*this.maxStep+"%"}setIndexStatus(){const t=this.currentStep;for(let e=0;ethis.maxStep&&(this.maxStep=t),this.status[t]=STEPPER_IS_ACTIVE,this.direction===STEPPER_HORIZONTAL_DIRECTION?this.progressHorizontal():this.progressVertical(),this.setBulletStatus(s)),e?this.setCurrentStep(t):this.currentStep=t}back(t=!1){this.currentStep>0&&(this.status[this.currentStep]=STEPPER_IS_COMPLETE,this.setCurrentStep(this.currentStep-1),this.status[this.currentStep]=STEPPER_IS_ACTIVE,this.setBulletStatus(t))}setBulletStatus(t=!1){this.status.forEach((t,e)=>{const s=()=>{this.progressBulletArray[e].classList.remove(STEPPER_ACTIVE_STEP),this.progressBulletArray[e].classList.add(STEPPER_DEFAULT_STEP),this.progressStepArray[e].classList.remove(STEPPER_ACTIVE_STEP)};switch(t){case STEPPER_IS_ACTIVE:this.progressBulletArray[e].classList.remove(STEPPER_DEFAULT_STEP,STEPPER_COMPLETE_STEP),this.progressBulletArray[e].classList.add(STEPPER_ACTIVE_STEP),this.progressStepArray[e].classList.add(STEPPER_ACTIVE_STEP),this.progressStepArray[e].setAttribute(BcCommonConstants.ARIA_SELECTED,"true");break;case STEPPER_IS_DEFAULT:s();break;case STEPPER_IS_COMPLETE:this.progressBulletArray[e].classList.remove(STEPPER_ACTIVE_STEP),this.progressBulletArray[e].classList.add(STEPPER_COMPLETE_STEP),this.progressStepArray[e].classList.remove(STEPPER_ACTIVE_STEP),this.progressStepArray[e].setAttribute(BcCommonConstants.ARIA_SELECTED,"false");break;default:s()}})}setCurrentStep(t){this.currentStep=t,this.outputFunction&&this.outputFunction(t)}getCurrentState(){return this.currentStep}}const SKIP_LINK_CONTENT_CLASS=`${BcCommonConstants.PREFIX_LIB}-skip-link`;class BcSkipLinkBehavior extends BcDefaultBehavior{constructor(){super()}static setUpAll(){const t=Array.from(document.querySelectorAll(`a[class~='${SKIP_LINK_CONTENT_CLASS}']`)),e=[];for(let s=0;s{const t=this.mySelf.getAttribute("href");document.querySelector(t).scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}})}}const INPUT_CLASS=`${BcCommonConstants.PREFIX_LIB}-input`,INPUT_ACTIVE_CLASS=`${BcCommonConstants.PREFIX_LIB}-active`,INPUT_FORM_FILE=`${BcCommonConstants.PREFIX_LIB}-form-field`;class BcInputBehavior extends BcDefaultBehavior{constructor(){super(),this.checkInput=(t=>null!=t&&""!==t),this.addRemoveClass=((t,e)=>t?e.classList.add(INPUT_ACTIVE_CLASS):e.classList.remove(INPUT_ACTIVE_CLASS)),this.updateState=(t=>{this.mySelf&&this.addRemoveClass(this.checkInput(this.mySelf.value),this.mySelf)})}static setUpAll(){const t=Array.from(document.querySelectorAll(`[class^='${INPUT_CLASS}']`)),e=[];for(const s of t){const t=new BcInputBehavior;t.setElement(s),t.setUp(),e.push(t)}return e}_setUp(){this.addRemoveClass(this.checkInput(this.mySelf.value),this.mySelf),this.mySelf.addEventListener(BcCommonConstants.EVENT_INPUT,this.updateState),this.getInputs()}getInputs(){const t=Array.from(document.querySelectorAll(`[class~='${INPUT_FORM_FILE}']`));for(const e of t)addFocusable(e,{tabindex:"0"})}}class BcBadgeBehavior extends BcDefaultBehavior{constructor(){super()}setPosition(t){this.removePosition(),"button-left"===t&&this.mySelf.classList.add(BADGE_BUTTON_LEFT),"button-right"===t&&this.mySelf.classList.add(BADGE_BUTTON_RIGHT),"top-right"===t&&this.mySelf.classList.add(BADGE_TOP_RIGHT),"top-left"===t&&this.mySelf.classList.add(BADGE_TOP_LEFT)}removePosition(){this.mySelf.classList.contains(BADGE_BUTTON_LEFT)&&this.mySelf.classList.remove(BADGE_BUTTON_LEFT),this.mySelf.classList.contains(BADGE_BUTTON_RIGHT)&&this.mySelf.classList.remove(BADGE_BUTTON_RIGHT),this.mySelf.classList.contains(BADGE_TOP_RIGHT)&&this.mySelf.classList.remove(BADGE_TOP_RIGHT),this.mySelf.classList.contains(BADGE_TOP_LEFT)&&this.mySelf.classList.remove(BADGE_TOP_LEFT)}setColor(t){this.removeColor(),"red"===t&&this.mySelf.classList.add(BADGE_RED),"green"===t&&this.mySelf.classList.add(BADGE_GREEN),"yellow"===t&&this.mySelf.classList.add(BADGE_YELLOW),"pink"===t&&this.mySelf.classList.add(BADGE_PINK),"purple"===t&&this.mySelf.classList.add(BADGE_PURPLE),"blue"===t&&this.mySelf.classList.add(BADGE_BLUE)}removeColor(){this.mySelf.classList.contains(BADGE_RED)&&this.mySelf.classList.remove(BADGE_RED),this.mySelf.classList.contains(BADGE_GREEN)&&this.mySelf.classList.remove(BADGE_GREEN),this.mySelf.classList.contains(BADGE_YELLOW)&&this.mySelf.classList.remove(BADGE_YELLOW),this.mySelf.classList.contains(BADGE_PINK)&&this.mySelf.classList.remove(BADGE_PINK),this.mySelf.classList.contains(BADGE_PURPLE)&&this.mySelf.classList.remove(BADGE_PURPLE),this.mySelf.classList.contains(BADGE_BLUE)&&this.mySelf.classList.remove(BADGE_BLUE)}setSize(t){this.removeSize(),"small"===t&&this.mySelf.classList.add(BADGE_SMALL),"medium"===t&&this.mySelf.classList.add(BADGE_MEDIUM)}removeSize(){this.mySelf.classList.contains(BADGE_SMALL)&&this.mySelf.classList.remove(BADGE_SMALL),this.mySelf.classList.contains(BADGE_MEDIUM)&&this.mySelf.classList.remove(BADGE_MEDIUM)}setBorder(t){t?this.mySelf.classList.add(BADGE_BORDER):t||this.mySelf.classList.remove(BADGE_BORDER)}setAnimation(){this.mySelf&&(setTimeout(()=>{this.mySelf.classList.add(BADGE_ANIMATION)}),this.mySelf.classList.contains(BADGE_ANIMATION)&&this.mySelf.classList.remove(BADGE_ANIMATION))}setNotification(t,e){if("medium"==t&&Number.isInteger(e)){const t=99;return parseInt(e){if(null!=e){addFocusable(t,{tabindex:"0"});const e=t.getAttribute("bctooltiptext");t.setAttribute("aria-label",e)}})}setTabIndexIcon(t){const e=this.getHeader(t),s=Array.from(e.querySelectorAll(`[class~='${ACCORDION_HEADER_LEFT_CLASS}'] .${ACCORDION_TEXT_CONTAINER_CLASS} .${BcCommonConstants.ICONS_CLASS}`)),n=Array.from(e.querySelectorAll(`[class~='${ACCORDION_HEADER_RIGHT_CLASS}'] .${ACCORDION_ACTION_CONTAINER_CLASS} .${BcCommonConstants.ICONS_CLASS}`));s.concat(n).forEach(t=>{addFocusable(t,{tabindex:"0"})})}getAccordionsGroup(){const t=Array.from(document.querySelectorAll(`div[class~='${ACCORDIONS_GROUPS_SUFIX}']`));for(const e of t)addFocusable(e,{role:"group",tabindex:"-1"});return t}getAccordions(){return Array.from(this.mySelf.querySelectorAll(`:scope > article[class~='${ACCORDION_CLASS}'],:scope >*>*> article[class~='${ACCORDION_CLASS}']`))}addExpandEvent(t,e){if(null!=t){const s=this.getContent(t),n=this.getHeader(t);this.setLabelTooltipText(t);const o=()=>{const n=t.closest(`.${ACCORDIONS_GROUPS_SUFIX}`),o=n.classList.contains(`${ACCORDION_SINGLE_CLASS}`),i=Array.from(n.querySelectorAll(`:scope > [class~='${ACCORDION_CLASS}']`));for(const e of i)e!==t&&o&&e.classList.remove(`${ACCORDION_ACTIVE_CLASS}`);const a=this.getHeader(t);if(t.id===a.getAttribute("aria-controls")){const n=t.classList.toggle(`${ACCORDION_ACTIVE_CLASS}`);n&&this.activeFunction&&this.activeFunction(e),a.setAttribute("aria-expanded",String(n)),s.setAttribute("tabindex",n?"0":"-1")}},i=n.querySelector(`.${ACCORDION_TOGGLE_BTN_CLASS}`);if(null!==n&&!this.closeButtons.includes(i)){i.addEventListener("click",o),this.closeButtons.push(i);const t=n.classList.contains(ACCORDION_ACTIVE_CLASS);addFocusable(n,{expanded:String(t),level:"1",tabindex:"0"},{event:o}),addFocusable(s,{role:"region",level:"2"},{event:o})}}}getCurrentElement(t){return this.mySelf.querySelectorAll("header")[t]}setAccessibility(){this.mySelf.querySelectorAll("header").forEach((t,e)=>{this.addScreenReader(t,e)})}addScreenReader(t,e){t.addEventListener(BcCommonConstants.EVENT_KEY_UP,t=>{t.key===BcCommonConstants.KEY_EVENT_ARROW_DOWN?this.focusNext(e):t.key===BcCommonConstants.KEY_EVENT_ARROW_UP?this.focusBack(e):t.key===BcCommonConstants.KEY_EVENT_HOME?this.focusHomeEnd(e,!0):t.key===BcCommonConstants.KEY_EVENT_END&&this.focusHomeEnd(e)})}focusHomeEnd(t,e=!1){const s=this.mySelf.querySelectorAll("header");null!==this.getCurrentElement(t)&&(this.getCurrentElement(t).classList.remove(BcCommonConstants.OUTLINE_ELEMENT),t=e?0:s.length-1,this.getCurrentElement(t).classList.add(BcCommonConstants.OUTLINE_ELEMENT),this.getCurrentElement(t).focus())}focusNext(t){const e=this.mySelf.querySelectorAll("header");null!==this.getCurrentElement(t)&&(this.getCurrentElement(t).classList.remove(BcCommonConstants.OUTLINE_ELEMENT),t0?t--:t=e.length-1,this.getCurrentElement(t).classList.add(BcCommonConstants.OUTLINE_ELEMENT),this.getCurrentElement(t).focus())}}const BC_ALERT=`${BcCommonConstants.PREFIX_LIB}-alert`,BC_ALERT_ACTIVE=`${BcCommonConstants.PREFIX_LIB}-alert-active`,BC_ALERT_CLOSE=`${BcCommonConstants.PREFIX_LIB}-alert-close`,BC_ALERT_CLOSING=`${BcCommonConstants.PREFIX_LIB}-alert-closing`,BC_ALERT_DISMISSIBLE=`${BcCommonConstants.PREFIX_LIB}-alert-dismissible`,BC_ALERT_INLINE=`${BcCommonConstants.PREFIX_LIB}-alert-inline`,BC_ALERT_CONTENT=`${BcCommonConstants.PREFIX_LIB}-alert-content`,MAX_TIME_DELAY=1e4,MIN_TIME_DELAY=5e3;class BcAlertBehavior extends BcDefaultBehavior{constructor(){super(),this.timeOut=0}static setUpAll(){const t=Array.from(document.querySelectorAll(`.${BC_ALERT}`)),e=[];for(let s=0;sthis.close()}),this.getContent()}getCloseButton(){this.bcAlertCloseButton=this.mySelf.querySelector(`.${BC_ALERT_CLOSE}`)}getContent(){const t=Array.from(this.mySelf.querySelectorAll(`.${BC_ALERT_CONTENT}`));for(const e of t)addFocusable(e,{tabindex:"0"})}listeners(){this.bcAlertCloseButton.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.close()}),this.hideAlertAfterCloseAnimation()}close(){(this.mySelf.classList.contains(BC_ALERT_ACTIVE)||this.mySelf.classList.contains(BC_ALERT_DISMISSIBLE))&&this.mySelf.classList.add(BC_ALERT_CLOSING)}onClose(t){this.onCloseFunction=t}hideAlertAfterCloseAnimation(){this.mySelf.addEventListener("animationend",t=>{t.animationName!==BcCommonConstants.FADE_OUT_OPACITY&&t.animationName!==BcCommonConstants.SLIDE_UP_REVERSE||(this.mySelf.classList.remove(BC_ALERT_CLOSING),this.mySelf.classList.remove(BC_ALERT_INLINE),replaceClass(this.mySelf,BC_ALERT_ACTIVE,BC_ALERT),this.onCloseFunction&&this.onCloseFunction())})}open(){replaceClass(this.mySelf,BC_ALERT,BC_ALERT_ACTIVE),0!=this.timeOut&&(this.mySelf.setAttribute("role","alert"),setTimeout(()=>{this.close()},this.timeOut))}setTimeOut(t){this.timeOut=t>=MIN_TIME_DELAY&&t<=MAX_TIME_DELAY?t:t>MAX_TIME_DELAY?MAX_TIME_DELAY:t>0&&tthis.close()})}getCloseButton(){this.bcNotificationCloseButton=this.mySelf.querySelector(`.${BC_NOTIFICATION_CLOSE}`)}listeners(){this.bcNotificationCloseButton.addEventListener(BcCommonConstants.EVENT_CLICK,t=>this.close()),this.hideNotificationAfterCloseAnimation()}close(){(this.mySelf.classList.contains(BC_NOTIFICATION_ACTIVE)||this.mySelf.classList.contains(BC_NOTIFICATION_DISMISSIBLE))&&this.mySelf.classList.add(BC_NOTIFICATION_CLOSING)}onClose(t){this.onCloseFunction=t}hideNotificationAfterCloseAnimation(){this.mySelf.addEventListener("animationend",t=>{"fade-out-opacity"!==t.animationName&&"slide-up-reverse"!==t.animationName||(this.mySelf.classList.remove(BC_NOTIFICATION_CLOSING),this.mySelf.classList.remove(BC_NOTIFICATION_INLINE),replaceClass(this.mySelf,BC_NOTIFICATION_ACTIVE,BC_NOTIFICATION),this.onCloseFunction&&this.onCloseFunction())})}open(){replaceClass(this.mySelf,BC_NOTIFICATION,BC_NOTIFICATION_ACTIVE),0!=this.timeOut&&setTimeout(()=>{this.close()},this.timeOut)}setTimeOut(t){this.timeOut=t>=_MIN_TIME_DELAY&&t<=_MAX_TIME_DELAY?t:t>_MAX_TIME_DELAY?_MAX_TIME_DELAY:t>0&&t<_MIN_TIME_DELAY?_MIN_TIME_DELAY:0}}class BcCalendarUtilities{topBarSingleMonth(){return`
arrow2-left
arrow2-right
`}topBarSingleMonthSplitSelector(){return`
arrow2-left
arrow2-rightarrow2-left
arrow2-right
`}topBarMobileScrollable(){return`
\n
`}getOneSplitSelectorMonth(t,e){return{month:t,year:e}}getOneSimpleMonth(t,e){return{month:t,year:e}}getDisplayedMonthElement(t){const e=`\n ${t}\n
\n
`,s=document.createElement("div");return s.classList.add(BcDateConstants.DISPLAYED_CALENDARS_CLASS),s.innerHTML=e,s}getTwelveScrollableMonths(t,e){const s=[];for(let n=t-BcDateConstants.NUMBERS.CALENDAR_N6;n<=t+BcDateConstants.NUMBERS.CALENDAR_N6;n++){const t=new Date(e,n,1),o={month:t.getMonth(),year:t.getFullYear()};s.push(o)}return s}getTwoRangeMonths(t,e){const s=[],n=new Date;n.setMonth(t,1),n.setFullYear(e);for(let e=t;e<=t+1;e++){n.setMonth(e);const t={month:n.getMonth(),year:n.getFullYear()};s.push(t)}return s}goToPreviousMonth(t){t.month--,t.month<0&&(t.month=11,t.year--)}getCalendarSelectMonthOrYear(){return`\n
\n chevron-left\n
\n
chevron-right
\n
`}getRangeCalendarButtons(){return`
`}getContentFixedContainer(){return`
\n

Desde

mm/dd/aa

\n

Hasta

mm/dd/aa

\n
\n \n error`}confirmBtnsString(){return`\n `}createARangeButton(t){const e=document.createElement("button");return e.classList.add(BcDateConstants.BC_FILTER_LBL),e.innerHTML=`\n

últimos ${t} días

\n `,e.setAttribute("value",t+""),e.setAttribute(BcCommonConstants.DISABLED,"true"),e}addWeekDays(t){t.innerHTML="",BcDateConstants.WEEK_SHORT.forEach(e=>{const s=document.createElement("p");s.classList.add(BcCommonConstants.SMALL,BcCommonConstants.TEXT_GRAY),s.textContent=e,t.appendChild(s)})}goToNextMonth(t){t.month++,t.month>BcDateConstants.NUMBERS.CALENDAR_N11&&(t.month=0,t.year++)}validateLeapYear(t){return t%BcDateConstants.NUMBERS.CALENDAR_N100==0?t%BcDateConstants.NUMBERS.CALENDAR_N400==0:t%BcDateConstants.NUMBERS.CALENDAR_N4==0}compareDates(t,e){return t-e}getMonthIndex(t){return BcDateConstants.MONTHS_TEXT.findIndex(e=>e===t)}getClickedDateYear(t){const e=t.querySelectorAll("h6");return e[1]?e[1].textContent:e[0].textContent.split(" ")[1]}verifyMobile(){return isMobileDevice()}getNumberOfDays(t,e){return BcDateConstants.LONG_MONTHS.includes(t)?BcDateConstants.NUMBERS.CALENDAR_N31:BcDateConstants.SHORT_MONTHS.includes(t)?BcDateConstants.NUMBERS.CALENDAR_N30:this.validateLeapYear(e)?BcDateConstants.NUMBERS.CALENDAR_N29:BcDateConstants.NUMBERS.CALENDAR_N28}getClickedDateMonth(t){return t.querySelector("h6").textContent.split(" ")[0]}configMonthElement(t,e){const s=this.getDisplayedMonthElement(t),n=s.querySelector(`.${BcDateConstants.DAYS_CLASS}`),o=s.querySelector(`.${BcDateConstants.YEAR_CLASS}`),i=s.querySelector(`.${BcDateConstants.MONTH_NAME_CLASS}`),a=s.querySelector(`.${BcDateConstants.WEEK_CLASS}`);o?(i.textContent=BcDateConstants.MONTHS_TEXT[e.month],o.textContent=e.year+""):i.textContent=BcDateConstants.MONTHS_TEXT[e.month]+" "+e.year,this.addWeekDays(a),n.innerHTML="";const l=new Date;return l.setFullYear(e.year),l.setMonth(e.month,1),{emptyDays:l.getDay(),month:n,tempDate:l,element:s}}}class BcCalendarBehavior extends BcDefaultBehavior{constructor(){super(...arguments),this.today=new Date,this.yearGroup=[this.today.getFullYear()-BcDateConstants.NUMBERS.CALENDAR_N11,this.today.getFullYear()],this.displayedMonths=[],this.bcCalendarUtilities=new BcCalendarUtilities}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class='${BcDateConstants.CALENDAR_CLASS}']`)),e=[];for(let s=0;sthis.maxDate&&(s=!1)}return s}dayEnabled(t,e){t?this.addListenerToSelectDate(e):e.classList.add(BcDateConstants.DISABLED_DAY)}setUpDisplayedCalendars(t,e){t.innerHTML="",this.displayedMonths.forEach(s=>{t.appendChild(this.createAMonthElement(s,e))})}simpleCalendarSetUp(){this.setUpDisplayedCalendars(this.calendarsContainer,this.bcCalendarUtilities.topBarSingleMonth()),this.calendarState=BcDateConstants.STATE_DAYS,this.topBarSelector=this.mySelf.querySelector(`.${BcDateConstants.TOP_BAR_SELECTOR_CLASS}`),this.next=this.mySelf.querySelector(`.${BcDateConstants.NEXT_CLASS}`),this.prev=this.mySelf.querySelector(`.${BcDateConstants.PREV_CLASS}`),this.monthAndDay=this.mySelf.querySelector("h6"),this.monthAndDay.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.changeCalendarType()),this.bcCalendarUtilities.verifyMobile()&&this.prependMobileTitleText(),this.addListenersForPrevAndNextBtns()}prependMobileTitleText(){const t=document.createElement("p");t.classList.add(BcDateConstants.MOBILE_TITLE_CLASS),t.textContent=BcDateConstants.MOBILE_CALENDAR_TITLE,this.mySelf.prepend(t),this.mySelf.insertAdjacentHTML("beforeend",`error`),this.btnCancel=this.mySelf.querySelector(`.${BcDateConstants.CANCEL_CLASS}`),this.btnCancel.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.eventRangeCanceled()})}addListenersForPrevAndNextBtns(){this.next.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.nextAction(),{once:!0}),this.prev.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.prevAction(),{once:!0})}nextYear(t){t.year++,this.setElementsWithCalendarState(t)}setElementsWithCalendarState(t){switch(this.calendarState){case BcDateConstants.STATE_SPLIT:this.setUpDisplayedMonthElement(t);break;case BcDateConstants.STATE_MONTHS:this.setElementsForMonthSelector();break;case BcDateConstants.STATE_YEARS:this.setElementsForYearSelector();break;default:this.setUpDisplayedMonthElement(t)}}previousYear(t){t.year--,this.setElementsWithCalendarState(t)}setUpDisplayedMonthElement(t){switch(this.calendarState){case BcDateConstants.STATE_RANGE:this.rangeDesktopCalendarSetUp();break;case BcDateConstants.STATE_SPLIT:this.splitCalendarSetUp();break;case BcDateConstants.STATE_DAYS:this.simpleCalendarSetUp();break;default:this.simpleCalendarSetUp()}}setUpDisplayedCalendarse(){this.setUpDisplayedCalendars(this.calendarsContainer,this.bcCalendarUtilities.topBarSingleMonthSplitSelector()),this.calendarState=BcDateConstants.STATE_SPLIT,this.topBarSelector=this.mySelf.querySelector(`.${BcDateConstants.TOP_BAR_SELECTOR_CLASS}`),this.prevMonthBtn=this.topBarSelector.childNodes[0],this.nextMonthBtn=this.topBarSelector.childNodes[BcDateConstants.NUMBERS.CALENDAR_N2]}splitCalendarSetUp(){this.setUpDisplayedCalendarse(),this.prevYearBtn=this.topBarSelector.childNodes[BcDateConstants.NUMBERS.CALENDAR_N3],this.nextYearBtn=this.topBarSelector.childNodes[BcDateConstants.NUMBERS.CALENDAR_N5],isMobileDevice()&&this.prependMobileTitleText(),this.addListenersForSplitSelectorCalendar(),this.topBarSelector.querySelectorAll("h6")[0].addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.setElementsForMonthSelector(),{once:!0}),this.topBarSelector.querySelectorAll("h6")[1].addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.setElementsForYearSelector(),{once:!0})}addListenersForSplitSelectorCalendar(){this.prevMonthBtn.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.bcCalendarUtilities.goToPreviousMonth(this.displayedMonths[0]),this.setUpDisplayedMonthElement(this.displayedMonths[0])}),this.nextMonthBtn.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.bcCalendarUtilities.goToNextMonth(this.displayedMonths[0]),this.setUpDisplayedMonthElement(this.displayedMonths[0])}),this.prevYearBtn.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.previousYear(this.displayedMonths[0])}),this.nextYearBtn.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.nextYear(this.displayedMonths[0])})}addMonthsPicker(){for(let t=0;tthis.selectDateOne(t))}addListenerToSelectMonth(t,e){t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.selectMonth(e,this.displayedMonths[0]))}addListenerToSelectYear(t,e){t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.selectYear(e,this.displayedMonths[0]))}nextYearGroup(t){t.year+=BcDateConstants.NUMBERS.CALENDAR_N12,this.yearGroup=[t.year-BcDateConstants.NUMBERS.CALENDAR_N11,t.year],this.setElementsWithCalendarState(t)}setElementsForMonthSelector(){this.calendarState=BcDateConstants.STATE_MONTHS,this.mySelf.innerHTML=this.bcCalendarUtilities.getCalendarSelectMonthOrYear(),this.topBarSelector=this.mySelf.querySelector(`.${BcDateConstants.TOP_BAR_SELECTOR_CLASS}`),this.addPrevAndNextBtnsToChangeYear(),this.changeYearAndAddListener(),this.monthsOrYearsContainer=this.mySelf.querySelector(`.${BcDateConstants.MONTHS_OR_YEARS_CLASS}`),this.addMonthsPicker(),isMobileDevice()&&this.prependMobileTitleText()}changeYearAndAddListener(){const t=this.topBarSelector.querySelector("h6");t.textContent=`${this.displayedMonths[0].year}`,t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.changeCalendarType(),{once:!0})}setElementsForYearSelector(){this.calendarState=BcDateConstants.STATE_YEARS,this.yearGroup=[this.displayedMonths[0].year-BcDateConstants.NUMBERS.CALENDAR_N11,this.displayedMonths[0].year],this.mySelf.innerHTML=this.bcCalendarUtilities.getCalendarSelectMonthOrYear(),this.topBarSelector=this.mySelf.querySelector(`.${BcDateConstants.TOP_BAR_SELECTOR_CLASS}`),this.addPrevAndNextBtnsToChangeYearGroup(),this.changeYearGroupAndAddListener(),this.monthsOrYearsContainer=this.mySelf.querySelector(`.${BcDateConstants.MONTHS_OR_YEARS_CLASS}`),this.addYearsPicker(),isMobileDevice()&&this.prependMobileTitleText()}changeYearGroupAndAddListener(){const t=this.topBarSelector.querySelector("h6");t.textContent=`${this.yearGroup[0]} - ${this.yearGroup[1]}`,t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.changeCalendarType(),{once:!0})}createBtnsfromArray(t){t.forEach(t=>{this.upperBtnsContainer.appendChild(this.bcCalendarUtilities.createARangeButton(t))})}rangeDesktopCalendarFirstSet(){this.calendarState=BcDateConstants.STATE_RANGE,this.mySelf.innerHTML="",this.mySelf.innerHTML=this.bcCalendarUtilities.getRangeCalendarButtons(),this.upperBtnsContainer=this.mySelf.querySelector(`.${BcDateConstants.UPPPER_BTNS_CLASS}`);const t=this.mySelf.getAttribute(BcDateConstants.RANGES)?this.mySelf.getAttribute(BcDateConstants.RANGES):"[]";let e=[];try{e=JSON.parse(t)}catch(t){e=[]}this.createBtnsfromArray(e)}rangeDesktopCalendarSetUp(){this.rangeDesktopCalendarFirstSet(),this.calendarsContainer=document.createElement("div"),this.calendarsContainer.classList.add(BcDateConstants.TWO_CALENDARS_CLASS),this.mySelf.appendChild(this.calendarsContainer),this.setUpDisplayedCalendars(this.calendarsContainer,this.bcCalendarUtilities.topBarSingleMonth()),this.mySelf.appendChild(this.getDesktopConfirmBottom()),this.mySelf.querySelectorAll(`.${BcDateConstants.NEXT_CLASS}`)[0].textContent=" ",this.mySelf.querySelectorAll(`.${BcDateConstants.PREV_CLASS}`)[1].textContent=" ",this.next=this.mySelf.querySelectorAll(`.${BcDateConstants.NEXT_CLASS}`)[1],this.prev=this.mySelf.querySelectorAll(`.${BcDateConstants.PREV_CLASS}`)[0],this.selectedDates&&this.selectRange(),this.addButtonListenersForConfirmAndCancel(),this.addListenersForPrevAndNextBtns(),this.addButtonListenersForUpperBtns()}rangeMobileCalendarSetUp(){this.calendarState=BcDateConstants.STATE_RANGE,this.mySelf.innerHTML="",this.mySelf.classList.add(BcDateConstants.MOBILE_CALENDAR_CLASS),this.calendarsContainer=document.createElement("div"),this.calendarsContainer.classList.add(BcDateConstants.SCROLLABLE_CALENDARS_CLASS),this.mySelf.appendChild(this.calendarsContainer),this.setUpDisplayedCalendars(this.calendarsContainer,this.bcCalendarUtilities.topBarMobileScrollable()),this.mySelf.appendChild(this.getFixedItemsScrollableCalendars()),this.selectedDates&&this.selectRange(),this.addButtonListenersForConfirmAndCancel()}getDesktopConfirmBottom(){const t=document.createElement("div");return t.classList.add(BcDateConstants.BUTTON_CONTAINER_CLASS),t.innerHTML=this.bcCalendarUtilities.confirmBtnsString(),this.btnConfirm=t.querySelector(`.${BcDateConstants.CONFIRM_CLASS}`),this.selectedDates||this.btnConfirm.setAttribute(BcCommonConstants.DISABLED,"true"),this.btnCancel=t.querySelector(`.${BcDateConstants.CANCEL_CLASS}`),t}getFixedItemsScrollableCalendars(){const t=document.createElement("div");return t.classList.add(BcDateConstants.FIXED_CONTENT_CLASS),t.innerHTML=this.bcCalendarUtilities.getContentFixedContainer(),this.btnConfirm=t.querySelector(`.${BcDateConstants.CONFIRM_CLASS}`),this.btnCancel=t.querySelector(`.${BcDateConstants.CANCEL_CLASS}`),t}addButtonListenersForConfirmAndCancel(){this.btnConfirm.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.eventRangeSelected()}),this.btnCancel.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.eventRangeCanceled()})}addButtonListenersForUpperBtns(){this.upperBtnsContainer.childNodes.forEach(t=>{const e=parseInt(t.getAttribute("value"));t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.automaticRange(e)})})}addPrevAndNextBtnsToChangeYear(){this.next=this.mySelf.querySelector("."+BcDateConstants.NEXT_CLASS),this.prev=this.mySelf.querySelector("."+BcDateConstants.PREV_CLASS),this.next.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.nextYear(this.displayedMonths[0])),this.prev.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.previousYear(this.displayedMonths[0]))}addPrevAndNextBtnsToChangeYearGroup(){this.next=this.mySelf.querySelector("."+BcDateConstants.NEXT_CLASS),this.prev=this.mySelf.querySelector("."+BcDateConstants.PREV_CLASS),this.next.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.nextYearGroup(this.displayedMonths[0])),this.prev.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.previousYearGroup(this.displayedMonths[0]))}changeCalendarType(){switch(this.calendarState){case BcDateConstants.STATE_DAYS:this.setElementsForMonthSelector();break;case BcDateConstants.STATE_MONTHS:this.setElementsForYearSelector();break;case BcDateConstants.STATE_YEARS:this.setElementsForMonthSelector();break;case BcDateConstants.STATE_SPLIT:this.splitCalendarSetUp();break;default:this.simpleCalendarSetUp()}}enableRangeButtons(){this.upperBtnsContainer.childNodes.forEach(t=>{t.removeAttribute(BcCommonConstants.DISABLED)})}prevAction(){this.calendarState===BcDateConstants.STATE_DAYS?(this.bcCalendarUtilities.goToPreviousMonth(this.displayedMonths[0]),this.setUpDisplayedMonthElement(this.displayedMonths[0])):this.calendarState===BcDateConstants.STATE_RANGE&&(this.displayedMonths.forEach(t=>{this.bcCalendarUtilities.goToPreviousMonth(t)}),this.setUpDisplayedMonthElement()),this.addBorderSelectedDates()}previousYearGroup(t){t.year-=12,this.yearGroup=[t.year-BcDateConstants.NUMBERS.CALENDAR_N11,t.year],this.setElementsWithCalendarState(t)}nextAction(){this.calendarState===BcDateConstants.STATE_RANGE?(this.displayedMonths.forEach(t=>{this.bcCalendarUtilities.goToNextMonth(t)}),this.setUpDisplayedMonthElement()):(this.bcCalendarUtilities.goToNextMonth(this.displayedMonths[0]),this.setUpDisplayedMonthElement(this.displayedMonths[0])),this.addBorderSelectedDates()}addYearsPicker(){this.monthsOrYearsContainer.innerHTML="";for(let t=0;t<=this.yearGroup[1]-this.yearGroup[0];t++){const e=document.createElement("p"),s=this.yearGroup[0]+t;e.textContent=`${s}`,this.monthsOrYearsContainer.appendChild(e),this.addListenerToSelectYear(e,s)}}selectDateOne(t){if(this.upperBtnsContainer&&this.enableRangeButtons(),this.firstDateIsSelected||t.classList.contains(BcDateConstants.SELECTED_DATE_CLASS))this.selectDateTwo(t);else{this.calendarState!==BcDateConstants.STATE_RANGE&&this.deleteAllSelected();const e=t.parentElement.parentElement;t.classList.add(BcDateConstants.SELECTED_DATE_CLASS),this.date=new Date,this.date.setHours(BcDateConstants.NUMBERS.CALENDAR_N12),this.date.setMonth(this.bcCalendarUtilities.getMonthIndex(this.bcCalendarUtilities.getClickedDateMonth(e)),parseInt(t.textContent)),this.date.setFullYear(parseInt(this.bcCalendarUtilities.getClickedDateYear(e))),this.selectDateOneDates()}this.addBorderSelectedDates()}selectDateOneDates(){const t=new CustomEvent(BcCommonConstants.EVENT_SELECT,{detail:this.date});this.mySelf.dispatchEvent(t),this.selectedDates&&this.selectedDates.length===BcDateConstants.NUMBERS.CALENDAR_N2&&this.addDatesToArraySelectRangeAndSort(),this.calendarState===BcDateConstants.STATE_RANGE&&(this.firstDateIsSelected=!0)}selectDateTwo(t){if(!t.classList.contains(BcDateConstants.SELECTED_DATE_CLASS)){const e=t.parentElement.parentElement;this.dateTwo=new Date,this.dateTwo.setHours(BcDateConstants.NUMBERS.CALENDAR_N12),this.dateTwo.setMonth(this.bcCalendarUtilities.getMonthIndex(this.bcCalendarUtilities.getClickedDateMonth(e)),parseInt(t.textContent)),this.dateTwo.setFullYear(parseInt(this.bcCalendarUtilities.getClickedDateYear(e))),this.addDatesToArraySelectRangeAndSort(),this.btnConfirm.removeAttribute("disabled"),this.firstDateIsSelected=!1}}addDatesToArraySelectRangeAndSort(){this.selectedDates=[this.date,this.dateTwo],this.selectedDates.sort((t,e)=>this.bcCalendarUtilities.compareDates(t,e)),this.selectRange(),isMobileDevice()&&(this.mySelf.querySelector(`.${BcDateConstants.FROM_CLASS}`).textContent=this.selectedDates[0].toISOString().substring(0,BcDateConstants.NUMBERS.CALENDAR_N10),this.mySelf.querySelector(`.${BcDateConstants.TO_CLASS}`).textContent=this.selectedDates[1].toISOString().substring(0,BcDateConstants.NUMBERS.CALENDAR_N10))}selectRange(){this.deleteAllRange(),this.deleteAllSelected();const t=this.mySelf.querySelectorAll(`.${BcDateConstants.DISPLAYED_CALENDARS_CLASS}`);for(let e=0;e{const e=new Date(s.year,s.month,parseInt(t.textContent));this.setAllDatesToZeroHours(e),this.addClassesSelectRange(e,t)})}}addClassesSelectRange(t,e){this.today.getTime()==t.getTime()&&e.classList.add(BcDateConstants.TODAY_CLASS),this.selectedDates[0].getTime()==t.getTime()&&e.classList.add(BcDateConstants.SELECTED_DATE_CLASS,BcDateConstants.INSIDE_RANGE_CLASS),this.selectedDates[1].getTime()==t.getTime()&&e.classList.add(BcDateConstants.SELECTED_DATE_CLASS,BcDateConstants.INSIDE_RANGE_CLASS),this.selectedDates[0].getTime()<=t.getTime()&&this.selectedDates[1].getTime()>=t.getTime()&&e.classList.add(BcDateConstants.INSIDE_RANGE_CLASS)}setAllDatesToZeroHours(t){t.setHours(0,0,0,0),this.selectedDates[0].setHours(0,0,0,0),this.selectedDates[1].setHours(0,0,0,0),this.today.setHours(0,0,0,0)}deleteAllRange(){this.mySelf.querySelectorAll("."+BcDateConstants.DAY).forEach(t=>{t.classList.remove(BcDateConstants.INSIDE_RANGE_CLASS)})}deleteAllSelected(){this.mySelf.querySelectorAll(`.${BcDateConstants.SELECTED_DATE_CLASS}`).forEach(t=>{t.classList.remove(BcDateConstants.SELECTED_DATE_CLASS),t.removeAttribute("date-selection")})}selectMonth(t,e){e.month=t,this.mySelf.getAttribute("type")===BcDateConstants.STATE_SPLIT?this.splitCalendarSetUp():this.simpleCalendarSetUp()}eventRangeSelected(){if(this.selectedDates&&this.selectedDates.length===BcDateConstants.NUMBERS.CALENDAR_N2){const t=new CustomEvent(BcCommonConstants.EVENT_RANGE,{detail:this.selectedDates});this.mySelf.dispatchEvent(t)}else this.eventRangeCanceled()}eventRangeCanceled(){const t=new CustomEvent(BcCommonConstants.EVENT_CANCEL);this.mySelf.dispatchEvent(t)}automaticRange(t){const e=new Date(this.date.getFullYear(),this.date.getMonth(),this.date.getDate()-t);this.dateTwo=e,this.addDatesToArraySelectRangeAndSort(),this.btnConfirm.removeAttribute("disabled"),this.addBorderSelectedDates()}emitEvent(){this.value=this.selectedDates,this.output&&this.output(this.value)}addBorderSelectedDates(){const t=`.${BcDateConstants.SELECTED_DATE_CLASS}~ .${BcDateConstants.SELECTED_DATE_CLASS}`,e=`.${BcDateConstants.DISPLAYED_CALENDARS_CLASS}:first-of-type .${BcDateConstants.SELECTED_DATE_CLASS}`,s=`.${BcDateConstants.SELECTED_DATE_CLASS}`,n=`.${BcDateConstants.SELECTED_DATE_CLASS}:not([date-selection])`,o=`.${BcDateConstants.SELECTED_DATE_CLASS}.${BcDateConstants.INSIDE_RANGE_CLASS}`,i=this.mySelf.querySelector(t);i?(i.setAttribute("date-selection","2"),this.mySelf.querySelector(n).setAttribute("date-selection","1")):this.mySelf.querySelectorAll(s).length>1?(this.mySelf.querySelector(e).setAttribute("date-selection","1"),this.mySelf.querySelector(n).setAttribute("date-selection","2")):this.mySelf.querySelector(o)&&(this.mySelf.querySelector(`${o}~${BcDateConstants.INSIDE_RANGE_CLASS}`)?this.mySelf.querySelector(o).setAttribute("date-selection","1"):this.mySelf.querySelector(o).setAttribute("date-selection","2"))}}const INPUT=`${BcCommonConstants.PREFIX_LIB}-input`,FORM_FIELD=`${BcCommonConstants.PREFIX_LIB}-form-field`,ICON=`${BcCommonConstants.PREFIX_LIB}-icon`,INPUT_AREA=`${BcCommonConstants.PREFIX_LIB}-input-area`,SPAN_INFO=`${BcCommonConstants.PREFIX_LIB}-span-info`,LEFT=`${BcCommonConstants.PREFIX_LIB}-left`,INVALID_FEEDBACK=`${BcCommonConstants.PREFIX_LIB}-invalid-feedback`,INPUT_ERROR=`${BcCommonConstants.PREFIX_LIB}-input-error`,INPUT_SUCCESS=`${BcCommonConstants.PREFIX_LIB}-input-success`,ICON_LEFT_ERROR=`${BcCommonConstants.PREFIX_LIB}-icon-left-error`,ICON_RIGHT_ERROR=`${BcCommonConstants.PREFIX_LIB}-icon-right-error`,INPUT_VALID=`${BcCommonConstants.PREFIX_LIB}-input-valid`,ICON_VALID=`${BcCommonConstants.PREFIX_LIB}-icon-valid`,VALID_FEEBACK=`${BcCommonConstants.PREFIX_LIB}-valid-feedback`,ICON_LEFT=`${BcCommonConstants.PREFIX_LIB}-icon-left`,_ICON_LEFT="icon-left",ICON_RIGHT=`${BcCommonConstants.PREFIX_LIB}-icon-right`,_ICON_RIGHT="icon-right",ICONS_LEFT=`${BcCommonConstants.PREFIX_LIB}-icons-left`,ICONS_RIGHT=`${BcCommonConstants.PREFIX_LIB}-icons-right`;class BcInputDateBehavior extends BcAbstractDropdownBehavior{static setUpAll(){const t=Array.from(document.querySelectorAll(`.${BcDateConstants.DATE_FORM_FIELD_CLASS}`)),e=[];for(let s=0;s{t.preventDefault(),this.setInputDateValue(t.detail.toISOString().substring(0,10)),this.closeDropdown()})}eventRigthIcon(){this.rigthIcon[1].addEventListener(BcCommonConstants.EVENT_CLICK,t=>{t.preventDefault(),this.rigthIcon[1].style.cursor=BcCommonConstants.CURSOR_POINTER,this.mySelf.classList.contains("bc-dropdown-active")?this.closeDropdown():this.openDrowndown()})}eventFocusOut(){this.inputDate.addEventListener(BcCommonConstants.EVENT_FOCUSOUT,t=>{t.preventDefault(),t.target.value&&this.setInputDateValue(t.target.value)},!1)}eventClick(){this.inputDate.addEventListener(BcCommonConstants.EVENT_CLICK,t=>{t.preventDefault()})}eventKeyPress(){this.inputDate.addEventListener(BcCommonConstants.EVENT_KEY_PRESS,t=>{"Enter"===t.key&&t.target.value&&this.setInputDateValue(t.target.value)})}setInputDateValue(t){this.inputDate.value=t,this.emitEvent()}emitEvent(){this.value=this.inputDate.value,this.output&&this.output(this.value)}setValue(t){this.inputDate&&(this.inputDate.value=t,this.emitEvent())}setDisabledState(t){this.inputDate.disabled=t}}class BcInputDateRangeBehavior extends BcAbstractDropdownBehavior{static setUpAll(){const t=Array.from(document.querySelectorAll(`.${BcDateConstants.RANGE_MOLECULE_CLASSES}`)),e=[];for(let s=0;sthis.setInputDateValues(t)),this.calendarElement.addEventListener(BcCommonConstants.EVENT_CANCEL,t=>this.toggleDropdown()),this.inputDate.addEventListener(BcCommonConstants.EVENT_CLICK,t=>{this.handleClick(t)}),this.inputDateTwo.addEventListener(BcCommonConstants.EVENT_CLICK,t=>{this.handleClick(t)}),this.mySelf.querySelectorAll("em").forEach(t=>{t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.openDrowndown(),!1),t.style.cursor=BcCommonConstants.CURSOR_POINTER})}handleClick(t){t.preventDefault(),this.toggleDropdown()}setInputDateValues(t){this.inputDate.value=t.detail[0].toISOString().substring(0,SIZE_DATE_STR),this.inputDateTwo.value=t.detail[1].toISOString().substring(0,SIZE_DATE_STR),this.toggleDropdown(),this.emitEvent()}emitEvent(){this.value={initialDate:this.inputDate.value,toDate:this.inputDateTwo.value},this.output&&this.output(this.value)}setValues(t){t&&t.initialDate&&t.toDate&&(this.inputDate.value=t.initialDate,this.inputDateTwo.value=t.toDate,this.emitEvent())}setDisabled(t){this.inputDate.disabled=t,this.inputDateTwo.disabled=t}}const INPUT_NUMBER=`${BcCommonConstants.PREFIX_LIB}-input-number`;class BcInputNumberBehavior extends BcDefaultBehavior{constructor(){super(),this.value=0}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class='${INPUT_NUMBER}']`)),e=[];for(let s=0;s{this.numberInput.stepDown(),this.inputBehavior.updateState(null),this.emitEvent()}),this.buttonIncrease.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.numberInput.stepUp(),this.inputBehavior.updateState(null),this.emitEvent()}),addFocusable(this.buttonDecrease,{role:"button",pressed:"false"}),addFocusable(this.buttonIncrease,{role:"button",pressed:"false"}),this.numberInput.addEventListener(BcCommonConstants.EVENT_INPUT,()=>{this.emitEvent()})}}const INPUT_CURRENCY=`${BcCommonConstants.PREFIX_LIB}-input-currency`;class BcInputCurrencyBehavior extends BcDefaultBehavior{constructor(){super(),this.value=0}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class='${INPUT_CURRENCY}']`)),e=[];for(let s=0;s{this.emitEvent()})}}const INPUT_TOKEN=`${BcCommonConstants.PREFIX_LIB}-input-token`,INPUT_TOKEN_CONTAINER=`${BcCommonConstants.PREFIX_LIB}-input-token-container`,ALL_INPUTS_VALID=`${BcCommonConstants.PREFIX_LIB}-all-inputs-valid`,ALL_INPUTS_ERROR=`${BcCommonConstants.PREFIX_LIB}-all-inputs-error`,LABEL_BOTTOM=`${BcCommonConstants.PREFIX_LIB}-label-bottom-token`,INPUT_TOKEN_ZERO_ASCII_CODE=48,INPUT_TOKEN_NINE_ASCII_CODE=57,INPUT_TOKEN_ZERO_ASCII_CODE_ALFA=96,INPUT_TOKEN_NINE_ASCII_CODE_ALFA=105;class BcInputTokenBehavior extends BcDefaultBehavior{constructor(){super(),this.value="",this.inputStatus=!1,this.isValid=!1}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class~='${INPUT_TOKEN}']`)),e=[];for(let s=0;s=INPUT_TOKEN_ZERO_ASCII_CODE&&e<=INPUT_TOKEN_NINE_ASCII_CODE||e>=INPUT_TOKEN_ZERO_ASCII_CODE_ALFA&&e<=INPUT_TOKEN_NINE_ASCII_CODE_ALFA)s=n==this.numInputs?this.numInputs:n+1;else{const e=t.value.toString().substring(0,1);t.value=e}else{const e=t.value.toString().substring(0,1);t.value=e}else t.setAttribute("value","");return s}findInput(t){return this.mySelf.querySelector(`input[id='${this._id}-`+t+"'")}_setUp(){this.validateId(),this.getElement(),this.createTokenInputs(),this.createLabel()}validateId(){if(!this._id){const t="input-token",e=new Uint32Array(1),s=window.crypto.getRandomValues(e);this._id=`${t}.${s[0]}`}}setNumInputs(t){this.numInputs=t}createTokenInputs(){for(let t=1;t<=this.numInputs;t++){const e=document.createElement("input");e.setAttribute("type","number");const s="^[0-9]$";e.setAttribute("pattern",s);const n=`${this._id}-${t}`;e.setAttribute("id",n);const o="bc-input";e.setAttribute("class",o),e.setAttribute("required","true"),e.setAttribute("placeholder"," "),e.addEventListener("keyup",e=>{this.inputkeyup(e,t)}),e.addEventListener("blur",()=>{this.inputBlur()}),e.addEventListener("focus",()=>{this.inputFocus()}),this.mySelf.querySelector(`div[class~='${INPUT_TOKEN_CONTAINER}'`).appendChild(e)}this.initialFocus()}initialFocus(){this.mySelf.querySelector(`input[id='${this._id}-1'`).focus()}createLabel(){const t=document.createElement("label");t.setAttribute("class","bc-label-bottom-token"),t.innerText="Ingresa el código de "+this.numInputs+" digítos",this.mySelf.appendChild(t)}controlInputs(){const t=this.mySelf.querySelectorAll(`input[id^='${this._id}'`);let e="";const s=Array.from(t);let n=!1;for(let t=0;t{e.disabled=t})}setValue(t){if(t){const e=t.split(""),s=Array.from(this.mySelf.querySelectorAll("input"));let n=0;e.forEach(t=>{s[n].value=t,s[++n]&&s[n].focus()}),this.controlInputs(),this.inputStatus?(this.putValid(),this.changeValuesEmitEvent()):this.removeValid(),(!this.isValid&&this.inputStatus||this.isValid&&!this.inputStatus)&&(this.isValid=this.inputStatus,this.changeStatusEmitEvent())}}}const INPUT_SELECT_TOGGLE_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-select-toggle`,INPUT_SELECT_ACTIVE_TOGGLE_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-select-active-toggle`,INPUT_SELECT_CONTENT_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-select-content`,INPUT_SELECT_ACTIVE_CONTENT_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-select-content-active`,INPUT_SELECT_ITEM_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-select-item`,INPUT_SELECT_TRIANGLE_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-select-triangle`,INPUT_SELECT_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-select`,INPUT_SELECT_ACTIVE_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-select-active`;var BcCardType,BcCardProductSizeFont;!function(t){t[t["none-icon"]=0]="none-icon",t[t.icon=1]="icon",t[t.small=2]="small",t[t["small-img"]=3]="small-img"}(BcCardType||(BcCardType={})),function(t){t[t.normal=0]="normal",t[t.medium=1]="medium",t[t.large=2]="large"}(BcCardProductSizeFont||(BcCardProductSizeFont={}));const CARD_CLASS=`${BcCommonConstants.PREFIX_LIB}-card`,CARD_MAIN_CLASS=`${CARD_CLASS}-product`,CARD_ICON_LEADING_ICON_CLASS=`${CARD_MAIN_CLASS}-icon`,CARD_ICON_LEADING_IMG_CLASS=`${CARD_MAIN_CLASS}-img`,CARD_BODY_CLASS=`${CARD_MAIN_CLASS}-body`,CARD_HEAD_CLASS=`${CARD_CLASS}-head`,CARD_TITTLE_CLASS=`${CARD_CLASS}-tittle`,CARD_TITTLE_MEDIUM_CLASS=`${CARD_CLASS}-tittle-medium`,CARD_TITTLE_LARGE_CLASS=`${CARD_CLASS}-tittle-large`,CARD_TOGGLE_CLASS=`${CARD_CLASS}-toggle`,CARD_TOGGLE_ACTIVE_CLASS=`${CARD_CLASS}-toggle-active`,CARD_TOGGLE_ACTIVE_DIRECTION_CLASS="arrow-direction",CARD_SUBTITTLE_CLASS=`${CARD_CLASS}-subtittle`,CARD_SUBTITTLE_MEDIUM_CLASS=`${CARD_CLASS}-subtittle-medium`,CARD_SUBTITTLE_LARGE_CLASS=`${CARD_CLASS}-subtittle-large`,CARD_SUBTITTLE_DESCRIPTION_CLASS=`${CARD_SUBTITTLE_CLASS}-description`,CARD_INFO_CLASS=`${CARD_CLASS}-info`,CARD_INFO_STATUS_CLASS=`${CARD_INFO_CLASS}-status`,CARD_INFO_ICON_CLASS=`${CARD_INFO_STATUS_CLASS}-icon`,CARD_INFO_STATUS_LABEL_CLASS=`${CARD_INFO_STATUS_CLASS}-label`,CARD_INFO_BALANCE_CLASS=`${CARD_INFO_CLASS}-balance`,CARD_INFO_ADITIOAL_TEXT_CLASS=`${CARD_INFO_CLASS}-aditional-text`,CARD_SUBTITTLE_DESCRIPTION_MEDIUM_CLASS=`${CARD_SUBTITTLE_CLASS}-description-medium`,CARD_SUBTITTLE_DESCRIPTION_LARGE_CLASS=`${CARD_SUBTITTLE_CLASS}-description-large`;class BcCardProductBehavior extends BcDefaultBehavior{constructor(){super(),this.toggleIcon=null,this.config=null,this.active=!1,this.cardBody=null,this.onceToggleAction=!1}_setUp(){this.getElements(),this.setEventListeners()}build(){switch(this.isReady=!1,this.bodySectionBuilder(),this.cardHeadBuilder(),this.cardDescriptionsBuilder(),this.cardInfoContainerBuilder(),this.cardStausBuilder(),this.toEnumValue(this.config.cardType)){case BcCardType["small-img"]:this.imgSectionBuilder();break;case BcCardType["none-icon"]:this.cardBalanceBuilder();break;case BcCardType.small:this.iconSectionBuilder();break;default:this.iconSectionBuilder(),this.cardBalanceBuilder()}this.cardAddtionalText(),this.isReady=!0}setActive(t){this.active=t,t?replaceClass(this.toggleIcon,CARD_TOGGLE_CLASS,CARD_TOGGLE_ACTIVE_CLASS):replaceClass(this.toggleIcon,CARD_TOGGLE_ACTIVE_CLASS,CARD_TOGGLE_CLASS)}setConfig(t){this.config=t,this.initConfiguration(),this.getType()}getConfig(){return this.getType(),this.getIconConfig(),this.getSutittleConfig(),this.getStatusConfig(),this.getBalanceConfig(),this.getAdditionalTextConfig(),this.toggleIcon&&(this.config.icon=this.toggleIcon),this.config}initConfiguration(){this.config||(this.config={value:(new Date).getMilliseconds(),cardType:BcCardType["none-icon"],tittle:this.getCardTittle()})}getElements(){this.getToggle(),this.getCardBody()}getCardTittle(){const t=this.mySelf.querySelector(`*[class~='${CARD_TITTLE_CLASS}']`);return t?t.innerHTML:""}getCardBody(){const t=this.mySelf.querySelector(`*[class~='${CARD_BODY_CLASS}']`);t&&(this.cardBody=t)}getToggle(){const t=this.mySelf.querySelector(`.${CARD_TOGGLE_CLASS}, .${CARD_TOGGLE_ACTIVE_CLASS}`);t&&(this.toggleIcon=t)}getType(){this.config||this.initConfiguration(),this.mySelf.classList.forEach(t=>{const e=this.toEnumValue(t.replace(`${CARD_CLASS}-`,""));e&&(this.config.cardType=e)})}setEventListeners(){if(this.toggleIcon&&this.toggleAction){const t=t=>{this.disabled||(this.toggleAction(t),t.target.setAttribute("listener","true"))};"true"!==this.toggleIcon.getAttribute("listener")&&(this.toggleIcon.addEventListener(BcCommonConstants.EVENT_CLICK,t),addFocusable(this.toggleIcon,{},{event:this.toggleAction}))}this.clickAction&&this.mySelf.addEventListener(BcCommonConstants.EVENT_CLICK,t=>{this.disabled||this.clickAction(t)})}cardAddtionalText(){this.config.additionalText&&this.infoDivAppend(createElement({element:BcCommonConstants.P_TAG,classList:[CARD_INFO_ADITIOAL_TEXT_CLASS],innerText:this.config.additionalText}))}cardBalanceBuilder(){this.infoDivAppend(createElement({element:BcCommonConstants.H6_TAG,classList:[CARD_INFO_BALANCE_CLASS],innerText:this.config.balance}))}cardStausBuilder(){const t=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_INFO_STATUS_CLASS],children:[createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_INFO_ICON_CLASS],children:[createElement({element:BcCommonConstants.DIV_TAG,classList:[this.config.statusType]})]}),createElement({element:BcCommonConstants.P_TAG,classList:[CARD_INFO_STATUS_LABEL_CLASS],innerText:this.config.statusText})]});this.infoDivAppend(t)}infoDivAppend(t){const e=this.cardBody.querySelector(`*[class~='${CARD_INFO_CLASS}']`);e&&e.appendChild(t)}cardInfoContainerBuilder(){const t=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_INFO_CLASS]});this.cardBody&&this.cardBody.appendChild(t)}cardDescriptionsBuilder(){const t=this.mySelf.querySelector(`*[class~='${CARD_BODY_CLASS}']`),e=this.getSizeClass().subtittleClass,s=this.getSizeClass().subtittleDescriptionClass;if(t){const n=createElement({element:BcCommonConstants.P_TAG,classList:[e]}),o=createElement({element:BcCommonConstants.P_TAG,classList:[s]}),i=this.config.subtittle;i&&("string"==typeof i?n.innerText=i:(n.innerText=i[0],o.innerText=i[1]),t.appendChild(n),t.appendChild(o))}}getSizeClass(){const t={titleClass:CARD_TITTLE_CLASS,subtittleClass:CARD_SUBTITTLE_CLASS,subtittleDescriptionClass:CARD_SUBTITTLE_DESCRIPTION_CLASS};switch(this.config.size){case BcCardProductSizeFont.normal:t.titleClass=CARD_TITTLE_CLASS,t.subtittleClass=CARD_SUBTITTLE_CLASS,t.subtittleDescriptionClass=CARD_SUBTITTLE_DESCRIPTION_CLASS;break;case BcCardProductSizeFont.medium:t.titleClass=CARD_TITTLE_MEDIUM_CLASS,t.subtittleClass=CARD_SUBTITTLE_MEDIUM_CLASS,t.subtittleDescriptionClass=CARD_SUBTITTLE_DESCRIPTION_MEDIUM_CLASS;break;case BcCardProductSizeFont.large:t.titleClass=CARD_TITTLE_LARGE_CLASS,t.subtittleClass=CARD_SUBTITTLE_LARGE_CLASS,t.subtittleDescriptionClass=CARD_SUBTITTLE_DESCRIPTION_LARGE_CLASS;break;default:t.titleClass=CARD_TITTLE_CLASS,t.subtittleClass=CARD_SUBTITTLE_CLASS,t.subtittleDescriptionClass=CARD_SUBTITTLE_DESCRIPTION_CLASS}return t}cardHeadBuilder(){const t=this.getSizeClass().titleClass;if(this.cardBody){const e=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_HEAD_CLASS],children:[createElement({element:BcCommonConstants.H6_TAG,classList:[t],innerText:this.config.tittle})]}),s=this.config.toggleIcon||createElement({element:BcCommonConstants.EM_TAG,classList:[this.active?CARD_TOGGLE_ACTIVE_CLASS:CARD_TOGGLE_CLASS,BcCommonConstants.ICONS_CLASS,CARD_TOGGLE_ACTIVE_DIRECTION_CLASS],props:{"aria-hidden":"true"}});this.toggleIcon=s,e.appendChild(s),this.cardBody.appendChild(e)}}iconSectionBuilder(){const t=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_ICON_LEADING_ICON_CLASS],children:[createElement({element:BcCommonConstants.EM_TAG,classList:[BcCommonConstants.ICONS_CLASS,BcCommonConstants.ICON_MD_CLASS],props:{"aria-hidden":"true"},innerText:this.config.icon||"e-card"})]});this.mySelf.prepend(t)}imgSectionBuilder(){const t=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_ICON_LEADING_IMG_CLASS],children:[createElement({element:BcCommonConstants.IMG_TAG,classList:[BcCommonConstants.ICONS_CLASS,BcCommonConstants.ICON_MD_CLASS],props:{alt:this.config.icon,src:`https://library-sdb.apps.bancolombia.com/bds/2.1.19/assets/icons/${this.config.typeIcon}/${this.config.icon}.svg`}})]});this.mySelf.prepend(t)}bodySectionBuilder(){const t=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_BODY_CLASS]});this.mySelf.appendChild(t),this.getCardBody()}toEnumValue(t){if("string"==typeof t){return BcCardType[t]}return t}getIconConfig(){let t=CARD_ICON_LEADING_ICON_CLASS;this.config.cardType===BcCardType["small-img"]&&(t=CARD_ICON_LEADING_IMG_CLASS);const e=this.mySelf.querySelector(`div.${t} > em`);e&&(this.config.icon=e)}getSutittleConfig(){const t=this.cardBody.querySelector(`*[class~='${CARD_SUBTITTLE_CLASS}']`),e=this.cardBody.querySelector(`*[class~='${CARD_SUBTITTLE_DESCRIPTION_CLASS}']`);t&&(this.config.subtittle=t.innerHTML,e&&(this.config.subtittle=[t.innerHTML,e.innerHTML]))}getStatusConfig(){const t=this.cardBody.querySelector(`div.${CARD_INFO_ICON_CLASS} > div`),e=this.cardBody.querySelector(`*[class~='${CARD_INFO_STATUS_LABEL_CLASS}']`);t&&(this.config.statusType=String(t.className)),e&&(this.config.statusText=e.innerHTML)}getBalanceConfig(){const t=this.cardBody.querySelector(`*[class~='${CARD_INFO_BALANCE_CLASS}']`);t&&(this.config.balance=t.innerHTML)}getAdditionalTextConfig(){const t=this.cardBody.querySelector(`*[class~='${CARD_INFO_ADITIOAL_TEXT_CLASS}']`);t&&(this.config.additionalText=t.innerHTML)}}const CARD_SELECT_CLASS=`${BcCommonConstants.PREFIX_LIB}-card-select`,CARD_SELECT_INPUT=`${BcCommonConstants.PREFIX_LIB}-input`,CARD_SELECT_ACTIVE_CLASS=`${CARD_SELECT_CLASS}-active`,CARD_SELECT_SELECTED_CLASS=`${CARD_SELECT_CLASS}-selected`,CARD_SELECT_ACTIVE_ITEM_CLASS=`${CARD_SELECT_CLASS}-active-item`,CARD_SELECT_SELECTED_ITEM_CLASS=`${CARD_SELECT_CLASS}-selected-item`,CARD_SELECT_CONTROL_CLASS=`${CARD_SELECT_CLASS}-control`,CARD_SELECT_INPUT_CLASS=`${CARD_SELECT_CLASS}-input`,CARD_SELECT_PLACEHOLDER_CLASS=`${CARD_SELECT_CLASS}-placeholder`,CARD_ICON_SEARCH_CLASS=`${CARD_SELECT_CLASS}-search`,CARD_SELECT_CONTENT_TOGGLE_CLASS=`${CARD_SELECT_CLASS}-content-toggle`,CARD_SELECT_TOGGLE_CLASS=`${CARD_SELECT_CLASS}-toggle`,CARD_SELECT_ACTIVE_TOGGLE_CLASS=`${CARD_SELECT_CLASS}-active-toggle`,CARD_SELECT_DROPDOWN_CLASS=`${CARD_SELECT_CLASS}-content`,CARD_SELECT_DROPDOWN_ACTIVE_CLASS=`${CARD_SELECT_CLASS}-content-active`,CARD_SELECT_DROPDOWN_BODY_CLASS=`${CARD_SELECT_CLASS}-content-body`,CARD_SELECT_DROPDOWN_ITEM_CLASS=`${CARD_SELECT_CLASS}-item`,CARD_SELECT_DROPDOWN_FILTRABLE_ITEMS_CLASS=`${CARD_SELECT_DROPDOWN_ACTIVE_CLASS}-filtrable`,CARD_SELECT_DROPDOWN_FILTERED_ITEMS_CLASS=`${CARD_SELECT_DROPDOWN_ITEM_CLASS}-filtered`,CARD_SELECT_DROPDOWN_FOOTER_CLASS=`${CARD_SELECT_CLASS}-content-footer`,CARD_SELECT_DROPDOWN_FOOTER_ITEM_CLASS=`${CARD_SELECT_CLASS}-content-add-item`,CARD_DROPDOWN_SELECT_ACTION=`${CARD_SELECT_CLASS}-action`,CARD_SELECT_CONTENT_NO_DATA_CLASS=`${CARD_SELECT_CLASS}-no-data`,CARD_SELECT_SUBTITLE_CLASS=`${BcCommonConstants.PREFIX_LIB}-subtittle`,CARD_SELECT_INFO_CLASS=`${BcCommonConstants.PREFIX_LIB}-card-info-balance`,CARD_SELECT_OUTLINE_ELEMENT="outline-element",CARD_SELECT_MAX_WIDTH_CLIENT=6,CARD_SELECT_MIN_FILTER_CHA=3,CARD_SELECT_MIN_SIZE=`${BcCommonConstants.PREFIX_LIB}-col-xs-6`,CARD_SELECT_MAX_SIZE=`${BcCommonConstants.PREFIX_LIB}-col-sm-12`,CARD_SELECT_PLACEHOLDER_MEDIUM_CLASS=`${CARD_SELECT_CLASS}-placeholder-medium`,CARD_SELECT_PLACEHOLDER_LARGE_CLASS=`${CARD_SELECT_CLASS}-placeholder-large`,CARD_SELECT_SIZE=`${CARD_SELECT_CLASS}-size`;class BcCardSelectBehavior extends BcAbstractDropdownBehavior{constructor(){super(),this.activeElement=null,this.bcCardProductBehavior=null,this.selectedItemsDisplay="{0} ítems seleccionados",this.bcInputBehavior=new BcInputBehavior}_setUp(){this.setDropDownConfiguration(),this.getDropdownContent(),super._setUp(),this.bcInputBehavior.setElement(this.mySelf.querySelector("input")),this.bcInputBehavior.setUp(),this.createItems(),this.getInsideElements(),this.setMarginTop(),this.setupPlaceHolder(),this.setEventListeners(),this.markItemByIndex(this.defaultIndex),this.setupAccessibility(),this.setEventClickOutside(),this.setResponsive()}_setDisable(t){this.bcInputBehavior&&this.bcInputBehavior.setDisable(t),this.bcCardProductBehavior&&(this.bcCardProductBehavior.setDisable(t),this.closeDropdown())}createItems(){if(this.dropdownItems=[],this.itemsConfig){this.itemsConfig.forEach((t,e)=>{const s=this.createCardItem(t);this.dropdownItems[e]=s});const t=this.dropdownContent.querySelector(`*[class~='${CARD_SELECT_DROPDOWN_BODY_CLASS}']`);t.innerHTML="",t.appendChild(createElement({element:BcCommonConstants.UL_TAG,children:this.dropdownItems}))}}setItems(t,e){this.sizeFont=e,this.cleanItems(),this.itemsConfig=t,this.itemsConfig.forEach(t=>{t.size=e})}setMarginTop(){this.span&&(this.topMarginContent=-25)}toEnumValue(t){if("string"==typeof t){return BcCardProductSizeFont[t]}return t}getPlaceHolderClass(){let t;switch(this.toEnumValue(this.sizeFont)){case BcCardProductSizeFont.normal:t=CARD_SELECT_PLACEHOLDER_CLASS;break;case BcCardProductSizeFont.medium:t=CARD_SELECT_PLACEHOLDER_MEDIUM_CLASS;break;case BcCardProductSizeFont.large:t=CARD_SELECT_PLACEHOLDER_LARGE_CLASS;break;default:t=CARD_SELECT_PLACEHOLDER_CLASS}return t}setupPlaceHolder(){const t=this.getPlaceHolderClass();if(this.cardSelectInput=this.mySelf.querySelector(`.${CARD_SELECT_INPUT_CLASS}`),this.cardSelectInput){this.selectControl=this.mySelf.querySelector(`.${CARD_SELECT_CONTROL_CLASS}`);const e=this.cardSelectInput.querySelector("label");this.placeHolder=document.createElement("label"),this.placeHolder.innerHTML=e.innerHTML,this.getFirstElementByClassName(CARD_SELECT_PLACEHOLDER_CLASS)||(this.placeHolder.classList.add(`${CARD_SELECT_SUBTITLE_CLASS}`,`${t}`),this.setupSelectControlAccesibility(!1),this.cardSelectInput.parentNode.insertBefore(this.placeHolder,this.cardSelectInput.nextSibling||null),this.cardSelectInput.style.display="none"),window.addEventListener(_DROPDOWN_OPENED_EVENT,t=>{this.setupSelectControlAccesibility(!0),this.showPlaceHolder(t,!1)}),window.addEventListener(_DROPDOWN_CLOSED_EVENT,t=>{this.setupSelectControlAccesibility(!1),this.showPlaceHolder(t),this.setupDropDownAccessibility(),this.setupCardAccessibility()})}}setupAccessibility(){addFocusable(this.dropdownContent.querySelector(`*[class~='${CARD_SELECT_DROPDOWN_FOOTER_CLASS}']`),{role:"button",tabindex:"0"});const t=this.dropdownContent.querySelector(`*[class~='${CARD_SELECT_DROPDOWN_BODY_CLASS}']`).querySelectorAll(`.${CARD_SELECT_INFO_CLASS}`);null==t||t.forEach(t=>{if(t.innerHTML.length>0){const e=`Saldo de cuenta: ${t.innerHTML.replace("$","")} pesos colombianos`;t.setAttribute("aria-label",e)}}),this.setupBodyAccessibility(),this.setupCardAccessibility(),this.setupDropDownAccessibility()}setupBodyAccessibility(){const t=this.dropdownContent.querySelector(`*[class~='${CARD_SELECT_DROPDOWN_BODY_CLASS}']`);t.addEventListener(BcCommonConstants.EVENT_KEY_DOWN,e=>{this.processKeyDown(e,t)})}processKeyDown(t,e){const s=e.querySelector(`li.${CARD_SELECT_OUTLINE_ELEMENT}`);let n;if(s)if(t.key===BcCommonConstants.KEY_EVENT_ARROW_UP||t.key===BcCommonConstants.KEY_EVENT_ARROW_DOWN)(n=t.key===BcCommonConstants.KEY_EVENT_ARROW_UP?s.previousElementSibling:s.nextElementSibling)&&this.focusNextItem(s,n);else if(t.key===BcCommonConstants.KEY_EVENT_END||t.key===BcCommonConstants.KEY_EVENT_HOME){const o=e.querySelectorAll(`.${CARD_SELECT_DROPDOWN_ITEM_CLASS}`);(n=t.key===BcCommonConstants.KEY_EVENT_END?o[o.length-1]:o[0])&&this.focusNextItem(s,n)}}setupCardAccessibility(){this.activeElement?(this.selectControl.removeAttribute("tabindex"),addFocusable(this.mySelf,{tabindex:"0"})):(this.mySelf.removeAttribute("tabindex"),addFocusable(this.selectControl,{tabindex:"0"}))}setupSelectControlAccesibility(t){var e;this.selectControl.setAttribute("aria-label",`${null===(e=this.placeHolder)||void 0===e?void 0:e.innerHTML}, menú desplegable, ${t?"Expandido":"Contraido"}`)}setupDropDownAccessibility(){const t=this.mySelf.querySelector("em.arrow-direction");addFocusable(t,{tabindex:"0"}),null==t||t.setAttribute("aria-label","Cambiar producto, menú desplegable")}focusNextItem(t,e){t.classList.remove(`${CARD_SELECT_OUTLINE_ELEMENT}`),e.classList.add(`${CARD_SELECT_OUTLINE_ELEMENT}`),e.focus()}showPlaceHolder(t,e=!0){if(this.mySelf.querySelector(`[aria-controls="${t.detail}"]`)){const t=this.mySelf.querySelector(`.${CARD_SELECT_ACTIVE_ITEM_CLASS}`);t?this.showSelectedCard(t,e):e?(this.cardSelectInput.style.display="none",this.placeHolder.style.display="block"):(this.cardSelectInput.style.display="block",this.placeHolder.style.display="none",this.input&&this.input.focus())}}showSelectedCard(t,e=!0){this.cardSelectInput.style.display="block",e?(this.selectControl.style.display="none",t.style.display="block"):(this.selectControl.style.display="flex",this.placeHolder.style.display="none",t.style.display="none",this.input&&this.input.focus())}setSelectedItemsDisplay(t){t&&(this.selectedItemsDisplay=t)}setDefaultIndex(t){this.defaultIndex=t}setDefaultValue(t){if(void 0===t)return;if(!this.itemsConfig)return;const e=this.itemsConfig.find(e=>e.value==t);if(e){const t=this.itemsConfig.indexOf(e);this.markItemByIndex(t),this.defaultIndex=t}}getInsideElements(){this.input=this.mySelf.querySelector(`${BcCommonConstants.INPUT_TAG}[class=${INPUT}]`),this.itemsConfig||this.getItems()}getItems(){this.cleanItems(),Array.from(this.mySelf.querySelectorAll(`*[class=${CARD_SELECT_DROPDOWN_ITEM_CLASS}]`)).forEach((t,e)=>{const s=this.toCardComponent(t,!1);this.itemsConfig[e]=s.getConfig(),this.dropdownItems[e]=t})}setDropDownConfiguration(){this.setConfig({toggleClass:CARD_SELECT_TOGGLE_CLASS,toggleActiveClass:CARD_SELECT_ACTIVE_TOGGLE_CLASS,contentClass:CARD_SELECT_DROPDOWN_CLASS,contentActiveClass:CARD_SELECT_DROPDOWN_ACTIVE_CLASS,itemClass:CARD_SELECT_DROPDOWN_ITEM_CLASS,triangleClass:CARD_SELECT_DROPDOWN_ITEM_CLASS,extraToggles:[{node:this.input,events:["focus"]}],toggleEvents:["click","input"],mainClass:CARD_SELECT_CLASS,mainActiveClass:CARD_SELECT_ACTIVE_CLASS,static:!0,isPopUp:!1,parentWidth:!0,onlyBottomPosition:!0})}getCurrentActiveItem(){if(!this.activeElement){const t=this.mySelf.querySelector(`div[class=${CARD_SELECT_ACTIVE_ITEM_CLASS}]`);if(t){const e=this.toCardComponent(t,!0);this.setActiveItem(e)}}return this.activeElement}setFormatOutput(t){!t||"simple"!==t&&"full"!==t||(this.formatType=t)}markItemByIndex(t){const e=this.mySelf.querySelectorAll(`li[class~='${CARD_SELECT_DROPDOWN_ITEM_CLASS}']`);void 0!==t&&this.dropdownItems.length>t&&t>=0&&e.length>0&&(this.bcInputBehavior.addRemoveClass(!0,this.mySelf.querySelector("input")),this.dropdownItems[String(t)].dispatchEvent(new Event(BcCommonConstants.EVENT_CLICK,{})))}configSelectedEvent(t,e,s){this.disabled||(this.removeSelectedItem(s),this.showSelectedItem(s),this.closeDropdown(),this.showAllItems(),this.removeFilter(),this.activeElement=this.itemsConfig[e],this.outputFunction&&this.outputFunction(this.itemsConfig[e]))}setEventListeners(){this.dropdownItems.forEach(t=>{t.addEventListener(BcCommonConstants.EVENT_CLICK,e=>{e.stopPropagation(),e.preventDefault(),this.configSelectedEvent(e,this.dropdownItems.indexOf(t),t)}),addFocusable(t,{tabindex:"0"},{event:this.configSelectedEvent.bind(this,{},this.dropdownItems.indexOf(t),t)})}),window.addEventListener(BcCommonConstants.EVENT_KEY_UP,t=>{this.filterItemsEvent(t)})}filterItemsEvent(t){if(t.target.value){t.target.value.toUpperCase().length>=CARD_SELECT_MIN_FILTER_CHA?this.filterDropdown():this.showAllItems()}}filterDropdown(){const t=this.getFirstElementByClassName(CARD_SELECT_INPUT).value.toUpperCase();if(this.input&&(this.input.value=this.getFirstElementByClassName(CARD_SELECT_INPUT).value),t.length>=CARD_SELECT_MIN_FILTER_CHA){this.restoreFilters();let e=!1;this.itemsConfig.forEach((s,n)=>{Object.values(s).map(t=>"string"==typeof t?t.toUpperCase():"").join().indexOf(t)>=0&&(e=!0,this.dropdownItems[n].classList.add(CARD_SELECT_DROPDOWN_FILTERED_ITEMS_CLASS))}),e?this.openDrowndown():this.closeDropdown(!0)}else this.showAllItems()}returnValueInput(){return this.getFirstElementByClassName(CARD_SELECT_INPUT).value}getFirstElementByClassName(t){const e=this.mySelf.getElementsByClassName(t);let s=null;return e.length>0&&(s=e[0]),s}showAllItems(){this.dropdownContent.classList.remove(CARD_SELECT_DROPDOWN_FILTRABLE_ITEMS_CLASS)}restoreFilters(){this.dropdownContent&&(this.dropdownContent.classList.add(CARD_SELECT_DROPDOWN_FILTRABLE_ITEMS_CLASS),this.dropdownItems.forEach(t=>{t.classList.remove(CARD_SELECT_DROPDOWN_FILTERED_ITEMS_CLASS)}))}removeItemsSelection(){this.dropdownItems&&this.dropdownItems.forEach(t=>{t.classList.remove(CARD_SELECT_SELECTED_ITEM_CLASS)})}removeFilter(){this.input&&(this.input.value="")}toCardComponent(t,e,s){const n=t.querySelector(`div[class~=${CARD_MAIN_CLASS}]`).cloneNode(!0),o=new BcCardProductBehavior;return o.setElement(n),s&&(o.toggleAction=s.bind(this)),o.setUp(),o.setActive(e),o}removeSelectedItem(t){const e=this.mySelf.querySelector(`div[class~=${CARD_SELECT_ACTIVE_ITEM_CLASS}]`);this.removeItemsSelection(),e&&e.remove(),this.mySelf.classList.remove(CARD_SELECT_SELECTED_CLASS),t.classList.add(CARD_SELECT_SELECTED_ITEM_CLASS),this.setActiveItem(null)}showSelectedItem(t){const e=this.toCardComponent(t,!0,this.clickToggleEvent);this.setActiveItem(e),this.mySelf.classList.add(CARD_SELECT_SELECTED_CLASS),this.mySelf.prepend(createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_SELECT_ACTIVE_ITEM_CLASS],children:[e.getMySelf()]}))}setActiveItem(t){if(t)return this.activeElement=t.getConfig(),void(this.bcCardProductBehavior=t);this.activeElement=null,this.bcCardProductBehavior=null}getDropdownContent(){this.getDropdownParent(),this.getDropdownBody(),this.dropdownButtonConfig&&this.getDropdownFooter()}getDropdownFooter(){let t=this.dropdownContent.querySelector(`*[class~='${CARD_SELECT_DROPDOWN_FOOTER_CLASS}']`);t?this.addDropdownButtonEventClick(t):(t=this.createDropDownFooter(),this.dropdownContent.appendChild(t),this.addDropdownButtonEventClick(t))}createDropDownFooter(){const t=this.dropdownButtonConfig,e=createElement({element:BcCommonConstants.SPAN_TAG,children:[createElement({element:BcCommonConstants.EM_TAG,classList:[BcCommonConstants.ICONS_CLASS],props:{"aria-hidden":"true"},innerText:t.icon}),createElement({element:BcCommonConstants.LABEL_TAG,innerText:t.text})]}),s=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_SELECT_DROPDOWN_FOOTER_ITEM_CLASS],children:[e]});return createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_SELECT_DROPDOWN_FOOTER_CLASS],children:[s]})}addDropdownButtonEventClick(t){t.addEventListener(BcCommonConstants.EVENT_CLICK,t=>{this.dropdownButtonConfig.event(t)}),addFocusable(t,{},{event:this.dropdownButtonConfig.event})}getDropdownBody(){this.dropdownContent.querySelector(`*[class~='${CARD_SELECT_DROPDOWN_BODY_CLASS}']`)||this.dropdownContent.appendChild(createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_SELECT_DROPDOWN_BODY_CLASS]}))}getDropdownParent(){let t=this.mySelf.querySelector(`*[class~='${CARD_SELECT_DROPDOWN_CLASS}']`);if(t)return void(this.dropdownContent=t);const e=`${this.mySelf.getAttribute("id")}-content`;t=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_SELECT_DROPDOWN_CLASS],props:{id:e}}),this.mySelf.appendChild(t),this.dropdownContent=t}cleanItems(){this.itemsConfig=[],this.dropdownItems=[]}createCardItem(t){const e=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_MAIN_CLASS,`${CARD_CLASS}-${String(t.cardType)}`]}),s=new BcCardProductBehavior;return s.setElement(e),s.setConfig(t),s.setUp(),s.build(),createElement({element:BcCommonConstants.LI_TAG,classList:[this.config.itemClass],children:[s.getMySelf()]})}setEventClickOutside(){document.addEventListener("click",function(t){const e=this.mySelf;this.mySelf.parentNode.classList.add(CARD_SELECT_CLASS),e&&!e.contains(t.target)&&this.closeDropdown()}.bind(this))}setResponsive(){this.mySelf.parentElement.classList.add(CARD_SELECT_SIZE)}}class BcInputSelectBehavior extends BcAbstractDropdownBehavior{constructor(){super(),this.activeElements={},this.selectedItemsDisplay="{0} ítems seleccionados",this.bcInputBehavior=new BcInputBehavior,this.isDisabled=!1,this.isKeydown=!1,this.inpValue=""}_setUp(){this.isMultiple=this.mySelf.hasAttribute("multiple"),this.isFilter=this.mySelf.hasAttribute("filter");const t=this.mySelf.querySelector("input");t.readOnly=this._setReadOnly(this.isFilter,t),this.setDropDownConfiguration(),super._setUp(),this.bcInputBehavior.setElement(t),this.bcInputBehavior.setUp(),this.createItems(),this.getInsideElements(),this.setMarginTop(),this.setEventListeners(),this.markItemByIndex(this.defaultIndex)}_setReadOnly(t,e){return!t||(this.filter(e),!1)}createItems(){this.closeDropdown();const t=this.mySelf.querySelector(`*[id='${this.idContent}']`);for(const e of Array.from(t.childNodes))t.removeChild(e);if(this.activeElements={},this.dropdownItems=[],this.itemsConfig)for(const t of this.itemsConfig){const e=this.itemsConfig.indexOf(t);"object"!=typeof t&&(this.itemsConfig[e]={label:t,value:t});let s=null;this.itemsConfigAux=this.itemsConfig,s=this.isMultiple?this.createItemTypeMultiple(this.itemsConfig[e]):(this.isFilter,this.createItemTypeSingle(this.itemsConfig[e])),this.dropdownItems.push(s),this.dropdownContent.appendChild(s)}this.setValueInputMultiple()}createItemTypeSingle(t){const e=document.createElement(BcCommonConstants.LI_TAG);if(e.classList.add(this.config.itemClass),t.icon){const s=document.createElement(BcCommonConstants.EM_TAG);s.innerText=t.icon,e.appendChild(s)}const s=document.createElement(BcCommonConstants.SPAN_TAG);return s.innerText=t.label,e.appendChild(s),e}createItemTypeMultiple(t){const e=document.createElement(BcCommonConstants.LI_TAG);e.classList.add(this.config.itemClass);const s=document.createElement(BcCommonConstants.LABEL_TAG),n=document.createElement(BcCommonConstants.INPUT_TAG),o=document.createElement(BcCommonConstants.SPAN_TAG);return s.classList.add(BcCommonConstants.CONTAINER_CHECKBOX_CLASS),o.classList.add(BcCommonConstants.CHECKBOX_CLASS),n.setAttribute("type","checkbox"),n.setAttribute("class",INPUT_SELECT_ITEM_CLASS),s.innerText=t.label,s.appendChild(n),s.appendChild(o),e.appendChild(s),e.appendChild(s),e}setItems(t){this.itemsConfig=t}setMarginTop(){this.span&&(this.topMarginContent=-25)}setSelectedItemsDisplay(t){t&&(this.selectedItemsDisplay=t)}setDefaultIndex(t){this.defaultIndex=t}setDefaultValue(t){let e=0;if(t){for(const s in this.itemsConfig){const n=this.itemsConfig[s],o="string"==typeof n&&n===t,i="object"==typeof n&&(n.value===t||n.label===t);if(o||i)break;e++}this.markItemByIndex(e),e>=0&&e0&&(t=t[0])}return t}setFormatOutput(t){!t||"simple"!==t&&"full"!==t||(this.formatType=t)}createActiveIcon(){const t=document.createElement(BcCommonConstants.EM_TAG);return t.innerText="ok",t}markItemByIndex(t){void 0!==t&&this.dropdownItems.length>t&&t>=0&&(this.bcInputBehavior.addRemoveClass(!0,this.mySelf.querySelector("input")),this.dropdownItems[String(t)].dispatchEvent(new Event(BcCommonConstants.EVENT_CLICK,{})))}configSelectedEvent(t,e,s){if(this.isMultiple){if(-1===["INPUT","LI"].indexOf(t.target.tagName))return void t.stopPropagation();const n=s.querySelector(BcCommonConstants.INPUT_TAG),o=e in this.activeElements;n&&this.configInputCheck(n,o,t,s,e),this.setValueInputMultiple()}else{for(const t in this.activeElements)if(Object.prototype.hasOwnProperty.call(this.activeElements,t)){const e=this.activeElements[t];e.item.removeChild(e.check)}this.activeElements={};const s=this.createActiveIcon();t.target.appendChild(s),this.activeElements[e]={item:t.target,check:s},this.closeDropdown(),this.setValueInputSingle()}this.outputFunction&&this.outputFunction(this.getCurrentActiveItems())}configInputCheck(t,e,s,n,o){if("LI"===s.target.tagName)return s.stopPropagation(),void t.click();e?(t.removeAttribute("checked"),delete this.activeElements[o]):(t.setAttribute("checked",""+e),this.activeElements[o]={item:n,check:null})}setEventListeners(){const t=t=>{t.addEventListener(BcCommonConstants.EVENT_CLICK,e=>{this.inpValue="";const s=this.dropdownItems.map(t=>t.innerHTML);this.configSelectedEvent(e,s.indexOf(t.innerHTML),t),!0===this.isKeydown&&(this.itemsConfig=this.itemsConfigAux,this.updateDropdown(),this.isKeydown=!1)})};for(const e of this.dropdownItems)t(e),addFocusable(e,{},{event:this.configSelectedEvent})}setValueInputMultiple(){let t=null;const e=Object.keys(this.activeElements);e.length>1?(this.bcInputBehavior.addRemoveClass(!0,this.mySelf.querySelector("input")),t=this.selectedItemsDisplay.replace("{0}",String(e.length))):1==e.length?(this.bcInputBehavior.addRemoveClass(!0,this.mySelf.querySelector("input")),t=this.getValueInputSingle(parseInt(e[0]))):(this.bcInputBehavior.addRemoveClass(!1,this.mySelf.querySelector("input")),t=""),this.input&&(this.input.value=t)}setValueInputSingle(t){const e=this.getValueInputSingle(t);return this.input&&(this.input.value=e),this.bcInputBehavior.addRemoveClass(!0,this.mySelf.querySelector("input")),e}getValueInputSingle(t){let e=0,s=null;if(t)e=t,s=this.activeElements[String(e)];else for(const t in this.activeElements)Object.prototype.hasOwnProperty.call(this.activeElements,t)&&(e=parseInt(t),s=this.activeElements[t]);let n="";if(this.config)n=this.itemsConfig[e].label;else if(s){n=s.querySelector(BcCommonConstants.SPAN_TAG).innerText}else n="";return n}filter(t){let e=[];this.inpValue="",t.addEventListener("keydown",t=>{if(/([a-zA-Z])\w+/.test(t.key)||(this.inpValue+=t.key.toLowerCase()),"Backspace"===t.key&&(this.inpValue=this.inpValue.slice(0,-1)),""!=this.inpValue){this.isKeydown=!0;e=this.itemsConfigAux.filter(t=>t.label.toLowerCase().indexOf(this.inpValue.toLowerCase())>-1),this.itemsConfig=e,this.updateDropdown(),this.openDrowndown()}else e=[],this.itemsConfig=this.itemsConfigAux,this.updateDropdown()})}addItemSelectArray(t,e,s){return t.filter((t,n)=>{t.label.toLowerCase().includes(s)&&(e.push(t),this.itemsConfig=e,e=this.removeItemSelectArray(e,s),this.updateDropdown(),this.openDrowndown())}),e}removeItemSelectArray(t,e){if(t.find((s,n)=>{if(s){s.label.toLowerCase().includes(e)||t.splice(n,1)}}),t.length>0){t.reduce((e,s,n)=>{s.label===e.label&&t.splice(n,1)})}return t}updateDropdown(){this.closeDropdown();const t=this.mySelf.querySelector(`*[id='${this.idContent}']`);for(const e of Array.from(t.childNodes))t.removeChild(e);if(this.activeElements={},this.dropdownItems=[],this.itemsConfig)for(const t of this.itemsConfig){const e=this.itemsConfig.indexOf(t);this.itemsConfig[e]="object"!=typeof t?{label:t,value:t}:t;let s=null;this.isFilter&&(s=this.isMultiple?this.createItemTypeMultiple(this.itemsConfig[e]):this.createItemTypeSingle(this.itemsConfig[e])),this.dropdownItems.push(s),this.dropdownContent.appendChild(s)}this.setEventListeners()}setInputValue(t){if(!this.mySelf)return;const e=t||"";this.mySelf.querySelector("input").value=e}}const SELECT_HTML='\nHTML:\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n\n
\n
\n
\n Seleccionachevron-down\n address-cardHelp text\n
\n \n
\n
\n\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n\n\n\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n\n
\n
\n
\n Seleccionachevron-down\n address-cardHelp text\n
\n \n
\n
\n\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n
\n
\n
\n Seleccionachevron-down\n address-cardHelp\n text
\n \n
\n
\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n\n
\n
\n
chevron-down\n Help text
\n \n
\n
\n
\n
\n
Seleccionachevron-down\n address-cardHelp text\n
\n \n
\n
\n
\n
\n
chevron-down\n Help text
\n \n
\n
\n
\n
\n
Seleccionachevron-down\n Help text
\n \n
\n
\n\n',MODAL=`${BcCommonConstants.PREFIX_LIB}-modal`,MODAL_ACTIVE=`${BcCommonConstants.PREFIX_LIB}-modal-active`,BC_MODAL_CLOSE=`${BcCommonConstants.PREFIX_LIB}-modal-close-button`,BC_MODAL_BUTTON_CONTAINER=`${BcCommonConstants.PREFIX_LIB}-modal-button-container`,BC_MODAL_TITLE=`${BcCommonConstants.PREFIX_LIB}-modal-title`,BC_MODAL_TITLE_LABEL="modal-title-label",BC_MODAL_CONTENT=`${BcCommonConstants.PREFIX_LIB}-modal-content`,BC_MODAL_OVERLAY=`${BcCommonConstants.PREFIX_LIB}-modal-overlay`,OPEN_STATE_MODAL=1,CLOSE_STATE_MODAL=0,MAIN_TASK=1,SECONDARY_TASK=0;class BcModalBehavior extends BcDefaultBehavior{constructor(){super(),this.isMainButtonConfigured=!1,this.isSecondaryButtonConfigured=!1,this.eventClosedAdded=!1,this.modalState=CLOSE_STATE_MODAL}static setUpAll(){const t=Array.from(document.querySelectorAll(`article[class='${MODAL}']`)),e=[];for(let s=0;sthis.closeModal()}),addFocusable(this.mainButton,{pressed:"false"},{event:()=>this.configEventListener()}),addFocusable(this.secondaryButton,{pressed:"false"},{event:()=>this.configEventListener()})}getElement(){this.mainButton=this.mySelf.querySelector(`.${BC_MODAL_BUTTON_CONTAINER} .${BcCommonConstants.BTN_PRIMARY_CLASS}`),this.secondaryButton=this.mySelf.querySelector(`.${BC_MODAL_BUTTON_CONTAINER} .${BcCommonConstants.BTN_SECONDARY_CLASS}`),this.closeButton=this.mySelf.querySelector(`button[class*='${BC_MODAL_CLOSE}']`),this.modalOverlay=this.mySelf.querySelector(`article[class='${MODAL}']`)}configEventListener(){this.callback&&(this.mainButton&&!this.isMainButtonConfigured&&(this.isMainButtonConfigured=!0,this.configureCallBack(this.mainButton,MAIN_TASK)),this.secondaryButton&&!this.isSecondaryButtonConfigured&&(this.configureCallBack(this.secondaryButton,SECONDARY_TASK),this.isSecondaryButtonConfigured=!0))}configureCallBack(t,e){t.addEventListener(BcCommonConstants.EVENT_CLICK,function(){this.callback(e)}.bind(this),!0)}optionalClose(){this.mySelf.addEventListener(BcCommonConstants.EVENT_CLICK,t=>{t.target.classList.contains(MODAL_ACTIVE)&&1===this.modalState&&this.closeModal()})}closeEventKey(){window.addEventListener(BcCommonConstants.EVENT_KEY_DOWN,t=>{t.key===BcCommonConstants.KEY_EVENT_ESCAPE&&this.closeModal()})}openModal(){this.modalState=OPEN_STATE_MODAL,this.changeState(),this.createOverlay()}closeModal(){this.modalState=CLOSE_STATE_MODAL,this.changeState();const t=document.querySelector(`.${BC_MODAL_OVERLAY}`);t&&t.remove(),this.closeModalCallback&&this.closeModalCallback()}changeState(){this.modalState===OPEN_STATE_MODAL?this.mySelf.classList.replace(MODAL,MODAL_ACTIVE):this.modalState===CLOSE_STATE_MODAL&&this.mySelf.classList.replace(MODAL_ACTIVE,MODAL)}setEventToCloseBtn(){this.closeButton.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.closeModal()})}}const MOLECULE_PAGINATOR=`${BcCommonConstants.PREFIX_LIB}-paginator`,MOLECULE_PAGINATOR_LIST=`${BcCommonConstants.PREFIX_LIB}-paginator-list`,MOLECULE_PAGINATOR_PAGES=`${BcCommonConstants.PREFIX_LIB}-paginator-pages`,MOLECULE_PAGINATOR_PAGE_INFO=`${BcCommonConstants.PREFIX_LIB}-paginator-pages-info`,MOLECULE_PAGINATOR_CENTER=`${BcCommonConstants.PREFIX_LIB}-paginator-center`,MOLECULE_PAGINATOR_PREV=`${BcCommonConstants.PREFIX_LIB}-paginator-prev`,MOLECULE_PAGINATOR_NEXT=`${BcCommonConstants.PREFIX_LIB}-paginator-next`,MOLECULE_DROPDOWN=`${BcCommonConstants.PREFIX_LIB}-dropdown`,MOLECULE_DROPDOWN_TOGGLE=`${BcCommonConstants.PREFIX_LIB}-dropdown-toggle`,MOLECULE_DROPDOWN_CONTENT=`${BcCommonConstants.PREFIX_LIB}-dropdown-content`,MOLECULE_DROPDOWN_CUSTOM=`${BcCommonConstants.PREFIX_LIB}-dropdown-custom`,MOLECULE_DROPDOWN_ITEM=`${BcCommonConstants.PREFIX_LIB}-dropdown-item`,MOLECULE_DROPDOWN_PERPAGE="dropdown-per-page",MAX_LENGHT=7,SECOND_PAGE=2,DEFAULT_PAGE_COUNT=10,PER_PAGE=10,PER_MULTIPLE=5,PAGINATOR_MATH_VALUE_1000=1e3,PAGINATOR_MATH_VALUE_100=100,PAGINATOR_MATH_VALUE_6=6;class BcPaginatorBehavior extends BcDefaultBehavior{constructor(){super(),this.paginatorList=document.createElement(BcCommonConstants.DIV_TAG),this.dropdownPages=document.createElement(BcCommonConstants.DIV_TAG),this.pagesInfo=document.createElement(BcCommonConstants.DIV_TAG),this.prev=document.createElement(BcCommonConstants.DIV_TAG),this.center=document.createElement(BcCommonConstants.DIV_TAG),this.next=document.createElement(BcCommonConstants.DIV_TAG),this.currentStart=0,this.currentPage=1,this.perPage=PER_PAGE,this.perMultiple=PER_MULTIPLE,this.pageNum=1}static setUpAll(){const t=Array.from(document.querySelectorAll(`nav[class^='${MOLECULE_PAGINATOR}']`)),e=[];for(let s=0;s\n \n`}addArrowButtonDefault(t,e,s){t.innerHTML=``;const n=t.getElementsByTagName("button")[0],o=document.createElement(BcCommonConstants.SPAN_TAG);"Anterior"===s&&(o.textContent=s,n.insertAdjacentElement("beforeend",o)),"Siguiente"===s&&(o.textContent=s,n.insertAdjacentElement("afterbegin",o))}pagination(t,e,s=DEFAULT_PAGE_COUNT){this.validateNumbers(t,e,s);const n=Math.ceil(Math.abs(t/s));let o=e/s+1;if(n<=MAX_LENGHT){return Array.from(Array(n),(t,e)=>e+1)}return 1===e&&(o=1),this.pageManagement(o,n)}pageManagement(t,e){const s=new Array;for(let n=1;n<=e;n++)this.pageAdder(n,t,e,{pages:s});return s}pageAdder(t,e,s,n){return 1===t&&n.pages.push(t),1===e&&1===t?(n.pages.push(t+1),void n.pages.push("...")):(e===s&&t===s&&(n.pages.push("..."),n.pages.push(t-1)),t!==s?(this.currentPageIndexValidator(e,t,n,s),n):void n.pages.push(t))}currentPageIndexValidator(t,e,s,n){t===e&&e-1===SECOND_PAGE&&s.pages.push(e-1),t===e&&e-1>SECOND_PAGE&&(s.pages.push("..."),s.pages.push(e-1)),t===e&&s.pages.push(e),t===e&&e+11?this.paginatorList.insertAdjacentElement("afterbegin",this.prev):this.prev.remove(),this.currentPage${this.pageNum}`),t}setperPage(t){const e=document.createElement(BcCommonConstants.DIV_TAG),s=document.createElement(BcCommonConstants.DIV_TAG),n=document.createElement(BcCommonConstants.H6_TAG),o=document.createElement(BcCommonConstants.EM_TAG),i=document.createElement(BcCommonConstants.DIV_TAG),a=document.createElement(BcCommonConstants.UL_TAG),l=1e3*Math.random()/100;this.setInfo(),e.classList.add(MOLECULE_DROPDOWN,MOLECULE_DROPDOWN_PERPAGE),e.setAttribute("id",`${l.toFixed(0)}`),s.classList.add(MOLECULE_DROPDOWN_TOGGLE,`${BcCommonConstants.PREFIX_LIB}-${BcCommonConstants.FLEX}`,BcCommonConstants.BC_ALIGN_ITEMS_CENTER_CLASS),s.setAttribute("aria-controls",`${l.toFixed(0)}`),n.innerHTML=`${this.perPage}`,o.classList.add(BcCommonConstants.ICONS_CLASS,BcCommonConstants.ICON_XS_CLASS),o.innerHTML=BcCommonConstants.ICON_ARROW_DOWN,i.classList.add(MOLECULE_DROPDOWN_CONTENT),i.setAttribute("id",`${l.toFixed(0)}`),this.dropdownFor(e,t,a),i.appendChild(a),s.appendChild(n),s.appendChild(o),e.appendChild(s),e.appendChild(i),t.appendChild(e),this.initDropdown(e)}dropdownFor(t,e,s){for(let n=1;n<=PAGINATOR_MATH_VALUE_6;n++){const o=document.createElement(BcCommonConstants.LI_TAG),i=document.createElement(BcCommonConstants.BUTTON_TAG);o.classList.add(MOLECULE_DROPDOWN_ITEM),i.classList.add(BcCommonConstants.BC_LINK_CLASS),i.innerHTML=`${n*this.perMultiple}`,i.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.onClickPerPage(t,e,n)),o.appendChild(i),s.appendChild(o)}}onClickPerPage(t,e,s){this.perPage=s*this.perMultiple,this.currentStart=0,this.pageList=this.pagination(this.totalPages,this.currentStart,this.perPage),this.center.innerHTML="",this.addPagination(this.perPage),this.setperPage(e),t.remove(),this.setInfo(),this.changeStatus()}addEllipsis(t,e,s,n){const o=Math.random()*PAGINATOR_MATH_VALUE_1000/PAGINATOR_MATH_VALUE_100,i=document.createElement(BcCommonConstants.DIV_TAG),a=document.createElement(BcCommonConstants.EM_TAG),l=document.createElement(BcCommonConstants.DIV_TAG),c=document.createElement(BcCommonConstants.UL_TAG);i.classList.add(MOLECULE_DROPDOWN,MOLECULE_DROPDOWN_CUSTOM),i.setAttribute("id",`${o.toFixed(0)}`),a.classList.add(BcCommonConstants.ICONS_CLASS,BcCommonConstants.ICON_MD_CLASS,MOLECULE_DROPDOWN_TOGGLE),a.setAttribute("aria-controls",e),a.innerHTML="secondary-menu-horizontal",l.classList.add(MOLECULE_DROPDOWN_CONTENT),l.setAttribute("id",e);for(let e=s+1;ethis.onClickAddEllipsis(t,e)),s.appendChild(n),c.appendChild(s)}l.appendChild(c),i.appendChild(a),i.appendChild(l),t.insertAdjacentElement("beforeend",i),this.initDropdown(i)}onClickAddEllipsis(t,e){this.currentStart=(e-1)*this.perPage,this.currentPage=this.currentStart/this.perPage+1,this.pageList=this.pagination(this.totalPages,this.currentStart,this.perPage),t.innerHTML="",this.addPagination(this.perPage),this.changeStatus()}initDropdown(t){this.bcDropdownBehavior=new BcDropdownBehavior,this.bcDropdownBehavior.setElement(t),this.bcDropdownBehavior.setConfig({isPopUp:!0}),this.bcDropdownBehavior.setUp()}addButtons(t,e){const s=document.createElement(BcCommonConstants.BUTTON_TAG);s.textContent=`${e}`,s.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.onClickAddButtons(t,e)),t.insertAdjacentElement("beforeend",s)}onClickAddButtons(t,e){this.currentStart=(e-1)*this.perPage,this.currentPage=this.currentStart/this.perPage+1,this.pageList=this.pagination(this.totalPages,this.currentStart,this.perPage),t.innerHTML="",this.addPagination(this.perPage),this.setInfo(),this.changeStatus()}prevPage(){this.prev.children[0].addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.onClickPrevPage())}onClickPrevPage(){"default"!=this.typePaginator?(this.currentPage--,this.currentStart>=0&&(this.currentStart=this.currentStart-this.perPage,this.pageList=this.pagination(this.totalPages,this.currentStart,this.perPage),this.center.innerHTML="",this.addPagination(this.perPage),this.setInfo()),this.changeStatus()):this.changeStatusDefault("previous")}nextPage(){this.next.children[0].addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.onClickNextPage())}onClickNextPage(){"default"!=this.typePaginator?(this.currentPage++,this.currentStart-this.perPage<=this.totalPages-this.perPage&&(this.currentStart=this.currentStart+this.perPage,this.pageList=this.pagination(this.totalPages,this.currentStart,this.perPage),this.center.innerHTML="",this.addPagination(this.perPage),this.setInfo()),this.changeStatus()):this.changeStatusDefault("next")}setInfo(){const t=document.createElement(BcCommonConstants.SPAN_TAG);t.innerHTML=`Mostrando ${this.getQuantityInfo()} de ${this.totalPages}`,this.pagesInfo.innerHTML="",this.pagesInfo.appendChild(t)}getQuantityInfo(){const t=this.currentPage*this.perPage;return t>this.totalPages?this.totalPages:t}changeStatus(){this.changeState({TotalRegisters:this.totalPages,CurrentPage:this.currentPage,PerPage:this.perPage})}changeStatusDefault(t){let e=!1,s=!1;"previous"===t&&(e=!0),"next"===t&&(s=!0),this.changeState({PreviousPage:e,NextPage:s})}}class BcSearchBehavior extends BcDefaultBehavior{constructor(){super(),this.jsObjt={},this.objectArrayItem=[],this.stringFilters=""}setItems(t){this.objectArrayItem=t}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class^='${GROUP_SEARCH_SUFIX}']`)),e=[];for(const s of t){const t=s,n=new BcSearchBehavior;n.setElement(t),n.setUp(),e.push(n)}return e}setElement(t){this.isReady=!1,this.mySelf=t,addFocusable(this.mySelf)}_setUp(){this.inputObjectSearch(),this.searchClick(),this.searchDropDown(),this.searchInputs(),this.clearSearch()}searchDropDown(){const t=this.mySelf.querySelector(`div[class^="${SEARCH_ARROW_CLASS}"]`),e=this.mySelf.querySelector(`.${SEARCH_ADVANCED_CLASS}`),s=this.mySelf.querySelector(`.${SEARCH_ARROW_CLASS} .bc-icon`);t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{e.classList.contains(`${SEARCH_ADVANCED_ACTIVE_CLASS}`)?(e.classList.remove(`${SEARCH_ADVANCED_ACTIVE_CLASS}`),s.innerHTML="arrow2-down"):(e.classList.add(`${SEARCH_ADVANCED_ACTIVE_CLASS}`),s.innerHTML="error")})}searchClick(){const t=this.mySelf.querySelectorAll(`.${SEARCH_BUTTON_CLASS}`);for(const e of t)e.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.searchObject()})}searchObject(){this.jsObjt={};const t=this.mySelf.querySelectorAll(BcCommonConstants.INPUT_TAG),e=this.mySelf.querySelector(`.${SEARCH_BUTTON_CLASS} ${BcCommonConstants.BUTTON_TAG}`);let s=!1;this.stringFilters="",s=this.searchObjectIterate(t,s);const n=[];if(Object.keys(this.jsObjt).length)for(const t of this.objectArrayItem){this.dataSearch(t,this.jsObjt)&&n.push(t)}this.outputFunction&&(n.query=this.jsObjt,this.outputFunction(n)),this.showQuantityItems(n.length),e.disabled=!s}searchObjectIterate(t,e){for(const s of t)"checkbox"===s.type?s.checked&&(this.jsObjt.hasOwnProperty(s.name)?(this.jsObjt[s.name].push(s.value),this.stringFilters+=s.value+","):(this.jsObjt[s.name]=[],this.jsObjt[s.name].push(s.value),this.stringFilters+=s.value+",")):s.value&&(this.jsObjt[s.name]=s.value,s.dataset.value&&(this.jsObjt[s.dataset.value]=s.value),this.stringFilters+=s.value+","),s.value.length&&(e=!0);return e}inputObjectSearch(){const t=this.mySelf.querySelectorAll(BcCommonConstants.INPUT_TAG);for(const e of t)e.addEventListener(BcCommonConstants.EVENT_INPUT,()=>{this.searchObject()})}dataSearch(t,e){let s=!1;return Object.keys(e).every(n=>{if(Array.isArray(e[n])){for(const o of e[n])if(t[n]&&o&&(s=String(t[n]).toUpperCase().includes(o.toUpperCase())))return s}else s=this.dataSearchIsNotArray(n,s,t,e)}),s}dataSearchIsNotArray(t,e,s,n){const o=this.mySelf.querySelectorAll("input[name="+t+"]");return o.length&&o[0].dataset.value?(e=String(s[o[0].dataset.value]).toUpperCase().includes(n[t].toUpperCase()))||(e=String(s[t]).toUpperCase().includes(n[t].toUpperCase())):s[t]&&n[t]&&(e=String(s[t]).toUpperCase().includes(n[t].toUpperCase())),e}searchInputs(){const t=this.mySelf.querySelectorAll(BcCommonConstants.DIV_TAG);for(const e of t)if(e.classList.contains(`${SEARCH_INPUT_SELECT_CLASS}`)){const t=new BcInputSelectBehavior;t.setElement(e),t.outputFunction=(t=>{this.searchObject()}),t.setUp()}}showQuantityItems(t){const e=this.mySelf.querySelector(`.${SEARCH_CONTENT_SHOW_RESULT_CLASS}`),s=this.mySelf.querySelector(`.${SEARCH_CLEAR_CLASS}`),n=this.mySelf.querySelectorAll(`.${SEARCH_RESULT_NULL_CLASS} ${BcCommonConstants.DIV_TAG}`);if(void 0===t?(e.innerHTML="",s.classList.remove(`${SEARCH_CLEAR_SHOW_CLASS}`)):t?(e.innerHTML=`Mostrando ${t} resultados para: ${this.stringFilters} \n `,s.classList.add(`${SEARCH_CLEAR_SHOW_CLASS}`)):(e.innerHTML=`Mostrando 0 resultados para: ${this.stringFilters} `,s.classList.add(`${SEARCH_CLEAR_SHOW_CLASS}`)),t||void 0===t)for(const t of n)t.classList.remove(`${SEARCH_SHOW_IMAGE_CLASS}`);else for(const t of n)t.classList.add(`${SEARCH_SHOW_IMAGE_CLASS}`)}clearSearch(){const t=document.querySelector(`.${SEARCH_CONTENT_SHOW_RESULT_CLASS}`),e=document.querySelector(`.${SEARCH_CLEAR_CLASS}`),s=document.querySelectorAll(`.${SEARCH_RESULT_NULL_CLASS} ${BcCommonConstants.DIV_TAG}`);e.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.jsObjt={},t.innerHTML="",e.classList.remove(`${SEARCH_CLEAR_SHOW_CLASS}`);const n=this.mySelf.querySelectorAll(`${BcCommonConstants.INPUT_TAG}`);this.mySelf.querySelector(`.${SEARCH_BUTTON_CLASS} ${BcCommonConstants.BUTTON_TAG}`).disabled=!0;for(const t of n)"checkbox"===t.type?t.checked&&(t.checked=!1):t.value&&(t.value="");for(const t of s)t.classList.remove(`${SEARCH_SHOW_IMAGE_CLASS}`)})}}const SEARCH_ARROW_CLASS=`${BcCommonConstants.PREFIX_LIB}-search-button-expanded`,SEARCH_ADVANCED_ACTIVE_CLASS=`${BcCommonConstants.PREFIX_LIB}-content-advanced-search-active`,SEARCH_ADVANCED_CLASS=`${BcCommonConstants.PREFIX_LIB}-content-advanced-search`,SEARCH_BUTTON_CLASS=`${BcCommonConstants.PREFIX_LIB}-search-button`,SEARCH_INPUT_SELECT_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-select`,SEARCH_CONTENT_SHOW_RESULT_CLASS=`${BcCommonConstants.PREFIX_LIB}-content-show-result`,SEARCH_CLEAR_CLASS=`${BcCommonConstants.PREFIX_LIB}-search-clear`,SEARCH_RESULT_NULL_CLASS=`${BcCommonConstants.PREFIX_LIB}-search-result-null`,SEARCH_CLEAR_SHOW_CLASS=`${BcCommonConstants.PREFIX_LIB}-search-clear-show`,SEARCH_SHOW_IMAGE_CLASS=`${BcCommonConstants.PREFIX_LIB}-search-show-image`,GROUP_SEARCH_SUFIX=`${BcCommonConstants.PREFIX_LIB}-search`,SIDE_BAR=`${BcCommonConstants.PREFIX_LIB}-sidebar`,SIDE_BAR_ACTIVE_CONTENT=`${BcCommonConstants.PREFIX_LIB}-sidebar-active-content`,SIDE_BAR_ACTIVE_ITEM=`${BcCommonConstants.PREFIX_LIB}-sidebar-active-item`,CLOSE_BUTTON_TEXT="error",SIDE_BAR_STATUS_PROPERTY="status",SIDE_BAR_TYPE_PROPERTY="type",SIDE_BAR_ASIDE=":scope>aside",SIDE_BAR_PRINCIPAL_CONTENT=":scope>section:first-child>div:first-child",SIDE_BAR_BUTTONS_QUERY=":scope>aside>section:first-child>section:first-child>button",SIDE_BAR_ARIA_CONTROL="",SIDE_BAR_CONTENT_QUERY=":scope>aside>section:first-child>section:nth-child(2)>div",SIDE_BAR_ID="id",SIDE_BAR_LI_NAV=":scope>aside>nav>ul>li",SIDE_BAR_BUTTON_NAV=":scope>aside>nav>ul:first-child>li>button",ARIA_LABEL_BARRA_EXPANDIR="Expandir barra lateral",ARIA_LABEL_BARRA_CONTRAER="Contraer barra lateral",ARIA_LABEL="aria-label";var SideBarStatus,SideBarType;!function(t){t.close="close",t.open="open"}(SideBarStatus||(SideBarStatus={})),function(t){t.fixed="fixed",t.hide="hide",t.collapsible="collapsible",t.states="states"}(SideBarType||(SideBarType={}));class BcSidebarBehavior extends BcDefaultBehavior{constructor(){super()}static setUpAll(){const t=Array.from(document.querySelectorAll(`section[class~='${SIDE_BAR}']`)),e=[];for(const s of t){const t=s,n=new BcSidebarBehavior;n.setElement(t),n.setUp(),e.push(n)}return e}_setUp(){this.configTypeFActions()}configOpenCloseButtonEvent(){this.mySelf.querySelector(`${SIDE_BAR_BUTTONS_QUERY}:first-child`).addEventListener(BcCommonConstants.EVENT_CLICK,()=>{switch(this.mySelf.getAttribute(SIDE_BAR_STATUS_PROPERTY)){case SideBarStatus.close:this.open();break;case SideBarStatus.open:this.close();break;default:this.open()}})}setHeightContent(){const t=this.mySelf.querySelector(`${SIDE_BAR_PRINCIPAL_CONTENT}`);let e=document.documentElement.clientHeight;t.style.height=e+"px",window.addEventListener("resize",function(s){e=document.documentElement.clientHeight,t.style.height=e+"px"})}open(){const t=this.mySelf.querySelector(`${SIDE_BAR_BUTTONS_QUERY}:first-child`);this.changeStatus(SideBarStatus.open),this.configMainContent(!0),t.setAttribute(`${ARIA_LABEL}`,`${ARIA_LABEL_BARRA_CONTRAER}`),t.innerHTML=BcCommonConstants.ICON_ARROW_RIGHT}close(){const t=this.mySelf.querySelector(`${SIDE_BAR_BUTTONS_QUERY}:first-child`);this.changeStatus(SideBarStatus.close),this.configMainContent(!1),t.setAttribute(`${ARIA_LABEL}`,`${ARIA_LABEL_BARRA_EXPANDIR}`),t.innerHTML=BcCommonConstants.ICON_ARROW_LEFT}changeStatus(t){this.mySelf.setAttribute(SIDE_BAR_STATUS_PROPERTY,t)}configMainContent(t){const e=this.mySelf.querySelector(`${SIDE_BAR_CONTENT_QUERY}:first-child`);t?e.classList.toggle(SIDE_BAR_ACTIVE_CONTENT):e.classList.remove(SIDE_BAR_ACTIVE_CONTENT)}configCloseButtonEvent(){const t=this.mySelf.querySelector(`${SIDE_BAR_BUTTONS_QUERY}:first-child`);null==t||t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.mySelf.setAttribute(SIDE_BAR_STATUS_PROPERTY,SideBarStatus.close)})}configOpenButtonEventHide(){this.mySelf.getAttribute(SIDE_BAR_TYPE_PROPERTY).includes(SideBarType.hide)&&this.changeStatus(SideBarStatus.open)}removeArrowButton(){this.removeDiferentSelectedButtons([CLOSE_BUTTON_TEXT])}menuComponent(){const t=[];this.mySelf.querySelectorAll(`${SIDE_BAR_BUTTONS_QUERY}`).forEach(e=>{t.includes(e.innerText)?e.remove():t.push(e.innerText)})}closeEventKey(){const t=this.mySelf.querySelectorAll(`${SIDE_BAR_BUTTONS_QUERY}`);window.addEventListener(BcCommonConstants.EVENT_KEY_DOWN,e=>{this.closeComponentWithEsc(e,t)})}closeComponentWithEsc(t,e){if(t.key===BcCommonConstants.KEY_EVENT_ESCAPE){this.mySelf.getAttribute(SIDE_BAR_TYPE_PROPERTY)==SideBarType.collapsible?this.close():this.mySelf.setAttribute(SIDE_BAR_STATUS_PROPERTY,SideBarStatus.close);for(let t=0;t{t.includes(e.innerText)||e.remove()}),this.menuComponent()}removeBothButtons(){this.removeArrowButton(),this.removeCloseButton()}removeCloseButton(){this.removeDiferentSelectedButtons([BcCommonConstants.ICON_ARROW_LEFT])}configMenuItemsAction(){const t=this.mySelf.querySelectorAll(`${SIDE_BAR_LI_NAV}`);for(let e=0;e{var s;t.classList.contains(SIDE_BAR_ACTIVE_ITEM)?(this.removeActiveItem(),e.classList.remove(SIDE_BAR_ACTIVE_CONTENT),this.changeStatus(SideBarStatus.close)):(null===(s=this.mySelf.querySelector(`${SIDE_BAR_CONTENT_QUERY}.${SIDE_BAR_ACTIVE_CONTENT}`))||void 0===s||s.classList.remove(SIDE_BAR_ACTIVE_CONTENT),e&&(this.removeActiveItem(),t.classList.toggle(SIDE_BAR_ACTIVE_ITEM),e.classList.toggle(SIDE_BAR_ACTIVE_CONTENT),this.changeStatus(SideBarStatus.open)))}}removeActiveItem(){var t;null===(t=this.mySelf.querySelector(`${SIDE_BAR_LI_NAV}.${SIDE_BAR_ACTIVE_ITEM}`))||void 0===t||t.classList.remove(SIDE_BAR_ACTIVE_ITEM)}configTypeFActions(){switch(this.mySelf.getAttribute(SIDE_BAR_TYPE_PROPERTY)){case SideBarType.collapsible:this.setHeightContent(),this.removeCloseButton(),this.configOpenCloseButtonEvent(),this.accesibility(),this.closeEventKey();break;case SideBarType.hide:this.setHeightContent(),this.configMainContent(!0),this.removeArrowButton(),this.configCloseButtonEvent(),this.configOpenButtonEventHide(),this.accesibility();break;case SideBarType.states:this.setHeightContent(),this.removeBothButtons(),this.configMenuItemsAction(),this.closeEventKey();break;case SideBarType.fixed:this.setHeightContent(),this.configMainContent(!0),this.removeBothButtons();break;default:this.removeBothButtons()}}}const OFF_CANVAS=`${BcCommonConstants.PREFIX_LIB}-off-canvas`,OFF_CANVAS_STATUS_PROPERTY="status",OFF_CANVAS_CLOSE_BUTTON_TEXT="error",OFF_CANVAS_STATUS_TYPE="type",OFF_CANVAS_BUTTONS_QUERY=":scope>aside>section:first-child>button:first-child";var OffCanvasStatus;!function(t){t.close="close",t.open="open"}(OffCanvasStatus||(OffCanvasStatus={}));class BcOffCanvasBehavior extends BcDefaultBehavior{constructor(){super()}static setUpAll(){const t=Array.from(document.querySelectorAll(`section[class~='${OFF_CANVAS}']`)),e=[];for(const s of t){const t=s,n=new BcOffCanvasBehavior;n.setElement(t),n.setUp(),e.push(n)}return e}_setUp(){this.configCloseButton(),this.closeAccesibilidad(),this.closeOffCanvasWithclick(),this.closeEventKey()}closeOffCanvasWithclick(){this.mySelf.addEventListener(BcCommonConstants.EVENT_CLICK,t=>{t.target.className===OFF_CANVAS&&this.close()})}closeEventKey(){window.addEventListener(BcCommonConstants.EVENT_KEY_DOWN,t=>{t.key===BcCommonConstants.KEY_EVENT_ESCAPE&&this.close()})}open(){this.changeStatus(OffCanvasStatus.open)}close(){this.changeStatus(OffCanvasStatus.close)}configCloseButton(){const t=this.mySelf.querySelector(`${OFF_CANVAS_BUTTONS_QUERY}`);null==t||t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.close()})}closeAccesibilidad(){addFocusable(this.mySelf.querySelector(`${OFF_CANVAS_BUTTONS_QUERY}`),{tabindex:"0"})}changeStatus(t){this.mySelf.setAttribute(OFF_CANVAS_STATUS_PROPERTY,t)}}const NOT_LABELS_ERROR="There are no labels in tabs.",NOT_LABEL_HEADER_ERROR="Is not posible to find the labels container. Please review the HTML structure of you component.",LEFT_POSITION="flex-start",RIGHT_POSITION="flex-end";class BcTabsGroupBehavior extends BcDefaultBehavior{constructor(){super(),this.currentTabsSelected=0,this.firsLoad=!0,this.tabScrollPosition=0}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class^='${MOLECULA}']`)),e=[];for(let s=0;s .${TAB_HEADER_CLASS}`),this.tabsContainer=this.tabHeader.querySelector(`:scope > .${TAB_CONTAINER_CLASS}`),this.tabsArrowButtons=this.tabHeader.querySelector(`:scope > .${ARROW_BUTTONS}`),this.tabsPane=this.tabHeader.querySelectorAll(`:scope .${TAB_CONTAINER_CLASS} > .${TAB_CLASS}`),this.tabHeaderStyle=window.getComputedStyle(this.tabHeader)||this.tabHeader.style,this.tabHeaderMargin=parseInt(this.tabHeaderStyle.marginLeft,10)+parseInt(this.tabHeaderStyle.marginRight,10)+parseInt(this.tabHeaderStyle.paddingLeft,10)+parseInt(this.tabHeaderStyle.paddingRight,10),this.tabsLength=this.tabsPane.length,this.maxWidth=this.tabHeader.offsetWidth,this.scrollBase=Math.round(this.maxWidth/this.tabsLength),this.base=0,this.left=0,this.tabBody=this.mySelf.querySelector(`:scope > .${TAB_BODY_CLASS}`),this.justifycontent=this.tabsContainer.getAttribute("justifycontent"),this.orientation=this.tabsContainer.getAttribute("orientation"),this.positionTabs(),window.addEventListener(BcCommonConstants.EVENT_LOAD,()=>{this.configureTabsWidth(this.justifycontent),this.onResizeFunction(window.innerWidth)}),window.addEventListener(BcCommonConstants.EVENT_RESIZE,t=>{this.onResizeFunction(t.target.innerWidth)}),this.initTabsGroup(),this.addListenersArrows()}callBackTabSelected(t){this.onSelectTab=t}getCurrentIndexSelected(){return this.currentTabsSelected}onResizeFunction(t){this.maxWidth=this.tabsContainer.offsetWidth,this.scrollBase=Math.round(this.maxWidth/this.tabsLength),this.toggleNav(this.tabsArrowButtons,t)}positionTabs(){this.mySelf.getAttribute("right")&&"true"===this.mySelf.getAttribute("right")&&this.tabsContainer.setAttribute("justifycontent",RIGHT_POSITION),this.mySelf.getAttribute("left")&&"true"===this.mySelf.getAttribute("left")&&this.tabsContainer.setAttribute("justifycontent",LEFT_POSITION)}toggleNav(t,e){const s=t;if(this.tabHeader.offsetWidthFIVE_LENGTH&&(this.base=SIX_LENGTH),t.lengthFIVE_LENGTH&&(this.base=FOUR_LENGTH),eFIVE_LENGTH&&(this.base=FIVE_LENGTH),this.firsLoad&&(this.tabsContainer.style.width="vertical"==this.orientation?"100%":this.getWidthAllTabs()+"px",this.firsLoad=!1)}else s.classList.add(HIDE_CLASS),this.tabsContainer.setAttribute("justifycontent",this.justifycontent),this.tabsContainer.style.width="auto",this.tabsContainer.style.left="0"}addListenersArrows(){const t=this.tabsArrowButtons.children,e=this.tabsContainer;e.style.left="0";for(let s=0;s{if(n.className.indexOf(PREV_CLASS)>=0&&this.tabScrollPosition>0){const t=`-${-1*this.left-this.tabsPane[this.tabScrollPosition].offsetWidth}px`;e.style.left=t,this.tabScrollPosition--}if(n.className.indexOf(NEXT_CLASS)>=0&&this.tabsPane.length-2>=this.tabScrollPosition){const t=`-${-1*this.left+this.tabsPane[this.tabScrollPosition].offsetWidth}px`;e.style.left=t,this.tabScrollPosition++}this.left=parseInt(this.tabsContainer.style.left,10)})}}initTabsGroup(){const t=this.tabsPane[0],e=this.tabBody.querySelectorAll(`:scope > .${TAB_CONTENT_CLASS}`)[0];void 0!==t&&t.classList.add(ACTIVE_CLASS),void 0!==e&&e.classList.add(ACTIVE_CLASS);for(let t=0;t{this.removeAddClasses(t,e),this.onSelectTab&&(this.currentTabsSelected=e,this.onSelectTab(this.currentTabsSelected))})}removeAddClasses(t,e){const s=this.tabHeader.querySelectorAll(`:scope .${TAB_CONTAINER_CLASS} > .${ACTIVE_CLASS}`)[0];void 0!==s&&s.classList.remove(`${ACTIVE_CLASS}`);const n=this.tabBody.querySelectorAll(`:scope > .${ACTIVE_CLASS}`)[0];void 0!==n&&n.classList.remove(`${ACTIVE_CLASS}`),void 0!==t&&t.classList.add(ACTIVE_CLASS);const o=this.tabBody.querySelectorAll(`:scope > .${TAB_CONTENT_CLASS}`)[e];void 0!==o&&o.classList.add(ACTIVE_CLASS)}selectTab(t){this.tabsPane[t]&&this.tabsPane[t].click()}configureTabsWidth(t){let e="auto";if("space-between"===t){const t=this.tabsPane.length||0;e=`${ONE_HUNDRED/t}%`}this.tabsPane.forEach(t=>{"vertical"===this.orientation?t.style.width="100%":t.style.width=`${e}`})}show(t){this.getTabsHTMLObject(t).title.style.display="block"}hidden(t){this.getTabsHTMLObject(t).title.style.display="none",this.autoSelectTab(t)}getTabsHTMLObject(t){return{title:this.mySelf.querySelectorAll(".bc-tab")[t],body:this.mySelf.querySelectorAll(".bc-tab-content")[t]}}autoSelectTab(t){if(t==this.getCurrentIndexSelected()){const e=t+1,s=t-1;e0&&this.selectTab(s)}}getWidthAllTabs(){return Array.from(this.tabsPane).map(t=>t.offsetWidth).reduce((t,e)=>t+e)}}const MOLECULA=`${BcCommonConstants.PREFIX_LIB}-tabs-group`,TAB_HEADER_CLASS=`${BcCommonConstants.PREFIX_LIB}-tab-header`,TAB_CONTAINER_CLASS=`${BcCommonConstants.PREFIX_LIB}-tabs`,TAB_CLASS=`${BcCommonConstants.PREFIX_LIB}-tab`,TAB_BODY_CLASS=`${BcCommonConstants.PREFIX_LIB}-tab-body`,TAB_CONTENT_CLASS=`${BcCommonConstants.PREFIX_LIB}-tab-content`,ARROW_BUTTONS="arrow-buttons",ACTIVE_CLASS="active",HIDE_CLASS="hide",PREV_CLASS="prev",NEXT_CLASS="next",FOUR_LENGTH=4,FIVE_LENGTH=4,SIX_LENGTH=4,MIN_WIDTH=551,MEDIUM_WIDTH=650,ONE_HUNDRED=100;class BcTooltipBehavior extends BcDefaultBehavior{constructor(){super(...arguments),this.margin=BC_TOOLTIP_EIGHT}static setUpAll(){const t=Array.from(document.querySelectorAll(`.${BC_TOOLTIP_SELECTOR}`)),e=[];for(const s of t){const t=new BcTooltipBehavior;t.setElement(s),t.setUp(),e.push(t)}return e}_setUp(){this.buildView(),this.addListeners()}buildView(){const t=this.mySelf.getAttribute(BC_TOOLTIP_TEXT_ATTRIBUTE),e=this.mySelf.getAttribute(BC_TOOLTIP_TITLE_ATTRIBUTE),s=this.mySelf.getAttribute(BC_TOOLTIP_BUTTON_TEXT_ATTRIBUTE);this.parentELementClass=this.mySelf.getAttribute(BC_TOOLTIP_PARENT_ELEMENT_CLASS),this.position=this.mySelf.getAttribute(BC_TOOLTIP_POSITION_ATTRIBUTE),this.classNameWithId=`${BC_TOOLTIP_CONTAINER_SELECTOR}--${BcTooltipBehavior.ID}`,BcTooltipBehavior.ID++,this.mySelf.setAttribute("tabindex","0"),this.tooltipElement=this.createElement("div","class",`${BC_TOOLTIP_CONTAINER_SELECTOR} ${this.classNameWithId}`),this.arrowElement=this.createElement("div","class",BC_TOOLTIP_ARROW_CLASS);const n=this.createElementWithText("p",t||"");if(addFocusable(n),this.position=this.position?this.position.toLowerCase():"top",this.arrowElement.classList.add(this.arrowElement.classList.item(0)+"--"+this.position),null!=e&&"undefined"!==e){const t=this.createElementWithText("h5",e||"");this.tooltipElement.appendChild(t),this.tooltipElement.appendChild(this.createElement("hr","class",BC_TOOLTIP_DIVIDER_CLASS)),addFocusable(t)}if(this.tooltipElement.appendChild(n),this.tooltipElement.appendChild(this.arrowElement),null!=s&&"undefined"!==s){const t=this.createElementWithText("button",s||"");t.classList.add(BC_TOOLTIP_BUTTON_CLASS_TYPE),t.classList.add(`${BC_TOOLTIP_SELECTOR}-button`),t.setAttribute(BC_TOOLTIP_BUTTON_CLASS,""),t.setAttribute("typeButton","secondary"),t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.hideTooltip(),this.buttonClickCallback()}),addFocusable(t),this.tooltipElement.appendChild(t)}document.body.appendChild(this.tooltipElement),isMobileDevice()&&this.tooltipElement.classList.add(BC_TOOLTIP_BUTTON_CLOSE_CLASS)}showTooltip(){this.fadeIn(this.mySelf,null,this.tooltipElement,!1)}hideTooltip(){this.fadeOut(this.mySelf,null,this.tooltipElement,!1)}addListeners(){if(this.fadeIn(this.mySelf,BcCommonConstants.EVENT_MOUSEENTER,this.tooltipElement,!1),this.fadeIn(this.mySelf,BcCommonConstants.EVENT_FOCUS,this.tooltipElement,!1),this.fadeOut(this.mySelf,BcCommonConstants.EVENT_MOUSEOUT,this.tooltipElement,!1),this.fadeOut(this.mySelf,BcCommonConstants.EVENT_BLUR,this.tooltipElement,!1),window.addEventListener("resize",()=>{this.setPosition()}),document.addEventListener("scroll",()=>{this.setPosition()}),null!=this.parentELementClass&&"undefined"!==this.parentELementClass){const t=document.querySelector(`div[class~='${this.parentELementClass}']`);t.addEventListener("scroll",()=>{this.setPosition()}),t.addEventListener("resize",()=>{this.setPosition()})}}buttonClick(t){this.buttonClickCallback=t}setPosition(){const t=this.mySelf;switch(this.position){case BC_TOOLTIP_BUTTON_BOTTOM:this.bottomTooltip(t,this.arrowElement,this.tooltipElement);break;case BC_TOOLTIP_BUTTON_RIGHT:this.rightTooltip(t,this.arrowElement,this.tooltipElement);break;case BC_TOOLTIP_BUTTON_LEFT:this.leftTooltip(t,this.arrowElement,this.tooltipElement);break;default:this.topTooltip(t,this.arrowElement,this.tooltipElement)}}createElement(t,e,s){const n=document.createElement(t);return n.setAttribute(e,s),n}createElementWithText(t,e){const s=document.createElement(t);return s.innerText=e,s}topTooltip(t,e,s){this.changeArrowClass(e,s,"top");const n=this.fixPosXIfElementIsOutScreen(t,s,e);this.setElementPosition(s,this.offset(t).top-s.offsetHeight-e.offsetHeight-this.margin,n.tooltip),this.setElementPosition(e,s.offsetHeight,n.arrow)}offset(t){const e=t.getBoundingClientRect(),s=window.pageXOffset||document.documentElement.scrollLeft,n=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+n,left:e.left+s}}bottomTooltip(t,e,s){const n=this.fixPosXIfElementIsOutScreen(t,s,e);this.setElementPosition(s,this.offset(t).top+t.offsetHeight+e.offsetHeight+this.margin,n.tooltip),this.setElementPosition(e,-e.offsetHeight,n.arrow)}rightTooltip(t,e,s){const n=this.offset(t).left+t.offsetWidth+e.offsetWidth+this.margin,o=this.centerToTarget(t,s,e,!0);n+s.offsetWidth>=document.body.offsetWidth?this.topTooltip(t,e,s):(this.changeArrowClass(e,s,"right"),this.setElementPosition(s,o.tooltip,n),this.setElementPosition(e,o.arrow,-e.offsetWidth))}leftTooltip(t,e,s){const n=this.offset(t).left-s.offsetWidth-e.offsetWidth-this.margin,o=this.centerToTarget(t,s,e,!0);n<=0?this.topTooltip(t,e,s):(this.changeArrowClass(e,s,"left"),this.setElementPosition(s,o.tooltip,n),this.setElementPosition(e,o.arrow,s.offsetWidth))}fadeIn(t,e,s,n){if(!e)return this.setPosition(),s.style.animation="fade-in-opacity 100ms forwards";t.addEventListener(e,()=>{this.setPosition(),s.style.animation="fade-in-opacity 100ms forwards"},n)}fadeOut(t,e,s,n){if(!e)return s.style.animation="fade-out-opacity 100ms forwards";t.addEventListener(e,()=>{s.style.animation="fade-out-opacity 100ms forwards"},n)}setElementPosition(t,e,s){t.style.top=e+"px",t.style.left=s+"px"}centerToTarget(t,e,s,n){const o=n?"offsetHeight":"offsetWidth";return{tooltip:(n?this.offset(t).top:this.offset(t).left)-e[o]/BC_TOOLTIP_TWO+t[o]/BC_TOOLTIP_TWO,arrow:e[o]/BC_TOOLTIP_TWO-s[o]/BC_TOOLTIP_TWO}}changeArrowClass(t,e,s){e.removeChild(t),t.classList.remove(t.classList.item(1)),t.classList.add(t.classList.item(0)+"--"+s),e.appendChild(t)}fixPosXIfElementIsOutScreen(t,e,s){const n=this.centerToTarget(t,e,s,!1);return n.tooltip+e.offsetWidth>=document.body.offsetWidth?(n.tooltip=this.offset(t).left+t.offsetWidth-e.offsetWidth,n.arrow=e.offsetWidth-s.offsetWidth-t.offsetWidth/BC_TOOLTIP_TWO):n.tooltip<=0&&(n.tooltip=this.offset(t).left,n.arrow=t.offsetWidth/BC_TOOLTIP_TWO),n}}BcTooltipBehavior.ID=0;const BC_TOOLTIP_SELECTOR=`${BcCommonConstants.PREFIX_LIB}-tooltip`,BC_TOOLTIP_CONTAINER_SELECTOR=`${BcCommonConstants.PREFIX_LIB}-tooltip-container`,BC_TOOLTIP_TEXT_ATTRIBUTE=`${BcCommonConstants.PREFIX_LIB}TooltipText`,BC_TOOLTIP_TITLE_ATTRIBUTE=`${BcCommonConstants.PREFIX_LIB}TooltipTitle`,BC_TOOLTIP_BUTTON_TEXT_ATTRIBUTE=`${BcCommonConstants.PREFIX_LIB}TooltipButtonText`,BC_TOOLTIP_POSITION_ATTRIBUTE=`${BcCommonConstants.PREFIX_LIB}TooltipPosition`,BC_TOOLTIP_ARROW_CLASS=`${BcCommonConstants.PREFIX_LIB}-tooltip-arrow`,BC_TOOLTIP_DIVIDER_CLASS=`${BcCommonConstants.PREFIX_LIB}-tooltip-arrow`,BC_TOOLTIP_BUTTON_CLOSE_CLASS=`${BcCommonConstants.PREFIX_LIB}-tooltip-close-btn`,BC_TOOLTIP_BUTTON_CLASS=`${BcCommonConstants.PREFIX_LIB}-button`,BC_TOOLTIP_BUTTON_CLASS_TYPE=`${BcCommonConstants.PREFIX_LIB}-button-secondary`,BC_TOOLTIP_PARENT_ELEMENT_CLASS=`${BcCommonConstants.PREFIX_LIB}TooltipParentElement`,BC_TOOLTIP_BUTTON_TOP="top",BC_TOOLTIP_BUTTON_RIGHT="right",BC_TOOLTIP_BUTTON_BOTTOM="bottom",BC_TOOLTIP_BUTTON_LEFT="left",BC_TOOLTIP_EIGHT=8,BC_TOOLTIP_TWO=2,ACTIVE="active",dropdown="dropdown",ICON_REMOVE_ITEM="error",ICON_ADD_FILTER="plus",BC_CLASS_NAME_COMPONENT=`${BcCommonConstants.PREFIX_LIB}-tag`,BC_CLASS_NAME_CONTENT=`${BC_CLASS_NAME_COMPONENT}-content`,BC_CLASS_NAME_DROPDOWN_COMPONENT=`${BC_CLASS_NAME_COMPONENT}-dropdown`,BC_CLASS_NAME_DROPDOWN_CONTENT_LIST=`${BC_CLASS_NAME_COMPONENT}-dropdown-content-list`,BC_CLASS_NAME_ITEM=`${BC_CLASS_NAME_COMPONENT}-dropdown-item`,BC_CLASS_NAME_DROPDOWN_PARENT=`${BC_CLASS_NAME_COMPONENT}-dropdown-content`,BC_CLASS_NAME_DROPDOWN_ACTIVE=`${BC_CLASS_NAME_COMPONENT}-dropdown-content-active`,BC_CLASS_NAME_MAIN_ACTIVE=`${BC_CLASS_NAME_COMPONENT}-dropdown-main-active`,BC_CLASS_NAME_FILTER_ACTIVE=`${BC_CLASS_NAME_COMPONENT}-filter-active`;class BcTagBehavior extends BcAbstractDropdownBehavior{constructor(){super()}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class~='${BC_CLASS_NAME_CONTENT}']`)),e=[];for(let s=0;s{t.firstElementChild.classList.toggle(`${BC_CLASS_NAME_FILTER_ACTIVE}`),t.firstElementChild.classList.contains(`${BC_CLASS_NAME_FILTER_ACTIVE}`)?(t.firstElementChild.lastElementChild.innerHTML=ICON_REMOVE_ITEM,t.firstElementChild.setAttribute(BcCommonConstants.ARIA_CURRENT,"true")):(t.firstElementChild.setAttribute(BcCommonConstants.ARIA_CURRENT,"false"),t.firstElementChild.lastElementChild.innerHTML=ICON_ADD_FILTER)})}listenerSelectOption(){this.mySelf.querySelectorAll(BcCommonConstants.LI_TAG).forEach(t=>{t.addEventListener(BcCommonConstants.EVENT_CLICK,t=>{const e=t.currentTarget.getAttribute("data-value"),s=t.currentTarget.lastChild.innerText;this.outputFunction(this.addValueObject(e)),this.changeValueSelected(s)})})}changeValueSelected(t){this.mySelf.querySelector(BcCommonConstants.P_TAG).innerText=t}addValueObject(t){return{idElement:this.mySelf.id,value:t}}createItems(){if(this.validateItemsExists())this.listenerSelectOption();else if(this.itemsConfig){const t=[];for(const e of this.itemsConfig){const s=this.itemsConfig.indexOf(e);let n=null;n=this.itemsConfig[s],t.push(n)}this.updateItemCreate(t)}}validateItemsExists(){return this.mySelf.querySelectorAll(BcCommonConstants.LI_TAG).length}setItems(t){this.itemsConfig=t}updateItemCreate(t){const e=this.mySelf.querySelector(BcCommonConstants.UL_TAG);e.innerHTML="";for(const s of t){const t=createElement({element:BcCommonConstants.LI_TAG,classList:[BC_CLASS_NAME_ITEM],children:[createElement({element:BcCommonConstants.I_TAG,innerText:s.iconName,classList:["bc-icon","bc-mx-1"]}),createElement({element:BcCommonConstants.SPAN_TAG,innerText:s.spanText})]});t.dataset.value=s.value,e.appendChild(t)}this.listenerSelectOption()}}class BcListBehavior extends BcDefaultBehavior{constructor(){super()}static setUpAll(){const t=Array.from(document.querySelectorAll(`section[class~='${LIST}']`)),e=[];for(const s of t){const t=s,n=new BcListBehavior;n.setElement(t),n.setUp(),e.push(n)}return e}_setUp(){this.setCheckbox(),this.accessibility()}setCheckbox(){document.querySelector("input[type=checkbox]").addEventListener("change",function(){const t=document.getElementById("list");this.checked?t.classList.add(LIST_SELECTED):t.classList.remove(LIST_SELECTED)})}accessibility(){const t=Array.from(document.querySelectorAll(`.${LIST}`));for(const e of t)addFocusable(e,{tabindex:"0"})}}const LIST=`${BcCommonConstants.PREFIX_LIB}-list`,LIST_ACTION_ICON=LIST+"-action-icon",LIST_CHECKBOX=LIST+"-checkbox",LIST_CONTENT=LIST+"-content",LIST_CONTENT_DATA=LIST+"-content-data",LIST_MAIN_CONTENT=LIST+"-main-content",LIST_CONTAINER_CHECKBOX=LIST+"-container-checkbox",LIST_SELECTED=`${BcCommonConstants.PREFIX_LIB}-selected`,BC_COACH_MARK_SELECTOR=`${BcCommonConstants.PREFIX_LIB}-coach-mark`,BC_COACH_MARK_CONTAINER=`${BcCommonConstants.PREFIX_LIB}-coach-mark-container`,BC_COACH_MARK_FOOTER=`${BC_COACH_MARK_SELECTOR}-footer`,BC_COACH_MARK_EXPANDED=`${BC_COACH_MARK_SELECTOR}-expanded`,BC_COACH_MARK_FOOTER_FIRST_BUTTON=`${BC_COACH_MARK_FOOTER}>button:first-child`,BC_COACH_MARK_HIGHLIGHT=`${BC_COACH_MARK_SELECTOR}-highlight`,BC_COACH_MARK_OVERLAY=`${BC_COACH_MARK_SELECTOR}-overlay`,BC_COACH_MARK_MAIN=`${BC_COACH_MARK_SELECTOR}-main`,BC_COACH_MARK_NEXT=`${BC_COACH_MARK_SELECTOR}-next`,BC_COACH_MARK_PREV=`${BC_COACH_MARK_SELECTOR}-prev`,BC_COACH_MARK_CLOSE=`${BC_COACH_MARK_SELECTOR}-close`,BC_COACH_MARK_QUANTITY_ITEMS=`${BC_COACH_MARK_SELECTOR}-quantity-items`,BC_COACH_MARK_NUMBER=`${BC_COACH_MARK_SELECTOR}-number`,BC_COACH_MARK_DATA_ATTRIBUTE="dataCoachmark",BC_COACH_MARK_DATA_CONTROLLER="dataController",BC_COACH_MARK_LINK=`${BC_COACH_MARK_SELECTOR}-link`,BC_COACH_MARK_BLOCK_SCROLL=`${BC_COACH_MARK_SELECTOR}-scroll-block`,BC_COACH_MARK_ANIMATION_IN="fade-in-opacity ease-in-out 350ms forwards",BC_COACH_MARK_ANIMATION_OUT="ease-in-out 250ms forwards",BC_COACH_MARK_RIGHT="right",BC_COACH_MARK_LEFT="left",BC_COACH_MARK_TOP="top",BC_COACH_MARK_BOTTOM="bottom",BC_COACH_MARK_ARIA_LABEL="aria-label",BC_COACH_MARK_NUMBER_0=0,BC_COACH_MARK_NUMBER_1=1,BC_COACH_MARK_NUMBER_2=2,BC_COACH_MARK_NUMBER_20=20,BC_COACH_MARK_NUMBER_MIN_WIDTH=280,BC_COACH_MARK_UNDERSTOOD_TEXT="Entendido",BC_COACH_MARK_NEXT_TEXT="Siguiente",BC_COACH_MARK_PREV_TEXT="Regresar",BC_COACH_MARK_CLOSE_TEXT="Cerrar",BC_COACH_MARK_STATUS="status",BC_COACH_MARK_STATUS_ACTIVE="active",BC_COACH_MARK_STATUS_ID="id",BC_COACH_MARK_ARROW_CLASS=`${BC_COACH_MARK_SELECTOR}-arrow`,BC_COACH_MARK_ARROW_SPACE=16,BC_COACH_MARK_END_POSITION="end",BC_COACH_MARK_START_POSITION="start",BC_COACH_MARK_CENTER_POSITION="center",BC_COACH_MARK_WIDTH="width",BC_COACH_MARK_HEIGHT="height",BC_COACH_MARK_POSITION="position",BC_COACH_MARK_X="x",BC_COACH_MARK_Y="y",BC_COACH_MARK_Z_INDEX="2001";var CoachmarkStyle,bcDisplay;!function(t){t.none="none",t.flex="flex",t.block="block",t.contents="contents"}(CoachmarkStyle||(CoachmarkStyle={})),function(t){t.none="bc-d-none",t.flex="bc-d-flex",t.block="bc-d-block",t.contents="contents"}(bcDisplay||(bcDisplay={}));class BcCoachMarkBehavior extends BcDefaultBehavior{constructor(){super()}static setUpAll(){const t=Array.from(document.querySelectorAll(`.${BC_COACH_MARK_SELECTOR}`)),e=[];for(const s of t){const t=new BcCoachMarkBehavior;t.setElement(s),t.setUp(),e.push(t)}return e}_setUp(){this.localization=new ClientRectUtils,this.coachMarkElement=this.mySelf.querySelector(`.${BC_COACH_MARK_CONTAINER}`),this.sliderElements=Array.from(this.mySelf.querySelectorAll(`.${BC_COACH_MARK_MAIN}`)),this.buttonPrev=this.mySelf.querySelector(`.${BC_COACH_MARK_PREV}`),this.buttonNext=this.mySelf.querySelector(`.${BC_COACH_MARK_NEXT}`),this.arrowElement=createElement({element:BcCommonConstants.DIV_TAG,classList:[BC_COACH_MARK_ARROW_CLASS]}),this.createPaginationStep(),this.setAccessibility(),this.addEventListeners()}createPaginationStep(){const t=Array.from(this.mySelf.querySelectorAll(`.${BC_COACH_MARK_MAIN}`)),e=this.mySelf.querySelector(`${BcCommonConstants.SECTION_TAG}.${BC_COACH_MARK_QUANTITY_ITEMS}`);e.innerHTML="";const s=`${BC_COACH_MARK_NUMBER_1}/${t.length}`;e.appendChild(createElement({element:BcCommonConstants.DIV_TAG,classList:[BC_COACH_MARK_NUMBER],innerText:s}))}setStepQuantity(){const t=this.currentStep();this.buttonNext=this.mySelf.querySelector(`.${BC_COACH_MARK_NEXT}`),this.buttonPrev=this.mySelf.querySelector(`.${BC_COACH_MARK_PREV}`);const e=this.mySelf.querySelector(`.${BC_COACH_MARK_NUMBER}`);e.innerHTML="",e.innerHTML=`${t+BC_COACH_MARK_NUMBER_1}/${this.sliderElements.length}`,e.setAttribute(BC_COACH_MARK_ARIA_LABEL,"Paso "+`${t+BC_COACH_MARK_NUMBER_1}`+" de "+`${this.sliderElements.length}`),this.setButtonsStyle()}setButtonsStyle(){const t=this.currentStep();1==this.sliderElements.length?(this.setNextAndUnderstoodButton(),replaceClass(this.buttonPrev,bcDisplay.flex,bcDisplay.none)):t+BC_COACH_MARK_NUMBER_1==1?(replaceClass(this.buttonNext,BC_COACH_MARK_CLOSE,BC_COACH_MARK_NEXT),replaceClass(this.buttonPrev,bcDisplay.flex,bcDisplay.none),this.buttonNext.setAttribute(BC_COACH_MARK_ARIA_LABEL,BC_COACH_MARK_NEXT_TEXT)):t+BC_COACH_MARK_NUMBER_1==this.sliderElements.length?(this.setNextAndUnderstoodButton(),replaceClass(this.buttonPrev,bcDisplay.none,bcDisplay.flex),this.buttonPrev.setAttribute(BC_COACH_MARK_ARIA_LABEL,BC_COACH_MARK_PREV_TEXT)):(replaceClass(this.buttonPrev,bcDisplay.none,bcDisplay.flex),replaceClass(this.buttonNext,bcDisplay.none,bcDisplay.flex),replaceClass(this.buttonNext,BC_COACH_MARK_CLOSE,BC_COACH_MARK_NEXT),this.buttonPrev.setAttribute(BC_COACH_MARK_ARIA_LABEL,BC_COACH_MARK_PREV_TEXT),this.buttonNext.setAttribute(BC_COACH_MARK_ARIA_LABEL,BC_COACH_MARK_NEXT_TEXT))}setNextAndUnderstoodButton(){this.buttonNext.innerText=BC_COACH_MARK_UNDERSTOOD_TEXT,this.buttonNext.setAttribute(BC_COACH_MARK_ARIA_LABEL,BC_COACH_MARK_UNDERSTOOD_TEXT),replaceClass(this.buttonNext,BC_COACH_MARK_NEXT,BC_COACH_MARK_CLOSE)}initTour(){for(const t of this.sliderElements){this.targetElement=document.getElementById(t.getAttribute(BC_COACH_MARK_DATA_CONTROLLER)),this.setValueTour(this.targetElement,t),this.setStepQuantity(),this.setButtonsStyle();break}}setValueTour(t,e){this.removeAllProperties(),this.createOverlay(),this.mySelf.querySelector(`.${BC_COACH_MARK_FOOTER}`).style.display=CoachmarkStyle.flex,this.setWidthButtonsStyle(),t.classList.add(`${BC_COACH_MARK_HIGHLIGHT}`),e.setAttribute(BC_COACH_MARK_STATUS,BC_COACH_MARK_STATUS_ACTIVE),this.setTargetPosition(t),this.setPosition(this.coachMarkElement,this.arrowElement),this.coachMarkElement.classList.add(`${BC_COACH_MARK_SELECTOR}-expanded`)}removeHighLight(){const t=this.sliderElements.find(t=>t.getAttribute(BC_COACH_MARK_STATUS));if(t){document.getElementById(t.getAttribute(BC_COACH_MARK_DATA_CONTROLLER)).classList.remove(BC_COACH_MARK_HIGHLIGHT),t.removeAttribute(BC_COACH_MARK_STATUS)}}createOverlay(){const t=createElement({element:BcCommonConstants.DIV_TAG,classList:[BC_COACH_MARK_OVERLAY]});document.body.insertBefore(t,null),this.addClassBlockScroll()}addClassBlockScroll(){document.body.classList.add(BC_COACH_MARK_BLOCK_SCROLL)}removeOverlay(){const t=document.querySelector(`.${BC_COACH_MARK_OVERLAY}`);t&&t.remove(),this.removeClassBlockScroll()}removeClassBlockScroll(){document.body.classList.remove(BC_COACH_MARK_BLOCK_SCROLL)}removeAllProperties(){this.removeOverlay(),this.removeHighLight()}focusElement(){this.mySelf.querySelector(`.${BC_COACH_MARK_CONTAINER}`).scrollIntoView()}addEventListeners(){this.listenerNext(),this.listenerPrev(),this.listenerCloseButton()}listenerCloseButton(){this.mySelf.querySelectorAll(`.${BC_COACH_MARK_CLOSE}`).forEach(t=>{t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.hideWindow()})})}listenerNext(){const t=this.mySelf.querySelector(`.${BC_COACH_MARK_FOOTER} .${BC_COACH_MARK_NEXT}`);t.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{t.innerText!==BC_COACH_MARK_UNDERSTOOD_TEXT?this.nextStep():this.hideWindow()})}setWidthButtonsStyle(){const t=this.mySelf.querySelector(`.${BC_COACH_MARK_FOOTER}`),e=parseInt(this.mySelf.style.width);t.style.display=e==BC_COACH_MARK_NUMBER_MIN_WIDTH?CoachmarkStyle.contents:CoachmarkStyle.flex}hideWindow(){this.coachMarkElement.classList.remove(`${BC_COACH_MARK_SELECTOR}-expanded`),this.coachMarkElement.style.animation=BC_COACH_MARK_ANIMATION_OUT,this.restoreValueButton(),this.removeAllProperties(),this.arrowElement.remove(),this.targetCopy.remove()}listenerPrev(){this.mySelf.querySelector(`.${BC_COACH_MARK_PREV}`).addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.currentStep()>0?this.prevStep():this.hideWindow()})}nextStep(){this.targetCopy.remove(),this.arrowElement.remove(),this.moveStep(BC_COACH_MARK_NUMBER_1)}setTargetPosition(t){const e=t.cloneNode(!0);this.targetCopy=e;const s=this.localization.getFullBoundingClientRect(t);this.targetCopy.appendChild(this.arrowElement),document.body.append(this.targetCopy),this.targetCopy.style.position="absolute",this.targetCopy.style.left=s.x+"px",this.targetCopy.style.top=s.y+"px",this.targetCopy.style.width=s.width+"px",this.targetCopy.style.height=s.height+"px",this.targetCopy.style.zIndex=`${BC_COACH_MARK_Z_INDEX}`}prevStep(){this.targetCopy.remove(),this.arrowElement.remove(),this.moveStep()}currentStep(){let t=this.sliderElements.find(t=>t.getAttribute(BC_COACH_MARK_STATUS)===BC_COACH_MARK_STATUS_ACTIVE);return parseInt(t.getAttribute(BC_COACH_MARK_DATA_ATTRIBUTE))}moveStep(t=0){let e;const s=this.mySelf.querySelector(`.${BC_COACH_MARK_FOOTER_FIRST_BUTTON}`),n=this.sliderElements.find(t=>t.getAttribute(BC_COACH_MARK_STATUS));if(n){const o=parseInt(n.getAttribute(BC_COACH_MARK_DATA_ATTRIBUTE));(e=t?o+BC_COACH_MARK_NUMBER_1:o-BC_COACH_MARK_NUMBER_1)===this.sliderElements.length-BC_COACH_MARK_NUMBER_1?s.innerText=`${BC_COACH_MARK_UNDERSTOOD_TEXT}`:this.restoreValueButton();const i=this.sliderElements.find(t=>parseInt(t.getAttribute(BC_COACH_MARK_DATA_ATTRIBUTE))===e);if(i){const t=document.getElementById(i.getAttribute(BC_COACH_MARK_DATA_CONTROLLER));this.mySelf.removeAttribute(BC_COACH_MARK_POSITION),this.setValueTour(t,i),this.setStepQuantity()}}}restoreValueButton(){const t=this.mySelf.querySelector(`.${BC_COACH_MARK_FOOTER_FIRST_BUTTON}`);t.innerText=`${BC_COACH_MARK_NEXT_TEXT}`,replaceClass(t,`${BC_COACH_MARK_CLOSE}`,`${BC_COACH_MARK_NEXT}`)}setAccessibility(){const t=this.mySelf.querySelector(`.${BC_COACH_MARK_FOOTER} .${BC_COACH_MARK_NEXT}`),e=this.mySelf.querySelector(`.${BC_COACH_MARK_PREV}`),s=this.mySelf.querySelector(`.${BC_COACH_MARK_LINK} ${BcCommonConstants.HREF_TAG}`),n=this.mySelf.querySelector(`${BcCommonConstants.SECTION_TAG}.${BC_COACH_MARK_CLOSE} ${BcCommonConstants.BUTTON_TAG}`);addFocusable(t,{tabindex:"0"}),addFocusable(e,{tabindex:"0"}),addFocusable(n,{tabindex:"0"}),addFocusable(s,{tabindex:"0"})}setPosition(t,e){const s=new BcCoachMarkLocalizationBuilder,n={height:window.innerHeight,width:window.innerWidth},o=this.localization.getFullBoundingClientRect(this.targetCopy),i=this.localization.getFullBoundingClientRect(t),a=s.getPosition(o,i,n);this.evaluateArrowPosition(s.position,e,o),this.setElementPosition(a)}setElementPosition(t){this.mySelf.style.left=t.x+"px",this.mySelf.style.top=t.y+"px",this.coachMarkElement.style.animation=BC_COACH_MARK_ANIMATION_IN,this.focusElement()}evaluateArrowPosition(t,e,s){switch(t){case BC_COACH_MARK_BOTTOM:this.setPosititonArrow(BC_COACH_MARK_BOTTOM,e,s);break;case BC_COACH_MARK_RIGHT:this.setPosititonArrow(BC_COACH_MARK_RIGHT,e,s);break;case BC_COACH_MARK_LEFT:this.setPosititonArrow(BC_COACH_MARK_LEFT,e,s);break;default:this.setPosititonArrow(BC_COACH_MARK_TOP,e,s)}}setPosititonArrow(t,e,s){switch(this.arrowElement.classList.remove(this.arrowElement.classList.item(1)),this.arrowElement.classList.add(this.arrowElement.classList.item(0)+"--"+t),t){case BC_COACH_MARK_BOTTOM:e.style.left=s.width/BC_COACH_MARK_NUMBER_2+"px",e.style.top=s.height+"px";break;case BC_COACH_MARK_RIGHT:e.style.top=s.height/BC_COACH_MARK_NUMBER_2+"px",e.style.left=s.width+"px";break;case BC_COACH_MARK_LEFT:e.style.top=s.height/BC_COACH_MARK_NUMBER_2+"px",e.style.left=-BC_COACH_MARK_ARROW_SPACE+"px";break;default:e.style.left=s.width/BC_COACH_MARK_NUMBER_2+"px",e.style.top=-BC_COACH_MARK_ARROW_SPACE+"px"}}}class BcCoachMarkLocalizationBuilder{constructor(){this.position=null}getPosition(t,e,s){let n={x:0,y:0};const o=this.permute(this.center,this.start,this.end);for(const i of o){const o=this.getXYPosition(t,e,s,{axis:BC_COACH_MARK_Y,sizeProperty:BC_COACH_MARK_HEIGHT},i);if(null==o.value){const o=this.getXYPosition(t,e,s,{axis:BC_COACH_MARK_X,sizeProperty:BC_COACH_MARK_WIDTH},i),a=this.getXYPosition(t,e,s,{axis:BC_COACH_MARK_Y,sizeProperty:BC_COACH_MARK_HEIGHT},i,o);null!=o.value&&null!=a.value&&(n={x:o.value,y:a.value},this.validateXPosition(o,a))}else{const a=this.getXYPosition(t,e,s,{axis:BC_COACH_MARK_X,sizeProperty:BC_COACH_MARK_WIDTH},i,o);if(null!=a.value&&null!=o.value&&(n={x:a.value,y:o.value},this.validateYPosition(a,o),a.kind===BC_COACH_MARK_CENTER_POSITION))return n}}return n}validateXPosition(t,e){t.kind==BC_COACH_MARK_END_POSITION?this.position=`${BC_COACH_MARK_RIGHT}`:t.kind==BC_COACH_MARK_START_POSITION?this.position=`${BC_COACH_MARK_LEFT}`:t.kind==BC_COACH_MARK_CENTER_POSITION&&e.kind==BC_COACH_MARK_END_POSITION?this.position=`${BC_COACH_MARK_BOTTOM}`:t.kind==BC_COACH_MARK_CENTER_POSITION&&e.kind==BC_COACH_MARK_START_POSITION&&(this.position=`${BC_COACH_MARK_TOP}`)}validateYPosition(t,e){e.kind==BC_COACH_MARK_END_POSITION?this.position=`${BC_COACH_MARK_BOTTOM}`:e.kind==BC_COACH_MARK_START_POSITION?this.position=`${BC_COACH_MARK_TOP}`:e.kind==BC_COACH_MARK_CENTER_POSITION&&t.kind==BC_COACH_MARK_END_POSITION?this.position=`${BC_COACH_MARK_RIGHT}`:e.kind==BC_COACH_MARK_CENTER_POSITION&&t.kind==BC_COACH_MARK_START_POSITION&&(this.position=`${BC_COACH_MARK_LEFT}`)}permute(t,e,s){const n=[t,e,s],o=[];for(const t of n)for(const e of n)for(const s of n)t!=e&&e!=s&&t!=s&&o.push([t,e,s]);return o}center(t,e,s,n,o){const i=t[n.axis]+t[n.sizeProperty]/BC_COACH_MARK_NUMBER_2,a=e[n.sizeProperty]/BC_COACH_MARK_NUMBER_2,l=i+a,c=s[n.sizeProperty],r=i-a,C=r>0,d=i+a<=s[n.sizeProperty],h=C&&d,E=t[n.axis],_=Math.abs(c-l),m=Math.abs(c-l),S={kind:BC_COACH_MARK_CENTER_POSITION,value:null};return o?o.kind!=BC_COACH_MARK_CENTER_POSITION&&this.validateCenterNotMain(S,C,e,n,r,t,s):h?S.value=i-a:C?this.validateAvailableCenterStart(_,E,a,S,s,n):this.validateScroll(r,m,a,n,S),S}start(t,e,s,n,o){const i=t[n.axis],a=BC_COACH_MARK_ARROW_SPACE,l={kind:BC_COACH_MARK_START_POSITION,value:null};let c=i-a>=e[n.sizeProperty];if(o){let s=0;o.kind==BC_COACH_MARK_CENTER_POSITION&&(s=t[n.sizeProperty]+a);const i=t[n.axis]+t[n.sizeProperty];(c=i-e[n.sizeProperty]-s>=0)&&(l.value=i-e[n.sizeProperty]-s)}else c&&(l.value=t[n.axis]-a-e[n.sizeProperty]);return l}end(t,e,s,n,o){const i=BC_COACH_MARK_ARROW_SPACE,a={kind:BC_COACH_MARK_END_POSITION,value:null};let l=s[n.sizeProperty]-t[n.axis]-t[n.sizeProperty]-i>=e[n.sizeProperty];if(o){let c=0;o.kind==BC_COACH_MARK_CENTER_POSITION&&(c=t[n.sizeProperty]+i),(l=t[n.axis]+e[n.sizeProperty]+c<=s[n.sizeProperty])&&(a.value=t[n.axis]+c)}else l&&(a.value=t[n.axis]+i+t[n.sizeProperty]);return a}getXYPosition(t,e,s,n,o,i,a){let l={kind:BC_COACH_MARK_END_POSITION,value:null};for(const c of o)if(null!=(l=c.call(this,t,e,s,n,i,a)).value)return l;return l}validateCenterNotMain(t,e,s,n,o,i,a){const l=i[n.axis]+i[n.sizeProperty]/BC_COACH_MARK_NUMBER_2,c=s[n.sizeProperty]/BC_COACH_MARK_NUMBER_2,r=l+c<=a[n.sizeProperty],C=e&&r,d=i[n.axis],h=l+c,E=Math.abs(a[n.sizeProperty]-h);C?t.value=l-c:e?E<=s[n.sizeProperty]&&E<=d&&(t.value=a[n.sizeProperty]-s[n.sizeProperty]):this.validateOverflowCoach(E,s,n,o,t)}validateAvailableCenterStart(t,e,s,n,o,i){t<=e&&s>=t&&e=Math.abs(n)&&(o.value=0)}validateScroll(t,e,s,n,o){Math.abs(t)<=e&&s>=Math.abs(t)&&e{this.target+=t.X,this.clampTarget(),null===this.rAF&&requestAnimationFrame(this.moveSlider)}),this.moveSlider=(()=>{const t=this.target-this.current;this.current+=t*SWIPE_EASE;const e=round(this.current);this.setCSS(e),0==parseInt(t.toFixed(SWIPE_NUMBER_2))?(this.rAF=null,this.config.infinity?this.restoreSwipe(t):this.pivots(t,e)):this.rAF=requestAnimationFrame(this.moveSlider),this.config.onMoving&&this.config.onMoving(e)}),this.pivots=((t,e)=>{const s=(t,e)=>{this.setCSS(t+e),setTimeout(()=>{this.setCSS(t)},this.timeSettingCss)};this.isLastClamp(t)&&s(e,-this.finalPositionSlider),this.isStartClamp()&&s(e,this.finalPositionSlider)}),this.restoreSwipe=(t=>{this.isLastClamp(t)&&this.moveSliderTo(0),this.isStartClamp()&&this.moveSliderTo(-1*this.mWidth)}),this.isStartClamp=(()=>this.swipeToLeft&&this.target==SWIPE_CERO),this.onResize=(()=>{const t=this.mySelf.getBoundingClientRect().width,e=this.containerItems.getBoundingClientRect().width;this.vWidth=window.innerWidth,this.mWidth=e+(this.vWidth-t),this.clampTarget(),this.rAF=requestAnimationFrame(this.moveSlider)}),this.on=(t=>{this.initialized||this.addListeners(),this.listeners.push(t),this.numListeners=this.listeners.length}),this.notify=(t=>{const e=this.isTouch&&t.targetTouches?t.targetTouches[0]:t;this.swipeEvent.X=(e.pageX-this.swipeEvent.initialX)*this.config.speed,this.swipeEvent.Y=(e.pageY-this.swipeEvent.initialY)*this.config.speed,this.swipeEvent.originalEvent=t,this.swipeEvent.cursorDown=this.curDown,this.swipeEvent.initialX=e.pageX,this.swipeEvent.initialY=e.pageY;for(let t=0;t{this.curDown&&(t.preventDefault(),this.notify(t),"mousemove"==t.type&&this.setDirection(t.screenX))}),this.onDragStart=(t=>{const e=this.isTouch&&t.targetTouches?t.targetTouches[0]:t;this.swipeEvent.initialX=e.pageX,this.swipeEvent.initialY=e.pageY,this.curDown=!0,this.setDirection(e.screenX)}),this.onDragEnd=(t=>{this.curDown=!1}),this.onMouseLeave=(t=>{this.onDragEnd(t)}),this.addListeners=(()=>{if(this.hasMouseEvent&&(this.mySelf.addEventListener("mouseleave",this.onMouseLeave),this.mySelf.addEventListener("mouseup",this.onDragEnd),this.mySelf.addEventListener("mousedown",this.onDragStart),this.mySelf.addEventListener("mousemove",this.onDrag)),this.hasTouchEvent&&(this.mySelf.addEventListener("touchmove",this.onDrag),this.mySelf.addEventListener("touchend",this.onDragEnd),this.mySelf.addEventListener("touchstart",this.onDragStart)),this.hasPointerEvent&&this.hasTouchWinEvent){const t=this.mySelf.getAttribute("style"),e=/(msTouchAction:)(.*?)(?=;)/g;this.msTouchAction=t.match(e).join(),this.mySelf.setAttribute("style",t.replace(e,"none")),this.mySelf.addEventListener("MSPointerMove",this.onDrag),this.mySelf.addEventListener("MSPointerUp",this.onDragEnd),this.mySelf.addEventListener("MSPointerDown",this.onDragStart)}}),this.removeListeners=(()=>{this.hasMouseEvent&&(this.mySelf.removeEventListener("mouseleave",this.onMouseLeave),this.mySelf.removeEventListener("mouseup",this.onDragEnd),this.mySelf.removeEventListener("mousedown",this.onDragStart),this.mySelf.removeEventListener("mousemove",this.onDrag)),this.hasTouchEvent&&(this.mySelf.removeEventListener("touchmove",this.onDrag),this.mySelf.removeEventListener("touchend",this.onDragEnd),this.mySelf.removeEventListener("touchstart",this.onDragStart)),this.hasPointerEvent&&this.hasTouchWinEvent&&(this.msTouchAction&&this.mySelf.setAttribute("style",`msTouchAction:${this.msTouchAction}`),this.mySelf.removeEventListener("MSPointerMove",this.onDrag),this.mySelf.removeEventListener("MSPointerUp",this.onDragEnd),this.mySelf.removeEventListener("MSPointerDown",this.onDragStart))})}_setUp(){this.initConfiguration(),this.getElements(),this.init()}init(){this.swipeInit(),this.on(t=>this.calc(t)),this.mySelf.addEventListener(BcCommonConstants.EVENT_RESIZE,this.onResize),this.onResize()}setConfig(t){this.config=t,this.initConfiguration()}initConfiguration(){this.config=Object.assign({speed:SWIPE_MIN_SPEED,contentItemsClass:SWIPE_CLASS,sliderClass:SLIDER_CLASS,step:SLIDER_STEP,infinity:!1},this.config||{})}getElements(){const t=this.mySelf.querySelector(`.${this.config.contentItemsClass}`);if(!t)throw SWIPE_NOT_CONTENT_CLASS_ELEMENTS;this.containerItems=t}swipeInitConfig(){this.swipeEvent={X:SWIPE_CERO,Y:SWIPE_CERO,cursorDown:!1,initialX:SWIPE_CERO,initialY:SWIPE_CERO,originalEvent:null},this.initialized=!1,this.curDown=!1,this.numListeners=SWIPE_CERO,this.listeners=[]}setDirection(t){this.swipeToLeft=t>this.lastOffset,this.lastOffset=t}moveSliderToLeft(t){this.target=t?this.target+this.config.step:this.target-this.config.step,this.clampTarget(),this.moveSlider()}moveSliderTo(t){this.target=t,this.clampTarget(),this.moveSlider()}setCSS(t){const e=`${Math.ceil(t)}px`;this.containerItems.style.transform=`translate3d(${e},${this.positionTranslateYX},${this.positionTranslateYX})`}isLastClamp(t){return!this.swipeToLeft&&this.target1,this.hasPointerEvent=!!window.navigator.msPointerEnabled,this.isTouch=this.hasTouchEvent||this.hasTouchWinEvent||this.hasPointerEvent,this.msTouchAction=null}swipeInit(){this.swipeInitConfig(),this.detectInterationType()}}class BcCarouselBehavior extends BcAbstractSwipeBehavior{constructor(){super(),this.options=null,this.slidesElements=[],this.currentIndex=0,this.currentSlide=0,this.slideCount=0,this.pageNumber="",this.prevArrow=null,this.nextArrow=null,this.bulletContent=null,this.slidesTrack=null,this.bullets=[],this.sliderWidth=0,this.slideWidth=0,this.slideOffset=0,this.slideTrackWidth=0,this.interval=0,this.defaultIntervalTimeout=CAROUSEL_DEFAULT_INTERVAL_TIMEOUT,this.hideElement=((t,e)=>{e?(t.classList.add(CAROUSEL_HIDE_CLASS),t.setAttribute(CAROUSEL_ARIA_HIDDEN,"true")):(t.classList.remove(CAROUSEL_HIDE_CLASS),t.setAttribute(CAROUSEL_ARIA_HIDDEN,"false"))})}_setUp(){try{this.initOptions(),this.initilize(),this.setConfiguration(),super._setUp(),this.addEventListener()}catch(t){console.trace()}}setOptions(t){this.options=t,this.initOptions()}createItems(){if(this.options&&this.options.items.length>0){const{items:t}=this.options;t.forEach((t,e)=>{const s=this.createItem(t);this.slidesElements[e]=s});const e=this.mySelf.querySelector(`${BcCommonConstants.SECTION_TAG}.${CAROUSEL_LIST_CLASS}`);e.innerHTML="",e.appendChild(createElement({element:BcCommonConstants.UL_TAG,classList:[CAROUSEL_TRACK_CLASS],children:this.slidesElements})),this.setSlideCount(t.length)}}setSlideCount(t){this.slideCount=t}initilize(){this.getContentItems(),this.checkItems(),this.buildBullets(),this.addArrows(),this.setupInfinite(),this.setPosition(),this.updateBullets(),this.updateArrows(),this.setupAutoPlay(),this.changeDataAccessibility()}changeDataAccessibility(){const t=this.mySelf.querySelectorAll(`.${CAROUSEL_ITEM_CLASS}`),e=t.length;t.forEach((t,s)=>{t.setAttribute(CAROUSEL_ARIA_LABEL,`${s+1} de ${e}`),t.setAttribute(CAROUSEL_ARIA_ROL_DESCRIPTION,"slide"),t.setAttribute(CAROUSEL_ROL_ITEM,"group")}),this.mySelf.setAttribute(CAROUSEL_ARIA_ROL_DESCRIPTION,"carousel")}buildBullets(){if(this.options.bullets&&!0===this.options.bullets&&this.slideCount>this.options.slidesToShow){const t=this.getBulletQty();for(let e=0;e0){const t=this.bullets.find(t=>t.classList.contains(CAROUSEL_ACTIVE_BULLET_CLASS));this.bulletRemove(t);const e=this.getBulletPosByIndex();let s;s=this.bulletsToActivate(e,s),this.bulletActiveRemove(s)}}bulletsToActivate(t,e){if(this.options.arrowsInBullets)if(t&&this.bullets[t].classList[0]===`${CAROUSEL_CLASS}-arrow`)e=this.bullets[1];else if(t===this.bullets.length&&this.bullets[t].classList[0]===`${CAROUSEL_CLASS}-arrow`){const t=this.bullets.length-1;e=this.bullets[t]}else e=this.bullets[t];else e=this.bullets[t];return e}bulletRemove(t){t&&t.classList.remove(CAROUSEL_ACTIVE_BULLET_CLASS)}bulletActiveRemove(t){t&&t.classList.add(CAROUSEL_ACTIVE_BULLET_CLASS)}getBulletPosByIndex(){const t=this.currentSlide,e=this.options.slidesToScroll;for(let s=0,n=0;s<=this.getBulletQty()*e;s+=e,n++)if(t>=s&&t ${BcCommonConstants.P_TAG}`);if(t)t.innerHTML=this.pageNumber;else{const t=createElement({element:BcCommonConstants.DIV_TAG,classList:[CAROUSEL_CONTENT_NUMBER_PAGINATOR_CLASS],children:[createElement({element:BcCommonConstants.P_TAG,innerText:this.pageNumber})]});this.mySelf.append(t)}}createBullet(){return createElement({element:BcCommonConstants.LI_TAG,classList:[CAROUSEL_BULLET_ITEM_CLASS],children:[createElement({element:BcCommonConstants.BUTTON_TAG,classList:[CAROUSEL_BULLET_CLASS]})]})}getBulletQty(){const{slidesToScroll:t,slidesToShow:e}=this.options;return this.slideCount/(t>=e?t:e)}initOptions(){this.options=Object.assign({spacingBetweenItems:CAROUSEL_ITEMS_SPACE_BETWEEN,iconNamePrev:CAROUSEL_CONTROL_LEFT_NAME,iconNameNext:CAROUSEL_CONTROL_RIGHT_NAME,swipeSpeed:CAROUSEL_SWIPE_SPEED,items:[],arrows:!0,bullets:!1,accessibility:!0,initialSlide:0,slidesToShow:1,slidesToScroll:1,swipe:!0,variableWidth:!1,infinity:!1,gridSystem:!1,arrowsInBullets:!1,autoPlay:!1,sliderPagination:!1,autoplayTimeout:4e3},this.options||{}),this.currentSlide=this.options.initialSlide}setupInfinite(){this.options.infinity}pauseAutoPlay(){clearInterval(this.interval)}listenerMoveItem(){let t=0,e=0;const s=this.mySelf.querySelector(`.${CAROUSEL_TRACK_CLASS}`);s.addEventListener(BcCommonConstants.EVENT_MOUSEDOWN,e=>{t=e.clientX}),s.addEventListener(BcCommonConstants.EVENT_MOUSEUP,s=>{e=s.clientX,t!==e&&this.pauseAutoPlay()})}setupAutoPlay(){this.options.autoPlay&&this.bullets&&this.bullets.length>0&&(this.listenerMoveItem(),this.interval||(this.interval=setInterval(()=>{const t=this.bullets.find(t=>t.classList.contains(CAROUSEL_ACTIVE_BULLET_CLASS));if(t){let e=t.nextElementSibling;null!=e&&e.classList.contains(CAROUSEL_BULLET_ITEM_CLASS)||(e=this.bullets[0]),e.dispatchEvent(new Event(BcCommonConstants.EVENT_CLICK))}},this.defaultIntervalTimeout||this.options.autoplayTimeout)))}addEventListener(){this.onCLick(this.prevArrow,this.onLeftClick),this.onCLick(this.nextArrow,this.onRightClick),this.bulletsEventListeners()}bulletsEventListeners(){if(this.options.bullets&&this.slideCount>this.options.slidesToShow){const t=Math.ceil(this.slideTrackWidth/this.getBulletQty());this.options.arrowsInBullets&&(this.bullets.shift(),this.bullets.pop()),this.bullets.forEach((e,s)=>{e.setAttribute(CAROUSEL_MOVE_TO,(t*s).toString()),e.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{const t=e.getAttribute(CAROUSEL_MOVE_TO),s=this.getValidLeft(t,!0);this.moveSliderTo(s)})})}}getValidLeft(t,e=!1){t=(t=typeof t===IS_STRING?parseInt(t):t)<0?-1*t:t;let s=this.moveValidLeft(t);return this.currentSlide=Math.floor(s/this.slideWidth),e&&(this.updateArrows(),this.updateBullets()),-1*s}moveValidLeft(t){const e=this.slideCount;let s=0,n=0;for(n=0;n=o?s=o:o<=t&&i>=t?s=o:n=t&&(s=a)}return s}onCLick(t,e){e=e.bind(this),t.addEventListener(BcCommonConstants.EVENT_CLICK,t=>{e(t)}),addFocusable(t,{},{event:e})}createItem(t){return createElement({element:BcCommonConstants.LI_TAG,classList:[CAROUSEL_ITEM_CLASS,`${BcCommonConstants.PREFIX_LIB}-mx-${this.options.spacingBetweenItems}`,`${BcCommonConstants.PREFIX_LIB}-my-3`,t.hidden?BcCommonConstants.INVISIBLE_CLASS:"_"],children:[t.content]})}getSlidesTrack(){const t=this.mySelf.querySelector(`*.${CAROUSEL_TRACK_CLASS}`);t?this.slidesTrack=t:this.buildSlidesTrack()}buildSlidesTrack(){const t=createElement({element:BcCommonConstants.DIV_TAG,classList:[CAROUSEL_TRACK_CLASS]});this.containerItems.append(t),this.slidesTrack=t}getContentItems(){const t=this.mySelf.querySelector(`.${CAROUSEL_LIST_CLASS}`);if(t)return this.containerItems=t,void this.addIdClassList();this.buildContentItems()}addIdClassList(){const t=this.mySelf.querySelector(`.${CAROUSEL_LIST_CLASS}`),e=Math.floor(Math.random()*COROUSEL_ID_CONTENT);t.id=`${CAROUSEL_LIST_CLASS}-${e}`}buildContentItems(){const t=createElement({element:BcCommonConstants.SECTION_TAG,classList:[CAROUSEL_LIST_CLASS]});this.mySelf.append(t),this.containerItems=t,this.addIdClassList()}cleanItems(){this.options.items=[],this.slidesElements=[]}checkItems(){if(this.options.gridSystem)return this.addGridOut(),void this.getGridItems();this.getItems()}addGridOut(){this.mySelf.classList.add(CAROUSEL_GRID_CLASS)}addIdItemGrid(t){t.forEach((t,e)=>{t.id=`slide-${e}`})}getGridItems(){const t=Array.from(this.mySelf.querySelectorAll(`*.${CAROUSEL_ITEM_CLASS}`)),e=Array.from(this.mySelf.querySelectorAll(`*.${CAROUSEL_ROW_CLASS}`));if(0!=t.length){if(e.length>0)return this.addIdItemGrid(t),this.slidesElements=e,void this.loadItemGrid(e);this.cleanItems(),this.loadGridItemsObject(t)}else this.createGridItems()}loadGridItemsObject(t){t.forEach((t,e)=>{this.checkSpacing(t)}),this.setSlideCount(t.length)}createGridItems(){if(this.options&&this.options.items.length>0){const{items:t}=this.options;t.forEach((t,e)=>{const s=this.createGridItem(t);this.slidesElements[e]=s});const e=this.mySelf.querySelector(`${BcCommonConstants.SECTION_TAG}.${CAROUSEL_LIST_CLASS}`);e.innerHTML="",e.appendChild(createElement({element:BcCommonConstants.UL_TAG,classList:[CAROUSEL_TRACK_CLASS],children:this.slidesElements}))}}loadItemGrid(t){t.forEach(t=>{for(const e of t.children)e.classList.contains(CAROUSEL_ROW_CLASS)||e.classList.add(CAROUSEL_CELL_CLASS,`${BcCommonConstants.PREFIX_LIB}-m-${this.options.spacingBetweenItems}`),this.setSlideCount(this.slideCount+1)})}createGridItem(t){const e=createElement({element:BcCommonConstants.DIV_TAG,props:{id:`slide-${t.uid}`},classList:[..."row"===t.typeDesign?[CAROUSEL_ROW_CLASS]:[CAROUSEL_ITEM_CLASS,CAROUSEL_CELL_CLASS,`${BcCommonConstants.PREFIX_LIB}-m-${this.options.spacingBetweenItems}`,t.colspan?`${CAROUSEL_COLSPAN_CLASS}-${t.colspan}`:"_"],t.hidden?BcCommonConstants.INVISIBLE_CLASS:"_"]});return t.content?(e.append(t.content),this.setSlideCount(this.slideCount+1),e):(t.children.forEach(t=>{const s=this.createGridItem(t);e.append(s)}),e)}getItems(){const t=Array.from(this.mySelf.querySelectorAll(`*.${CAROUSEL_ITEM_CLASS}`));0!=t.length?(this.cleanItems(),t.forEach((t,e)=>{this.checkSpacing(t),this.options.items[e]={content:t,order:e,hidden:t.classList.contains(BcCommonConstants.INVISIBLE_CLASS)},this.slidesElements[e]=t}),this.setSlideCount(t.length)):this.createItems()}checkSpacing(t){const e=`${BcCommonConstants.PREFIX_LIB}-mx-${this.options.spacingBetweenItems}`,s=`${BcCommonConstants.PREFIX_LIB}-my-3`;t.classList.contains(e)||t.classList.add(e),t.classList.contains(s)||t.classList.add(s)}setDimensions(){const t=this.mySelf.querySelector(`${BcCommonConstants.SECTION_TAG}.${CAROUSEL_LIST_CLASS}`),e=Array.from(this.mySelf.querySelectorAll(`*.${CAROUSEL_ROW_CLASS}`));let s=0;this.getSlidesTrack(),this.sliderWidth=t.clientWidth,this.slideWidth=Math.ceil(this.sliderWidth/this.options.slidesToShow);const n=this.mySelf.querySelectorAll(`.${CAROUSEL_ITEM_CLASS} > *`);this.options.variableWidth?s=COROUSEL_TRACK_WIDTH*this.slideCount:this.options.gridSystem&&this.options.items&&this.options.items.length>0?this.options.items.forEach(t=>{const e=this.mySelf.querySelector(`#slide-${t.uid} > *`),n=getOffsetWidth(e.parentElement);e.style.width=`${this.slideWidth-n}px`,s+=this.slideWidth,this.slideOffset=n}):this.options.gridSystem&&e?e.forEach((t,e)=>{t.id=`slide-row-${e}`;const n=this.mySelf.querySelector(`#${t.id} > *`),o=getOffsetWidth(n.parentElement);n.style.width=`${this.slideWidth-o}px`,s+=this.slideWidth,this.slideOffset=o}):n&&n.length>0&&n.forEach((t,e)=>{t.id=`slide-${e}`;const n=getOffsetWidth(t.parentElement);t.style.width=`${this.slideWidth-n}px`,s+=this.slideWidth,this.slideOffset=n}),this.slidesTrack.style.width=`${s}px`,this.slideTrackWidth=s}setPosition(){this.setDimensions(),this.setCSS(this.getLeftByIndex(this.currentSlide))}getLeftByIndex(t){let e,s;return this.slideOffset=0,t+this.options.slidesToShow>this.slideCount&&(this.slideOffset=(t+this.options.slidesToShow-this.slideCount)*this.slideWidth),this.slideCount<=this.options.slidesToShow&&(this.slideOffset=0),e=t*this.slideWidth*-1+this.slideOffset,!0===this.options.variableWidth&&(e=(s=this.slidesElements[t])?-1*s.offsetLeft:0),e}addArrows(){this.options.arrows&&!this.options.arrowsInBullets&&(this.getArrows(),this.mySelf.querySelector(`.${CAROUSEL_CONTAINER_TOP_BUTTON_CLASS}`)||this.mySelf.querySelector(`.${CAROUSEL_CONTAINER_BOTTOM_BUTTON_CLASS}`)||(this.mySelf.prepend(this.prevArrow),this.mySelf.append(this.nextArrow)))}getArrows(){this.prevArrow=this.getArrow(CAROUSEL_ARROW_PREV_CLASS,this.options.iconNamePrev),this.nextArrow=this.getArrow(CAROUSEL_ARROW_NEXT_CLASS,this.options.iconNameNext)}changeAttributeButton(t,e){e.setAttribute(CAROUSEL_ARIA_HIDDEN,"false");const s=this.mySelf.querySelector(`.${CAROUSEL_LIST_CLASS}`);return t===CAROUSEL_ARROW_PREV_CLASS?e.setAttribute(CAROUSEL_ARIA_LABEL,CAROUSEL_TEXT_SLIDE_PREV):e.setAttribute(CAROUSEL_ARIA_LABEL,CAROUSEL_TEXT_SLIDE_NEXT),e.setAttribute(CAROUSEL_ARIA_CONTROLS,s.id),e.tabIndex="0",e}getArrow(t,e){let s=this.mySelf.querySelector(`.${t}`);return s=s?this.changeAttributeButton(t,s):this.createArrow(t,e)}createArrow(t,e){const s=createElement({element:BcCommonConstants.DIV_TAG,classList:[CAROUSEL_ARROW_CLASS,t],children:[createElement({element:BcCommonConstants.I_TAG,classList:[BcCommonConstants.ICONS_CLASS],innerText:e})]});return this.changeAttributeButton(t,s)}updateArrows(){this.options.arrows&&this.slideCount>this.options.slidesToShow&&!this.options.infinity&&(this.getArrows(),this.hideArrows(!1),0===this.currentSlide?(this.hideElement(this.prevArrow,!0),this.hideElement(this.nextArrow,!1)):this.currentSlide>=this.slideCount-this.options.slidesToShow&&(this.hideElement(this.prevArrow,!1),this.hideElement(this.nextArrow,!0))),this.options.sliderPagination&&(this.pageNumber=`${this.currentSlide+1}/${this.slideCount}`,this.createNumberPaginator())}hideArrows(t){this.hideElement(this.prevArrow,t),this.hideElement(this.nextArrow,t)}setConfiguration(){this.setConfig({speed:this.options.swipeSpeed,contentItemsClass:CAROUSEL_TRACK_CLASS,sliderClass:CAROUSEL_CLASS,onMoving:this.onSwipe.bind(this),step:this.options.slidesToScroll*this.slideWidth,infinity:this.options.infinity})}onLeftClick(){this.pauseAutoPlay(),this.moveSliderToLeft(!0),this.getValidLeft(this.target,!0)}onRightClick(){this.pauseAutoPlay(),this.moveSliderToLeft(!1),this.getValidLeft(this.target,!0)}onSwipe(t){this.getValidLeft(t,!0)}}class BcFileDownloadBehavior extends BcDefaultBehavior{constructor(){super(),this.downloadlist=1,this.downloadlistSuccess=0,this.arrayStatus=[]}setRow(t){return`
\n \n \n \n
\n
\n
\n
\n

Generando  

\n

\n

  generado

\n
\n Error al generar el archivo\n
\n
\n \n \n
\n \n \n
\n download\n

Descargar

\n
\n
\n
\n
\n error\n
\n
\n \n `}openAccordion(){this.getFirstElementByClassName(FILE_DOWNLOAD_ACCORDION_TYPE).classList.add(FILE_DOWNLOAD_ACCORDION_ACTIVE),this.mySelf.classList.remove(FILE_DOWNLOAD_ACCORDION)}showIcon(t,e){const s=this.getFirstElementByClassName(`download-document_${e}`),n=this.getFirstElementByClassName(`successful_${e}`),o=this.getFirstElementByClassName(`alert_${e}`);if(s)switch(t){case"download-document":s.style.display="block",n.style.display="none",o.style.display="none";break;case"successful":s.style.display="none",n.style.display="block",o.style.display="none";break;case"alert":s.style.display="none",n.style.display="none",o.style.display="block";break;default:s.style.display="none",n.style.display="none",o.style.display="none"}}getFirstElementByClassName(t){const e=this.mySelf.getElementsByClassName(t);return e.length>FILE_DOWNLOAD_CERO?e[FILE_DOWNLOAD_CERO]:null}convertToBinary(t,e,s){s||(s=e.name);const n=new FileReader;n.onload=(()=>__awaiter(this,void 0,void 0,function*(){const e=n.result,o=yield fetch(e.toString()),i=yield o.blob();this.createRow(t,i,s)})),n.readAsDataURL(e)}createRow(t,e,s){this.fileName=s;const n=this.getFirstElementByClassName(FILE_DOWNLOAD_ROWSCONTAINER),o=document.createElement("section");o.innerHTML=this.setRow(this.downloadlist),o.classList.add(FILE_DOWNLOAD_ROW),o.classList.add(`file-download-row_${this.downloadlist}`),n.prepend(o),this.showIcon("download-document",this.downloadlist),this.downloadFile(this.downloadlist,t,e,s),this.downloadlist++,this.setHeadAccordion(),this.openAccordion(),this.showLoader(!0),BcTooltipBehavior.setUpAll()}downloadFile(t,e,s,n){this.managerProgressBar(t,e,"init",FILE_DOWNLOAD_CERO),e&&(this.eventListener(t,e,n),this.setNameFile(t,e,n)),s&&null===e&&(s.size>FILE_DOWNLOAD_TRECIENTOS?(this.eventListener(t,e,n),this.setHref(s,t,n),this.setNameFile(t,e,n)):this.managerProgressBar(t,e,"error",FILE_DOWNLOAD_CERO))}managerProgressBar(t,e,s,n){const o=this.getFirstElementByClassName(`progress_${t}`),i=this.getFirstElementByClassName(`progress-text_${t}`),a=this.getFirstElementByClassName(`progress-bar-download_${t}`);switch(this.setStatusDownload(t,s),s){case"init":this.stateInit(t);break;case"success":this.stateSuccess(t);break;case"error":this.stateError(t,e);break;case"progress":o.setAttribute("max",n.total.toString()),o.setAttribute("value",n.loaded.toString());let l=n.loaded/n.total*FILE_DOWNLOAD_CIEN;isNaN(l)?this.stateError(t,e):(l=Math.floor(l),i.innerHTML=l+"%",l===FILE_DOWNLOAD_CIEN&&(this.showIcon("successful",t),a.classList.remove(FILE_DOWNLOAD_CONTAINER),a.classList.remove(FILE_DOWNLOAD_PROGRESS_YELLOW),a.classList.add(FILE_DOWNLOAD_PROGRESS_GREEN)));break;default:this.stateError(t,e)}}stateInit(t){const e=this.getFirstElementByClassName(`progress_${t}`),s=this.getFirstElementByClassName(`progress-bar-download_${t}`);s.classList.remove(FILE_DOWNLOAD_PROGRESS_ORANGE),s.classList.add(FILE_DOWNLOAD_PROGRESS_YELLOW),s.classList.add("bc-file-download-progress"),e.setAttribute("value","0"),this.setLabelProgress(t,"loading"),this.eventDeleteRow(t),e.style.marginTop="-15px",e.style.marginBottom="5px"}stateSuccess(t){const e=this.getFirstElementByClassName(`progress-text_${t}`);this.getFirstElementByClassName(`progress-bar-download_${t}`).classList.add(FILE_DOWNLOAD_PROGRESS_GREEN),e.classList.remove(FILE_DOWNLOAD_ERROR),e.classList.add(FILE_DOWNLOAD_SUCCESS)}stateError(t,e){const s=this.getFirstElementByClassName(`progress_${t}`),n=this.getFirstElementByClassName(`progress-text_${t}`),o=this.getFirstElementByClassName(`progress-bar-download_${t}`);this.showIcon("alert",t),n.innerHTML=FILE_DOWNLOAD_ERROR_MESSAGE,n.classList.remove(FILE_DOWNLOAD_SUCCESS),n.classList.add(FILE_DOWNLOAD_ERROR),s.setAttribute("value","100"),this.clearColorProgressbar(o),o.classList.remove(FILE_DOWNLOAD_PROGRESS_GREEN),o.classList.add(FILE_DOWNLOAD_PROGRESS_ORANGE),this.setHeadAccordionError(),this.updatebuttonDownload(t,e,"refresh","Reintentar"),this.setRowClass(t,"error"),this.setLabelProgress(t,"error"),this.enableTagButton(t)}eventListener(t,e,s){const n=new XMLHttpRequest;n.responseType="blob",n.open("get",e,!0),n.setRequestHeader("Access-Control-Allow-Headers","*"),n.setRequestHeader("Access-Control-Allow-Origin","*"),n.send(),n.onerror=(()=>{this.managerProgressBar(t,e,"error",FILE_DOWNLOAD_CERO)}),n.onprogress=(s=>{n.status==FILE_DOWNLOAD_DOSCIENTOS&&s.total>FILE_DOWNLOAD_CERO?this.managerProgressBar(t,e,"progress",s):this.managerProgressBar(t,e,"error",FILE_DOWNLOAD_CERO)}),n.onloadend=(o=>{e&&(n.readyState==FILE_DOWNLOAD_CUATRO&&n.status==FILE_DOWNLOAD_DOSCIENTOS&&o.total>FILE_DOWNLOAD_CERO?(this.managerProgressBar(t,e,"success",FILE_DOWNLOAD_CERO),this.setHref(n.response,t,s)):this.managerProgressBar(t,e,"error",FILE_DOWNLOAD_CERO))}),n.addEventListener=(o=>{e&&(n.readyState==FILE_DOWNLOAD_CUATRO&&n.status==FILE_DOWNLOAD_DOSCIENTOS?(this.managerProgressBar(t,e,"success",FILE_DOWNLOAD_CERO),this.setHref(n.response,t,s)):this.managerProgressBar(t,e,"error",FILE_DOWNLOAD_CERO))})}setHref(t,e,s){const n=window.URL.createObjectURL(t),o=this.getFirstElementByClassName(`save-file_${e}`);o.setAttribute("href",n),s?o.setAttribute("download",s):o.setAttribute("download",n),this.setRowClass(e,"success"),this.enableTagButton(e),this.updatebuttonDownload(e,n,"download","Descargar"),this.setHeadAccordion(),this.setLabelProgress(e,"loaded")}setHeadAccordion(){const t=this.stateRow();this.downloadlistSuccess===t?(this.updateTitte(FILE_DOWNLOAD_SUCCESS_MESSAGE_TITLE),this.updateSubTitte(null),this.showLoader(!1)):1==t?this.updateTitte("Preparando descarga"):t>1&&this.updateTitte(`Preparando descarga (${this.downloadlistSuccess} de ${t})`)}setHeadAccordionError(){const t=FILE_DOWNLOAD_ERROR_MESSAGE_SUBTITLE;this.updateSubTitte(t),this.downloadlist===FILE_DOWNLOAD_UNO&&this.updateTitte(FILE_DOWNLOAD_ERROR_MESSAGE_TITTLE),this.showLoader(!1)}setNameFile(t,e,s){const n=this.getFirstElementByClassName(`bc-file-download-filename_${t}`);if(e){const t=e.split("/"),s=t[t.length-FILE_DOWNLOAD_UNO];n.innerHTML=s}s&&(n.innerHTML=s)}enableTagButton(t){const e=this.getFirstElementByClassName(`tag-button_${t}`);e.classList.remove("bc-tag-disabled"),e.classList.add("bc-tag")}clearColorProgressbar(t){t.classList.remove("bc-progress-container"),t.classList.remove("bc-progress-container-green"),t.classList.remove("bc-progress-container-orange")}eventDeleteRow(t){this.getFirstElementByClassName(`delete-row_${t}`).addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.deleteRow(t)})}deleteRow(t){const e=this.getFirstElementByClassName(FILE_DOWNLOAD_ROWSCONTAINER),s=this.getFirstElementByClassName(`file-download-row_${t}`);s&&(e.removeChild(s),this.setStatusDownload(t,"delete")),this.setHeadAccordion(),this.stateRow()}setLabelProgress(t,e){const s=this.getFirstElementByClassName(`bc-file-download-labelPre_${t}`),n=this.getFirstElementByClassName(`bc-file-download-labelPos_${t}`);switch(e){case"loading":s.style.display="block",n.style.display="none";break;case"loaded":s.style.display="none",n.style.display="block";break;case"error":s.style.display="none",n.style.display="none";break;default:s.style.display="block",n.style.display="none"}}stateRow(){const t=this.mySelf.getElementsByClassName(FILE_DOWNLOAD_ROW);t.length===FILE_DOWNLOAD_CERO&&this.mySelf.classList.add(FILE_DOWNLOAD_ACCORDION);const e=this.mySelf.getElementsByClassName(FILE_DOWNLOAD_SUCCESS);return this.downloadlistSuccess=e.length,t.length}setRowClass(t,e){this.getFirstElementByClassName(`file-download-row_${t}`).classList.add(`bc-download-row-${e}`)}updateTitte(t){this.getFirstElementByClassName(FILE_DOWNLOAD_ACCORDION_TITLE).innerHTML=t}updateSubTitte(t){this.getFirstElementByClassName(FILE_DOWNLOAD_ACCORDION_SUBTITLE).innerHTML=t}updatebuttonDownload(t,e,s,n){const o=this.getFirstElementByClassName(`bc-icon-download_${t}`),i=this.getFirstElementByClassName(`bc-label-download_${t}`);o.innerHTML=s,i.innerHTML=n,this.getFirstElementByClassName(`save-file_${t}`).addEventListener(BcCommonConstants.EVENT_CLICK,()=>{"Reintentar"===n&&this.downloadFile(t,e,null,this.fileName)})}showLoader(t){const e=this.getFirstElementByClassName(FILE_DOWNLOAD_LOADER),s=this.getFirstElementByClassName(FILE_DOWNLOAD_ICON);t?(e.style.display="block",s.style.display="none"):(e.style.display="none",s.style.display="block")}setStatusDownload(t,e){const s={};if(s.index=t,s.state=e,this.arrayStatus.find(e=>e.index===t)){let s;for(s=0;s{this.addFocusableLink(t)})}addFocusableLink(t){addFocusable(t,{label:`Ir a ${t.innerHTML}`})}getFooterTopELements(){return Array.from(this.mySelf.querySelectorAll(`div[class~='${BC_FOOTER_TOP_CONTAINERS}']`))}validateBreakPointMobile(){const t=()=>{window.innerWidth<=BC_FOOTER_MOBILE_BREAK_POINT&&!this.bcFooterIsMobile&&this.addAccordion()};window.addEventListener("load",()=>{t()}),window.addEventListener("resize",()=>{t()})}addAccordion(){this.bcFooterIsMobile=!0,this.getFooterTopELements().forEach((t,e)=>{if(t){const s=t.querySelector(`.${BC_FOOTER_TOP_CONTAINER_T} h6`),n=Array.from(t.querySelectorAll(`.${BC_FOOTER_TOP_CONTAINER_P} p`)),o=this.createAccordionGroupELement(e),i=this.createAccordionELement(),a=this.createAccordionHeaderELement(s,n.length),l=this.createAccordionContentELement(n);i.appendChild(a),i.appendChild(l),o.appendChild(i),t.appendChild(o)}BcAccordionBehavior.setUpAll()})}createAccordionGroupELement(t){const e=document.createElement("div");return e.classList.add(BC_FOOTER_ACCORDIONS_GROUP),e.setAttribute("id",this.mySelf.getAttribute("id")+t),e}createAccordionELement(){const t=document.createElement("div");return t.classList.add(BC_FOOTER_ACCORDION),t.classList.add(BC_FOOTER_ACCORDION_TYPE),t}createAccordionHeaderELement(t,e){const s=document.createElement("div");s.classList.add(BC_FOOTER_ACCORDION_HEADER);const n=`\n \n ${e>0?`\n `:""}\n `;return s.innerHTML=n,s.querySelector(`.${BC_FOOTER_ACCORDION_TEXT_CONTAINER}`).append(t.cloneNode(!0)),s}createAccordionContentELement(t){const e=document.createElement("div");return e.classList.add(BC_FOOTER_ACCORDION_CONTENT),t.forEach(t=>{e.appendChild(t.cloneNode(!0))}),e}}const BC_FOOTER_HIDE="hide",BC_FOOTER_TOP="footer-top ",BC_FOOTER_BC_ICON=`${BcCommonConstants.PREFIX_LIB}-icon`,BC_FOOTER_SELECTOR=`${BcCommonConstants.PREFIX_LIB}-footer`,BC_FOOTER_TOP_CONTAINER_T=`${BcCommonConstants.PREFIX_LIB}-footer-top-container-t`,BC_FOOTER_TOP_CONTAINER_P=`${BcCommonConstants.PREFIX_LIB}-footer-top-container-p`,BC_FOOTER_BOTTOM=`${BcCommonConstants.PREFIX_LIB}-footer-bottom `,BC_FOOTER_BOTTOM_RIGHT=`${BcCommonConstants.PREFIX_LIB}-footer-bottom-right`,BC_FOOTER_ELEMENTS_TOPTA=`${BcCommonConstants.PREFIX_LIB}FooterElementsTopTA`,BC_FOOTER_ELEMENTS_TOPPA=`${BcCommonConstants.PREFIX_LIB}footerElementsTopPA`,BC_FOOTER_A="a",BC_FOOTER_P="p",BC_FOOTER_CLICK="mousedown",BC_FOOTER_SHOW_DOWN_ARROW="chevron-down",BC_FOOTER_SHOW_UP_ARROW="chevron-up",BC_FOOTER_NETWORK_ICONS=`${BcCommonConstants.PREFIX_LIB}-footer-bottom-right-network-icons`,BC_FOOTER_TOP_CONTAINERS=`${BcCommonConstants.PREFIX_LIB}-footer-top-container`,BC_FOOTER_TOP_LA=`${BcCommonConstants.PREFIX_LIB}-footer-top-links-ca-a`,BC_FOOTER_ELEMENTS_LA=`${BcCommonConstants.PREFIX_LIB}FooterElementsLA`,BC_FOOTER_ACCORDION_CLASS=`${BcCommonConstants.PREFIX_LIB}-accordion`,BC_FOOTER_MOBILE_BREAK_POINT=578,BC_FOOTER_ACCORDIONS_GROUP=`${BcCommonConstants.PREFIX_LIB}-accordions-group`,BC_FOOTER_ACCORDION=`${BcCommonConstants.PREFIX_LIB}-accordion`,BC_FOOTER_ACCORDION_TYPE=`${BcCommonConstants.PREFIX_LIB}-accordion-minimal-unbordered`,BC_FOOTER_ACCORDION_HEADER=`${BcCommonConstants.PREFIX_LIB}-accordion-header`,BC_FOOTER_ACCORDION_HEADER_LEFT=`${BcCommonConstants.PREFIX_LIB}-accordion-header-left`,BC_FOOTER_ACCORDION_HEADER_RIGHT=`${BcCommonConstants.PREFIX_LIB}-accordion-header-right`,BC_FOOTER_ACCORDION_TEXT_CONTAINER=`${BcCommonConstants.PREFIX_LIB}-accordion-text-container`,BC_FOOTER_ACCORDION_CONTENT=`${BcCommonConstants.PREFIX_LIB}-accordion-content`,BC_HEADER_CLASS=`${BcCommonConstants.PREFIX_LIB}-header`,BC_HEADER_DROPDOWN_CONTENT=`${BcCommonConstants.PREFIX_LIB}-dropdown-content`,BC_HEADER_MOBILE=`${BcCommonConstants.PREFIX_LIB}-header-mobile`,BC_HEADER_DROPDOWN_CUSTOM=`${BcCommonConstants.PREFIX_LIB}-dropdown-custom`,BC_HEADER_BRAND=`${BcCommonConstants.PREFIX_LIB}-header-brand`,BC_HEADER_NAV_ITEM=`${BcCommonConstants.PREFIX_LIB}-header-nav-item`,BC_HEADER_NAV=`${BcCommonConstants.PREFIX_LIB}-header-nav`,BC_HEADER_CHANNEL=`${BcCommonConstants.PREFIX_LIB}-header-channel`,BC_HEADER_LOGO=`${BcCommonConstants.PREFIX_LIB}-md`,BC_HEADER_DROPDOW_TOGGLE=`${BcCommonConstants.PREFIX_LIB}-dropdown`,BC_HEADER_BRAND_TOGGLE=`${BC_HEADER_BRAND}_menu-toggle`,BC_HEADER_TOGGLE=`${BcCommonConstants.PREFIX_LIB}-dropdown-toggle`,BC_HEADER_TOGGLE_ACTIVE=`${BcCommonConstants.PREFIX_LIB}-dropdown-toggle-active`,BC_HADER_CUSTOM_EVENT="headerDropdownChanged",BC_HEADER_LOGOUT_BUTTON_CLASS=`${BcCommonConstants.PREFIX_LIB}-header-nav-item_logout`,BC_HEADER_NOT_LOGOUT_CLASS=`${BcCommonConstants.PREFIX_LIB}-header-not-logout`,BC_LINK=`${BcCommonConstants.PREFIX_LIB}-link`;class BcHeaderBehavior extends BcDefaultBehavior{constructor(){super(),this.dropdowns=[],this.dropdownsContents=[],this.dropdownActive=null,this.menuButton=null,this.communicationWithMenu=!0}static setUpAll(){const t=Array.from(document.querySelectorAll(`header[class^='${BC_HEADER_CLASS}']`)),e=[];for(let s=0;s{this.removeLogoutBtn()}),this.initDropdowns(),this.getDropdownContents(),this.addEventForOption(),this.getMenuButton(),this.accessibility(),this.communicationWithMenu?this.addEvents():this.menuButton.style.display="none"}setFocus(){const t=this.mySelf.querySelector(`.${BC_HEADER_BRAND}`);if(t){const e=t.querySelector(`.${BC_HEADER_LOGO}`),s=this.menuButton,n=this.mySelf.querySelector(`.${BC_HEADER_CHANNEL}`),o=this.mySelf.querySelector(`.${BC_HEADER_NAV}`).querySelectorAll(`.${BC_HEADER_NAV_ITEM} > .${BC_LINK}`);let i=[s,e,n],a=Array.from(o);(i=i.concat(a)).forEach(t=>{addFocusable(t,{tabindex:String(0)})})}}getMenuButton(){const t=this.mySelf.querySelector(`.${BC_HEADER_BRAND}`);null!==t&&(this.menuButton=t.querySelector(`.${BC_HEADER_BRAND_TOGGLE}`))}accessibility(){const t=this.mySelf.querySelectorAll(`.${BC_HEADER_DROPDOWN_CUSTOM}`);if(t){const e=this.mySelf.querySelector(`.${BC_HEADER_TOGGLE}`);t.forEach(t=>{this.setkeyBoard(t,e)}),this.setFocus()}}setkeyBoard(t,e){t.addEventListener(BcCommonConstants.EVENT_KEY_UP,t=>{t.key!==BcCommonConstants.KEY_EVENT_ENTER&&t.key!==BcCommonConstants.KEY_EVENT_SPACE||e.click()})}getDropdownContents(){this.mySelf.classList.contains(`${BC_HEADER_MOBILE}`)?this.dropdownsContents=this.mySelf.querySelectorAll(`.${BC_HEADER_DROPDOWN_CONTENT}`):this.dropdownsContents=this.mySelf.querySelectorAll(`*[class~="${BC_HEADER_DROPDOWN_CONTENT}"]`)}toggleSidebarMenu(){const t=new CustomEvent(BcCommonConstants.EVENT_HEADER_TOGGLE_MENU);window.dispatchEvent(t)}addMenuButtonEvent(){null!==this.menuButton&&this.menuButton.addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.toggleSidebarMenu()})}removeLogoutBtn(){const t=this.mySelf.querySelector(`.${BC_HEADER_LOGOUT_BUTTON_CLASS}`);t&&(t.remove(),this.mySelf.classList.add(BC_HEADER_NOT_LOGOUT_CLASS))}menuItemOpened(){window.addEventListener(BcCommonConstants.EVENT_MENU_ITEM_OPENED,t=>{null!==t.detail.itemStatus?this.mySelf.style.zIndex="1":this.mySelf.style.zIndex="999"})}addEvents(){this.iAmHere(),this.addMenuButtonEvent(),this.menuItemOpened()}iAmHere(){const t=new CustomEvent(BcCommonConstants.EVENT_HEADER_EXIST);window.dispatchEvent(t)}addEventForOption(t){for(let t=0;t{this.addEventClick(e,t)},!0),t.setAttribute("listener",BcCommonConstants.EVENT_CLICK)}addEventClick(t,e){const s=t.closest(`.${BC_HEADER_DROPDOWN_CUSTOM}`);this.updateHeaderItemText(s,e)}updateHeaderItemText(t,e){const s=t.querySelector(BcCommonConstants.P_TAG),n=t.querySelector(BcCommonConstants.SMALL);s.textContent=e.querySelector(BcCommonConstants.P_TAG).textContent,n&&(n.textContent=e.querySelector(BcCommonConstants.SMALL).textContent);const o=new CustomEvent(BC_HADER_CUSTOM_EVENT,{detail:null!=n?{text:s.textContent,subText:n.textContent}:{text:s.textContent}});window.dispatchEvent(o)}initDropdowns(){const t=Array.from(this.mySelf.querySelectorAll('*[class*="bc-dropdown"]'));for(const e of t){const t=new BcDropdownBehavior;t.setElement(e),t.setUp()}}}const ORGANISM_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-file`,BUTTON_SELECT_FILE_CLASS=`${BcCommonConstants.PREFIX_LIB}-button-select-file`,INFO_NAME_CLASS=`${BcCommonConstants.PREFIX_LIB}-info-name`,INFO_NAME_FINAL_CLASS=`${BcCommonConstants.PREFIX_LIB}-info-name-final`,INFO_SIZE_CLASS=`${BcCommonConstants.PREFIX_LIB}-info-size`,INFO_LOAD_CLASS=`${BcCommonConstants.PREFIX_LIB}-info-load`,INFO_LOAD_SUCCESS_CLASS=`${BcCommonConstants.PREFIX_LIB}-info-load-success`,INFO_LOAD_ERROR_CLASS=`${BcCommonConstants.PREFIX_LIB}-info-load-error`,INFO_PERCENT_CLASS=`${BcCommonConstants.PREFIX_LIB}-info-percent`,DROP_AREA_CLASS=`${BcCommonConstants.PREFIX_LIB}-drop-area`,DROP_AREA_NONE_CLASS=`${BcCommonConstants.PREFIX_LIB}-drop-area-none`,DROP_AREA_HOVER_CLASS=`${BcCommonConstants.PREFIX_LIB}-drop-area-hover`,CONTAINER_INPUT_CLASS=`${BcCommonConstants.PREFIX_LIB}-container-button-input-file`,LABEL_BUTTON_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-file-label`,FILES_CONTAINER_CLASS=`${BcCommonConstants.PREFIX_LIB}-files-container`,SEE_MORE_FILES_CONTAINER_CLASS=`${BcCommonConstants.PREFIX_LIB}-files-show-more-container`,UPLOADED_FILE_CLASS=`${BcCommonConstants.PREFIX_LIB}-uploaded-file`,UPLOADED_FILE_SUCCESS_CLASS=`${BcCommonConstants.PREFIX_LIB}-uploaded-file-success`,UPLOADED_FILE_ERROR_CLASS=`${BcCommonConstants.PREFIX_LIB}-uploaded-file-error`,UPLOADED_FILE_DELETED_CLASS=`${BcCommonConstants.PREFIX_LIB}-uploaded-file-deleted`,INPUT_FILE_HIDDEN_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-file-hidden`,INPUT_REFRESH_CLASS=`${BcCommonConstants.PREFIX_LIB}-input-refresh`,FILE_CARD_LEFT=`${BcCommonConstants.PREFIX_LIB}-file-left`,FILE_CARD_CENTER=`${BcCommonConstants.PREFIX_LIB}-file-center`,FILE_CARD_RIGTH=`${BcCommonConstants.PREFIX_LIB}-file-right`,FILE_CARD_INFO=`${BcCommonConstants.PREFIX_LIB}-info`,PROGRESS_CONTAINER=`${BcCommonConstants.PREFIX_LIB}-progress-container`,INPUT_TYPE_FILE="input[type=file]",DRAG_EVENTS=["drag","dragstart","dragend","dragenter","dragover","dragleave","drop"],DRAGENTER_EVENT="dragenter",DRAGLEAVE_EVENT="dragleave",DROP_EVENT="drop",CLICK_EVENT="click",MOUSEOUT_EVENT="mouseout",CHANGE_EVENT="change",SEE_MORE_MESSAGE="Ver más adjuntos",SEE_LESS_MESSAGE="Ver menos",ATTR_MAX_SIZE="maxSize",ATTR_MAX_CARDS="maxCards",ATTR_MAX_FILES="maxFiles",ATTR_VALID_TYPE="validType",FILE_MAX_SIZE=5120,MAX_CONTAINERS=3,KILOBYTE=1024,MEGABYTE=1048576,GIGABYTE=1073741824,DECIMALS_MAX=2,BYTES_1073741824=1073741824,SLICE=28,ONE_HUNDRED_NUMBER=100,ONE_NUMBER=1,ZERO_NUMBER=0,UPLOAD_STATUS="upload",SUCCESS_STATUS="success",ERROR_STATUS="error",CLOUD_UPLOAD_ICON="cloud-upload",SUCCESSFUL_ICON="successful",ALERT_ICON="alert",ERROR_ICON="error",REFRESH_ICON="refresh",BUTTON_ELEMENT="button",DISABLED="disabled";class BcInputFileBehavior extends BcDefaultBehavior{constructor(){super(),this.filesAdded=[],this.filesAddErr=[],this.counter=ZERO_NUMBER,this.counterMouse=ZERO_NUMBER,this.toogleChangeEvent=!0,this.toogleButtonSeeMore=!1,this.sanitizer=new BcHTMLSanitizer}static setUpAll(){const t=Array.from(document.querySelectorAll(`.${ORGANISM_CLASS}`)),e=[];for(let s=ZERO_NUMBER;s{this.dropArea.addEventListener(t,this.preventDefaults,!1)})}listenerDrop(){this.dropArea.addEventListener(DROP_EVENT,t=>{this.mySelf.querySelector(`.${DROP_AREA_CLASS}`).classList.contains(DROP_AREA_NONE_CLASS)||this.handleDrop(t)},!1)}listenerClick(){this.buttonSelectFile.addEventListener(CLICK_EVENT,()=>{this.inputFile.click()})}listenerDragenter(){this.dropArea.addEventListener(DRAGENTER_EVENT,t=>{t.preventDefault(),t.stopPropagation(),this.counter++;const e=t.target.classList.contains(DROP_AREA_NONE_CLASS);t.target.className!==DROP_AREA_CLASS||e||t.target.classList.add(DROP_AREA_HOVER_CLASS)},!1)}listenerDragleave(){this.dropArea.addEventListener(DRAGLEAVE_EVENT,t=>{t.preventDefault(),t.stopPropagation(),this.counter--,this.counter===ZERO_NUMBER&&t.target.classList.remove(DROP_AREA_HOVER_CLASS)},!1)}listenerMouseout(){this.dropArea.addEventListener(MOUSEOUT_EVENT,t=>{t.target.classList.contains(DROP_AREA_CLASS)&&t.target.classList.remove(DROP_AREA_HOVER_CLASS)})}listenerChange(){this.inputFile.addEventListener(CHANGE_EVENT,t=>{this.handleFiles(this.inputFile.files),this.inputFile.value=null,this.toogleChangeEvent=!1})}preventDefaults(t){t.preventDefault(),t.stopPropagation()}handleDrop(t){const e=t.dataTransfer.files;this.handleFiles(e)}handleFiles(t){this.maxCards=this.inputFile.getAttribute(ATTR_MAX_CARDS)?parseInt(this.inputFile.getAttribute(ATTR_MAX_CARDS)):MAX_CONTAINERS,this.maxSize=this.inputFile.getAttribute(ATTR_MAX_SIZE)?parseInt(this.inputFile.getAttribute(ATTR_MAX_SIZE)):FILE_MAX_SIZE,this.maxFiles=this.inputFile.getAttribute(ATTR_MAX_FILES)?parseInt(this.inputFile.getAttribute(ATTR_MAX_FILES)):null,this.maxFiles&&this.maxFiles>ZERO_NUMBER&&this.filesAdded.length+t.length>this.maxFiles?this.changeStateMaxFiles&&this.changeStateMaxFiles(this.filesAdded):(this.setTypeAttribute(),this.iterateFiles(t,this.validTypesArray))}updateButtonState(t){const e=this.mySelf.querySelector(BcCommonConstants.BUTTON_TAG);t?e.setAttribute(DISABLED,""):e.removeAttribute(DISABLED)}setTypeAttribute(){let t=this.inputFile.getAttribute(ATTR_VALID_TYPE)?this.inputFile.getAttribute(ATTR_VALID_TYPE):"[]";t=t.toLowerCase();try{const e=/'/gm;t=t.replace(e,'"'),this.validTypesArray=JSON.parse(t)}catch(t){this.validTypesArray=[],console.error("Validacion tipo de archivo invalido")}this.inputFile.accept=this.getInputAcceptTypes(this.validTypesArray)}iterateFiles(t,e){this.overFileLimit(t)?this.validLimitFn(t):this.iterateFilesErr(t,e)}iterateFilesErr(t,e){if(!(Array.from(t).map(t=>this.isRepeatedFileErr(t)).filter(t=>t).length>0))for(let s=ZERO_NUMBER;sthis.maxSize?this.validSizeFn(t,s):(this.appendFileMolecule(t[s],this.uploadedFilesMainContainer),this.changeState&&this.changeState(this.filesAdded)):this.validTypeFn(t,s)}validLimitFn(t){const e=new BcInputFileValidationError("Este selector no permite más de un archivo");this.createFileInDom(t[ZERO_NUMBER],this.uploadedFilesMainContainer,String(e).slice(SLICE));const s=this.getContainers(this.uploadedFilesMainContainer);this.hideContainers(s,this.uploadedFilesMainContainer)}validTypeFn(t,e){const s=new BcInputFileValidationError("Tipo de archivo inválido");this.filesAddErr.push(t[e]),this.createFileInDom(t[e],this.uploadedFilesMainContainer,String(s).slice(SLICE)),this.changeStateErr&&this.changeStateErr(String(s).slice(SLICE));const n=this.getContainers(this.uploadedFilesMainContainer);this.hideContainers(n,this.uploadedFilesMainContainer)}validSizeFn(t,e){const s=new BcInputFileValidationError("Archivo demasiado grande");this.filesAddErr.push(t[e]),this.createFileInDom(t[e],this.uploadedFilesMainContainer,String(s).slice(SLICE)),this.changeStateErr&&this.changeStateErr(String(s).slice(SLICE));const n=this.getContainers(this.uploadedFilesMainContainer);this.hideContainers(n,this.uploadedFilesMainContainer)}appendFileMolecule(t,e){if(this.isRepeatedFile(t))return;if(this.filesAdded.push(t),this.createFileInDom(t,this.uploadedFilesMainContainer,UPLOAD_STATUS),this.maxFiles&&this.maxFiles>ZERO_NUMBER&&this.filesAdded.length>=this.maxFiles)return void this.updateButtonState(!0);const s=this.getContainers(e);this.hideContainers(s,e)}isRepeatedFile(t){let e=!1;for(let s=ZERO_NUMBER;s