const COMMON_CONSTANTS_NUMBERS={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.X_SMALL_CLASS="bc-xs",BcCommonConstants.SMALL="small",BcCommonConstants.EVENT_CANCEL="cancelSelection",BcCommonConstants.EVENT_RANGE="selectRange",BcCommonConstants.EVENT_SELECT="selectDate",BcCommonConstants.EVENT_CLICK="click",BcCommonConstants.EVENT_FOCUS="focus",BcCommonConstants.EVENT_BLUR="blur",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.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.NONE="none",BcCommonConstants.FLEX="flex",BcCommonConstants.EVENT_MOUSEDOWN="mousedown",BcCommonConstants.EVENT_MOUSEOVER="mouseover",BcCommonConstants.EVENT_MOUSEOUT="mouseout",BcCommonConstants.EVENT_MOUSEENTER="mouseenter",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.EVENT_RESIZE="resize",BcCommonConstants.KEY_EVENT_ARROW_DOWN="ArrowDown",BcCommonConstants.KEY_EVENT_ARROW_UP="ArrowUp",BcCommonConstants.KEY_EVENT_ENTER="Enter",BcCommonConstants.KEY_EVENT_ESCAPE="Escape",BcCommonConstants.CLOSE_ALERT_EVENT="onCloseAlert",BcCommonConstants.CLOSE_NOTIFICATION_EVENT="onCloseNotification",BcCommonConstants.ARIA_LABEL="aria-label",BcCommonConstants.BUTTON_TAG="button",BcCommonConstants.DIV_TAG="div",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.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";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.mySelf}setElement(t){this.mySelf=t}getMySelf(){return this.mySelf}setUp(t=!1){if(!this.isReady||t)try{this._setUp(),this.isReady=!0}catch(t){this.isReady=!1}}setDisable(t){t?this.mySelf.classList.add(BcCommonConstants.DISABLE_CLASS):this.mySelf.classList.remove(BcCommonConstants.DISABLE_CLASS)}}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_NUMBER_0=0,_DROPDOWN_NUMBER_1=-1,_DROPDOWN_NUMBER_11=11,_DROPDOWN_NUMBER_14=14,_DROPDOWN_NUMBER_243=243;class BcDropdownHelper{constructor(){}getProperty(t,e,n){if(e.length>0){if(e[0]in t){const s=t[e[0]];return e.length-1>0?this.getProperty(s,e.slice(1,e.length),n):s}if(n)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);try{this.initConfiguration()}catch(t){}}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"],""),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}}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.setDropdownContentPosition()},!0)}openDrowndown(){setTimeout(()=>{this.setDropdownContentPosition()});const t=this.dropdownContent;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,window.dispatchEvent(new CustomEvent(_DROPDOWN_OPENED_EVENT,{detail:this.dropdownContent.getAttribute("id")})),this.config.parentWidth&&this.setParentWidth()}closeDropdown(){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.toggleButton&&this.toggleButton.classList.remove(_DROPDOWN_DROPTOP_CLASS),this.dropdownContent&&window.dispatchEvent(new CustomEvent(_DROPDOWN_CLOSED_EVENT,{detail:this.dropdownContent.getAttribute("id")}))}setHeightContent(t){const e=this.mySelf.getBoundingClientRect().y;if(this.originalHeightContent||(this.originalHeightContent=this.dropdownContent.clientHeight),"top"==t)if(e{this.clickToggleEvent(t)};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}),null!==this.closeButton&&(this.closeButton.addEventListener("click",e=>{t(e)}),addFocusable(this.closeButton,{haspopup:"listbox"},{event:t}))}clickToggleEvent(t){t.preventDefault(),t.stopPropagation(),this&&this.disabled||this.toggleDropdown()}toggleDropdown(t){this.validateDropdownIsActive()||(this.dropdownActive=null),null==this.dropdownActive||t?this.openDrowndown():this.closeDropdown()}configureExtraToggles(t){if(this.config.extraToggles)for(const e of this.config.extraToggles){let n;if(n=e.id?this.mySelf.querySelector(`*[id='${e.id}']`):e.node)for(const s of e.events)n.addEventListener(s,e=>{t.bind(this,e)})}}getElements(){this.toggleButton=this.mySelf.querySelector(`.${this.config.toggleActiveClass}, .${this.config.toggleClass}`),this.toggleButton&&(this.idContent=this.toggleButton.getAttribute("aria-controls")),this.dropdownContent=this.mySelf.querySelector(`*[id='${this.idContent}']`),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 this.dropdownContent.classList.contains(this.config.contentActiveClass)}setDropdownContentPosition(){if(null!==this.dropdownActive){const t=this.mySelf.getBoundingClientRect(),e=this.dropdownContent.getBoundingClientRect(),n=document.documentElement.clientWidth,s=document.documentElement.clientHeight;this.triangle&&this.triangle.classList.remove(_DROPDOWN_DROPTOP_CLASS);let o=_DROPDOWN_NUMBER_0,a=_DROPDOWN_NUMBER_0,i=t.left,l=t.top+t.height;this.config.isPopUp&&(l+=_DROPDOWN_NUMBER_11),i+e.width>=n&&(o=n-(i+t.width),i=_DROPDOWN_NUMBER_1),l+e.height>=s&&(a=s-(t.bottom-t.height-_DROPDOWN_NUMBER_14),l=_DROPDOWN_NUMBER_1,this.triangle&&this.triangle.classList.add(_DROPDOWN_DROPTOP_CLASS)),this.setPosition(i,o,l,a)}}setPosition(t,e,n,s){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`),n!==_DROPDOWN_NUMBER_1?(this.dropdownContent.style.top=`${n}px`,this.dropdownContent.style.bottom="auto",this.setHeightContent("bottom")):(this.setHeightContent("top"),this.dropdownContent.style.top="auto",this.dropdownContent.style.bottom=`${s}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+"px"}addWindowEventClick(){window.addEventListener("click",t=>{t.stopPropagation();const e=-1!==t.target.className.indexOf(this.config.toggleClass),n=!!this.config.multiple&&-1!==t.target.className.indexOf(this.config.itemClass);!this.dropdownActive||e||n||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}']`)),n=[];for(const s of e){const e=new BcDropdownBehavior;e.setElement(s),t&&e.setConfig(t),e.setUp(),n.push(e)}return n}}class BcButtonGroupBehavior extends BcDefaultBehavior{constructor(){super(),this.buttonsState=[]}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class~='${ELEMENT_BUTTON_GROUP_CLASS}']`)),e=[];for(const n of t){const t=new BcButtonGroupBehavior;t.setElement(n),t.setUp(),e.push(t)}return e}_setUp(){this.selectElements()}selectElements(){const t=document.querySelectorAll(`div[class~='${ELEMENT_BUTTON_GROUP_CLASS}']`);for(let e=0;ethis.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 n=0;n{this.updateInput()}),this.updateInput()}updateInput(){const t=this.mySelf,e=parseInt(this.mySelf.getAttribute("min")),n=(parseInt(this.mySelf.getAttribute("max"))-e)/SLIDER_N100,s=(parseInt(this.mySelf.value)-e)/n;this.mySelf.style.setProperty("--value",s.toString()),this.outputFunction&&this.outputFunction(s),this.thumb||(this.thumb=this.mySelf.parentElement.querySelector(`[class='${THUMB_SLIDER_CLASS}']`)),this.thumb.style.left=(parseInt((s/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 n=0;n{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,n=parseInt(e.min),s=parseInt(e.max),o=Math.min(parseInt(e.value),parseInt(t.value));e.value=o.toString();const a=(o-n)/(s-n)*SLIDER_PERCENTAGE,i=this.mySelf.querySelector(".slider > .thumb.left"),l=this.mySelf.querySelector(".slider > .range");if(i.style.left=a+"%",l.style.left=a+"%",this.inputL.style.zIndex=a>SLIDER_N90?"4":"3",this.thumbLeft){const t=parseInt(`${parseInt(i.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,n=parseInt(e.min),s=parseInt(e.max),o=Math.max(parseInt(e.value),parseInt(t.value));e.value=o.toString();const a=(o-n)/(s-n)*SLIDER_PERCENTAGE,i=this.mySelf.querySelector(".slider > .thumb.right"),l=this.mySelf.querySelector(".slider > .range");if(i.style.right=SLIDER_PERCENTAGE-a+"%",l.style.right=SLIDER_PERCENTAGE-a+"%",this.inputR.style.zIndex=a=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
${t}
\n
ok
\n
\n `:e.innerHTML=`\n
\n
\n
${t}
\n
ok
\n
\n `,this.mySelf.appendChild(e),addFocusable(e.querySelector(`.${STEPPER_INNER_BULLET}`),{label:this.labels[t-1]},{event:()=>{this.click(t-1)}})}}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()),e?this.setCurrentStep(t):this.currentStep=t}back(){this.currentStep>0&&(this.status[this.currentStep]=STEPPER_IS_DEFAULT,this.setCurrentStep(this.currentStep-1),this.status[this.currentStep]=STEPPER_IS_ACTIVE,this.setBulletStatus())}setBulletStatus(){this.status.forEach((t,e)=>{const n=()=>{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);break;case STEPPER_IS_DEFAULT:n();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);break;default:n()}})}setCurrentStep(t){this.currentStep=t,this.outputFunction&&this.outputFunction(t)}getCurrentState(){return this.currentStep}}const INPUT_CLASS=`${BcCommonConstants.PREFIX_LIB}-input`,INPUT_ACTIVE_CLASS=`${BcCommonConstants.PREFIX_LIB}-active`;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 n of t){const t=new BcInputBehavior;t.setElement(n),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)}}const ACCORDIONS_GROUPS_SUFIX=`${BcCommonConstants.PREFIX_LIB}-accordions-group`,ACCORDION_CLASS=`${BcCommonConstants.PREFIX_LIB}-accordion`,ACCORDION_HEADER_CLASS=`${BcCommonConstants.PREFIX_LIB}-accordion-header`,ACCORDION_MULTIPLE_CLASS=`${BcCommonConstants.PREFIX_LIB}-multiple`,ACCORDION_TOGGLE_BTN_CLASS=`${BcCommonConstants.PREFIX_LIB}-toggle-button`,ACCORDION_ACTIVE_CLASS=`${BcCommonConstants.PREFIX_LIB}-active`;class BcAccordionBehavior extends BcDefaultBehavior{constructor(){super(),this.headerList=[]}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class~='${ACCORDIONS_GROUPS_SUFIX}']`)),e=[];for(const n of t){const t=new BcAccordionBehavior;t.setElement(n),t.setUp(),e.push(t)}return e}_setUp(){this.getAccordionsGroup();const t=this.getAccordions();let e=0;for(const n of t)this.addExpandEvent(n,e),e++}getHeader(t){return t.querySelector(`div[class^='${ACCORDION_HEADER_CLASS}']`)}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(`div[class~='${ACCORDION_CLASS}']`))}addExpandEvent(t,e){if(null!=t){const n=()=>{const n=t.closest(`.${ACCORDIONS_GROUPS_SUFIX}`),s=n.classList.contains(`.${ACCORDION_MULTIPLE_CLASS}`),o=Array.from(n.querySelectorAll(`.${ACCORDION_CLASS}`));for(const e of o)e!==t&&s&&e.classList.remove(`${ACCORDION_ACTIVE_CLASS}`);t.classList.toggle(`${ACCORDION_ACTIVE_CLASS}`)&&this.activeFunction&&this.activeFunction(e)},s=this.getHeader(t),o=s.querySelector(`.${ACCORDION_TOGGLE_BTN_CLASS}`);null!==s&&(o.addEventListener("click",n),addFocusable(o,{role:"heading",level:"1"},{event:n}))}}}const BC_ALERT=`${BcCommonConstants.PREFIX_LIB}-alert`,BC_ALERT_ACTIVE=`${BcCommonConstants.PREFIX_LIB}-alert-active`,BC_ALERT_CLOSE=`${BcCommonConstants.PREFIX_LIB}-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`,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 n=0;nthis.close()})}getCloseButton(){this.bcAlertCloseButton=this.mySelf.querySelector(`.${BC_ALERT_CLOSE}`)}listeners(){this.bcAlertCloseButton.addEventListener(BcCommonConstants.EVENT_CLICK,t=>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=>{"fade-out-opacity"!==t.animationName&&"slide-up-reverse"!==t.animationName||(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&&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
`,n=document.createElement("div");return n.classList.add(BcDateConstants.DISPLAYED_CALENDARS_CLASS),n.innerHTML=e,n}getTwelveScrollableMonths(t,e){const n=[];for(let s=t-BcDateConstants.NUMBERS.CALENDAR_N6;s<=t+BcDateConstants.NUMBERS.CALENDAR_N6;s++){const t=new Date(e,s,1),o={month:t.getMonth(),year:t.getFullYear()};n.push(o)}return n}getTwoRangeMonths(t,e){const n=[],s=new Date;s.setMonth(t,1),s.setFullYear(e);for(let e=t;e<=t+1;e++){s.setMonth(e);const t={month:s.getMonth(),year:s.getFullYear()};n.push(t)}return n}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 n=document.createElement("p");n.classList.add(BcCommonConstants.SMALL,BcCommonConstants.TEXT_GRAY),n.textContent=e,t.appendChild(n)})}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 n=this.getDisplayedMonthElement(t),s=n.querySelector(`.${BcDateConstants.DAYS_CLASS}`),o=n.querySelector(`.${BcDateConstants.YEAR_CLASS}`),a=n.querySelector(`.${BcDateConstants.MONTH_NAME_CLASS}`),i=n.querySelector(`.${BcDateConstants.WEEK_CLASS}`);o?(a.textContent=BcDateConstants.MONTHS_TEXT[e.month],o.textContent=e.year+""):a.textContent=BcDateConstants.MONTHS_TEXT[e.month]+" "+e.year,this.addWeekDays(i),s.innerHTML="";const l=new Date;return l.setFullYear(e.year),l.setMonth(e.month,1),{emptyDays:l.getDay(),month:s,tempDate:l,element:n}}}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 n=0;n{t.appendChild(this.createAMonthElement(n,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())}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]))}addYearsPicker(){this.monthsOrYearsContainer.innerHTML="";for(let t=0;t<=this.yearGroup[1]-this.yearGroup[0];t++){const e=document.createElement("p"),n=this.yearGroup[0]+t;e.textContent=`${n}`,this.monthsOrYearsContainer.appendChild(e),this.addListenerToSelectYear(e,n)}}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()}}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(n.year,n.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)})}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")}emitEvent(){this.value=this.selectedDates,this.output&&this.output(this.value)}}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`,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 n=0;nthis.setInputDateValue(t)),this.inputDate.addEventListener(BcCommonConstants.EVENT_CLICK,t=>this.handleClick(t),!1),this.calendarElement.addEventListener(BcCommonConstants.EVENT_CANCEL,t=>this.handleClick(t),!1),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()}setInputDateValue(t){this.inputDate.value=t.detail.toISOString().substring(0,10),this.handleClick(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 n=0;nthis.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 n=0;n{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_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;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 n=0;n=INPUT_TOKEN_ZERO_ASCII_CODE&&n<=INPUT_TOKEN_NINE_ASCII_CODE)s=e==this.numInputs?this.numInputs:e+1,this.findInput(s).focus();else{const t=o.value.toString().substring(0,1);o.value=t}else{const t=o.value.toString().substring(0,1);o.value=t}else o.setAttribute("value","");this.controlInputs(),this.inputStatus?(this.putValid(),this.changeValuesEmitEvent()):this.removeValid(),(!this.isValid&&this.inputStatus||this.isValid&&!this.inputStatus)&&(this.isValid=this.inputStatus,this.changeStatusEmitEvent())}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),n=window.crypto.getRandomValues(e);this._id=`${t}.${n[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 n="^[0-9]$";e.setAttribute("pattern",n);const s=`${this._id}-${t}`;e.setAttribute("id",s);const o="bc-input";e.setAttribute("class",o),e.setAttribute("required","true"),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 n=Array.from(t),s=[];let o=!1;for(let t=0;t{e.disabled=t})}setValue(t){if(t){const e=t.split(""),n=Array.from(this.mySelf.querySelectorAll("input"));let s=0;e.forEach(t=>{n[s].value=t,n[++s]&&n[s].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;!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={}));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_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_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_TC_IMG="https://upload.wikimedia.org/wikipedia/commons/a/a4/Mastercard_2019_logo.svg";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()}_setDisable(t){}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}']`);if(t){const e=createElement({element:BcCommonConstants.P_TAG,classList:[CARD_SUBTITTLE_CLASS]}),n=createElement({element:BcCommonConstants.P_TAG,classList:[CARD_SUBTITTLE_DESCRIPTION_CLASS]}),s=this.config.subtittle;s&&("string"==typeof s?e.innerText=s:(e.innerText=s[0],n.innerText=s[1]),t.appendChild(e),t.appendChild(n))}}cardHeadBuilder(){if(this.cardBody){const t=createElement({element:BcCommonConstants.DIV_TAG,classList:[CARD_HEAD_CLASS],children:[createElement({element:BcCommonConstants.H6_TAG,classList:[CARD_TITTLE_CLASS],innerText:this.config.tittle})]}),e=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=e,t.appendChild(e),this.cardBody.appendChild(t)}}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/2.0.16/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_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_CONTROL_CLASS=`${CARD_SELECT_CLASS}-control`,CARD_SELECT_INPUT_CLASS=`${CARD_SELECT_CLASS}-input`,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_MAX_WIDTH_CLIENT=6;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.setEventListeners(),this.markItemByIndex(this.defaultIndex)}_setDisable(t){this.bcInputBehavior&&this.bcInputBehavior.setDisable(t),this.bcCardProductBehavior&&(this.bcCardProductBehavior.setDisable(t),this.closeDropdown())}createItems(){if(this.itemsConfig){this.itemsConfig.forEach((t,e)=>{const n=this.createCardItem(t);this.dropdownItems[e]=n});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){this.itemsConfig=t}setMarginTop(){this.span&&(this.topMarginContent=-25)}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 n=this.toCardComponent(t,!1);this.itemsConfig[e]=n.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})}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,n){this.disabled||(this.removeSelectedItem(n),this.showSelectedItem(n),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,{},{event:this.configSelectedEvent})}),this.input.addEventListener(BcCommonConstants.EVENT_KEY_UP,t=>{this.filterItems(t)})}filterItems(t){if(this.disabled)return;const e=t.target.value.toUpperCase();if(e.length>=3)return this.restoreFilters(),this.itemsConfig.forEach((t,n)=>{Object.values(t).map(t=>"string"==typeof t?t.toUpperCase():"").join().indexOf(e)>=0&&this.dropdownItems[n].classList.add(CARD_SELECT_DROPDOWN_FILTERED_ITEMS_CLASS)}),void this.toggleDropdown(!0);this.showAllItems()}showAllItems(){this.dropdownContent.classList.remove(CARD_SELECT_DROPDOWN_FILTRABLE_ITEMS_CLASS)}restoreFilters(){this.dropdownContent.classList.add(CARD_SELECT_DROPDOWN_FILTRABLE_ITEMS_CLASS),this.dropdownItems.forEach(t=>{t.classList.remove(CARD_SELECT_DROPDOWN_FILTERED_ITEMS_CLASS)})}removeFilter(){this.input.value=""}toCardComponent(t,e,n){const s=t.querySelector(`div[class~=${CARD_MAIN_CLASS}]`),o=new BcCardProductBehavior;return o.setElement(s),n&&(o.toggleAction=n.bind(this)),o.setUp(),o.setActive(e),o}removeSelectedItem(t){const e=this.mySelf.querySelector(`li[class~=${CARD_SELECT_ACTIVE_ITEM_CLASS}]`),n=this.mySelf.querySelector(`div[class~=${CARD_SELECT_ACTIVE_ITEM_CLASS}]`);e&&replaceClass(e,CARD_SELECT_ACTIVE_ITEM_CLASS,this.config.itemClass),n&&(e&&e.appendChild(this.toCardComponent(n,!1).getMySelf()),n.remove()),this.mySelf.classList.remove(CARD_SELECT_SELECTED_CLASS),replaceClass(t,this.config.itemClass,CARD_SELECT_ACTIVE_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})]}),n=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:[n]})}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)}`]}),n=new BcCardProductBehavior;return n.setElement(e),n.setConfig(t),n.setUp(),n.build(),createElement({element:BcCommonConstants.LI_TAG,classList:[this.config.itemClass],children:[n.getMySelf()]})}}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(let 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 n=null;this.itemsConfigAux=this.itemsConfig,n=this.isMultiple?this.createItemTypeMultiple(this.itemsConfig[e]):(this.isFilter,this.createItemTypeSingle(this.itemsConfig[e])),this.dropdownItems.push(n),this.dropdownContent.appendChild(n)}this.setValueInputMultiple()}createItemTypeSingle(t){const e=document.createElement(BcCommonConstants.LI_TAG);if(e.classList.add(this.config.itemClass),t.icon){const n=document.createElement(BcCommonConstants.EM_TAG);n.innerText=t.icon,e.appendChild(n)}const n=document.createElement(BcCommonConstants.SPAN_TAG);return n.innerText=t.label,e.appendChild(n),e}createItemTypeMultiple(t){const e=document.createElement(BcCommonConstants.LI_TAG);e.classList.add(this.config.itemClass);const n=document.createElement(BcCommonConstants.LABEL_TAG),s=document.createElement(BcCommonConstants.INPUT_TAG),o=document.createElement(BcCommonConstants.SPAN_TAG);return n.classList.add(BcCommonConstants.CONTAINER_CHECKBOX_CLASS),o.classList.add(BcCommonConstants.CHECKBOX_CLASS),s.setAttribute("type","checkbox"),s.setAttribute("class",INPUT_SELECT_ITEM_CLASS),n.innerText=t.label,n.appendChild(s),n.appendChild(o),e.appendChild(n),e.appendChild(n),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 n in this.itemsConfig){const s=this.itemsConfig[n],o="string"==typeof s&&s===t,a="object"==typeof s&&(s.value===t||s.label===t);if(o||a)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,n){if(this.isMultiple){if(-1===["INPUT","LI"].indexOf(t.target.tagName))return void t.stopPropagation();const s=n.querySelector(BcCommonConstants.INPUT_TAG),o=e in this.activeElements;s&&this.configInputCheck(s,o,t,n,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 n=this.createActiveIcon();t.target.appendChild(n),this.activeElements[e]={item:t.target,check:n},this.closeDropdown(),this.setValueInputSingle()}this.outputFunction&&this.outputFunction(this.getCurrentActiveItems())}configInputCheck(t,e,n,s,o){if("LI"===n.target.tagName)return n.stopPropagation(),void t.click();e?(t.removeAttribute("checked"),delete this.activeElements[o]):(t.setAttribute("checked",""+e),this.activeElements[o]={item:s,check:null})}setEventListeners(){const t=t=>{t.addEventListener(BcCommonConstants.EVENT_CLICK,e=>{this.inpValue="",this.configSelectedEvent(e,this.dropdownItems.indexOf(t),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,n=null;if(t)e=t,n=this.activeElements[String(e)];else for(const t in this.activeElements)Object.prototype.hasOwnProperty.call(this.activeElements,t)&&(e=parseInt(t),n=this.activeElements[t]);let s="";if(this.config)s=this.itemsConfig[e].label;else if(n){s=n.querySelector(BcCommonConstants.SPAN_TAG).innerText}else s="";return s}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.addItemSelectArray(this.itemsConfigAux,e,this.inpValue)}else e=[],this.itemsConfig=this.itemsConfigAux,this.updateDropdown()})}addItemSelectArray(t,e,n){return t.filter((t,s)=>{t.label.toLowerCase().includes(n)&&(e.push(t),this.itemsConfig=e,e=this.removeItemSelectArray(e,n),this.updateDropdown(),this.openDrowndown())}),e}removeItemSelectArray(t,e){if(t.find((n,s)=>{if(n){n.label.toLowerCase().includes(e)||t.splice(s,1)}}),t.length>0){t.reduce((e,n,s)=>{n.label===e.label&&t.splice(s,1)})}return t}updateDropdown(){this.closeDropdown();const t=this.mySelf.querySelector(`*[id='${this.idContent}']`);for(let 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 n=null;this.isFilter&&(n=this.isMultiple?this.createItemTypeMultiple(this.itemsConfig[e]):this.createItemTypeSingle(this.itemsConfig[e])),this.dropdownItems.push(n),this.dropdownContent.appendChild(n)}this.setEventListeners()}}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`,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(`div[class='${MODAL}']`)),e=[];for(let n=0;nthis.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(BC_MODAL_CLOSE),this.modalOverlay=this.mySelf.querySelector(`div[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()}closeModal(){this.modalState=CLOSE_STATE_MODAL,this.changeState(),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)}}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 n=0;n\n \n`}addArrowButtonDefault(t,e,n){t.innerHTML=``;const s=t.getElementsByTagName("button")[0],o=document.createElement(BcCommonConstants.SPAN_TAG);"Anterior"===n&&(o.textContent=n,s.insertAdjacentElement("beforeend",o)),"Siguiente"===n&&(o.textContent=n,s.insertAdjacentElement("afterbegin",o))}pagination(t,e,n=DEFAULT_PAGE_COUNT){this.validateNumbers(t,e,n);const s=Math.ceil(Math.abs(t/n));if(s<=MAX_LENGHT){return Array.from(Array(s),(t,e)=>e+1)}let o=e/n+1;return 1===e&&(o=1),this.currentPage=o,this.pageManagement(o,s)}pageManagement(t,e){const n=new Array;for(let s=1;s<=e;s++)this.pageAdder(s,t,e,{pages:n});return n}pageAdder(t,e,n,s){return 1===t&&s.pages.push(t),1===e&&1===t?(s.pages.push(t+1),void s.pages.push("...")):(e===n&&t===n&&(s.pages.push("..."),s.pages.push(t-1)),t!==n?(this.currentPageIndexValidator(e,t,s,n),s):void s.pages.push(t))}currentPageIndexValidator(t,e,n,s){t===e&&e-1===SECOND_PAGE&&n.pages.push(e-1),t===e&&e-1>SECOND_PAGE&&(n.pages.push("..."),n.pages.push(e-1)),t===e&&n.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),n=document.createElement(BcCommonConstants.DIV_TAG),s=document.createElement(BcCommonConstants.H6_TAG),o=document.createElement(BcCommonConstants.EM_TAG),a=document.createElement(BcCommonConstants.DIV_TAG),i=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)}`),n.classList.add(MOLECULE_DROPDOWN_TOGGLE,`${BcCommonConstants.PREFIX_LIB}-${BcCommonConstants.FLEX}`,BcCommonConstants.BC_ALIGN_ITEMS_CENTER_CLASS),n.setAttribute("aria-controls",`${l.toFixed(0)}`),s.innerHTML=`${this.perPage}`,o.classList.add(BcCommonConstants.ICONS_CLASS,BcCommonConstants.ICON_XS_CLASS),o.innerHTML=BcCommonConstants.ICON_ARROW_DOWN,a.classList.add(MOLECULE_DROPDOWN_CONTENT),a.setAttribute("id",`${l.toFixed(0)}`),this.dropdownFor(e,t,i),a.appendChild(i),n.appendChild(s),n.appendChild(o),e.appendChild(n),e.appendChild(a),t.appendChild(e),this.initDropdown(e)}dropdownFor(t,e,n){for(let s=1;s<=PAGINATOR_MATH_VALUE_6;s++){const o=document.createElement(BcCommonConstants.LI_TAG),a=document.createElement(BcCommonConstants.BUTTON_TAG);o.classList.add(MOLECULE_DROPDOWN_ITEM),a.classList.add(BcCommonConstants.BC_LINK_CLASS),a.innerHTML=`${s*this.perMultiple}`,a.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.onClickPerPage(t,e,s)),o.appendChild(a),n.appendChild(o)}}onClickPerPage(t,e,n){this.perPage=n*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,n,s){const o=Math.random()*PAGINATOR_MATH_VALUE_1000/PAGINATOR_MATH_VALUE_100,a=document.createElement(BcCommonConstants.DIV_TAG),i=document.createElement(BcCommonConstants.EM_TAG),l=document.createElement(BcCommonConstants.DIV_TAG),c=document.createElement(BcCommonConstants.UL_TAG);a.classList.add(MOLECULE_DROPDOWN,MOLECULE_DROPDOWN_CUSTOM),a.setAttribute("id",`${o.toFixed(0)}`),i.classList.add(BcCommonConstants.ICONS_CLASS,BcCommonConstants.ICON_MD_CLASS,MOLECULE_DROPDOWN_TOGGLE),i.setAttribute("id",e),i.innerHTML="secondary-menu-horizontal",l.classList.add(MOLECULE_DROPDOWN_CONTENT),l.setAttribute("aria-labelledby",e);for(let e=n+1;ethis.onClickAddEllipsis(t,e)),n.appendChild(s),c.appendChild(n)}l.appendChild(c),a.appendChild(i),a.appendChild(l),t.insertAdjacentElement("beforeend",a),this.initDropdown(a)}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 n=document.createElement(BcCommonConstants.BUTTON_TAG);n.textContent=`${e}`,n.addEventListener(BcCommonConstants.EVENT_CLICK,()=>this.onClickAddButtons(t,e)),t.insertAdjacentElement("beforeend",n)}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.currentStart-=this.perPage,this.currentPage=this.currentStart/this.perPage-1,this.currentStart>=0&&(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.currentStart+=this.perPage,this.currentPage=this.currentStart/this.perPage+1,this.currentStart-this.perPage<=this.totalPages-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,n=!1;"previous"===t&&(e=!0),"next"===t&&(n=!0),this.changeState({PreviousPage:e,NextPage:n})}}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 n of t){const t=n,s=new BcSearchBehavior;s.setElement(t),s.setUp(),e.push(s)}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}`),n=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}`),n.innerHTML="arrow2-down"):(e.classList.add(`${SEARCH_ADVANCED_ACTIVE_CLASS}`),n.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}`);this.stringFilters="",this.searchObjectIterate(t,!1);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=!0}searchObjectIterate(t,e){for(const e of t)"checkbox"===e.type?e.checked&&(this.jsObjt.hasOwnProperty(e.name)?(this.jsObjt[e.name].push(e.value),this.stringFilters+=e.value+","):(this.jsObjt[e.name]=[],this.jsObjt[e.name].push(e.value),this.stringFilters+=e.value+",")):e.value&&(this.jsObjt[e.name]=e.value,e.dataset.value&&(this.jsObjt[e.dataset.value]=e.value),this.stringFilters+=e.value+","),e.value.length&&!0}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 n=!1;return Object.keys(e).every(s=>{if(Array.isArray(e[s])){for(const o of e[s])if(t[s]&&o&&(n=t[s].toUpperCase().includes(o.toUpperCase())))return n}else this.dataSearchIsNotArray(s,n,t,e)}),n}dataSearchIsNotArray(t,e,n,s){const o=this.mySelf.querySelectorAll("input[name="+t+"]");o.length&&o[0].dataset.value?n[o[0].dataset.value].toUpperCase().includes(s[t].toUpperCase())||n[t].toUpperCase().includes(s[t].toUpperCase()):n[t]&&s[t]&&n[t].toUpperCase().includes(s[t].toUpperCase())}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}`),n=this.mySelf.querySelector(`.${SEARCH_CLEAR_CLASS}`),s=this.mySelf.querySelectorAll(`.${SEARCH_RESULT_NULL_CLASS} ${BcCommonConstants.DIV_TAG}`);if(void 0===t?(e.innerHTML="",n.classList.remove(`${SEARCH_CLEAR_SHOW_CLASS}`)):t?(e.innerHTML=`Mostrando ${t} resultados para: ${this.stringFilters} \n `,n.classList.add(`${SEARCH_CLEAR_SHOW_CLASS}`)):(e.innerHTML=`Mostrando 0 resultados para: ${this.stringFilters} `,n.classList.add(`${SEARCH_CLEAR_SHOW_CLASS}`)),t||void 0===t)for(const t of s)t.classList.remove(`${SEARCH_SHOW_IMAGE_CLASS}`);else for(const t of s)t.classList.add(`${SEARCH_SHOW_IMAGE_CLASS}`)}clearSearch(){const t=document.querySelector(`.${SEARCH_CONTENT_SHOW_RESULT_CLASS}`),e=document.querySelector(`.${SEARCH_CLEAR_CLASS}`),n=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 s=this.mySelf.querySelectorAll(`${BcCommonConstants.INPUT_TAG}`);this.mySelf.querySelector(`.${SEARCH_BUTTON_CLASS} ${BcCommonConstants.BUTTON_TAG}`).disabled=!0;for(const t of s)"checkbox"===t.type?t.checked&&(t.checked=!1):t.value&&(t.value="");for(const t of n)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`,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.firsLoad=!0,this.tabScrollPosition=0}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class^='${MOLECULA}']`)),e=[];for(let n=0;n .${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 n=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 n.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 n=0;n{if(s.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(s.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(){this.tabsPane[0].classList.add(ACTIVE_CLASS),this.tabBody.querySelectorAll(`:scope > .${TAB_CONTENT_CLASS}`)[0].classList.add(ACTIVE_CLASS);for(let t=0;t{this.tabHeader.querySelectorAll(`:scope .${TAB_CONTAINER_CLASS} > .${ACTIVE_CLASS}`)[0].classList.remove(`${ACTIVE_CLASS}`),this.tabBody.querySelectorAll(`:scope > .${ACTIVE_CLASS}`)[0].classList.remove(`${ACTIVE_CLASS}`),this.tabsPane[t].classList.add(ACTIVE_CLASS),this.tabBody.querySelectorAll(`:scope > .${TAB_CONTENT_CLASS}`)[t].classList.add(ACTIVE_CLASS),this.onSelectTab&&(this.currentTabsSelected=t,this.onSelectTab(this.currentTabsSelected))})}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}`})}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 n of t){const t=new BcTooltipBehavior;t.setElement(n),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),n=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 s=this.createElementWithText("p",t||"");if(addFocusable(s),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(s),this.tooltipElement.appendChild(this.arrowElement),null!=n&&"undefined"!==n){const t=this.createElementWithText("button",n||"");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,n){const s=document.createElement(t);return s.setAttribute(e,n),s}createElementWithText(t,e){const n=document.createElement(t);return n.innerText=e,n}topTooltip(t,e,n){this.changeArrowClass(e,n,"top");const s=this.fixPosXIfElementIsOutScreen(t,n,e);this.setElementPosition(n,this.offset(t).top-n.offsetHeight-e.offsetHeight-this.margin,s.tooltip),this.setElementPosition(e,n.offsetHeight,s.arrow)}offset(t){const e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,s=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+s,left:e.left+n}}bottomTooltip(t,e,n){const s=this.fixPosXIfElementIsOutScreen(t,n,e);this.setElementPosition(n,this.offset(t).top+t.offsetHeight+e.offsetHeight+this.margin,s.tooltip),this.setElementPosition(e,-e.offsetHeight,s.arrow)}rightTooltip(t,e,n){const s=this.offset(t).left+t.offsetWidth+e.offsetWidth+this.margin,o=this.centerToTarget(t,n,e,!0);s+n.offsetWidth>=document.body.offsetWidth?this.topTooltip(t,e,n):(this.changeArrowClass(e,n,"right"),this.setElementPosition(n,o.tooltip,s),this.setElementPosition(e,o.arrow,-e.offsetWidth))}leftTooltip(t,e,n){const s=this.offset(t).left-n.offsetWidth-e.offsetWidth-this.margin,o=this.centerToTarget(t,n,e,!0);s<=0?this.topTooltip(t,e,n):(this.changeArrowClass(e,n,"left"),this.setElementPosition(n,o.tooltip,s),this.setElementPosition(e,o.arrow,n.offsetWidth))}fadeIn(t,e,n,s){if(!e)return this.setPosition(),n.style.animation="fade-in-opacity 100ms forwards";t.addEventListener(e,()=>{this.setPosition(),n.style.animation="fade-in-opacity 100ms forwards"},s)}fadeOut(t,e,n,s){if(!e)return n.style.animation="fade-out-opacity 100ms forwards";t.addEventListener(e,()=>{n.style.animation="fade-out-opacity 100ms forwards"},s)}setElementPosition(t,e,n){t.style.top=e+"px",t.style.left=n+"px"}centerToTarget(t,e,n,s){const o=s?"offsetHeight":"offsetWidth";return{tooltip:(s?this.offset(t).top:this.offset(t).left)-e[o]/BC_TOOLTIP_TWO+t[o]/BC_TOOLTIP_TWO,arrow:e[o]/BC_TOOLTIP_TWO-n[o]/BC_TOOLTIP_TWO}}changeArrowClass(t,e,n){e.removeChild(t),t.classList.remove(t.classList.item(1)),t.classList.add(t.classList.item(0)+"--"+n),e.appendChild(t)}fixPosXIfElementIsOutScreen(t,e,n){const s=this.centerToTarget(t,e,n,!1);return s.tooltip+e.offsetWidth>=document.body.offsetWidth?(s.tooltip=this.offset(t).left+t.offsetWidth-e.offsetWidth,s.arrow=e.offsetWidth-n.offsetWidth-t.offsetWidth/BC_TOOLTIP_TWO):s.tooltip<=0&&(s.tooltip=this.offset(t).left,s.arrow=t.offsetWidth/BC_TOOLTIP_TWO),s}}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,FOOTER_HTML='\n\n
\n \n
\n\n\n';class BcFooterBehavior extends BcDefaultBehavior{constructor(){super(),this.bcFooterIsMobile=!1}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class~='${BC_FOOTER_SELECTOR}']`)),e=[];for(let n=0;n{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 n=t.querySelector(`.${BC_FOOTER_TOP_CONTAINER_T} h6`),s=Array.from(t.querySelectorAll(`.${BC_FOOTER_TOP_CONTAINER_P} p`)),o=this.createAccordionGroupELement(e),a=this.createAccordionELement(),i=this.createAccordionHeaderELement(n,s.length),l=this.createAccordionContentELement(s);a.appendChild(i),a.appendChild(l),o.appendChild(a),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 n=document.createElement("div");n.classList.add(BC_FOOTER_ACCORDION_HEADER);const s=`\n \n ${e>0?`\n `:""}\n `;return n.innerHTML=s,n.querySelector(`.${BC_FOOTER_ACCORDION_TEXT_CONTAINER}`).append(t.cloneNode(!0)),n}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_DROPDOWN_CUSTOM=`${BcCommonConstants.PREFIX_LIB}-dropdown-custom`,BC_HEADER_BRAND=`${BcCommonConstants.PREFIX_LIB}-header-brand`,BC_HEADER_BRAND_TOGGLE=`${BC_HEADER_BRAND}_menu-toggle`,BC_HADER_CUSTOM_EVENT="headerCompanyChanged",BC_HEADER_LOGOUT_BUTTON_CLASS=`${BcCommonConstants.PREFIX_LIB}-header-nav-item_logout`,BC_HEADER_NOT_LOGOUT_CLASS=`${BcCommonConstants.PREFIX_LIB}-header-not-logout`;class BcHeaderBehavior extends BcDefaultBehavior{constructor(){super(),this.dropdowns=[],this.dropdownsContents=[],this.dropdownActive=null,this.comunicationWithMenu=!0}static setUpAll(){const t=Array.from(document.querySelectorAll(`div[class^='${BC_HEADER_CLASS}']`)),e=[];for(let n=0;n{this.removeLogoutBtn()}),this.initDropdowns(),this.getDropdownContents(),this.addEventForOption(),this.comunicationWithMenu&&this.addEvents()}getDropdownContents(){this.dropdownsContents=this.mySelf.querySelectorAll(`*[class~="${BC_HEADER_DROPDOWN_CONTENT}"]`)}toogleSidebarMenu(){const t=new CustomEvent(BcCommonConstants.EVENT_HEADER_TOGGLE_MENU);window.dispatchEvent(t)}addMenuButtonEvent(){this.mySelf.querySelector(`.${BC_HEADER_BRAND}`).querySelector(`.${BC_HEADER_BRAND_TOGGLE}`).addEventListener(BcCommonConstants.EVENT_CLICK,()=>{this.toogleSidebarMenu()})}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.dropArea.addEventListener(t,this.preventDefaults,!1)}),this.dropArea.addEventListener(DROP_EVENT,t=>this.handleDrop(t),!1),this.dropArea.addEventListener(CLICK_EVENT,t=>this.inputFile.click(),!1),this.addFocus(),this.inputFile.addEventListener(CHANGE_EVENT,t=>{this.handleFiles(this.inputFile.files),this.inputFile.value=null})}addFocus(){addFocusable(this.dropArea,{label:"Adjuntar archivos"},{event:()=>{this.inputFile.click()}}),addFocusable(this.labelButton,{label:"Adjuntar archivos"},{event:()=>{this.inputFile.click()}})}preventDefaults(t){t.preventDefault(),t.stopPropagation()}handleDrop(t){const e=t.dataTransfer.files;this.handleFiles(e)}handleFiles(t){let e=this.inputFile.getAttribute(ATTR_VALID_TYPE)?this.inputFile.getAttribute(ATTR_VALID_TYPE):"[]",n=[];try{const t=/'/gm;e=e.replace(t,'"'),n=JSON.parse(e)}catch(t){n=[]}this.iterateFiles(t,n)}iterateFiles(t,e){for(let n=0;nthis.maxSize){throw new BcInputFileValidationError("Se ha superado el límite de tamaño de ficheros")}if(this.overFileLimit()){const t=new BcInputFileValidationError("Este selector no permite más de un archivo");throw this.inputFile.value=null,t}if(!this.validateType(e,t[n])){const t=new BcInputFileValidationError("Tipo de archivo ínvalido");throw this.inputFile.value=null,t}this.appendFileMolecule(t[n])}this.changeState&&this.changeState(this.filesAdded)}appendFileMolecule(t){this.isRepeatedFile(t)||(this.filesAdded.push(t),this.filesAdded.length<=FILES_FIVE&&this.createFileInDom(t,this.uploadedFilesMainContainer),this.filesAdded.length===FILES_SIX&&(this.seeMoreButton=this.getSeeMoreButton(),this.mySelf.appendChild(this.seeMoreButton)),this.filesAdded.length>=FILES_SIX&&(this.createFileInDom(t,this.uploadedFilesSeeMoreContainer),this.seeMoreButton.textContent=`${SEE_MORE_MESSAGE} (${this.uploadedFilesSeeMoreContainer.childNodes.length})`))}isRepeatedFile(t){let e=!1;for(let n=0;n