1 2; /* Start:"a:4:{s:4:"full";s:53:"/local/templates/calendario/js/app.js?176665359390465";s:6:"source";s:37:"/local/templates/calendario/js/app.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3(() => { 4 "use strict"; 5 const modules_flsModules = {}; 6 function isWebp() { 7 function testWebP(callback) { 8 let webP = new Image; 9 webP.onload = webP.onerror = function() { 10 callback(webP.height == 2); 11 }; 12 webP.src = "data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA"; 13 } 14 testWebP((function(support) { 15 let className = support === true ? "webp" : "no-webp"; 16 document.documentElement.classList.add(className); 17 })); 18 } 19 let _slideUp = (target, duration = 500, showmore = 0) => { 20 if (!target.classList.contains("_slide")) { 21 target.classList.add("_slide"); 22 target.style.transitionProperty = "height, margin, padding"; 23 target.style.transitionDuration = duration + "ms"; 24 target.style.height = `${target.offsetHeight}px`; 25 target.offsetHeight; 26 target.style.overflow = "hidden"; 27 target.style.height = showmore ? `${showmore}px` : `0px`; 28 target.style.paddingTop = 0; 29 target.style.paddingBottom = 0; 30 target.style.marginTop = 0; 31 target.style.marginBottom = 0; 32 window.setTimeout((() => { 33 target.hidden = !showmore ? true : false; 34 !showmore ? target.style.removeProperty("height") : null; 35 target.style.removeProperty("padding-top"); 36 target.style.removeProperty("padding-bottom"); 37 target.style.removeProperty("margin-top"); 38 target.style.removeProperty("margin-bottom"); 39 !showmore ? target.style.removeProperty("overflow") : null; 40 target.style.removeProperty("transition-duration"); 41 target.style.removeProperty("transition-property"); 42 target.classList.remove("_slide"); 43 document.dispatchEvent(new CustomEvent("slideUpDone", { 44 detail: { 45 target 46 } 47 })); 48 }), duration); 49 } 50 }; 51 let _slideDown = (target, duration = 500, showmore = 0) => { 52 if (!target.classList.contains("_slide")) { 53 target.classList.add("_slide"); 54 target.hidden = target.hidden ? false : null; 55 showmore ? target.style.removeProperty("height") : null; 56 let height = target.offsetHeight; 57 target.style.overflow = "hidden"; 58 target.style.height = showmore ? `${showmore}px` : `0px`; 59 target.style.paddingTop = 0; 60 target.style.paddingBottom = 0; 61 target.style.marginTop = 0; 62 target.style.marginBottom = 0; 63 target.offsetHeight; 64 target.style.transitionProperty = "height, margin, padding"; 65 target.style.transitionDuration = duration + "ms"; 66 target.style.height = height + "px"; 67 target.style.removeProperty("padding-top"); 68 target.style.removeProperty("padding-bottom"); 69 target.style.removeProperty("margin-top"); 70 target.style.removeProperty("margin-bottom"); 71 window.setTimeout((() => { 72 target.style.removeProperty("height"); 73 target.style.removeProperty("overflow"); 74 target.style.removeProperty("transition-duration"); 75 target.style.removeProperty("transition-property"); 76 target.classList.remove("_slide"); 77 document.dispatchEvent(new CustomEvent("slideDownDone", { 78 detail: { 79 target 80 } 81 })); 82 }), duration); 83 } 84 }; 85 let _slideToggle = (target, duration = 500) => { 86 if (target.hidden) return _slideDown(target, duration); else return _slideUp(target, duration); 87 }; 88 function functions_FLS(message) { 89 setTimeout((() => { 90 if (window.FLS) console.log(message); 91 }), 0); 92 } 93 let formValidate = { 94 getErrors(form) { 95 let error = 0; 96 let formRequiredItems = form.querySelectorAll("*[data-required]"); 97 if (formRequiredItems.length) formRequiredItems.forEac
97h((formRequiredItem => { 98 if ((formRequiredItem.offsetParent !== null || formRequiredItem.tagName === "SELECT") && !formRequiredItem.disabled) error += this.validateInput(formRequiredItem); 99 })); 100 return error; 101 }, 102 validateInput(formRequiredItem) { 103 let error = 0; 104 if (formRequiredItem.dataset.required === "email") { 105 formRequiredItem.value = formRequiredItem.value.replace(" ", ""); 106 if (this.emailTest(formRequiredItem)) { 107 this.addError(formRequiredItem); 108 error++; 109 } else this.removeError(formRequiredItem); 110 } else if (formRequiredItem.type === "checkbox" && !formRequiredItem.checked) { 111 this.addError(formRequiredItem); 112 error++; 113 } else if (!formRequiredItem.value) { 114 this.addError(formRequiredItem); 115 error++; 116 } else this.removeError(formRequiredItem); 117 return error; 118 }, 119 addError(formRequiredItem) { 120 formRequiredItem.classList.add("_form-error"); 121 formRequiredItem.parentElement.classList.add("_form-error"); 122 let inputError = formRequiredItem.parentElement.querySelector(".form__error"); 123 if (inputError) formRequiredItem.parentElement.removeChild(inputError); 124 if (formRequiredItem.dataset.error) formRequiredItem.parentElement.insertAdjacentHTML("beforeend", `<div class="form__error">${formRequiredItem.dataset.error}</div>`); 125 }, 126 removeError(formRequiredItem) { 127 formRequiredItem.classList.remove("_form-error"); 128 formRequiredItem.parentElement.classList.remove("_form-error"); 129 if (formRequiredItem.parentElement.querySelector(".form__error")) formRequiredItem.parentElement.removeChild(formRequiredItem.parentElement.querySelector(".form__error")); 130 }, 131 formClean(form) { 132 form.reset(); 133 setTimeout((() => { 134 let inputs = form.querySelectorAll("input,textarea"); 135 for (let index = 0; index < inputs.length; index++) { 136 const el = inputs[index]; 137 el.parentElement.classList.remove("_form-focus"); 138 el.classList.remove("_form-focus"); 139 formValidate.removeError(el); 140 } 141 let checkboxes = form.querySelectorAll(".checkbox__input"); 142 if (checkboxes.length > 0) for (let index = 0; index < checkboxes.length; index++) { 143 const checkbox = checkboxes[index]; 144 checkbox.checked = false; 145 } 146 if (modules_flsModules.select) { 147 let selects = form.querySelectorAll(".select"); 148 if (selects.length) for (let index = 0; index < selects.length; index++) { 149 const select = selects[index].querySelector("select"); 150 modules_flsModules.select.selectBuild(select); 151 } 152 } 153 }), 0); 154 }, 155 emailTest(formRequiredItem) { 156 return !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,8})+$/.test(formRequiredItem.value); 157 } 158 }; 159 class SelectConstructor { 160 constructor(props, data = null) { 161 let defaultConfig = { 162 init: true, 163 logging: true 164 }; 165 this.config = Object.assign(defaultConfig, props); 166 this.selectClasses = { 167 classSelect: "select", 168 classSelectBody: "select__body", 169 classSelectTitle: "select__title", 170 classSelectValue: "select__value", 171 classSelectLabel: "select__label", 172 classSelectInput: "select__input", 173 classSelectText: "select__text", 174 classSelectLink: "select__link", 175 classSelectOptions: "select__options", 176 classSelectOptionsScroll: "select__scroll", 177 classSelectOption: "select__option", 178 classSelectContent: "select__content", 179 classSelectRow: "select__row", 180 classSelectData: "select__asset", 181 classSelectDisabled: "_select-disabled", 182 classSelectTag: "_select-tag", 183 classSelectOpen: "_select-open", 184 classSelectActive: "_select-active", 185 classSelectFocus: "_select-focus", 186 classSelectMultiple: "_select-multiple", 187 classSelectCheckBox: "_select-checkbox", 188 classSelectOptionSelected: "_select-selected", 189 classSelectPseudoLabel: "_select-pseudo-label" 190 }; 191 this._this = this; 192 if (this.config.init) { 193 const selectItems = data ? document.querySelectorAll(data) : document.querySelectorAll("select"); 194 if (selectItems.length) this.selectsInit(selectItems); 195 } 196 } 197 getSelectClass(className) { 198 return `.${className}`; 199 } 200 getSelectElement(selectItem, className) { 201 return { 202 originalSelect: selectItem.querySelector("select"), 203 selectElement: selectItem.querySelector(this.getSelectClass(className)) 204 }; 205 } 206 selectsInit(selectItems) {
207 selectItems.forEach(((originalSelect, index) => { 208 this.selectInit(originalSelect, index + 1); 209 })); 210 document.addEventListener("click", function(e) { 211 this.selectsActions(e); 212 }.bind(this)); 213 document.addEventListener("keydown", function(e) { 214 this.selectsActions(e); 215 }.bind(this)); 216 document.addEventListener("focusin", function(e) { 217 this.selectsActions(e); 218 }.bind(this)); 219 document.addEventListener("focusout", function(e) { 220 this.selectsActions(e); 221 }.bind(this)); 222 } 223 selectInit(originalSelect, index) { 224 const _this = this; 225 let selectItem = document.createElement("div"); 226 selectItem.classList.add(this.selectClasses.classSelect); 227 originalSelect.parentNode.insertBefore(selectItem, originalSelect); 228 selectItem.appendChild(originalSelect); 229 originalSelect.hidden = true; 230 index ? originalSelect.dataset.id = index : null; 231 if (this.getSelectPlaceholder(originalSelect)) { 232 originalSelect.dataset.placeholder = this.getSelectPlaceholder(originalSelect).value; 233 if (this.getSelectPlaceholder(originalSelect).label.show) { 234 const selectItemTitle = this.getSelectElement(selectItem, this.selectClasses.classSelectTitle).selectElement; 235 selectItemTitle.insertAdjacentHTML("afterbegin", `<span class="${this.selectClasses.classSelectLabel}">${this.getSelectPlaceholder(originalSelect).label.text ? this.get
235SelectPlaceholder(originalSelect).label.text : this.getSelectPlaceholder(originalSelect).value}</span>`); 236 } 237 } 238 selectItem.insertAdjacentHTML("beforeend", `<div class="${this.selectClasses.classSelectBody}"><div hidden class="${this.selectClasses.classSelectOptions}"></div></div>`); 239 this.selectBuild(originalSelect); 240 originalSelect.dataset.speed = originalSelect.dataset.speed ? originalSelect.dataset.speed : "150"; 241 originalSelect.addEventListener("change", (function(e) { 242 _this.selectChange(e); 243 })); 244 } 245 selectBuild(originalSelect) { 246 const selectItem = originalSelect.parentElement; 247 selectItem.dataset.id = originalSelect.dataset.id; 248 selectItem.classList.add(originalSelect.getAttribute("class") ? `select_${originalSelect.getAttribute("class")}` : ""); 249 originalSelect.multiple ? selectItem.classList.add(this.selectClasses.classSelectMultiple) : selectItem.classList.remove(this.selectClasses.classSelectMultiple); 250 originalSelect.hasAttribute("data-checkbox") && originalSelect.multiple ? selectItem.classList.add(this.selectClasses.classSelectCheckBox) : selectItem.classList.remove(this.selectClasses.classSelectCheckBox); 251 this.setSelectTitleValue(selectItem, originalSelect); 252 this.setOptions(selectItem, originalSelect); 253 originalSelect.hasAttribute("data-search") ? this.searchActions(selectItem) : null; 254 originalSelect.hasAttribute("data-open") ? this.selectAction(selectItem) : null; 255 this.selectDisabled(selectItem, originalSelect); 256 } 257 selectsActions(e) { 258 const targetElement = e.target; 259 const targetType = e.type; 260 if (targetElement.closest(this.getSelectClass(this.selectClasses.classSelect)) || targetElement.closest(this.getSelectClass(this.selectClasses.classSelectTag))) { 261 const selectItem = targetElement.closest(".select") ? targetElement.closest(".select") : document.querySelector(`.${this.selectClasses.classSelect}[data-id="${targetElement.closest(this.getSelectClass(this.selectClasses.classSelectTag)).dataset.selectId}"]`); 262 const originalSelect = this.getSelectElement(selectItem).originalSelect; 263 if (targetType === "click") { 264 if (!originalSelect.disabled) if (targetElement.closest(this.getSelectClass(this.selectClasses.classSelectTag))) { 265 const targetTag = targetElement.closest(this.getSelectClass(this.selectClasses.classSelectTag)); 266 const optionItem = document.querySelector(`.${this.selectClasses.classSelect}[data-id="${targetTag.dataset.selectId}"] .select__option[data-value="${targetTag.dataset.value}"]`); 267 this.optionAction(selectItem, originalSelect, optionItem); 268 } else if (targetElement.closest(this.getSelectClass(this.selectClasses.classSelectTitle))) this.selectAction(selectItem); else if (targetElement.closest(this.getSelectClass(this.selectClasses.classSelectOption))) { 269 const optionItem = targetElement.closest(this.getSelectClass(this.selectClasses.classSelectOption)); 270 this.optionAction(selectItem, originalSelect, optionItem); 271 } 272 } else if (targetType === "focusin" || targetType === "focusout") { 273 if (targetElement.closest(this.getSelectClass(this.selectClasses.classSelect))) targetType === "focusin" ? selectItem.classList.add(this.selectClasses.classSelectFocus) : selectItem.classList.remove(this.selectClasses.classSelectFocus); 274 } else if (targetType === "keydown" && e.code === "Escape") this.selectsСlose(); 275 } else this.selectsСlose(); 276 } 277 selectsСlose(selectOneGroup) { 278 const selectsGroup = selectOneGroup ? selectOneGroup : document; 279 const selectActiveItems = selectsGroup.querySelectorAll(`${this.get
279SelectClass(this.selectClasses.classSelect)}${this.getSelectClass(this.selectClasses.classSelectOpen)}`); 280 if (selectActiveItems.length) selectActiveItems.forEach((selectActiveItem => { 281 this.selectСlose(selectActiveItem); 282 })); 283 } 284 selectСlose(selectItem) { 285 const originalSelect = this.getSelectElement(selectItem).originalSelect; 286 const selectOptions = this.getSelectElement(selectItem, this.selectClasses.classSelectOptions).selectElement; 287 if (!selectOptions.classList.contains("_slide")) { 288 selectItem.classList.remove(this.selectClasses.classSelectOpen); 289 _slideUp(selectOptions, originalSelect.dataset.speed); 290 } 291 } 292 selectAction(selectItem) { 293 const originalSelect = this.getSelectElement(selectItem).originalSelect; 294 const selectOptions = this.getSelectElement(selectItem, this.selectClasses.classSelectOptions).selectElement; 295 if (originalSelect.closest("[data-one-select]")) { 296 const selectOneGroup = originalSelect.closest("[data-one-select]"); 297 this.selectsСlose(selectOneGroup); 298 } 299 if (!selectOptions.classList.contains("_slide")) { 300 selectItem.classList.toggle(this.selectClasses.classSelectOpen); 301 _slideToggle(selectOptions, originalSelect.dataset.speed); 302 } 303 } 304 setSelectTitleValue(selectItem, originalSelect) { 305 const selectItemBody = this.getSelectElement(selectItem, this.selectClasses.classSelectBody).selectElement; 306 const selectItemTitle = this.getSelectElement(selectItem, this.selectClasses.classSelectTitle).selectElement; 307 if (selectItemTitle) selectItemTitle.remove(); 308 selectItemBody.insertAdjacentHTML("afterbegin", this.getSelectTitleValue(selectItem, originalSelect)); 309 } 310 getSelectTitleValue(selectItem, originalSelect) { 311 let selectTitleValue = this.getSelectedOptionsData(originalSelect, 2).html; 312 if (originalSelect.multiple && originalSelect.hasAttribute("data-tags")) { 313 selectTitleValue = this.getSelectedOptionsData(originalSelect).elements.map((option => `<span role="button" data-select-id="${selectItem.dataset.id}" data-value="${option.value}" class="_select-tag">${this.getSelectElementContent(option)}</span>`)).join(""); 314 if (originalSelect.dataset.tags && document.querySelector(originalSelect.dataset.tags)) { 315 document.querySelector(originalSelect.dataset.tags).innerHTML = selectTitleValue; 316 if (originalSelect.hasAttribute("data-search")) selectTitleValue = false; 317 } 318 } 319 selectTitleValue = selectTitleValue.length ? selectTitleValue : originalSelect.dataset.placeholder ? originalSelect.dataset.placeholder : ""; 320 let pseudoAttribute = ""; 321 let pseudoAttributeClass = ""; 322 if (originalSelect.hasAttribute("data-pseudo-label")) { 323 pseudoAttribute = originalSelect.dataset.pseudoLabel ? ` data-pseudo-label="${originalSelect.dataset.pseudoLabel}"` : ` data-pseudo-label="ÐаполниÑе аÑÑибÑÑ"`; 324 pseudoAttributeClass = ` ${this.selectClasses.classSelectPseudoLabel}`; 325 }
326 this.getSelectedOptionsData(originalSelect).values.length ? selectItem.classList.add(this.selectClasses.classSelectActive) : selectItem.classList.remove(this.selectClasses.classSelectActive); 327 if (originalSelect.hasAttribute("data-search")) return `<div class="${this.selectClasses.classSelectTitle}"><span${pseudoAttribute} class="${this.selectClasses.classSelectValue}"><input autocomplete="off" type="text" placeholder="${selectTitleValue}" data-placeholder="${selectTitleValue}" class="${this.selectClasses.classSelectInput}"></span></div>`; else { 328 const customClass = this.getSelectedOptionsData(originalSelect).elements.length && this.getSelectedOptionsData(originalSelect).elements[0].dataset.class ? ` ${this.getSelectedOptionsData(originalSelect).elements[0].dataset.class}` : ""; 329 return `<button type="button" class="${this.selectClasses.classSelectTitle}"><span${pseudoAttribute} class="${this.selectClasses.classSelectValue}${pseudoAttributeClass}"><span class="${this.selectClasses.classSelectContent}${customClass}">${selectTitleValue}</span></span></button>`; 330 } 331 } 332 getSelectElementContent(selectOption) { 333 const selectOptionData = selectOption.dataset.asset ? `${selectOption.dataset.asset}` : ""; 334 const selectOptionDataHTML = (selectOptionData.indexOf("img") >= 0 || selectOptionData.indexOf("upload") >= 0) ? `<img src="${selectOptionData}" alt="">` : selectOptionData; 335 let selectOptionContentHTML = ``; 336 selectOptionContentHTML += selectOptionData ? `<span class="${this.selectClasses.classSelectRow}">` : ""; 337 selectOptionContentHTML += selectOptionData ? `<span class="${this.selectClasses.classSelectData}">` : ""; 338 selectOptionContentHTML += selectOptionData ? selectOptionDataHTML : ""; 339 selectOptionContentHTML += selectOptionData ? `</span>` : ""; 340 selectOptionContentHTML += selectOptionData ? `<span class="${this.selectClasses.classSelectText}">` : ""; 341 selectOptionContentHTML += selectOption.textContent; 342 selectOptionContentHTML += selectOptionData ? `</span>` : ""; 343 selectOptionContentHTML += selectOptionData ? `</span>` : ""; 344 return selectOptionContentHTML; 345 } 346 getSelectPlaceholder(originalSelect) { 347 const selectPlaceholder = Array.from(originalSelect.options).find((option => !option.value)); 348 if (selectPlaceholder) return { 349 value: selectPlaceholder.textContent, 350 show: selectPlaceholder.hasAttribute("data-show"), 351 label: { 352 show: selectPlaceholder.hasAttribute("data-label"), 353 text: selectPlaceholder.dataset.label 354 } 355 }; 356 } 357 getSelectedOptionsData(originalSelect, type) { 358 let selectedOptions = []; 359 if (originalSelect.multiple) selectedOptions = Array.from(originalSelect.options).filter((option => option.value)).filter((option => option.selected)); else selectedOptions.push(originalSelect.options[originalSelect.selectedIndex]); 360 return { 361 elements: selectedOptions.map((option => option)), 362 values: selectedOptions.filter((option => option.value)).map((option => option.value)), 363 html: selectedOptions.map((option => this.getSelectElementContent(option))) 364 }; 365 } 366 getOptions(originalSelect) { 367 let selectOptionsScroll = originalSelect.hasAttribute("data-scroll") ? `data-simplebar` : ""; 368 let selectOptionsScrollHeight = originalSelect.dataset.scroll ? `style="max-height:${originalSelect.dataset.scroll}px"` : ""; 369 let selectOptions = Array.from(originalSelect.options); 370 if (selectOptions.length > 0) { 371 let selectOptionsHTML = ``; 372 if (this.getSelectPlaceholder(originalSelect) && !this.getSelectPlaceholder(originalSelect).show || originalSelect.multiple) selectOptions = selectOptions.filter((option => option.value)); 373 selectOptionsHTML += selectOptionsScroll ? `<div ${selectOptionsScroll} ${selectOptionsScrollHeight} class="${this.selectClasses.classSelectOptionsScroll}">` : ""; 374 selectOptions.forEach((selectOption => { 375 selectOptionsHTML += this.getOption(selectOption, originalSelect); 376 })); 377 selectOptionsHTML += selectOptionsScroll ? `</div>` : ""; 378 return selectOptionsHTML; 379 } 380 } 381 getOption(selectOption, originalSelect) { 382 const selectOptionSelected = selectOption.selected && originalSelect.multiple ? ` ${this.selectClasses.classSelectOptionSelected}` : ""; 383 const selectOptionHide = selectOption.selected && !originalSelect.hasAttribute("data-show-selected") && !originalSelect.multiple ? `hidden` : ``; 384 const selectOptionClass = selectOption.dataset.class ? ` ${selectOption.dataset.class}` : ""; 385 const selectOptionLink = selectOption.dataset.href ? selectOption.dataset.href : false;
386 const selectOptionLinkTarget = selectOption.hasAttribute("data-href-blank") ? `target="_blank"` : ""; 387 let selectOptionHTML = ``; 388 selectOptionHTML += selectOptionLink ? `<a ${selectOptionLinkTarget} ${selectOptionHide} href="${selectOptionLink}" data-value="${selectOption.value}" class="${this.selectClasses.classSelectOption}${selectOptionClass}${selectOptionSelected}">` : `<button ${selectOptionHide} class="${this.selectClasses.classSelectOption}${selectOptionClass}${selectOptionSelected}" data-value="${selectOption.value}" type="button">`; 389 selectOptionHTML += this.getSelectElementContent(selectOption); 390 selectOptionHTML += selectOptionLink ? `</a>` : `</button>`; 391 return selectOptionHTML; 392 } 393 setOptions(selectItem, originalSelect) { 394 const selectItemOptions = this.getSelectElement(selectItem, this.selectClasses.classSelectOptions).selectElement; 395 selectItemOptions.innerHTML = this.getOptions(originalSelect); 396 } 397 optionAction(selectItem, originalSelect, optionItem) { 398 if (originalSelect.multiple) { 399 optionItem.classList.toggle(this.selectClasses.classSelectOptionSelected); 400 const originalSelectSelectedItems = this.getSelectedOptionsData(originalSelect).elements; 401 originalSelectSelectedItems.forEach((originalSelectSelectedItem => { 402 originalSelectSelectedItem.removeAttribute("selected"); 403 })); 404 const selectSelectedItems = selectItem.querySelectorAll(this.getSelectClass(this.selectClasses.classSelectOptionSelected)); 405 selectSelectedItems.forEach((selectSelectedItems => { 406 originalSelect.querySelector(`option[value="${selectSelectedItems.dataset.value}"]`).setAttribute("selected", "selected"); 407 })); 408 } else { 409 if (!originalSelect.hasAttribute("data-show-selected")) {
410 if (selectItem.querySelector(`${this.getSelectClass(this.selectClasses.classSelectOption)}[hidden]`)) selectItem.querySelector(`${this.getSelectClass(this.selectClasses.classSelectOption)}[hidden]`).hidden = false; 411 optionItem.hidden = true; 412 } 413 originalSelect.value = optionItem.hasAttribute("data-value") ? optionItem.dataset.value : optionItem.textContent; 414 this.selectAction(selectItem); 415 } 416 this.setSelectTitleValue(selectItem, originalSelect); 417 this.setSelectChange(originalSelect); 418 } 419 selectChange(e) { 420 const originalSelect = e.target; 421 this.selectBuild(originalSelect); 422 this.setSelectChange(originalSelect); 423 } 424 setSelectChange(originalSelect) { 425 if (originalSelect.hasAttribute("data-validate")) formValidate.validateInput(originalSelect); 426 if (originalSelect.hasAttribute("data-submit") && originalSelect.value) { 427 let tempButton = document.createElement("button"); 428 tempButton.type = "submit"; 429 originalSelect.closest("form").append(tempButton); 430 tempButton.click(); 431 tempButton.remove(); 432 } 433 const selectItem = originalSelect.parentElement; 434 this.selectCallback(selectItem, originalSelect); 435 } 436 selectDisabled(selectItem, originalSelect) { 437 if (originalSelect.disabled) { 438 selectItem.classList.add(this.selectClasses.classSelectDisabled);
439 this.getSelectElement(selectItem, this.selectClasses.classSelectTitle).selectElement.disabled = true; 440 } else { 441 selectItem.classList.remove(this.selectClasses.classSelectDisabled); 442 this.getSelectElement(selectItem, this.selectClasses.classSelectTitle).selectElement.disabled = false; 443 } 444 } 445 searchActions(selectItem) { 446 this.getSelectElement(selectItem).originalSelect; 447 const selectInput = this.getSelectElement(selectItem, this.selectClasses.classSelectInput).selectElement; 448 const selectOptions = this.getSelectElement(selectItem, this.selectClasses.classSelectOptions).selectElement; 449 const selectOptionsItems = selectOptions.querySelectorAll(`.${this.selectClasses.classSelectOption}`); 450 const _this = this; 451 selectInput.addEventListener("input", (function() { 452 selectOptionsItems.forEach((selectOptionsItem => { 453 if (selectOptionsItem.textContent.toUpperCase().indexOf(selectInput.value.toUpperCase()) >= 0) selectOptionsItem.hidden = false; else selectOptionsItem.hidden = true; 454 })); 455 selectOptions.hidden === true ? _this.selectAction(selectItem) : null; 456 })); 457 } 458 selectCallback(selectItem, originalSelect) { 459 document.dispatchEvent(new CustomEvent("selectCallback", { 460 detail: { 461 select: originalSelect 462 } 463 })); 464 } 465 setLogging(message) { 466 this.config.logging ? functions_FLS(`[select]: ${message}`) : null; 467 } 468 reinitialize(data = null) { 469 const selectItems = data ? document.querySelectorAll(data) : document.querySelectorAll("select"); 470 if (selectItems.length) { 471 this.selectsInit(selectItems); 472 this.setLogging(`ÐеÑеиниÑиализиÑовано ÑелекÑов: (${selectItems.length})`); 473 } else this.setLogging("ÐÐµÑ Ð½Ð¸ одного select Ð´Ð»Ñ Ð¿ÐµÑеиниÑиализаÑии"); 474 } 475 } 476 function initSelects(selector) { 477 new SelectConstructor({ 478 init: true 479 }, selector); 480 } 481 document.addEventListener('DOMContentLoaded', function () { 482 window.SelectConstructor = SelectConstructor; 483 window.initSelects = initSelects; 484 modules_flsModules.select = new SelectConstructor({}); 485 }); 486 function isObject(value) { 487 var type = typeof value; 488 return value != null && (type == "object" || type == "function"); 489 } 490 const lodash_es_isObject = isObject; 491 var freeGlobal = typeof global == "object" && global && global.Object === Object && global; 492 const _freeGlobal = freeGlobal; 493 var freeSelf = typeof self == "object" && self && self.Object === Object && self; 494 var root = _freeGlobal || freeSelf || Function("return this")(); 495 const _root = root; 496 var now = function() { 497 return _root.Date.now(); 498 }; 499 const lodash_es_now = now; 500 var reWhitespace = /\s/; 501 function trimmedEndIndex(string) { 502 var index = string.length; 503 while (index-- && reWhitespace.test(string.charAt(index))) ; 504 return index; 505 } 506 const _trimmedEndIndex = trimmedEndIndex; 507 var reTrimStart = /^\s+/; 508 function baseTrim(string) { 509 return string ? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string; 510 } 511 const _baseTrim = baseTrim; 512 var Symbol = _root.Symbol; 513 const _Symbol = Symbol; 514 var objectProto = Object.prototype; 515 var _getRawTag_hasOwnProperty = objectProto.hasOwnProperty; 516 var nativeObjectToString = objectProto.toString; 517 var symToStringTag = _Symbol ? _Symbol.toStringTag : void 0; 518 function getRawTag(value) { 519 var isOwn = _getRawTag_hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; 520 try { 521 value[symToStringTag] = void 0; 522 var unmasked = true; 523 } catch (e) {} 524 var result = nativeObjectToString.call(value); 525 if (unmasked) if (isOwn) value[symToStringTag] = tag; else delete value[symToStringTag]; 526 return result; 527 } 528 const _getRawTag = getRawTag; 529 var _objectToString_objectProto = Object.prototype; 530 var _objectToString_nativeObjectToString = _objectToString_objectProto.toString; 531 function objectToString(value) { 532 return _objectToString_nativeObjectToString.call(value); 533 } 534 const _objectToString = objectToString; 535 var nullTag = "[object Null]", undefinedTag = "[object Undef
535ined]"; 536 var _baseGetTag_symToStringTag = _Symbol ? _Symbol.toStringTag : void 0; 537 function baseGetTag(value) { 538 if (value == null) return value === void 0 ? undefinedTag : nullTag; 539 return _baseGetTag_symToStringTag && _baseGetTag_symToStringTag in Object(value) ? _getRawTag(value) : _objectToString(value); 540 } 541 const _baseGetTag = baseGetTag; 542 function isObjectLike(value) { 543 return value != null && typeof value == "object"; 544 } 545 const lodash_es_isObjectLike = isObjectLike; 546 var symbolTag = "[object Symbol]"; 547 function isSymbol(value) { 548 return typeof value == "symbol" || lodash_es_isObjectLike(value) && _baseGetTag(value) == symbolTag; 549 } 550 const lodash_es_isSymbol = isSymbol; 551 var NAN = 0 / 0; 552 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 553 var reIsBinary = /^0b[01]+$/i; 554 var reIsOctal = /^0o[0-7]+$/i; 555 var freeParseInt = parseInt; 556 function toNumber(value) { 557 if (typeof value == "number") return value; 558 if (lodash_es_isSymbol(value)) return NAN; 559 if (lodash_es_isObject(value)) { 560 var other = typeof value.valueOf == "function" ? value.valueOf() : value; 561 value = lodash_es_isObject(other) ? other + "" : other; 562 } 563 if (typeof value != "string") return value === 0 ? value : +value; 564 value = _baseTrim(value); 565 var isBinary = reIsBinary.test(value); 566 return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; 567 } 568 const lodash_es_toNumber = toNumber; 569 var FUNC_ERROR_TEXT = "Expected a function"; 570 var nativeMax = Math.max, nativeMin = Math.min; 571 function debounce(func, wait, options) { 572 var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; 573 if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT); 574 wait = lodash_es_toNumber(wait) || 0; 575 if (lodash_es_isObject(options)) { 576 leading = !!options.leading; 577 maxing = "maxWait" in options; 578 maxWait = maxing ? nativeMax(lodash_es_toNumber(options.maxWait) || 0, wait) : maxWait; 579 trailing = "trailing" in options ? !!options.trailing : trailing; 580 } 581 function invokeFunc(time) { 582 var args = lastArgs, thisArg = lastThis; 583 lastArgs = lastThis = void 0; 584 lastInvokeTime = time; 585 result = func.apply(thisArg, args); 586 return result; 587 } 588 function leadingEdge(time) { 589 lastInvokeTime = time; 590 timerId = setTimeout(timerExpired, wait); 591 return leading ? invokeFunc(time) : result; 592 } 593 function remainingWait(time) { 594 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; 595 return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; 596 } 597 function shouldInvoke(time) { 598 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; 599 return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; 600 } 601 function timerExpired() { 602 var time = lodash_es_now(); 603 if (shouldInvoke(time)) return trailingEdge(time); 604 timerId = setTimeout(timerExpired, remainingWait(time)); 605 } 606 function trailingEdge(time) { 607 timerId = void 0; 608 if (trailing && lastArgs) return invokeFunc(time); 609 lastArgs = lastThis = void 0; 610 return result; 611 } 612 function cancel() { 613 if (timerId !== void 0) clearTimeout(timerId); 614 lastInvokeTime = 0; 615 lastArgs = lastCallTime = lastThis = timerId = void 0; 616 } 617 function flush() { 618 return timerId === void 0 ? result : trailingEdge(lodash_es_now()); 619 } 620 function debounced() { 621 var time = lodash_es_now(), isInvoking = shouldInvoke(time); 622 lastArgs = arguments; 623 lastThis = this; 624 lastCallTime = time; 625 if (isInvoking) { 626 if (timerId === void 0) return leadingEdge(lastCallTime); 627 if (maxing) { 628 clearTimeout(timerId); 629 timerId = setTimeout(timerExpired, wait); 630 return invokeFunc(lastCallTime); 631 } 632 } 633 if (timerId === void 0) timerId = setTimeout(timerExpired, wait); 634 return result; 635 } 636 debounced.cancel = cancel; 637 debounced.flush = flush; 638 return debounced; 639 } 640 const lodash_es_debounce = debounce; 641 var throttle_FUNC_ERROR_TEXT = "Expected a function"; 642 function throttle(func, wait, options) { 643 var leading = true, trailing = true; 644 if (typeof func != "function") throw new TypeError(throttle_FUNC_ERROR_TEXT); 645 if (lodash_es_isObject(options)) { 646 leading = "leading" in options ? !!options.leading : leading; 647 trailing = "trailing" in options ? !!options.trailing : trailing; 648 } 649 return lodash_es_debounce(func, wait, { 650 leading, 651 maxWait: wait, 652 trailing 653 }); 654 } 655 const lodash_es_throttle = throttle; 656 var __assign = function() { 657 __assign = Object.assign || function __assign(t) { 658 for (var s, i = 1, n = arguments.length; i < n; i++) { 659 s = arguments[i]; 660 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 661 } 662 return t; 663 }; 664 return __assign.apply(this, arguments); 665 }; 666 function getElementWindow$1(element) { 667 if (!element || !element.ownerDocument || !element.ownerDocument.defaultView) return window; 668 return element.ownerDocument.defaultView; 669 } 670 function getElementDocument$1(element) { 671 if (!element || !element.ownerDocument) return document; 672 return element.ownerDocument; 673 } 674 var getOptions$1 = function(obj) { 675 var initialObj = {}; 676 var options = Array.prototype.reduce.call(obj, (function(acc, attribute) { 677 var option = attribute.name.match(/data-simplebar-(.+)/); 678 if (option) { 679 var key = option[1].replace(/\W+(.)/g, (function(_, chr) { 680 return chr.toUpperCase(); 681 })); 682 switch (attribute.value) { 683 case "true": 684 acc[key] = true; 685 break; 686 687 case "false": 688 acc[key] = false;
689 break; 690 691 case void 0: 692 acc[key] = true; 693 break; 694 695 default: 696 acc[key] = attribute.value; 697 } 698 } 699 return acc; 700 }), initialObj); 701 return options; 702 }; 703 function addClasses$1(el, classes) { 704 var _a; 705 if (!el) return; 706 (_a = el.classList).add.apply(_a, classes.split(" ")); 707 } 708 function removeClasses$1(el, classes) { 709 if (!el) return; 710 classes.split(" ").forEach((function(className) { 711 el.classList.remove(className); 712 })); 713 } 714 function classNamesToQuery$1(classNames) { 715 return ".".concat(classNames.split(" ").join(".")); 716 } 717 var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement); 718 var helpers = Object.freeze({ 719 __proto__: null, 720 addClasses: addClasses$1, 721 canUseDOM, 722 classNamesToQuery: classNamesToQuery$1, 723 getElementDocument: getElementDocument$1, 724 getElementWindow: getElementWindow$1, 725 getOptions: getOptions$1, 726 removeClasses: removeClasses$1 727 }); 728 var cachedScrollbarWidth = null; 729 var cachedDevicePixelRatio = null; 730 if (canUseDOM) window.addEventListener("resize", (function() { 731 if (cachedDevicePixelRatio !== window.devicePixelRatio) { 732 cachedDevicePixelRatio = window.devicePixelRatio; 733 cachedScrollbarWidth = null; 734 } 735 })); 736 function scrollbarWidth() { 737 if (cachedScrollbarWidth === null) { 738 if (typeof document === "undefined") { 739 cachedScrollbarWidth = 0; 740 return cachedScrollbarWidth; 741 } 742 var body = document.body; 743 var box = document.createElement("div"); 744 box.classList.add("simplebar-hide-scrollbar"); 745 body.appendChild(box); 746 var width = box.getBoundingClientRect().right; 747 body.removeChild(box); 748 cachedScrollbarWidth = width; 749 } 750 return cachedScrollbarWidth; 751 } 752 var getElementWindow = getElementWindow$1, getElementDocument = getElementDocument$1, getOptions = getOptions$1, addClasses = addClasses$1, dist_removeClasses = removeClasses$1, classNamesToQuery = classNamesToQuery$1; 753 var SimpleBarCore = function() { 754 function SimpleBarCore(element, options) { 755 if (options === void 0) options = {}; 756 var _this = this; 757 this.removePreventClickId = null; 758 this.minScrollbarWidth = 20; 759 this.stopScrollDelay = 175; 760 this.isScrolling = false; 761 this.isMouseEntering = false; 762 this.isDragging = false; 763 this.scrollXTicking = false; 764 this.scrollYTicking = false; 765 this.wrapperEl = null; 766 this.contentWrapperEl = null; 767 this.contentEl = null; 768 this.offsetEl = null; 769 this.maskEl = null; 770 this.placeholderEl = null; 771 this.heightAutoObserverWrapperEl = null; 772 this.heightAutoObserverEl = null; 773 this.rtlHelpers = null; 774 this.scrollbarWidth = 0; 775 this.resizeObserver = null; 776 this.mutationObserver = null; 777 this.elStyles = null; 778 this.isRtl = null; 779 this.mouseX = 0; 780 this.mouseY = 0; 781 this.onMouseMove = function() {}; 782 this.onWindowResize = function() {}; 783 this.onStopScrolling = function() {}; 784 this.onMouseEntered = function() {}; 785 this.onScroll = function() { 786 var elWindow = getElementWindow(_this.el); 787 if (!_this.scrollXTicking) { 788 elWindow.requestAnimationFrame(_this.scrollX); 789 _this.scrollXTicking = true; 790 } 791 if (!_this.scrollYTicking) { 792 elWindow.requestAnimationFrame(_this.scrollY); 793 _this.scrollYTicking = true; 794 } 795 if (!_this.isScrolling) { 796 _this.isScrolling = true; 797 addClasses(_this.el, _this.classNames.scrolling); 798 } 799 _this.showScrollbar("x"); 800 _this.showScrollbar("y"); 801 _this.onStopScrolling(); 802 }; 803 this.scrollX = function() { 804 if (_this.axis.x.isOverflowing) _this.positionScrollbar("x"); 805 _this.scrollXTicking = false;
806 }; 807 this.scrollY = function() { 808 if (_this.axis.y.isOverflowing) _this.positionScrollbar("y"); 809 _this.scrollYTicking = false; 810 }; 811 this._onStopScrolling = function() { 812 dist_removeClasses(_this.el, _this.classNames.scrolling); 813 if (_this.options.autoHide) { 814 _this.hideScrollbar("x"); 815 _this.hideScrollbar("y"); 816 } 817 _this.isScrolling = false; 818 }; 819 this.onMouseEnter = function() { 820 if (!_this.isMouseEntering) { 821 addClasses(_this.el, _this.classNames.mouseEntered); 822 _this.showScrollbar("x"); 823 _this.showScrollbar("y"); 824 _this.isMouseEntering = true; 825 } 826 _this.onMouseEntered(); 827 }; 828 this._onMouseEntered = function() { 829 dist_removeClasses(_this.el, _this.classNames.mouseEntered); 830 if (_this.options.autoHide) { 831 _this.hideScrollbar("x"); 832 _this.hideScrollbar("y"); 833 } 834 _this.isMouseEntering = false; 835 }; 836 this._onMouseMove = function(e) { 837 _this.mouseX = e.clientX; 838 _this.mouseY = e.clientY; 839 if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) _this.onMouseMoveForAxis("x"); 840 if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) _this.onMouseMoveForAxis("y"); 841 }; 842 this.onMouseLeave = function() { 843 _this.onMouseMove.cancel(); 844 if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) _this.onMouseLeaveForAxis("x"); 845 if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) _this.onMouseLeaveForAxis("y"); 846 _this.mouseX = -1; 847 _this.mouseY = -1; 848 }; 849 this._onWindowResize = function() { 850 _this.scrollbarWidth = _this.getScrollbarWidth(); 851 _this.hideNativeScrollbar(); 852 }; 853 this.onPointerEvent = function(e) { 854 if (!_this.axis.x.track.el || !_this.axis.y.track.el || !_this.axis.x.scrollbar.el || !_this.axis.y.scrollbar.el) return; 855 var isWithinTrackXBounds, isWithinTrackYBounds; 856 _this.axis.x.track.rect = _this.axis.x.track.el.getBoundingClientRect(); 857 _this.axis.y.track.rect = _this.axis.y.track.el.getBoundingClientRect(); 858 if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) isWithinTrackXBounds = _this.isWithinBounds(_this.axis.x.track.rect); 859 if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) isWithinTrackYBounds = _this.isWithinBounds(_this.axis.y.track.rect); 860 if (isWithinTrackXBounds || isWithinTrackYBounds) { 861 e.stopPropagation(); 862 if (e.type === "pointerdown" && e.pointerType !== "touch") { 863 if (isWithinTrackXBounds) { 864 _this.axis.x.scrollbar.rect = _this.axis.x.scrollbar.el.getBoundingClientRect(); 865 if (_this.isWithinBounds(_this.axis.x.scrollbar.rect)) _this.onDragStart(e, "x"); else _this.onTrackClick(e, "x"); 866 } 867 if (isWithinTrackYBounds) { 868 _this.axis.y.scrollbar.rect = _this.axis.y.scrollbar.el.getBoundingClientRect(); 869 if (_this.isWithinBounds(_this.axis.y.scrollbar.rect)) _this.onDragStart(e, "y"); else _this.onTrackClick(e, "y"); 870 } 871 } 872 } 873 }; 874 this.drag = function(e) { 875 var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; 876 if (!_this.draggedAxis || !_this.contentWrapperEl) return; 877 var eventOffset; 878 var track = _this.axis[_this.draggedAxis].track; 879 var trackSize = (_b = (_a = track.rect) === null || _a === void 0 ? void 0 : _a[_this.axis[_this.draggedAxis].sizeAttr]) !== null && _b !== void 0 ? _b : 0; 880 var scrollbar = _this.axis[_this.draggedAxis].scrollbar; 881 var contentSize = (_d = (_c = _this.contentWrapperEl) === null || _c === void 0 ? void 0 : _c[_this.axis[_this.draggedAxis].scrollSizeAttr]) !== null && _d !== void 0 ? _d : 0; 882 var hostSize = parseInt((_f = (_e = _this.elStyles) === null || _e === void 0 ? void 0 : _e[_this.axis[_this.draggedAxis].sizeAttr]) !== null && _f !== void 0 ? _f : "0px", 10); 883 e.preventDefault(); 884 e.stopPropagation(); 885 if (_this.draggedAxis === "y") eventOffset = e.pageY; else eventOffset = e.pageX; 886 var dragPos = eventOffset - ((_h = (_g = track.rect) === null || _g === void 0 ? void 0 : _g[_this.axis[_this.draggedAxis].offsetAttr]) !== null && _h !== void 0 ? _h : 0) - _this.axis[_this.draggedAxis].dragOffset; 887 dragPos = _this.draggedAxis === "x" && _this.isRtl ? ((_k = (_j = track.rect) === null || _j === void 0 ? void 0 : _j[_this.axis[_this.draggedAxis].sizeAttr]) !== null && _k !== void 0 ? _k : 0) - scrollbar.size - dragPos : dragPos; 888 var dragPerc = dragPos / (trackSize - scrollbar.size); 889 var scrollPos = dragPerc * (contentSize - hostSize); 890 if (_this.draggedAxis === "x" && _this.isRtl) scrollPos = ((_l = SimpleBarCore.getRtlHelpers()) === null || _l === void 0 ? void 0 : _l.isScrollingToNegative) ? -scrollPos : scrollPos; 891 _this.contentWrapperEl[_this.axis[_this.draggedAxis].scrollOffsetAttr] = scrollPos; 892 }; 893 this.onEndDrag = function(e) { 894 _this.isDragging = false;
895 var elDocument = getElementDocument(_this.el); 896 var elWindow = getElementWindow(_this.el); 897 e.preventDefault(); 898 e.stopPropagation(); 899 dist_removeClasses(_this.el, _this.classNames.dragging); 900 _this.onStopScrolling(); 901 elDocument.removeEventListener("mousemove", _this.drag, true); 902 elDocument.removeEventListener("mouseup", _this.onEndDrag, true); 903 _this.removePreventClickId = elWindow.setTimeout((function() { 904 elDocument.removeEventListener("click", _this.preventClick, true); 905 elDocument.removeEventListener("dblclick", _this.preventClick, true); 906 _this.removePreventClickId = null; 907 })); 908 }; 909 this.preventClick = function(e) { 910 e.preventDefault(); 911 e.stopPropagation(); 912 }; 913 this.el = element; 914 this.options = __assign(__assign({}, SimpleBarCore.defaultOptions), options); 915 this.classNames = __assign(__assign({}, SimpleBarCore.defaultOptions.classNames), options.classNames); 916 this.axis = { 917 x: { 918 scrollOffsetAttr: "scrollLeft", 919 sizeAttr: "width", 920 scrollSizeAttr: "scrollWidth", 921 offsetSizeAttr: "offsetWidth", 922 offsetAttr: "left", 923 overflowAttr: "overflowX", 924 dragOffset: 0, 925 isOverflowing: true, 926 forceVisible: false, 927 track: { 928 size: null, 929 el: null, 930 rect: null, 931 isVisible: false 932 }, 933 scrollbar: { 934 size: null, 935 el: null, 936 rect: null, 937 isVisible: false 938 } 939 }, 940 y: { 941 scrollOffsetAttr: "scrollTop", 942 sizeAttr: "height", 943 scrollSizeAttr: "scrollHeight", 944 offsetSizeAttr: "offsetHeight", 945 offsetAttr: "top", 946 overflowAttr: "overflowY", 947 dragOffset: 0, 948 isOverflowing: true, 949 forceVisible: false, 950 track: { 951 size: null, 952 el: null, 953 rect: null, 954 isVisible: false 955 }, 956 scrollbar: { 957 size: null, 958 el: null, 959 rect: null, 960 isVisible: false 961 } 962 } 963 }; 964 if (typeof this.el !== "object" || !this.el.nodeName) throw new Error("Argument passed to SimpleBar must be an HTML element instead of ".concat(this.el)); 965 this.onMouseMove = lodash_es_throttle(this._onMouseMove, 64); 966 this.onWindowResize = lodash_es_debounce(this._onWindowResize, 64, { 967 leading: true 968 }); 969 this.onStopScrolling = lodash_es_debounce(this._onStopScrolling, this.stopScrollDelay); 970 this.onMouseEntered = lodash_es_debounce(this._onMouseEntered, this.stopScrollDelay); 971 this.init(); 972 } 973 SimpleBarCore.getRtlHelpers = function() { 974 if (SimpleBarCore.rtlHelpers) return SimpleBarCore.rtlHelpers; 975 var dummyDiv = document.createElement("div"); 976 dummyDiv.innerHTML = '<div class="simplebar-dummy-scrollbar-size"><div></div></div>'; 977 var scrollbarDummyEl = dummyDiv.firstElementChild; 978 var dummyChild = scrollbarDummyEl === null || scrollbarDummyEl === void 0 ? void 0 : scrollbarDummyEl.firstElementChild; 979 if (!dummyChild) return null; 980 document.body.appendChild(scrollbarDummyEl); 981 scrollbarDummyEl.scrollLeft = 0; 982 var dummyContainerOffset = SimpleBarCore.getOffset(scrollbarDummyEl); 983 var dummyChildOffset = SimpleBarCore.getOffset(dummyChild); 984 scrollbarDummyEl.scrollLeft = -999; 985 var dummyChildOffsetAfterScroll = SimpleBarCore.getOffset(dummyChild); 986 document.body.removeChild(scrollbarDummyEl); 987 SimpleBarCore.rtlHelpers = { 988 isScrollOriginAtZero: dummyContainerOffset.left !== dummyChildOffset.left, 989 isScrollingToNegative: dummyChildOffset.left !== dummyChildOffsetAfterScroll.left 990 }; 991 return SimpleBarCore.rtlHelpers; 992 }; 993 SimpleBarCore.prototype.getScrollbarWidth = function() { 994 try { 995 if (this.contentWrapperEl && getComputedStyle(this.contentWrapperEl, "::-webkit-scrollbar").display === "none" || "scrollbarWidth" in document.documentElement.style || "-ms-overflow-style" in document.documentElement.style) return 0; else return scrollbarWidth(); 996 } catch (e) { 997 return scrollbarWidth(); 998 } 999 }; 1000 SimpleBarCore.getOffset = function(el) { 1001 var rect = el.getBoundingClientRect(); 1002 var elDocument = getElementDocument(el); 1003 var elWindow = getElementWindow(el); 1004 return { 1005 top: rect.top + (elWindow.pageYOffset || elDocument.documentElement.scrollTop), 1006 left: rect.left + (elWindow.pageXOffset || elDocument.documentElement.scrollLeft) 1007 }; 1008 }; 1009 SimpleBarCore.prototype.init = function() { 1010 if (canUseDOM) { 1011 this.initDOM(); 1012 this.rtlHelpers = SimpleBarCore.getRtlHelpers();
vendor: 6,768 bytes, lines 1013-1103
1013 this.scrollbarWidth = this.getScrollbarWidth(); 1014 this.recalculate(); 1015 this.initListeners(); 1016 } 1017 }; 1018 SimpleBarCore.prototype.initDOM = function() { 1019 var _a, _b; 1020 this.wrapperEl = this.el.querySelector(classNamesToQuery(this.classNames.wrapper)); 1021 this.contentWrapperEl = this.options.scrollableNode || this.el.querySelector(classNamesToQuery(this.classNames.contentWrapper)); 1022 this.contentEl = this.options.contentNode || this.el.querySelector(classNamesToQuery(this.classNames.contentEl)); 1023 this.offsetEl = this.el.querySelector(classNamesToQuery(this.classNames.offset)); 1024 this.maskEl = this.el.querySelector(classNamesToQuery(this.classNames.mask)); 1025 this.placeholderEl = this.findChild(this.wrapperEl, classNamesToQuery(this.classNames.placeholder)); 1026 this.heightAutoObserverWrapperEl = this.el.querySelector(classNamesToQuery(this.classNames.heightAutoObserverWrapperEl)); 1027 this.heightAutoObserverEl = this.el.querySelector(classNamesToQuery(this.classNames.heightAutoObserverEl)); 1028 this.axis.x.track.el = this.findChild(this.el, "".concat(classNamesToQuery(this.classNames.track)).concat(classNamesToQuery(this.classNames.horizontal))); 1029 this.axis.y.track.el = this.findChild(this.el, "".concat(classNamesToQuery(this.classNames.track)).concat(classNamesToQuery(this.classNames.vertical))); 1030 this.axis.x.scrollbar.el = ((_a = this.axis.x.track.el) === null || _a === void 0 ? void 0 : _a.querySelector(classNamesToQuery(this.classNames.scrollbar))) || null; 1031 this.axis.y.scrollbar.el = ((_b = this.axis.y.track.el) === null || _b === void 0 ? void 0 : _b.querySelector(classNamesToQuery(this.classNames.scrollbar))) || null; 1032 if (!this.options.autoHide) { 1033 addClasses(this.axis.x.scrollbar.el, this.classNames.visible); 1034 addClasses(this.axis.y.scrollbar.el, this.classNames.visible); 1035 } 1036 }; 1037 SimpleBarCore.prototype.initListeners = function() { 1038 var _this = this; 1039 var _a; 1040 var elWindow = getElementWindow(this.el); 1041 this.el.addEventListener("mouseenter", this.onMouseEnter); 1042 this.el.addEventListener("pointerdown", this.onPointerEvent, true); 1043 this.el.addEventListener("mousemove", this.onMouseMove); 1044 this.el.addEventListener("mouseleave", this.onMouseLeave); 1045 (_a = this.contentWrapperEl) === null || _a === void 0 ? void 0 : _a.addEventListener("scroll", this.onScroll); 1046 elWindow.addEventListener("resize", this.onWindowResize); 1047 if (!this.contentEl) return; 1048 if (window.ResizeObserver) { 1049 var resizeObserverStarted_1 = false; 1050 var resizeObserver = elWindow.ResizeObserver || ResizeObserver; 1051 this.resizeObserver = new resizeObserver((function() { 1052 if (!resizeObserverStarted_1) return; 1053 elWindow.requestAnimationFrame((function() { 1054 _this.recalculate(); 1055 })); 1056 })); 1057 this.resizeObserver.observe(this.el); 1058 this.resizeObserver.observe(this.contentEl); 1059 elWindow.requestAnimationFrame((function() { 1060 resizeObserverStarted_1 = true; 1061 })); 1062 } 1063 this.mutationObserver = new elWindow.MutationObserver((function() { 1064 elWindow.requestAnimationFrame((function() { 1065 _this.recalculate(); 1066 })); 1067 })); 1068 this.mutationObserver.observe(this.contentEl, { 1069 childList: true, 1070 subtree: true, 1071 characterData: true 1072 }); 1073 }; 1074 SimpleBarCore.prototype.recalculate = function() { 1075 if (!this.heightAutoObserverEl || !this.contentEl || !this.contentWrapperEl || !this.wrapperEl || !this.placeholderEl) return; 1076 var elWindow = getElementWindow(this.el); 1077 this.elStyles = elWindow.getComputedStyle(this.el); 1078 this.isRtl = this.elStyles.direction === "rtl"; 1079 var contentElOffsetWidth = this.contentEl.offsetWidth; 1080 var isHeightAuto = this.heightAutoObserverEl.offsetHeight <= 1; 1081 var isWidthAuto = this.heightAutoObserverEl.offsetWidth <= 1 || contentElOffsetWidth > 0; 1082 var contentWrapperElOffsetWidth = this.contentWrapperEl.offsetWidth; 1083 var elOverflowX = this.elStyles.overflowX; 1084 var elOverflowY = this.elStyles.overflowY; 1085 this.contentEl.style.padding = "".concat(this.elStyles.paddingTop, " ").concat(this.elStyles.paddingRight, " ").concat(this.elStyles.paddingBottom, " ").concat(this.elStyles.paddingLeft); 1086 this.wrapperEl.style.margin = "-".concat(this.elStyles.paddingTop, " -").concat(this.elStyles.paddingRight, " -").concat(this.elStyles.paddingBottom, " -").concat(this.elStyles.paddingLeft); 1087 var contentElScrollHeight = this.contentEl.scrollHeight; 1088 var contentElScrollWidth = this.contentEl.scrollWidth; 1089 this.contentWrapperEl.style.height = isHeightAuto ? "auto" : "100%"; 1090 this.placeholderEl.style.width = isWidthAuto ? "".concat(contentElOffsetWidth || contentElScrollWidth, "px") : "auto"; 1091 this.placeholderEl.style.height = "".concat(contentElScrollHeight, "px"); 1092 var contentWrapperElOffsetHeight = this.contentWrapperEl.offsetHeight; 1093 this.axis.x.isOverflowing = contentElOffsetWidth !== 0 && contentElScrollWidth > contentElOffsetWidth; 1094 this.axis.y.isOverflowing = contentElScrollHeight > contentWrapperElOffsetHeight; 1095 this.axis.x.isOverflowing = elOverflowX === "hidden" ? false : this.axis.x.isOverflowing; 1096 this.axis.y.isOverflowing = elOverflowY === "hidden" ? false : this.axis.y.isOverflowing; 1097 this.axis.x.forceVisible = this.options.forceVisible === "x" || this.options.forceVisible === true; 1098 this.axis.y.forceVisible = this.options.forceVisible === "y" || this.options.forceVisible === true; 1099 this.hideNativeScrollbar(); 1100 var offsetForXScrollbar = this.axis.x.isOverflowing ? this.scrollbarWidth : 0; 1101 var offsetForYScrollbar = this.axis.y.isOverflowing ? this.scrollbarWidth : 0; 1102 this.axis.x.isOverflowing = this.axis.x.isOverflowing && contentElScrollWidth > contentWrapperElOffsetWidth - offsetForYScrollbar; 1103 this.axis.y.isOverflowing = this.axis.y.isOverflowing && contentElScrollHeight > contentWrapperElOffsetHeight - offsetForXScrollbar;
1104 this.axis.x.scrollbar.size = this.getScrollbarSize("x"); 1105 this.axis.y.scrollbar.size = this.getScrollbarSize("y"); 1106 if (this.axis.x.scrollbar.el) this.axis.x.scrollbar.el.style.width = "".concat(this.axis.x.scrollbar.size, "px"); 1107 if (this.axis.y.scrollbar.el) this.axis.y.scrollbar.el.style.height = "".concat(this.axis.y.scrollbar.size, "px"); 1108 this.positionScrollbar("x"); 1109 this.positionScrollbar("y"); 1110 this.toggleTrackVisibility("x"); 1111 this.toggleTrackVisibility("y"); 1112 }; 1113 SimpleBarCore.prototype.getScrollbarSize = function(axis) { 1114 var _a, _b; 1115 if (axis === void 0) axis = "y"; 1116 if (!this.axis[axis].isOverflowing || !this.contentEl) return 0; 1117 var contentSize = this.contentEl[this.axis[axis].scrollSizeAttr]; 1118 var trackSize = (_b = (_a = this.axis[axis].track.el) === null || _a === void 0 ? void 0 : _a[this.axis[axis].offsetSizeAttr]) !== null && _b !== void 0 ? _b : 0; 1119 var scrollbarRatio = trackSize / contentSize; 1120 var scrollbarSize; 1121 scrollbarSize = Math.max(~~(scrollbarRatio * trackSize), this.options.scrollbarMinSize); 1122 if (this.options.scrollbarMaxSize) scrollbarSize = Math.min(scrollbarSize, this.options.scrollbarMaxSize); 1123 return scrollbarSize; 1124 }; 1125 SimpleBarCore.prototype.positionScrollbar = function(axis) { 1126 var _a, _b, _c; 1127 if (axis === void 0) axis = "y"; 1128 var scrollbar = this.axis[axis].scrollbar; 1129 if (!this.axis[axis].isOverflowing || !this.contentWrapperEl || !scrollbar.el || !this.elStyles) return; 1130 var contentSize = this.contentWrapperEl[this.axis[axis].scrollSizeAttr]; 1131 var trackSize = ((_a = this.axis[axis].track.el) === null || _a === void 0 ? void 0 : _a[this.axis[axis].offsetSizeAttr]) || 0; 1132 var hostSize = parseInt(this.elStyles[this.axis[axis].sizeAttr], 10); 1133 var scrollOffset = this.contentWrapperEl[this.axis[axis].scrollOffsetAttr]; 1134 scrollOffset = axis === "x" && this.isRtl && ((_b = SimpleBarCore.getRtlHelpers()) === null || _b === void 0 ? void 0 : _b.isScrollOriginAtZero) ? -scrollOffset : scrollOffset; 1135 if (axis === "x" && this.isRtl) scrollOffset = ((_c = SimpleBarCore.getRtlHelpers()) === null || _c === void 0 ? void 0 : _c.isScrollingToNegative) ? scrollOffset : -scrollOffset; 1136 var scrollPourcent = scrollOffset / (contentSize - hostSize); 1137 var handleOffset = ~~((trackSize - scrollbar.size) * scrollPourcent); 1138 handleOffset = axis === "x" && this.isRtl ? -handleOffset + (trackSize - scrollbar.size) : handleOffset; 1139 scrollbar.el.style.transform = axis === "x" ? "translate3d(".concat(handleOffset, "px, 0, 0)") : "translate3d(0, ".concat(handleOffset, "px, 0)"); 1140 }; 1141 SimpleBarCore.prototype.toggleTrackVisibility = function(axis) { 1142 if (axis === void 0) axis = "y"; 1143 var track = this.axis[axis].track.el; 1144 var scrollbar = this.axis[axis].scrollbar.el; 1145 if (!track || !scrollbar || !this.contentWrapperEl) return; 1146 if (this.axis[axis].isOverflowing || this.axis[axis].forceVisible) { 1147 track.style.visibility = "visible"; 1148 this.contentWrapperEl.style[this.axis[axis].overflowAttr] = "scroll"; 1149 this.el.classList.add("".concat(this.classNames.scrollable, "-").concat(axis)); 1150 } else { 1151 track.style.visibility = "hidden"; 1152 this.contentWrapperEl.style[this.axis[axis].overflowAttr] = "hidden"; 1153 this.el.classList.remove("".concat(this.classNames.scrollable, "-").concat(axis)); 1154 } 1155 if (this.axis[axis].isOverflowing) scrollbar.style.display = "block"; else scrollbar.style.display = "none"; 1156 }; 1157 SimpleBarCore.prototype.showScrollbar = function(axis) { 1158 if (axis === void 0) axis = "y"; 1159 if (this.axis[axis].isOverflowing && !this.axis[axis].scrollbar.isVisible) { 1160 addClasses(this.axis[axis].scrollbar.el, this.classNames.visible); 1161 this.axis[axis].scrollbar.isVisible = true; 1162 } 1163 }; 1164 SimpleBarCore.prototype.hideScrollbar = function(axis) { 1165 if (axis === void 0) axis = "y"; 1166 if (this.isDragging) return; 1167 if (this.axis[axis].isOverflowing && this.axis[axis].scrollbar.isVisible) { 1168 dist_removeClasses(this.axis[axis].scrollbar.el, this.classNames.visible); 1169 this.axis[axis].scrollbar.isVisible = false;
1170 } 1171 }; 1172 SimpleBarCore.prototype.hideNativeScrollbar = function() { 1173 if (!this.offsetEl) return; 1174 this.offsetEl.style[this.isRtl ? "left" : "right"] = this.axis.y.isOverflowing || this.axis.y.forceVisible ? "-".concat(this.scrollbarWidth, "px") : "0px"; 1175 this.offsetEl.style.bottom = this.axis.x.isOverflowing || this.axis.x.forceVisible ? "-".concat(this.scrollbarWidth, "px") : "0px"; 1176 }; 1177 SimpleBarCore.prototype.onMouseMoveForAxis = function(axis) { 1178 if (axis === void 0) axis = "y"; 1179 var currentAxis = this.axis[axis]; 1180 if (!currentAxis.track.el || !currentAxis.scrollbar.el) return; 1181 currentAxis.track.rect = currentAxis.track.el.getBoundingClientRect(); 1182 currentAxis.scrollbar.rect = currentAxis.scrollbar.el.getBoundingClientRect(); 1183 if (this.isWithinBounds(currentAxis.track.rect)) { 1184 this.showScrollbar(axis); 1185 addClasses(currentAxis.track.el, this.classNames.hover); 1186 if (this.isWithinBounds(currentAxis.scrollbar.rect)) addClasses(currentAxis.scrollbar.el, this.classNames.hover); else dist_removeClasses(currentAxis.scrollbar.el, this.classNames.hover); 1187 } else { 1188 dist_removeClasses(currentAxis.track.el, this.classNames.hover); 1189 if (this.options.autoHide) this.hideScrollbar(axis); 1190 } 1191 }; 1192 SimpleBarCore.prototype.onMouseLeaveForAxis = function(axis) { 1193 if (axis === void 0) axis = "y"; 1194 dist_removeClasses(this.axis[axis].track.el, this.classNames.hover); 1195 dist_removeClasses(this.axis[axis].scrollbar.el, this.classNames.hover); 1196 if (this.options.autoHide) this.hideScrollbar(axis); 1197 }; 1198 SimpleBarCore.prototype.onDragStart = function(e, axis) { 1199 var _a; 1200 if (axis === void 0) axis = "y"; 1201 this.isDragging = true; 1202 var elDocument = getElementDocument(this.el); 1203 var elWindow = getElementWindow(this.el); 1204 var scrollbar = this.axis[axis].scrollbar; 1205 var eventOffset = axis === "y" ? e.pageY : e.pageX; 1206 this.axis[axis].dragOffset = eventOffset - (((_a = scrollbar.rect) === null || _a === void 0 ? void 0 : _a[this.axis[axis].offsetAttr]) || 0); 1207 this.draggedAxis = axis; 1208 addClasses(this.el, this.classNames.dragging); 1209 elDocument.addEventListener("mousemove", this.drag, true); 1210 elDocument.addEventListener("mouseup", this.onEndDrag, true); 1211 if (this.removePreventClickId === null) { 1212 elDocument.addEventListener("click", this.preventClick, true); 1213 elDocument.addEventListener("dblclick", this.preventClick, true); 1214 } else { 1215 elWindow.clearTimeout(this.removePreventClickId); 1216 this.removePreventClickId = null; 1217 } 1218 }; 1219 SimpleBarCore.prototype.onTrackClick = function(e, axis) { 1220 var _this = this; 1221 var _a, _b, _c, _d; 1222 if (axis === void 0) axis = "y"; 1223 var currentAxis = this.axis[axis]; 1224 if (!this.options.clickOnTrack || !currentAxis.scrollbar.el || !this.contentWrapperEl) return; 1225 e.preventDefault(); 1226 var elWindow = getElementWindow(this.el); 1227 this.axis[axis].scrollbar.rect = currentAxis.scrollbar.el.getBoundingClientRect(); 1228 var scrollbar = this.axis[axis].scrollbar; 1229 var scrollbarOffset = (_b = (_a = scrollbar.rect) === null || _a === void 0 ? void 0 : _a[this.axis[axis].offsetAttr]) !== null && _b !== void 0 ? _b : 0; 1230 var hostSize = parseInt((_d = (_c = this.elStyles) === null || _c === void 0 ? void 0 : _c[this.axis[axis].sizeAttr]) !== null && _d !== void 0 ? _d : "0px", 10); 1231 var scrolled = this.contentWrapperEl[this.axis[axis].scrollOffsetAttr]; 1232 var t = axis === "y" ? this.mouseY - scrollbarOffset : this.mouseX - scrollbarOffset; 1233 var dir = t < 0 ? -1 : 1; 1234 var scrollSize = dir === -1 ? scrolled - hostSize : scrolled + hostSize; 1235 var speed = 40; 1236 var scrollTo = function() { 1237 if (!_this.contentWrapperEl) return; 1238 if (dir === -1) { 1239 if (scrolled > scrollSize) { 1240 scrolled -= speed; 1241 _this.contentWrapperEl[_this.axis[axis].scrollOffsetAttr] = scrolled; 1242 elWindow.requestAnimationFrame(scrollTo); 1243 } 1244 } else if (scrolled < scrollSize) { 1245 scrolled += speed; 1246 _this.contentWrapperEl[_this.axis[axis].scrollOffsetAttr] = scrolled; 1247 elWindow.requestAnimationFrame(scrollTo); 1248 } 1249 }; 1250 scrollTo(); 1251 }; 1252 SimpleBarCore.prototype.getContentElement = function() { 1253 return this.contentEl; 1254 }; 1255 SimpleBarCore.prototype.getScrollElement = function() { 1256 return this.contentWrapperEl; 1257 }; 1258 SimpleBarCore.prototype.removeListeners = function() { 1259 var elWindow = getElementWindow(this.el); 1260 this.el.removeEventListener("mouseenter", this.onMouseEnter); 1261 this.el.removeEventListener("pointerdown", this.onPointerEvent, true); 1262 this.el.removeEventListener("mousemove", this.onMouseMove); 1263 this.el.removeEventListener("mouseleave", this.onMouseLeave); 1264 if (this.contentWrapperEl) this.contentWrapperEl.removeEventListener("scroll", this.onScroll); 1265 elWindow.removeEventListener("resize", this.onWindowResize); 1266 if (this.mutationObserver) this.mutationObserver.disconnect(); 1267 if (this.resizeObserver) this.resizeObserver.disconnect(); 1268 this.onMouseMove.cancel(); 1269 this.onWindowResize.cancel(); 1270 this.onStopScrolling.cancel(); 1271 this.onMouseEntered.cancel(); 1272 }; 1273 SimpleBarCore.prototype.unMount = function() { 1274 this.removeListeners(); 1275 }; 1276 SimpleBarCore.prototype.isWithinBounds = function(bbox) { 1277 return this.mouseX >= bbox.left && this.mouseX <= bbox.left + bbox.width && this.mouseY >= bbox.top && this.mouseY <= bbox.top + bbox.height; 1278 }; 1279 SimpleBarCore.prototype.findChild = function(el, query) { 1280 var matches = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector; 1281 return Array.prototype.filter.call(el.children, (function(child) { 1282 return matches.call(child, query); 1283 }))[0]; 1284 }; 1285 SimpleBarCore.rtlHelpers = null; 1286 SimpleBarCore.defaultOptions = { 1287 forceVisible: false, 1288 clickOnTrack: true, 1289 scrollbarMinSize: 25, 1290 scrollbarMaxSize: 0, 1291 ariaLabel: "scrollable content", 1292 tabIndex: 0, 1293 classNames: { 1294 contentEl: "simplebar-content", 1295 contentWrapper: "simplebar-content-wrapper", 1296 offset: "simplebar-offset", 1297 mask: "simplebar-mask", 1298 wrapper: "simplebar-wrapper", 1299 placeholder: "simplebar-placeholder", 1300 scrollbar: "simplebar-scrollbar", 1301 track: "simplebar-track", 1302 heightAutoObserverWrapperEl: "simplebar-height-auto-observer-wrapper", 1303 heightAutoObserverEl: "simplebar-height-auto-observer", 1304 visible: "simplebar-visible", 1305 horizontal: "simplebar-horizontal", 1306 vertical: "simplebar-vertical", 1307 hover: "simplebar-hover", 1308 dragging: "simplebar-dragging", 1309 scrolling: "simplebar-scrolling", 1310 scrollable: "simplebar-scrollable", 1311 mouseEntered: "simplebar-mouse-entered" 1312 }, 1313 scrollableNode: null, 1314 contentNode: null, 1315 autoHide: true 1316 }; 1317 SimpleBarCore.getOptions = getOptions; 1318 SimpleBarCore.helpers = helpers; 1319 return SimpleBarCore; 1320 }(); 1321 var extendStatics = function(d, b) { 1322 extendStatics = Object.setPrototypeOf || { 1323 __proto__: [] 1324 } instanceof Array && function(d, b) { 1325 d.__proto__ = b; 1326 } || function(d, b) { 1327 for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 1328 }; 1329 return extendStatics(d, b); 1330 }; 1331 function __extends(d, b) { 1332 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 1333 extendStatics(d, b); 1334 function __() { 1335 this.constructor = d; 1336 } 1337 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __); 1338 } 1339 var _a = SimpleBarCore.helpers, dist_getOptions = _a.getOptions, dist_addClasses = _a.addClasses, dist_canUseDOM = _a.canUseDOM; 1340 var SimpleBar = function(_super) { 1341 __extends(SimpleBar, _super); 1342 function SimpleBar() { 1343 var args = []; 1344 for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i]; 1345 var _this = _super.apply(this, args) || this; 1346 SimpleBar.instances.set(args[0], _this); 1347 return _this; 1348 } 1349 SimpleBar.initDOMLoadedElements = function() { 1350 document.removeEventListener("DOMContentLoaded", this.initDOMLoadedElements); 1351 window.removeEventListener("load", this.initDOMLoadedElements); 1352 Array.prototype.forEach.call(document.querySelectorAll("[data-simplebar]"), (function(el) { 1353 if (el.getAttribute("data-simplebar") !== "init" && !SimpleBar.instances.has(el)) new SimpleBar(el, dist_getOptions(el.attributes)); 1354 })); 1355 }; 1356 SimpleBar.removeObserver = function() { 1357 var _a; 1358 (_a = SimpleBar.globalObserver) === null || _a === void 0 ? void 0 : _a.disconnect(); 1359 }; 1360 SimpleBar.prototype.initDOM = function() { 1361 var _this = this; 1362 var _a, _b, _c; 1363 if (!Array.prototype.filter.call(this.el.children, (function(child) { 1364 return child.classList.contains(_this.classNames.wrapper); 1365 })).length) { 1366 this.wrapperEl = document.createElement("div"); 1367 this.contentWrapperEl = document.createElement("div"); 1368 this.offsetEl = document.createElement("div"); 1369 this.maskEl = document.createElement("div"); 1370 this.contentEl = document.createElement("div"); 1371 this.placeholderEl = document.createElement("div"); 1372 this.heightAutoObserverWrapperEl = document.createElement("div"); 1373 this.heightAutoObserverEl = document.createElement("div"); 1374 dist_addClasses(this.wrapperEl, this.classNames.wrapper); 1375 dist_addClasses(this.contentWrapperEl, this.classNames.c
1375ontentWrapper); 1376 dist_addClasses(this.offsetEl, this.classNames.offset); 1377 dist_addClasses(this.maskEl, this.classNames.mask); 1378 dist_addClasses(this.contentEl, this.classNames.contentEl); 1379 dist_addClasses(this.placeholderEl, this.classNames.placeholder); 1380 dist_addClasses(this.heightAutoObserverWrapperEl, this.classNames.heightAutoObserverWrapperEl); 1381 dist_addClasses(this.heightAutoObserverEl, this.classNames.heightAutoObserverEl); 1382 while (this.el.firstChild) this.contentEl.appendChild(this.el.firstChild); 1383 this.contentWrapperEl.appendChild(this.contentEl); 1384 this.offsetEl.appendChild(this.contentWrapperEl); 1385 this.maskEl.appendChild(this.offsetEl); 1386 this.heightAutoObserverWrapperEl.appendChild(this.heightAutoObserverEl); 1387 this.wrapperEl.appendChild(this.heightAutoObserverWrapperEl); 1388 this.wrapperEl.appendChild(this.maskEl); 1389 this.wrapperEl.appendChild(this.placeholderEl); 1390 this.el.appendChild(this.wrapperEl); 1391 (_a = this.contentWrapperEl) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", this.options.tabIndex.toString()); 1392 (_b = this.contentWrapperEl) === null || _b === void 0 ? void 0 : _b.setAttribute("role", "region"); 1393 (_c = this.contentWrapperEl) === null || _c === void 0 ? void 0 : _c.setAttribute("aria-label", this.options.ariaLabel); 1394 } 1395 if (!this.axis.x.track.el || !this.axis.y.track.el) { 1396 var track = document.createElement("div"); 1397 var scrollbar = document.createElement("div"); 1398 dist_addClasses(track, this.classNames.track); 1399 dist_addClasses(scrollbar, this.classNames.scrollbar); 1400 track.appendChild(scrollbar); 1401 this.axis.x.track.el = track.cloneNode(true); 1402 dist_addClasses(this.axis.x.track.el, this.classNames.horizontal); 1403 this.axis.y.track.el = track.cloneNode(true); 1404 dist_addClasses(this.axis.y.track.el, this.classNames.vertical); 1405 this.el.appendChild(this.axis.x.track.el); 1406 this.el.appendChild(this.axis.y.track.el); 1407 } 1408 SimpleBarCore.prototype.initDOM.call(this); 1409 this.el.setAttribute("data-simplebar", "init"); 1410 }; 1411 SimpleBar.prototype.unMount = function() { 1412 SimpleBarCore.prototype.unMount.call(this); 1413 SimpleBar.instances["delete"](this.el); 1414 }; 1415 SimpleBar.initHtmlApi = function() { 1416 this.initDOMLoadedElements = this.initDOMLoadedElements.bind(this); 1417 if (typeof MutationObserver !== "undefined") { 1418 this.globalObserver = new MutationObserver(SimpleBar.handleMutations); 1419 this.globalObserver.observe(document, { 1420 childList: true, 1421 subtree: true 1422 }); 1423 } 1424 if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) window.setTimeout(this.initDOMLoadedElements); else { 1425 document.addEventListener("DOMContentLoaded", this.initDOMLoadedElements); 1426 window.addEventListener("load", this.initDOMLoadedElements); 1427 } 1428 }; 1429 SimpleBar.handleMutations = function(mutations) { 1430 mutations.forEach((function(mutation) { 1431 mutation.addedNodes.forEach((function(addedNode) { 1432 if (addedNode.nodeType === 1) if (addedNode.hasAttribute("data-simplebar")) !SimpleBar.instances.has(addedNode) && document.documentElement.contains(addedNode) && new SimpleBar(addedNode, dist_getOptions(addedNode.attributes)); else addedNode.querySelectorAll("[data-simplebar]").forEach((function(el) { 1433 if (el.getAttribute("data-simplebar") !== "init" && !SimpleBar.instances.has(el) && document.documentElement.contains(el)) new SimpleBar(el, dist_getOptions(el.attributes)); 1434 })); 1435 }));
1436 mutation.removedNodes.forEach((function(removedNode) { 1437 var _a; 1438 if (removedNode.nodeType === 1) if (removedNode.getAttribute("data-simplebar") === "init") !document.documentElement.contains(removedNode) && ((_a = SimpleBar.instances.get(removedNode)) === null || _a === void 0 ? void 0 : _a.unMount()); else Array.prototype.forEach.call(removedNode.querySelectorAll('[data-simplebar="init"]'), (function(el) { 1439 var _a; 1440 !document.documentElement.contains(el) && ((_a = SimpleBar.instances.get(el)) === null || _a === void 0 ? void 0 : _a.unMount()); 1441 })); 1442 })); 1443 })); 1444 }; 1445 SimpleBar.instances = new WeakMap; 1446 return SimpleBar; 1447 }(SimpleBarCore); 1448 if (dist_canUseDOM) SimpleBar.initHtmlApi(); 1449 let addWindowScrollEvent = false; 1450 setTimeout((() => { 1451 if (addWindowScrollEvent) { 1452 let windowScroll = new Event("windowScroll"); 1453 window.addEventListener("scroll", (function(e) { 1454 document.dispatchEvent(windowScroll); 1455 })); 1456 } 1457 }), 0); 1458 function DynamicAdapt(type) { 1459 this.type = type; 1460 } 1461 DynamicAdapt.prototype.init = function() { 1462 const _this = this; 1463 this.оbjects = []; 1464 this.daClassname = "_dynamic_adapt_"; 1465 this.nodes = document.querySelectorAll("[data-da]"); 1466 for (let i = 0; i < this.nodes.length; i++) { 1467 const node = this.nodes[i]; 1468 const data = node.dataset.da.trim(); 1469 const dataArray = data.split(","); 1470 const оbject = {}; 1471 оbject.element = node; 1472 оbject.parent = node.parentNode; 1473 оbject.destination = document.querySelector(dataArray[0].trim()); 1474 оbject.breakpoint = dataArray[1] ? dataArray[1].trim() : "767"; 1475 оbject.place = dataArray[2] ? dataArray[2].trim() : "last"; 1476 оbject.index = this.indexInParent(оbject.parent, оbject.element); 1477 this.оbjects.push(оbject); 1478 } 1479 this.arraySort(this.оbjects); 1480 this.mediaQueries = Array.prototype.map.call(this.оbjects, (function(item) { 1481 return "(" + this.type + "-width: " + item.breakpoint + "px)," + item.breakpoint; 1482 }), this); 1483 this.mediaQueries = Array.prototype.filter.call(this.mediaQueries, (function(item, index, self) { 1484 return Array.prototype.indexOf.call(self, item) === index; 1485 })); 1486 for (let i = 0; i < this.mediaQueries.length; i++) { 1487 const media = this.mediaQueries[i]; 1488 const mediaSplit = String.prototype.split.call(media, ","); 1489 const matchMedia = window.matchMedia(mediaSplit[0]); 1490 const mediaBreakpoint = mediaSplit[1]; 1491 const оbjectsFilter = Array.prototype.filter.call(this.оbjects, (function(item) { 1492 return item.breakpoint === mediaBreakpoint; 1493 })); 1494 matchMedia.addListener((function() { 1495 _this.mediaHandler(matchMedia, оbjectsFilter); 1496 })); 1497 this.mediaHandler(matchMedia, оbjectsFilter); 1498 } 1499 }; 1500 DynamicAdapt.prototype.mediaHandler = function(matchMedia, оbjects) { 1501 if (matchMedia.matches) for (let i = 0; i < оbjects.length; i++) { 1502 const оbject = оbjects[i]; 1503 оbject.index = this.indexInParent(оbject.parent, оbject.element); 1504 this.moveTo(оbject.place, оbject.element, оbject.destination); 1505 } else for (let i = оbjects.length - 1; i >= 0; i--) { 1506 const оbject = оbjects[i]; 1507 if (оbject.element.classList.contains(this.daClassname)) this.moveBack(оbject.parent, оbject.element, оbject.index); 1508 } 1509 }; 1510 DynamicAdapt.prototype.moveTo = function(place, element, destination) { 1511 element.classList.add(this.daClassname); 1512 if (place === "last" || place >= destination.children.length) { 1513 destination.insertAdjacentElement("beforeend", element); 1514 return; 1515 } 1516 if (place === "first") { 1517 destination.insertAdjacentElement("afterbegin", element); 1518 return; 1519 } 1520 destination.children[place].insertAdjacentElement("beforebegin", element); 1521 }; 1522 DynamicAdapt.prototype.moveBack = function(parent, element, index) { 1523 element.classList.remove(this.daClassname); 1524 if (parent.children[index] !== void 0) parent.children[index].insertAdjacentElement("beforebegin", element); else parent.insertAdjacentElement("beforeend", element); 1525 }; 1526 DynamicAdapt.prototype.indexInParent = function(parent, element) { 1527 const array = Array.prototype.slice.call(parent.children); 1528 return Array.prototype.indexOf.call(array, element); 1529 }; 1530 DynamicAdapt.prototype.arraySort = function(arr) {
1531 if (this.type === "min") Array.prototype.sort.call(arr, (function(a, b) { 1532 if (a.breakpoint === b.breakpoint) { 1533 if (a.place === b.place) return 0; 1534 if (a.place === "first" || b.place === "last") return -1; 1535 if (a.place === "last" || b.place === "first") return 1; 1536 return a.place - b.place; 1537 } 1538 return a.breakpoint - b.breakpoint; 1539 })); else { 1540 Array.prototype.sort.call(arr, (function(a, b) { 1541 if (a.breakpoint === b.breakpoint) { 1542 if (a.place === b.place) return 0; 1543 if (a.place === "first" || b.place === "last") return 1; 1544 if (a.place === "last" || b.place === "first") return -1; 1545 return b.place - a.place; 1546 } 1547 return b.breakpoint - a.breakpoint; 1548 })); 1549 return; 1550 } 1551 }; 1552 const da = new DynamicAdapt("max"); 1553 da.init(); 1554 window.addEventListener("load", (function(e) { 1555 const search = document.querySelector(".header__search"); 1556 if (search) { 1557 const searchMobile = document.querySelector(".search-mobile"); 1558 searchMobile.addEventListener("click", (function(event) { 1559 search.classList.toggle("active"); 1560 })); 1561 document.addEventListener("click", (function(event) { 1562 if (!search.contains(event.target) && search.classList.contains("active")) search.classList.remove("active"); 1563 })); 1564 } 1565 if (document.querySelector(".filter-mobile")) { 1566 const filterMobileBtn = document.querySelector(".filter-mobile__button"); 1567 const filterMobile = document.querySelector(".filter-mobile"); 1568 // filterMobileBtn.addEventListener("click", (() => { 1569 // filterMobile.classList.toggle("open"); 1570 // })); 1571 document.addEventListener("click", (function(event) { 1572 if (!filterMobile.contains(event.target) && filterMobile.classList.contains("open")) filterMobile.classList.remove("open"); 1573 })); 1574 } 1575 function setCookie(name, value, days) { 1576 let expires = ""; 1577 if (days) { 1578 const date = new Date(); 1579 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); 1580 expires = "; expires=" + date.toUTCString(); 1581 } 1582 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 1583 } 1584 const toggle = document.getElementById("toggle"); 1585 1586 if (toggle) { 1587 const body = document.body; 1588 const html = document.documentElement 1589 toggle.addEventListener("change", (() => { 1590 if (toggle.checked) { 1591 body.classList.remove("light-theme"); 1592 html.classList.remove("light-theme"); 1593 setCookie("theme", "dark", 7); 1594 } else { 1595 body.classList.add("light-theme"); 1596 html.classList.remove("light-theme"); 1597 setCookie("theme", "light", 7); 1598 } 1599 })); 1600 } 1601 })); 1602 window["FLS"] = true; 1603 isWebp(); 1604})(); 1605 1606/* End */ 1607; 1608; /* Start:"a:4:{s:4:"full";s:69:"/local/templates/calendario/js/lib/imask/imask.min.js?174790643859248";s:6:"source";s:53:"/local/templates/calendario/js/lib/imask/imask.min.js";s:3:"min";s:53:"/local/templates/calendario/js/lib/imask/imask.min.js";s:3:"map";s:57:"/local/templates/calendario/js/lib/imask/imask.min.js.map";}"*/
vendor: 59,211 bytes, lines 1609-1610
1609!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).IMask={})}(this,(function(t){"use strict";function e(t){return"string"==typeof t||t instanceof String}function s(t){var e;return"object"==typeof t&&null!=t&&"Object"===(null==t||null==(e=t.constructor)?void 0:e.name)}function i(t,e){return Array.isArray(e)?i(t,((t,s)=>e.includes(s))):Object.entries(t).reduce(((t,s)=>{let[i,a]=s;return e(a,i)&&(t[i]=a),t}),{})}const a={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function u(t){switch(t){case a.LEFT:return a.FORCE_LEFT;case a.RIGHT:return a.FORCE_RIGHT;default:return t}}function n(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function r(t,e){if(e===t)return!0;const s=Array.isArray(e),i=Array.isArray(t);let a;if(s&&i){if(e.length!=t.length)return!1;for(a=0;a<e.length;a++)if(!r(e[a],t[a]))return!1;return!0}if(s!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){const s=e instanceof Date,i=t instanceof Date;if(s&&i)return e.getTime()==t.getTime();if(s!=i)return!1;const u=e instanceof RegExp,n=t instanceof RegExp;if(u&&n)return e.toString()==t.toString();if(u!=n)return!1;const h=Object.keys(e);for(a=0;a<h.length;a++)if(!Object.prototype.hasOwnProperty.call(t,h[a]))return!1;for(a=0;a<h.length;a++)if(!r(t[h[a]],e[h[a]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class h{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?a.NONE:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?a.LEFT:a.RIGHT}}function o(t,e){return new o.InputMask(t,e)}function l(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?o.MaskedRegExp:e(t)?o.MaskedPattern:t===Date?o.MaskedDate:t===Number?o.MaskedNumber:Array.isArray(t)||t===Array?o.MaskedDynamic:o.Masked&&t.prototype instanceof o.Masked?t:o.Masked&&t instanceof o.Masked?t.constructor:t instanceof Function?o.MaskedFunction:(console.warn("Mask not found for mask",t),o.Masked)}function p(t){if(!t)throw new Error("Options in not defined");if(o.Masked){if(t.prototype instanceof o.Masked)return{mask:t};const{mask:e,...a}=t instanceof o.Masked?{mask:t}:s(t)&&t.mask instanceof o.Masked?t:{};if(e){const t=e.mask;return{...i(e,((t,e)=>!e.startsWith("_"))),mask:e.constructor,_mask:t,...a}}}return s(t)?{...t}:{mask:t}}function d(t){if(o.Masked&&t instanceof o.Masked)return t;const e=p(t),s=l(e.mask);if(!s)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===s&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new s(e)}o.createMask=d;class c{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}o.MaskElement=c;class g extends c{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e,s;return null!=(t=null==(e=(s=this.input).getRootNode)?void 0:e.call(s))?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){return this._handlers.redo&&(90===t.keyCode&&t.shiftKey&&(t.metaKey||t.ctrlKey)||89===t.keyCode&&t.ctrlKey)?(t.preventDefault(),this._handlers.redo(t)):this._handlers.undo&&90===t.keyCode&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),this._handlers.undo(t)):void(t.isComposing||this._handlers.selectionChange(t))}_onBeforeinput(t){return"historyUndo"===t.inputType&&this._handlers.undo?(t.preventDefault(),this._handlers.undo(t)):"historyRedo"===t.inputType&&this._handlers.redo?(t.preventDefault(),this._handlers.redo(t)):void 0}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}o.HTMLMaskElement=g;class k extends g{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}o.HTMLMaskElement=g;class m extends g{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s<i?s:i}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s>i?s:i}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,t),s.setEnd(this.input.lastChild||this.input,e);const i=this.rootElement,a=i.getSelection&&i.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}o.HTMLContenteditableMaskElement=m;class _{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>_.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}_.MAX_LENGTH=100;class f{constructor(t,e){this.el=t instanceof c?t:t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?new m(t):new k(t),this.masked=d(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new _,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var e;return null==t||(null==(e=this.masked)?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof o.Masked)&&this.masked.constructor===l(t))return void this.masked.updateOptions({mask:t});const e=t instanceof o.Masked?t:d({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const s=this._listeners[t];s&&s.forEach((t=>t(e)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const e=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,u=this.unmaskedValue!==e||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=e,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),"auto"===t?this.alignCursor():null!=t&&(this.cursorPos=t),u&&this._fireChangeEvents(),this._historyChanging||!u&&!this.history.isEmpty||this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...s}=t,i=!this.maskEquals(e),a=this.masked.optionsIsChanged(s);i&&(this.mask=e),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout((()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())}),10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,a.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const e=new h({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,u=s===this.masked.rawInputValue?e.removeDirection:a.NONE;let n=this.masked.nearestInputPos(e.startChangePos+i,u);u!==a.NONE&&(n=this.masked.nearestInputPos(n,a.NONE)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}o.InputMask=f;class v{static normalize(t){return Array.isArray(t)?t:[t,new v]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}o.ChangeDetails=v;class E{constructor(t,e,s){void 0===t&&(t=""),void 0===e&&(e=0),this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||null!=t&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class C{constructor(t){this._value="",this._update({...C.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){void 0===e&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new E(this.extractInput(t,e),t)}appendTail(t){return e(t)&&(t=new E(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new v({inserted:t,rawInserted:t})):new v}_appendChar(t,e,s){void 0===e&&(e={});const i=this.state;let a;if([t,a]=this.doPrepareChar(t,e),t&&(a=a.aggregate(this._appendCharRaw(t,e)),!a.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=i;let u=this.pad(e);const n=this._appendCharRaw(t,e);u=u.aggregate(n),n.rawInserted||u.equals(a)?a=u:this.state=s}if(a.inserted){let t,u=!1!==this.doValidate(e);if(u&&null!=s){const e=this.state;if(!0===this.overwrite){t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.unshift(this.displayValue.length-a.tailShift)}let i=this.appendTail(s);if(u=i.rawInserted.length===s.toString().length,!(u&&i.inserted||"shift"!==this.overwrite)){this.state=e,t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.shift();i=this.appendTail(s),u=i.rawInserted.length===s.toString().length}u&&i.inserted&&(this.state=e)}u||(a=new v,this.state=i,s&&t&&(s.state=t))}return a}_appendPlaceholder(){return new v}_appendEager(){return new v}append(t,s,i){if(!e(t))throw new Error("value should be string");const a=e(i)?new E(String(i)):i;let u;null!=s&&s.tail&&(s._beforeTailState=this.state),[t,u]=this.doPrepare(t,s);for(let e=0;e<t.length;++e){const i=this._appendChar(t[e],s,a);if(!i.rawInserted&&!this.doSkipInvalid(t[e],s,a))break;u.aggregate(i)}return(!0===this.eager||"append"===this.eager)&&null!=s&&s.input&&t&&u.aggregate(this._appendEager()),null!=a&&(u.tailShift+=this.appendTail(a).tailShift),u}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new v}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,s=this.value,i=t();return this.rawInputValue=e,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,s=t(this);return this.state=e,delete this._isolated,s}doSkipInvalid(t,e,s){return Boolean(this.skipInvalid)}doPrepare(t,e){return void 0===e&&(e={}),v.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return void 0===e&&(e={}),v.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,i,n){void 0===s&&(s=""),void 0===i&&(i=a.NONE),void 0===n&&(n={input:!0});const r=t+e,h=this.extractTail(r),o=!0===this.eager||"remove"===this.eager;let l;o&&(i=u(i),l=this.extractInput(0,r,{raw:!0}));let p=t;const d=new v;if(i!==a.NONE&&(p=this.nearestInputPos(t,e>1&&0!==t&&!o?a.NONE:i),d.tailShift=p-t),d.aggregate(this.remove(p)),o&&i!==a.NONE&&l===this.rawInputValue)if(i===a.FORCE_LEFT){let t;for(;l===this.rawInputValue&&(t=this.displayValue.length);)d.aggregate(new v({tailShift:-1})).aggregate(this.remove(t-1))}else i===a.FORCE_RIGHT&&h.unshift();return d.aggregate(this.append(s,n,h))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!r(this,t)}typedValueEquals(t){const e=this.typedValue;return t===e||C.EMPTY_VALUES.includes(t)&&C.EMPTY_VALUES.includes(e)||!!this.format&&this.format(t,this)===this.format(this.typedValue,this)}pad(t){return new v}}C.DEFAULTS={skipInvalid:!0},C.EMPTY_VALUES=[void 0,null,""],o.Masked=C;class A{constructor(t,e){void 0===t&&(t=[]),void 0===e&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=e(t)?new E(String(t)):t;const s=this.chunks[this.chunks.length-1],i=s&&(s.stop===t.stop||null==t.stop)&&t.from===s.from+s.toString().length;if(t instanceof E)i?s.extend(t.toString()):this.chunks.push(t);else if(t instanceof A){if(null==t.stop){let e;for(;t.chunks.length&&null==t.chunks[0].stop;)e=t.chunks.shift(),e.from+=t.from,this.extend(e)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof o.MaskedPattern)){return new E(this.toString()).appendTo(t)}const e=new v;for(let s=0;s<this.chunks.length;++s){const i=this.chunks[s],a=t._mapPosToBlock(t.displayValue.length),u=i.stop;let n;if(null!=u&&(!a||a.index<=u)&&((i instanceof A||t._stops.indexOf(u)>=0)&&e.aggregate(t._appendPlaceholder(u)),n=i instanceof A&&t._blocks[u]),n){const s=n.appendTail(i);e.aggregate(s);const a=i.toString().slice(s.rawInserted.length);a&&e.aggregate(t.append(a,{tail:!0}))}else e.aggregate(t.append(i.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map((t=>t.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...s}=t;Object.assign(this,s),this.chunks=e.map((t=>{const e="chunks"in t?new A:new E;return e.state=t,e}))}unshift(t){if(!this.chunks.length||null!=t&&this.from>=t)return"";const e=null!=t?t-this.from:t;let s=0;for(;s<this.chunks.length;){const t=this.chunks[s],i=t.unshift(e);if(t.toString()){if(!i)break;++s}else this.chunks.splice(s,1);if(i)return i}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],s=e.shift();if(e.toString()){if(!s)break;--t}else this.chunks.splice(t,1);if(s)return s}return""}}class F{constructor(t,e){this.masked=t,this._log=[];const{offset:s,index:i}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(e=this.block)?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,a.FORCE_LEFT),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,a.LEFT),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,a.LEFT),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,a.FORCE_RIGHT),this.offset!==this.block.value.length||void 0}))}pushRightBeforeInput(){return this._pushRight((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,a.NONE),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,a.NONE),!0}))}}class x{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new v}nearestInputPos(t,e){void 0===e&&(e=a.NONE);const s=this._value.length;switch(e){case a.LEFT:case a.FORCE_LEFT:return 0;default:return s}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new v;const s=!0===this.eager||"append"===this.eager,i=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!s)&&!e.tail,a=new v({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(e.raw||e.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new v;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new E("")}appendTail(t){return e(t)&&(t=new E(String(t))),t.appendTo(this)}append(t,e,s){const i=this._appendChar(t[0],e);return null!=s&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=Boolean(t._rawInputValue)}pad(t){return this._appendPlaceholder()}}class S{constructor(t){const{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:u,eager:n,...r}=t;this.masked=d(r),Object.assign(this,{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:u,eager:n})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),0===t&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new v}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new v;const s=this.masked.state;let i=this.masked._appendChar(t,this.currentMaskFlags(e));return i.inserted&&!1===this.doValidate(e)&&(i=new v,this.masked.state=s),i.inserted||this.isOptional||this.lazy||e.input||(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=Boolean(i.inserted),i}append(t,e,s){return this.masked.append(t,this.currentMaskFlags(e),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new v:(this.isFilled=!0,new v({inserted:this.placeholderChar}))}_appendEager(){return new v}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.masked.extractInput(t,e,s)}nearestInputPos(t,e){void 0===e&&(e=a.NONE);const s=this.value.length,i=Math.min(Math.max(t,0),s);switch(e){case a.LEFT:case a.FORCE_LEFT:return this.isComplete?i:0;case a.RIGHT:case a.FORCE_RIGHT:return this.isComplete?i:s;default:return i}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(null==t||null==(e=t._beforeTailState)?void 0:e.masked)||(null==t?void 0:t._beforeTailState)}}pad(t){return new v}}S.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class B extends C{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=t=>t.search(e)>=0),super._update(t)}}o.MaskedRegExp=B;class b extends C{constructor(t){super({...b.DEFAULTS,...t,definitions:Object.assign({},S.DEFAULT_DEFINITIONS,null==t?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let s=!1,i=!1;for(let a=0;a<e.length;++a){if(this.blocks){const t=e.slice(a),s=Object.keys(this.blocks).filter((e=>0===t.indexOf(e)));s.sort(((t,e)=>e.length-t.length));const i=s[0];if(i){const{expose:t,repeat:e,...s}=p(this.blocks[i]),u={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:e,parent:this},n=null!=e?new o.RepeatBlock(u):d(u);n&&(this._blocks.push(n),t&&(this.exposeBlock=n),this._maskedBlocks[i]||(this._maskedBlocks[i]=[]),this._maskedBlocks[i].push(this._blocks.length-1)),a+=i.length-1;continue}}let u=e[a],n=u in t;if(u===b.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===u||"}"===u){s=!s;continue}if("["===u||"]"===u){i=!i;continue}if(u===b.ESCAPE_CHAR){if(++a,u=e[a],!u)break;n=!1}const r=n?new S({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...p(t[u]),parent:this}):new x({char:u,eager:this.eager,isUnmasking:s});this._blocks.push(r)}}get state(){return{...super.state,_blocks:this._blocks.map((t=>t.state))}}set state(t){if(!t)return void this.reset();const{_blocks:e,...s}=t;this._blocks.forEach(((t,s)=>t.state=e[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((t=>t.reset()))}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every((t=>t.isComplete))}get isFilled(){return this._blocks.every((t=>t.isFilled))}get isFixed(){return this._blocks.every((t=>t.isFixed))}get isOptional(){return this._blocks.every((t=>t.isOptional))}doCommit(){this._blocks.forEach((t=>t.doCommit())),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce(((t,e)=>t+e.unmaskedValue),"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce(((t,e)=>t+e.value),"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce(((t,e)=>t+e.displayValue),"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new v;let s=null==(t=this._mapPosToBlock(this.displayValue.length))?void 0:t.index;if(null==s)return e;this._blocks[s].isFilled&&++s;for(let t=s;t<this._blocks.length;++t){const s=this._blocks[t]._appendEager();if(!s.inserted)break;e.aggregate(s)}return e}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._mapPosToBlock(this.displayValue.length),i=new v;if(!s)return i;for(let u,n=s.index;u=this._blocks[n];++n){var a;const s=u._appendChar(t,{...e,_beforeTailState:null==(a=e._beforeTailState)||null==(a=a._blocks)?void 0:a[n]});if(i.aggregate(s),s.consumed)break}return i}extractTail(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=new A;return t===e||this._forEachBlocksInRange(t,e,((t,e,i,a)=>{const u=t.extractTail(i,a);u.stop=this._findStopBefore(e),u.from=this._blockStartPos(e),u instanceof A&&(u.blockIndex=e),s.extend(u)})),s}extractInput(t,e,s){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),void 0===s&&(s={}),t===e)return"";let i="";return this._forEachBlocksInRange(t,e,((t,e,a,u)=>{i+=t.extractInput(a,u,s)})),i}_findStopBefore(t){let e;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(!(i<=t))break;e=i}return e}_appendPlaceholder(t){const e=new v;if(this.lazy&&null==t)return e;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return e;const i=s.index,a=null!=t?t:this._blocks.length;return this._blocks.slice(i,a).forEach((s=>{var i;s.lazy&&null==t||e.aggregate(s._appendPlaceholder(null==(i=s._blocks)?void 0:i.length))})),e}_mapPosToBlock(t){let e="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],a=e.length;if(e+=i.displayValue,t<=e.length)return{index:s,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce(((t,e)=>t+e.displayValue.length),0)}_forEachBlocksInRange(t,e,s){void 0===e&&(e=this.displayValue.length);const i=this._mapPosToBlock(t);if(i){const t=this._mapPosToBlock(e),a=t&&i.index===t.index,u=i.offset,n=t&&a?t.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,u,n),t&&!a){for(let e=i.index+1;e<t.index;++e)s(this._blocks[e],e,0,this._blocks[e].displayValue.length);s(this._blocks[t.index],t.index,0,t.offset)}}}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._forEachBlocksInRange(t,e,((t,e,i,a)=>{s.aggregate(t.remove(i,a))})),s}nearestInputPos(t,e){if(void 0===e&&(e=a.NONE),!this._blocks.length)return 0;const s=new F(this,t);if(e===a.NONE)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(e===a.LEFT||e===a.FORCE_LEFT){if(e===a.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===t)return t;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),e===a.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=t)return s.pos;if(s.popState(),s.ok&&s.pos<=t)return s.pos;s.popState()}return s.ok?s.pos:e===a.FORCE_LEFT?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return e===a.RIGHT||e===a.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:e===a.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(t,a.LEFT)))):t}totalInputPositions(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);let s=0;return this._forEachBlocksInRange(t,e,((t,e,i,a)=>{s+=t.totalInputPositions(i,a)})),s}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map((t=>this._blocks[t])):[]}pad(t){const e=new v;return this._forEachBlocksInRange(0,this.displayValue.length,(s=>e.aggregate(s.pad(t)))),e}}b.DEFAULTS={...C.DEFAULTS,lazy:!0,placeholderChar:"_"},b.STOP_CHAR="`",b.ESCAPE_CHAR="\\",b.InputDefinition=S,b.FixedDefinition=x,o.MaskedPattern=b;class D extends b{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...u}=t;this.to=e,this.from=s,this.maxLength=Math.max(String(e).length,i),this.autofix=a;const n=String(this.from).padStart(this.maxLength,"0"),r=String(this.to).padStart(this.maxLength,"0");let h=0;for(;h<r.length&&r[h]===n[h];)++h;u.mask=r.slice(0,h).replace(/0/g,"\\0")+"0".repeat(this.maxLength-h),super._update(u)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",s="";const[,i,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(e="0".repeat(i.length)+a,s="9".repeat(i.length)+a),e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[e,s]}doPrepareChar(t,e){let s;return void 0===e&&(e={}),[t,s]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(s.skip=!this.isComplete),[t,s]}_appendCharRaw(t,e){if(void 0===e&&(e={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,e);const s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,u]=this.boundaries(this.value+t);return Number(u)<this.from?super._appendCharRaw(s[this.value.length],e):Number(a)>this.to?!e.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(i[this.value.length],e):super._appendCharRaw(t,e)}doValidate(t){const e=this.value;if(-1===e.search(/[^0]/)&&e.length<=this._matchFrom)return!0;const[s,i]=this.boundaries(e);return this.from<=Number(i)&&Number(s)<=this.to&&super.doValidate(t)}pad(t){const e=new v;if(this.value.length===this.maxLength)return e;const s=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let s=0;s<i;++s)e.aggregate(super._appendCharRaw("0",t));s.split("").forEach((t=>this._appendCharRaw(t)))}return e}}o.MaskedRange=D;class y extends b{static extractPatternOptions(t){const{mask:s,pattern:i,...a}=t;return{...a,mask:e(s)?s:i}}constructor(t){super(y.extractPatternOptions({...y.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:s,pattern:i,blocks:a,...u}={...y.DEFAULTS,...t},n=Object.assign({},y.GET_DEFAULT_BLOCKS());t.min&&(n.Y.from=t.min.getFullYear()),t.max&&(n.Y.to=t.max.getFullYear()),t.min&&t.max&&n.Y.from===n.Y.to&&(n.m.from=t.min.getMonth()+1,n.m.to=t.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=t.min.getDate(),n.d.to=t.max.getDate())),Object.assign(n,this.blocks,a),super._update({...u,mask:e(s)?s:i,blocks:n})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&null!=e&&(null==this.min||this.min<=e)&&(null==this.max||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(y.extractPatternOptions(t))}}y.GET_DEFAULT_BLOCKS=()=>({d:{mask:D,from:1,to:31,maxLength:2},m:{mask:D,from:1,to:12,maxLength:2},Y:{mask:D,from:1900,to:9999}}),y.DEFAULTS={...b.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(t,e)=>{if(!t)return"";return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:(t,e)=>{const[s,i,a]=t.split(".").map(Number);return new Date(a,i-1,s)}},o.MaskedDate=y;class M extends C{constructor(t){super({...M.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map((t=>{const{expose:e,...s}=p(t),i=d({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return e&&(this.exposeMask=i),i})):[])}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._applyDispatch(t,e);return this.currentMask&&s.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),s}_applyDispatch(t,e,s){void 0===t&&(t=""),void 0===e&&(e={}),void 0===s&&(s="");const i=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,a=this.rawInputValue,u=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:a,n=a.slice(u.length),r=this.currentMask,h=new v,o=null==r?void 0:r.state;return this.currentMask=this.doDispatch(t,{...e},s),this.currentMask&&(this.currentMask!==r?(this.currentMask.reset(),u&&(this.currentMask.append(u,{raw:!0}),h.tailShift=this.currentMask.value.length-i.length),n&&(h.tailShift+=this.currentMask.append(n,{raw:!0,tail:!0}).tailShift)):o&&(this.currentMask.state=o)),h}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new v;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,s;return{...t,_beforeTailState:(null==(e=t._beforeTailState)?void 0:e.currentMaskRef)===this.currentMask&&(null==(s=t._beforeTailState)?void 0:s.currentMask)||t._beforeTailState}}doDispatch(t,e,s){return void 0===e&&(e={}),void 0===s&&(s=""),this.dispatch(t,this,e,s)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){void 0===e&&(e={});let[s,i]=super.doPrepare(t,e);if(this.currentMask){let t;[s,t]=super.doPrepare(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}doPrepareChar(t,e){void 0===e&&(e={});let[s,i]=super.doPrepareChar(t,e);if(this.currentMask){let t;[s,t]=super.doPrepareChar(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}reset(){var t;null==(t=this.currentMask)||t.reset(),this.compiledMasks.forEach((t=>t.reset()))}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask)return this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,void this._applyDispatch();let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isFilled)}remove(t,e){const s=new v;return this.currentMask&&s.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),s}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((t=>t.state)),currentMaskRef:this.currentMask,currentMask:null==(t=this.currentMask)?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:s,currentMask:i,...a}=t;e&&this.compiledMasks.forEach(((t,s)=>t.state=e[s])),null!=s&&(this.currentMask=s,this.currentMask.state=i),super.state=a}extractInput(t,e,s){return this.currentMask?this.currentMask.extractInput(t,e,s):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every(((e,s)=>{if(!t[s])return;const{mask:i,...a}=t[s];return r(e,a)&&e.maskEquals(i)})):super.maskEquals(t)}typedValueEquals(t){var e;return Boolean(null==(e=this.currentMask)?void 0:e.typedValueEquals(t))}}M.DEFAULTS={...C.DEFAULTS,dispatch:(t,e,s,i)=>{if(!e.compiledMasks.length)return;const u=e.rawInputValue,n=e.compiledMasks.map(((n,r)=>{const h=e.currentMask===n,o=h?n.displayValue.length:n.nearestInputPos(n.displayValue.length,a.FORCE_LEFT);return n.rawInputValue!==u?(n.reset(),n.append(u,{raw:!0})):h||n.remove(o),n.append(t,e.currentMaskFlags(s)),n.appendTail(i),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,a.FORCE_LEFT)))}}));return n.sort(((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions)),e.compiledMasks[n[0].index]}},o.MaskedDynamic=M;class I extends b{constructor(t){super({...I.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...s}=t;if(e){const t=e.map((t=>t.length)),i=Math.min(...t),a=Math.max(...t)-i;s.mask="*".repeat(i),a&&(s.mask+="["+"*".repeat(a)+"]"),this.enum=e}super._update(s)}_appendCharRaw(t,e){void 0===e&&(e={});const s=Math.min(this.nearestInputPos(0,a.FORCE_RIGHT),this.value.length),i=this.enum.filter((e=>this.matchValue(e,this.unmaskedValue+t,s)));if(i.length){1===i.length&&this._forEachBlocksInRange(0,this.value.length,((t,s)=>{const a=i[0][s];s>=this.value.length||a===t.value||(t.reset(),t._appendChar(a,e))}));const t=super._appendCharRaw(i[0][this.value.length],e);return 1===i.length&&i[0].slice(this.unmaskedValue.length).split("").forEach((e=>t.aggregate(super._appendCharRaw(e)))),t}return new v({skip:!this.isComplete})}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new E("",t)}remove(t,e){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),t===e)return new v;const s=Math.min(super.nearestInputPos(0,a.FORCE_RIGHT),this.value.length);let i;for(i=t;i>=0;--i){if(this.enum.filter((t=>this.matchValue(t,this.value.slice(s,i),s))).length>1)break}const u=super.remove(i,e);return u.tailShift+=i-t,u}get isComplete(){return this.enum.indexOf(this.value)>=0}}I.DEFAULTS={...b.DEFAULTS,matchValue:(t,e,s)=>t.indexOf(e,s)===s},o.MaskedEnum=I;class V extends C{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}var T;o.MaskedFunction=V;class w extends C{constructor(t){super({...w.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+n(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(n).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(n(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){void 0===e&&(e={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!s&&(i.skip=!0),!s||this.allowPositive||this.value||"-"===s||i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(t,e){void 0===e&&(e=!1);let s=0;for(let i=0;i<t;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(t){return void 0===t&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t,e){void 0===e&&(e={});const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const u=this.number;let n,r=!isNaN(u),h=!1;if(r){let t;null!=this.min&&this.min<0&&this.number<this.min&&(t=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(t=this.max),null!=t&&(this.autofix?(this._value=this.format(t,this).replace(w.UNMASKED_RADIX,this.radix),h||(h=a===this._value&&!e.tail)):r=!1),r&&(r=Boolean(this._value.match(this._numberRegExp)))}r?n=new v({inserted:this._value.slice(a.length),rawInserted:h?"":t,skip:h}):(this._value=a,n=new v),this._value=this._insertThousandsSeparators(this._value);const o=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(o);return n.tailShift+=(l-i)*this.thousandsSeparator.length,n}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){const s=this._findSeparatorAround(t);s>=0&&(t=s);const i=this._findSeparatorAround(e);return i>=0&&(e=i+this.thousandsSeparator.length),[t,e]}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const s=this.value.slice(0,t),i=this.value.slice(e),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const u=this._separatorsCountFromSlice(s);return new v({tailShift:(u-a)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case a.NONE:case a.LEFT:case a.FORCE_LEFT:{const s=this._findSeparatorAround(t-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(t<i||this.value.length<=i||e===a.FORCE_LEFT)return s}break}case a.RIGHT:case a.FORCE_RIGHT:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,((t,e,s,i)=>e+i)),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,s){void 0===e&&(e={});const i=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===w.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,w.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(w.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&this.min>0||null!=this.max&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||w.EMPTY_VALUES.includes(t)&&w.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}T=w,w.UNMASKED_RADIX=".",w.EMPTY_VALUES=[...C.EMPTY_VALUES,0],w.DEFAULTS={...C.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[T.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},o.MaskedNumber=w;const R={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function P(t,e,s){void 0===e&&(e=R.MASKED),void 0===s&&(s=R.MASKED);const i=d(t);return t=>i.runIsolated((i=>(i[e]=t,i[s])))}function O(t,e,s,i){return P(e,s,i)(t)}o.PIPE_TYPE=R,o.createPipe=P,o.pipe=O;class L extends b{get repeatFrom(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?t:0}get repeatTo(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e,s,i;const{repeat:a,...u}=p(t);this._blockOpts=Object.assign({},this._blockOpts,u);const n=d(this._blockOpts);this.repeat=null!=(e=null!=(s=null!=a?a:n.repeat)?s:this.repeat)?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(i=this._blocks)?void 0:i.length)||0,this.repeatFrom)),blocks:{m:n},eager:n.eager,overwrite:n.overwrite,skipInvalid:n.skipInvalid,lazy:n.lazy,placeholderChar:n.placeholderChar,displayChar:n.displayChar})}_allocateBlock(t){return t<this._blocks.length?this._blocks[t]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(d(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(t,e){void 0===e&&(e={});const s=new v;for(let r,h,o=null!=(i=null==(a=this._mapPosToBlock(this.displayValue.length))?void 0:a.index)?i:Math.max(this._blocks.length-1,0);r=null!=(u=this._blocks[o])?u:h=!h&&this._allocateBlock(o);++o){var i,a,u,n;const l=r._appendChar(t,{...e,_beforeTailState:null==(n=e._beforeTailState)||null==(n=n._blocks)?void 0:n[o]});if(l.skip&&h){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(l),l.consumed)break}return s}_trimEmptyTail(t,e){var s,i;void 0===t&&(t=0);const a=Math.max((null==(s=this._mapPosToBlock(t))?void 0:s.index)||0,this.repeatFrom,0);let u;null!=e&&(u=null==(i=this._mapPosToBlock(e))?void 0:i.index),null==u&&(u=this._blocks.length-1);let n=0;for(let t=u;a<=t&&!this._blocks[t].unmaskedValue;--t,++n);n&&(this._blocks.splice(u-n+1,n),this.mask=this.mask.slice(n))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._trimEmptyTail(t,e),s}totalInputPositions(t,e){return void 0===t&&(t=0),null==e&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}o.RepeatBlock=L;try{globalThis.IMask=o}catch{}t.ChangeDetails=v,t.ChunksTailDetails=A,t.DIRECTION=a,t.HTMLContenteditableMaskElement=m,t.HTMLInputMaskElement=k,t.HTMLMaskElement=g,t.InputMask=f,t.MaskElement=c,t.Masked=C,t.MaskedDate=y,t.MaskedDynamic=M,t.MaskedEnum=I,t.MaskedFunction=V,t.MaskedNumber=w,t.MaskedPattern=b,t.MaskedRange=D,t.MaskedRegExp=B,t.PIPE_TYPE=R,t.PatternFixedDefinition=x,t.PatternInputDefinition=S,t.RepeatBlock=L,t.createMask=d,t.createPipe=P,t.default=o,t.forceDirection=u,t.normalizeOpts=p,t.pipe=O,Object.defineProperty(t,"__esModule",{value:!0})})); 1610/
vendor: 49,279 bytes, lines 1610-1618
1610* End */ 1611; 1612; /* Start:"a:4:{s:4:"full";s:83:"/local/templates/calendario/js/lib/air-datepicker/air-datepicker.js?174790643848711";s:6:"source";s:67:"/local/templates/calendario/js/lib/air-datepicker/air-datepicker.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 1613!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AirDatepicker=t():e.AirDatepicker=t()}(this,(function(){return function(){"use strict";var e={d:function(t,i){for(var s in i)e.o(i,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:i[s]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return R}});var i={days:"days",months:"months",years:"years",day:"day",month:"month",year:"year",eventChangeViewDate:"changeViewDate",eventChangeCurrentView:"changeCurrentView",eventChangeFocusDate:"changeFocusDate",eventChangeSelectedDate:"changeSelectedDate",eventChangeTime:"changeTime",eventChangeLastSelectedDate:"changeLastSelectedDate",actionSelectDate:"selectDate",actionUnselectDate:"unselectDate",cssClassWeekend:"-weekend-"},s={classes:"",inline:!1,locale:{days:["ÐоÑкÑеÑенÑе","ÐонеделÑник","ÐÑоÑник","СÑеда","ЧеÑвеÑг","ÐÑÑниÑа","СÑббоÑа"],daysShort:["ÐоÑ","Ðон","ÐÑо","СÑе","ЧеÑ","ÐÑÑ","СÑб"],daysMin:["ÐÑ","Ðн","ÐÑ","СÑ","ЧÑ","ÐÑ","Сб"],months:["ЯнваÑÑ","ФевÑалÑ","ÐаÑÑ","ÐпÑелÑ","Ðай","ÐÑнÑ","ÐÑлÑ","ÐвгÑÑÑ","СенÑÑбÑÑ","ÐкÑÑбÑÑ","ÐоÑбÑÑ","ÐекабÑÑ"],monthsShort:["Янв","Фев","ÐаÑ","ÐпÑ","Ðай","ÐÑн","ÐÑл","Ðвг","Сен","ÐкÑ","ÐоÑ","Ðек"],today:"СегоднÑ",clear:"ÐÑиÑÑиÑÑ",dateFormat:"dd.MM.yyyy",timeFormat:"HH:mm",firstDay:1},startDate:new Date,firstDay:"",weekends:[6,0],dateFormat:"",altField:"",altFieldDateFormat:"T",toggleSelected:!0,keyboardNav:!0,selectedDates:!1,container:"",isMobile:!1,visible:!1,position:"bottom left",offset:12,view:i.days,minView:i.days,showOtherMonths:!0,selectOtherMonths:!0,moveToOtherMonthsOnSelect:!0,showOtherYears:!0,selectOtherYears:!0,moveToOtherYearsOnSelect:!0,minDate:"",maxDate:"",disableNavWhenOutOfRange:!0,multipleDates:!1,multipleDatesSeparator:", ",range:!1,dynamicRange:!0,buttons:!1,monthsField:"monthsShort",showEvent:"focus",autoClose:!1,fixedHeight:!1,prevHtml:'<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>',nextHtml:'<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>',navTitles:{days:"MMMM, <i>yyyy</i>",months:"yyyy",years:"yyyy1 - yyyy2"},timepicker:!1,onlyTimepicker:!1,dateTimeSeparator:" ",timeFormat:"",minHours:0,maxHours:24,minMinutes:0,maxMinutes:59,hoursStep:1,minutesStep:1,onSelect:!1,onChangeViewDate:!1,onChangeView:!1,onRenderCell:!1,onShow:!1,onHide:!1,onClickDayName:!1};function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return"string"==typeof e?t.querySelector(e):e}function n(){let{tagName:e="div",className:t="",innerHtml:i="",id:s="",attrs:a={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=document.createElement(e);return t&&n.classList.add(...t.split(" ")),s&&(n.id=s),i&&(n.innerHTML=i),a&&r(n,a),n}function r(e,t){for(let[i,s]of Object.entries(t))void 0!==s&&e.setAttribute(i,s);return e}function o(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()}function h(e){let t=e.getHours(),{hours:i,dayPeriod:s}=l(t);return{year:e.getFullYear(),month:e.getMonth(),fullMonth:e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1,date:e.getDate(),fullDate:e.getDate()<10?"0"+e.getDate():e.getDate(),day:e.getDay(),hours:t,fullHours:d(t),hours12:i,dayPeriod:s,fullHours12:d(i),minutes:e.getMinutes(),fullMinutes:e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}}function l(e){return{dayPeriod:e>11?"pm":"am",hours:e%12==0?12:e%12}}function d(e){return e<10?"0"+e:e}function c(e){let t=10*Math.floor(e.getFullYear()/10);return[t,t+9]}function u(){let e=[];for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return i.forEach((t=>{if("object"==typeof t)for(let i in t)t[i]&&e.push(i);else t&&e.push(t)})),e.join(" ")}function p(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.days;if(!e||!t)return!1;let a=h(e),n=h(t);return{[i.days]:a.date===n.date&&a.month===n.month&&a.year===n.year,[i.months]:a.month===n.month&&a.year===n.year,[i.years]:a.year===n.year}[s]}function m(e,t,i){let s=g(e,!1).getTime(),a=g(t,!1).getTime();return i?s>=a:s>a}function v(e,t){return!m(e,t,!0)}function g(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=new Date(e.getTime());return"boolean"!=typeof t||t||function(e){e.setHours(0,0,0,0)}(i),i}function D(e,t,i){e.length?e.forEach((e=>{e.addEventListener(t,i)})):e.addEventListener(t,i)}function y(e,t){return!(!e||e===document||e instanceof DocumentFragment)&&(e.matches(t)?e:y(e.parentNode,t))}function f(e,t,i){return e>i?i:e<t?t:e}function w(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];return i.filter((e=>e)).forEach((t=>{for(let[i,s]of Object.entries(t))if(void 0!==s&&"[object Object]"===s.toString()){let t=void 0!==e[i]?e[i].toString():void 0,a=s.toString(),n=Array.isArray(s)?[]:{};e[i]=e[i]?t!==a?n:e[i]:n,w(e[i],s)}else e[i]=s})),e}function b(e){let t=e;return e instanceof Date||("string"==typeof e&&/^\d{4}-\d{2}-\d{2}$/.test(e)&&(e+="T00:00:00"),t=new Date(e)),isNaN(t.getTime())&&(console.log(`Unable to convert value "${e}" to Date object`),t=!1),t}function k(e){let t="\\s|\\.|-|/|\\\\|,|\\$|\\!|\\?|:|;";return new RegExp("(^|>|"+t+")("+e+")($|<|"+t+")","g")}function $(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class C{constructor(){let{type:e,date:t,dp:i,opts:s,body:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$(this,"focus",(()=>{this.$cell.classList.add("-focus-"),this.focused=!0})),$(this,"removeFocus",(()=>{this.$cell.classList.remove("-focus-"),this.focused=!1})),$(this,"select",(()=>{this.$cell.classList.add("-selected-"),this.selected=!0})),$(this,"removeSelect",(()=>{this.$cell.classList.remove("-selected-","-range-from-","-range-to-"),this.selected=!1})),$(this,"onChangeSelectedDate",(()=>{this.isDisabled||(this._handleSelectedStatus(),this.opts.range&&this._handleRangeStatus())})),$(this,"onChangeFocusDate",(e=>{if(!e)return void(this.focused&&this.removeFocus());let t=p(e,this.date,this.type);t?this.focus():!t&&this.focused&&this.removeFocus(),this.opts.range&&this._handleRangeStatus()})),$(this,"render",(()=>(this.$cell.innerHTML=this._getHtml(),this._handleClasses(),this.$cell))),this.type=e,this.singleType=this.type.slice(0,-1),this.date=t,this.dp=i,this.opts=s,this.body=a,this.customData=!1,this.init()}init(){var e;let{onRenderCell:t}=this.opts;t&&(this.customData=t({date:this.date,cellType:this.singleType,datepicker:this.dp})),this._createElement(),this._bindDatepickerEvents(),null!==(e=this.customData)&&void 0!==e&&e.disabled&&this.dp.disableDate(this.date)}_bindDatepickerEvents(){this.dp.on(i.eventChangeSelectedDate,this.onChangeSelectedDate),this.dp.on(i.eventChangeFocusDate,this.onChangeFocusDate)}unbindDatepickerEvents(){this.dp.off(i.eventChangeSelectedDate,this.onChangeSelectedDate),this.dp.off(i.eventChangeFocusDate,this.onChangeFocusDate)}_createElement(){var e;let{year:t,month:i,date:s}=h(this.date),a=(null===(e=this.customData)||void 0===e?void 0:e.attrs)||{};this.$cell=n({attrs:{"data-year":t,"data-month":i,"data-date":s,...a}}),this.$cell.adpCell=this}_getClassName(){var e;let t=new Date,{selectOtherMonths:s,selectOtherYears:a}=this.opts,{minDate:n,maxDate:r,isDateDisabled:o}=this.dp,{day:l}=h(this.date),d=this._isOutOfMinMaxRange(),c=o(this.date),m=u("air-datepicker-cell",`-${this.singleType}-`,{"-current-":p(t,this.date,this.type),"-min-date-":n&&p(n,this.date,this.type),"-max-date-":r&&p(r,this.date,this.type)}),v="";switch(this.type){case i.days:v=u({"-weekend-":this.dp.isWeekend(l),"-other-month-":this.isOtherMonth,"-disabled-":this.isOtherMonth&&!s||d||c});break;case i.months:v=u({"-disabled-":d});break;case i.years:v=u({"-other-decade-":this.isOtherDecade,"-disabled-":d||this.isOtherDecade&&!a})}return u(m,v,null===(e=this.customData)||void 0===e?void 0:e.classes).split(" ")}_getHtml(){var e;let{year:t,month:s,date:a}=h(this.date),{showOtherMonths:n,showOtherYears:r}=this.opts;if(null!==(e=this.customData)&&void 0!==e&&e.html)return this.customData.html;switch(this.type){case i.days:return!n&&this.isOtherMonth?"":a;case i.months:return this.dp.locale[this.opts.monthsField][s];case i.years:return!r&&this.isOtherDecade?"":t}}_isOutOfMinMaxRange(){let{minDate:e,maxDate:t}=this.dp,{type:s,date:a}=this,{month:n,year:r,date:o}=h(a),l=s===i.days,d=s===i.years,c=!!e&&new Date(r,d?e.getMonth():n,l?o:e.getDate()),u=!!t&&new Date(r,d?t.getMonth():n,l?o:t.getDate());return e&&t?v(c,e)||m(u,t):e?v(c,e):t?m(u,t):void 0}destroy(){this.unbindDatepickerEvents()}_handleRangeStatus(){const{selectedDates:e,focusDate:t,rangeDateTo:i,rangeDateFrom:s}=this.dp,a=e.length;if(!a)return;let n=s,r=i;if(1===a&&t){const i=m(t,e[0]);n=i?e[0]:t,r=i?t:e[0]}let o=u({"-in-range-":n&&r&&(h=this.date,l=n,d=r,m(h,l)&&v(h,d)),"-range-from-":n&&p(this.date,n,this.type),"-range-to-":r&&p(this.date,r,this.type)});var h,l,d;this.$cell.classList.remove("-range-from-","-range-to-","-in-range-"),o&&this.$cell.classList.add(...o.split(" "))}_handleSelectedStatus(){let e=this.dp._checkIfDateIsSelected(this.date,this.type);e?this.select():!e&&this.selected&&this.removeSelect()}_handleInitialFocusStatus(){p(this.dp.focusDate,this.date,this.type)&&this.focus()}_handleClasses(){this.$cell.setAttribute("class",""),this._handleInitialFocusStatus(),this.dp.hasSelectedDates&&(this._handleSelectedStatus(),this.dp.opts.range&&this._handleRangeStatus()),this.$cell.classList.add(...this._getClassName())}get isDisabled(){return this.$cell.matches(".-disabled-")}get isOtherMonth(){return this.dp.isOtherMonth(this.date)}get isOtherDecade(){return this.dp.isOtherDecade(this.date)}}function _(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}let M={[i.days]:`<div class="air-datepicker-body--day-names"></div><div class="air-datepicker-body--cells -${i.days}-"></div>`,[i.months]:`<div class="air-datepicker-body--cells -${i.months}-"></div>`,[i.years]:`<div class="air-datepicker-body--cells -${i.years}-"></div>`};const S=".air-datepicker-cell";class T{constructor(e){let{dp:t,type:s,opts:a}=e;_(this,"handleClick",(e=>{let t=e.target.closest(S).adpCell;if(t.isDisabled)return;if(!this.dp.isMinViewReached)return void this.dp.down();let i=this.dp._checkIfDateIsSelected(t.date,t.type);i?this.dp._handleAlreadySelectedDates(i,t.date):this.dp.selectDate(t.date)})),_(this,"handleDayNameClick",(e=>{let t=e.target.getAttribute("data-day-index");this.opts.onClickDayName({dayIndex:Number(t),datepicker:this.dp})})),_(this,"onChangeCurrentView",(e=>{e!==this.type?this.hide():(this.show(),this.render())})),_(this,"onMouseOverCell",(e=>{let t=y(e.target,S);this.dp.setFocusDate(!!t&&t.adpCell.date)})),_(this,"onMouseOutCell",(()=>{this.dp.setFocusDate(!1)})),_(this,"onClickBody",(e=>{let{onClickDayName:t}=this.opts,i=e.target;i.closest(S)&&this.handleClick(e),t&&i.closest(".air-datepicker-body--day-name")&&this.handleDayNameClick(e)})),_(this,"onMouseDown",(e=>{this.pressed=!0;let t=y(e.target,S),i=t&&t.adpCell;p(i.date,this.dp.rangeDateFrom)&&(this.rangeFromFocused=!0),p(i.date,this.dp.rangeDateTo)&&(this.rangeToFocused=!0)})),_(this,"onMouseMove",(e=>{if(!this.pressed||!this.dp.isMinViewReached)return;e.preventDefault();let t=y(e.target,S),i=t&&t.adpCell,{selectedDates:s,rangeDateTo:a,rangeDateFrom:n}=this.dp;if(!i||i.isDisabled)return;let{date:r}=i;if(2===s.length){if(this.rangeFromFocused&&!m(r,a)){let{hours:e,minutes:t}=h(n);r.setHours(e),r.setMinutes(t),this.dp.rangeDateFrom=r,this.dp.replaceDate(n,r)}if(this.rangeToFocused&&!v(r,n)){let{hours:e,minutes:t}=h(a);r.setHours(e),r.setMinutes(t),this.dp.rangeDateTo=r,this.dp.replaceDate(a,r)}}})),_(this,"onMouseUp",(()=>{this.pressed=!1,this.rangeFromFocused=!1,this.rangeToFocused=!1})),_(this,"onChangeViewDate",((e,t)=>{if(!this.isVisible)return;let s=c(e),a=c(t);switch(this.dp.currentView){case i.days:if(p(e,t,i.months))return;break;case i.months:if(p(e,t,i.years))return;break;case i.years:if(s[0]===a[0]&&s[1]===a[1])return}this.render()})),_(this,"render",(()=>{this.destroyCells(),this._generateCells(),this.cells.forEach((e=>{this.$cells.appendChild(e.render())}))})),this.dp=t,this.type=s,this.opts=a,this.cells=[],this.$el="",this.pressed=!1,this.isVisible=!0,this.init()}init(){this._buildBaseHtml(),this.type===i.days&&this.renderDayNames(),this.render(),this._bindEvents(),this._bindDatepickerEvents()}_bindEvents(){let{range:e,dynamicRange:t}=this.opts;D(this.$el,"mouseover",this.onMouseOverCell),D(this.$el,"mouseout",this.onMouseOutCell),D(this.$el,"click",this.onClickBody),e&&t&&(D(this.$el,"mousedown",this.onMouseDown),D(this.$el,"mousemove",this.onMouseMove),D(window.document,"mouseup",this.onMouseUp))}_bindDatepickerEvents(){this.dp.on(i.eventChangeViewDate,this.onChangeViewDate),this.dp.on(i.eventChangeCurrentView,this.onChangeCurrentView)}_buildBaseHtml(){this.$el=n({className:`air-datepicker-body -${this.type}-`,innerHtml:M[this.type]}),this.$names=a(".air-datepicker-body--day-names",this.$el),this.$cells=a(".air-datepicker-body--cells",this.$el)}_getDayNamesHtml(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dp.locale.firstDay,t="",s=this.dp.isWeekend,{onClickDayName:a}=this.opts,n=e,r=0;for(;r<7;){let e=n%7;t+=`<div class="${u("air-datepicker-body--day-name",{[i.cssClassWeekend]:s(e),"-clickable-":!!a})}" data-day-index='${e}'>${this.dp.locale.daysMin[e]}</div>`,r++,n++}return t}renderDayNames(){this.$names.innerHTML=this._getDayNamesHtml()}_generateCell(e){let{type:t,dp:i,opts:s}=this;return new C({type:t,dp:i,opts:s,date:e,body:this})}_generateCells(){T.getDatesFunction(this.type)(this.dp,(e=>{this.cells.push(this._generateCell(e))}))}show(){this.isVisible=!0,this.$el.classList.remove("-hidden-")}hide(){this.isVisible=!1,this.$el.classList.add("-hidden-")}destroyCells(){this.cells.forEach((e=>e.destroy())),this.cells=[],this.$cells.innerHTML=""}destroy(){this.destroyCells(),this.dp.off(i.eventChangeViewDate,this.onChangeViewDate),this.dp.off(i.eventChangeCurrentView,this.onChangeCurrentView)}static getDaysDates(e,t){let{viewDate:i,opts:{fixedHeight:s},locale:{firstDay:a}}=e,n=o(i),{year:r,month:l}=h(i),d=new Date(r,l,1),c=new Date(r,l,n),u=d.getDay()-a,p=6-c.getDay()+a;u=u<0?u+7:u,p=p>6?p-7:p;let m=function(e,t){let{year:i,month:s,date:a}=h(e);return new Date(i,s,a-t)}(d,u),v=n+u+p,g=m.getDate(),{year:D,month:y}=h(m),f=0;s&&(v=42);const w=[];for(;f<v;){let e=new Date(D,y,g+f);t&&t(e),w.push(e),f++}return w}static getMonthsDates(e,t){let{year:i}=e.parsedViewDate,s=0,a=[];for(;s<12;){const e=new Date(i,s);a.push(e),t&&t(e),s++}return a}static getYearsDates(e,t){let i=c(e.viewDate),s=i[0]-1,a=i[1]+1,n=s,r=[];for(;n<=a;){const e=new Date(n,0);r.push(e),t&&t(e),n++}return r}static getDatesFunction(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.days;return{[i.days]:T.getDaysDates,[i.months]:T.getMonthsDates,[i.years]:T.getYearsDates}[e]}}function F(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class V{constructor(e){let{dp:t,opts:i}=e;F(this,"onClickNav",(e=>{let t=y(e.target,".air-datepicker-nav--action");if(!t)return;let i=t.dataset.action;this.dp[i]()})),F(this,"onChangeViewDate",(()=>{this.render(),this._resetNavStatus(),this.handleNavStatus()})),F(this,"onChangeCurrentView",(()=>{this.render(),this._resetNavStatus(),this.handleNavStatus()})),F(this,"onClickNavTitle",(()=>{this.dp.isFinalView||this.dp.up()})),F(this,"update",(()=>{let{prevHtml:e,nextHtml:t}=this.opts;this.$prev.innerHTML=e,this.$next.innerHTML=t,this._resetNavStatus(),this.render(),this.handleNavStatus()})),F(this,"renderDelay",(()=>{setTimeout(this.render)})),F(this,"render",(()=>{this.$title.innerHTML=this._getTitle(),function(e,t){for(let i in t)t[i]?e.classList.add(i):e.classList.remove(i)}(this.$title,{"-disabled-":this.dp.isFinalView})})),this.dp=t,this.opts=i,this.init()}init(){this._createElement(),this._buildBaseHtml(),this._defineDOM(),this.render(),this.handleNavStatus(),this._bindEvents(),this._bindDatepickerEvents()}_defineDOM(){this.$title=a(".air-datepicker-nav--title",this.$el),this.$prev=a('[data-action="prev"]',this.$el),this.$next=a('[data-action="next"]',this.$el)}_bindEvents(){this.$el.addEventListener("click",this.onClickNav),this.$title.addEventListener("click",this.onClickNavTitle)}_bindDatepickerEvents(){this.dp.on(i.eventChangeViewDate,this.onChangeViewDate),this.dp.on(i.eventChangeCurrentView,this.onChangeCurrentView),this.isNavIsFunction&&(this.dp.on(i.eventChangeSelectedDate,this.renderDelay),this.dp.opts.timepicker&&this.dp.on(i.eventChangeTime,this.render))}destroy(){this.dp.off(i.eventChangeViewDate,this.onChangeViewDate),this.dp.off(i.eventChangeCurrentView,this.onChangeCurrentView),this.isNavIsFunction&&(this.dp.off(i.eventChangeSelectedDate,this.renderDelay),this.dp.opts.timepicker&&this.dp.off(i.eventChangeTime,this.render))}_createElement(){this.$el=n({tagName:"nav",className:"air-datepicker-nav"})}_getTitle(){let{dp:e,opts:t}=this,i=t.navTitles[e.currentView];return"function"==typeof i?i(e):e.formatDate(e.viewDate,i)}handleNavStatus(){let{disableNavWhenOutOfRange:e}=this.opts,{minDate:t,maxDate:s}=this.dp;if(!t&&!s||!e)return;let{year:a,month:n}=this.dp.parsedViewDate,r=!!t&&h(t),o=!!s&&h(s);switch(this.dp.currentView){case i.days:t&&r.month>=n&&r.year>=a&&this._disableNav("prev"),s&&o.month<=n&&o.year<=a&&this._disableNav("next");break;case i.months:t&&r.year>=a&&this._disableNav("prev"),s&&o.year<=a&&this._disableNav("next");break;case i.years:{let e=c(this.dp.viewDate);t&&r.year>=e[0]&&this._disableNav("prev"),s&&o.year<=e[1]&&this._disableNav("next");break}}}_disableNav(e){a('[data-action="'+e+'"]',this.$el).classList.add("-disabled-")}_resetNavStatus(){!function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];e.length?e.forEach((e=>{e.classList.remove(...i)})):e.classList.remove(...i)}(this.$el.querySelectorAll(".air-datepicker-nav--action"),"-disabled-")}_buildBaseHtml(){let{prevHtml:e,nextHtml:t}=this.opts;this.$el.innerHTML=`<div class="air-datepicker-nav--action" data-action="prev">${e}</div><div class="air-datepicker-nav--title"></div><div class="air-datepicker-nav--action" data-action="next">${t}</div>`}get isNavIsFunction(){let{navTitles:e}=this.opts;return Object.keys(e).find((t=>"function"==typeof e[t]))}}var x={today:{content:e=>e.locale.today,onClick:e=>e.setViewDate(new Date)},clear:{content:e=>e.locale.clear,onClick:e=>e.clear()}};class H{constructor(e){let{dp:t,opts:i}=e;this.dp=t,this.opts=i,this.init()}init(){this.createElement(),this.render()}createElement(){this.$el=n({className:"air-datepicker-buttons"})}destroy(){this.$el.parentNode.removeChild(this.$el)}clearHtml(){return this.$el.innerHTML="",this}generateButtons(){let{buttons:e}=this.opts;Array.isArray(e)||(e=[e]),e.forEach((e=>{let t=e;"string"==typeof e&&x[e]&&(t=x[e]);let i=this.createButton(t);t.onClick&&this.attachEventToButton(i,t.onClick),this.$el.appendChild(i)}))}attachEventToButton(e,t){e.addEventListener("click",(()=>{t(this.dp)}))}createButton(e){let{content:t,className:i,tagName:s="button",attrs:a={}}=e;return n({tagName:s,innerHtml:`<span tabindex='-1'>${"function"==typeof t?t(this.dp):t}</span>`,className:u("air-datepicker-button",i),attrs:a})}render(){this.generateButtons()}}function E(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class L{constructor(){let{opts:e,dp:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E(this,"toggleTimepickerIsActive",(e=>{this.dp.timepickerIsActive=e})),E(this,"onChangeSelectedDate",(e=>{let{date:t,updateTime:i=!1}=e;t&&(this.setMinMaxTime(t),this.setCurrentTime(!!i&&t),this.addTimeToDate(t))})),E(this,"onChangeLastSelectedDate",(e=>{e&&(this.setTime(e),this.render())})),E(this,"onChangeInputRange",(e=>{let t=e.target;this[t.getAttribute("name")]=t.value,this.updateText(),this.dp.trigger(i.eventChangeTime,{hours:this.hours,minutes:this.minutes})})),E(this,"onMouseEnterLeave",(e=>{let t=e.target.getAttribute("name"),i=this.$minutesText;"hours"===t&&(i=this.$hoursText),i.classList.toggle("-focus-")})),E(this,"onFocus",(()=>{this.toggleTimepickerIsActive(!0)})),E(this,"onBlur",(()=>{this.toggleTimepickerIsActive(!1)})),this.opts=e,this.dp=t;let{timeFormat:s}=this.dp.locale;s&&(s.match(k("h"))||s.match(k("hh")))&&(this.ampm=!0),this.init()}init(){this.setTime(this.dp.lastSelectedDate||this.dp.viewDate),this.createElement(),this.buildHtml(),this.defineDOM(),this.render(),this.bindDatepickerEvents(),this.bindDOMEvents()}bindDatepickerEvents(){this.dp.on(i.eventChangeSelectedDate,this.onChangeSelectedDate),this.dp.on(i.eventChangeLastSelectedDate,this.onChangeLastSelectedDate)}bindDOMEvents(){let e="input";navigator.userAgent.match(/trident/gi)&&(e="change"),D(this.$ranges,e,this.onChangeInputRange),D(this.$ranges,"mouseenter",this.onMouseEnterLeave),D(this.$ranges,"mouseleave",this.onMouseEnterLeave),D(this.$ranges,"focus",this.onFocus),D(this.$ranges,"mousedown",this.onFocus),D(this.$ranges,"blur",this.onBlur)}createElement(){this.$el=n({className:u("air-datepicker-time",{"-am-pm-":this.dp.ampm})})}destroy(){this.dp.off(i.eventChangeSelectedDate,this.onChangeSelectedDate),this.dp.off(i.eventChangeLastSelectedDate,this.onChangeLastSelectedDate),this.$el.parentNode.removeChild(this.$el)}buildHtml(){let{ampm:e,hours:t,displayHours:i,minutes:s,minHours:a,minMinutes:n,maxHours:r,maxMinutes:o,dayPeriod:h,opts:{hoursStep:l,minutesStep:c}}=this;this.$el.innerHTML=`<div class="air-datepicker-time--current"> <span class="air-datepicker-time--current-hours">${d(i)}</span> <span class="air-datepicker-time--current-colon">:</span> <span class="air-datepicker-time--current-minutes">${d(s)}</span> `+(e?`<span class='air-datepicker-time--current-ampm'>${h}</span>`:"")+'</div><div class="air-datepicker-time--sliders"> <div class="air-datepicker-time--row">'+` <input type="range" name="hours" value="${t}" min="${a}" max="${r}" step="${l}"/> </div> <div class="air-datepicker-time--row">`+` <input type="range" name="minutes" value="${s}" min="${n}" max="${o}" step="${c}"/> </div></div>`}defineDOM(){let e=e=>a(e,this.$el);this.$ranges=this.$el.querySelectorAll('[type="range"]'),this.$hours=e('[name="hours"]'),this.$minutes=e('[name="minutes"]'),this.$hoursText=e(".air-datepicker-time--current-hours"),this.$minutesText=e(".air-datepicker-time--current-minutes"),this.$ampm=e(".air-datepicker-time--current-ampm")}setTime(e){this.setMinMaxTime(e),this.setCurrentTime(e)}addTimeToDate(e){e&&(e.setHours(this.hours),e.setMinutes(this.minutes))}setMinMaxTime(e){if(this.setMinMaxTimeFromOptions(),e){let{minDate:t,maxDate:i}=this.dp;t&&p(e,t)&&this.setMinTimeFromMinDate(t),i&&p(e,i)&&this.setMaxTimeFromMaxDate(i)}}setCurrentTime(e){let{hours:t,minutes:i}=e?h(e):this;this.hours=f(t,this.minHours,this.maxHours),this.minutes=f(i,this.minMinutes,this.maxMinutes)}setMinMaxTimeFromOptions(){let{minHours:e,minMinutes:t,maxHours:i,maxMinutes:s}=this.opts;this.minHours=f(e,0,23),this.minMinutes=f(t,0,59),this.maxHours=f(i,0,23),this.maxMinutes=f(s,0,59)}setMinTimeFromMinDate(e){let{lastSelectedDate:t}=this.dp;this.minHours=e.getHours(),t&&t.getHours()>e.getHours()?this.minMinutes=this.opts.minMinutes:this.minMinutes=e.getMinutes()}setMaxTimeFromMaxDate(e){let{lastSelectedDate:t}=this.dp;this.maxHours=e.getHours(),t&&t.getHours()<e.getHours()?this.maxMinutes=this.opts.maxMinutes:this.maxMinutes=e.getMinutes()}updateSliders(){r(this.$hours,{min:this.minHours,max:this.maxHours}).value=this.hours,r(this.$minutes,{min:this.minMinutes,max:this.maxMinutes}).value=this.minutes}updateText(){this.$hoursText.innerHTML=d(this.displayHours),this.$minutesText.innerHTML=d(this.minutes),this.ampm&&(this.$ampm.innerHTML=this.dayPeriod)}set hours(e){this._hours=e;let{hours:t,dayPeriod:i}=l(e);this.displayHours=this.ampm?t:e,this.dayPeriod=i}get hours(){return this._hours}render(){this.updateSliders(),this.updateText()}}function O(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class A{constructor(e){let{dp:t,opts:i}=e;O(this,"pressedKeys",new Set),O(this,"hotKeys",new Map([[[["Control","ArrowRight"],["Control","ArrowUp"]],e=>e.month++],[[["Control","ArrowLeft"],["Control","ArrowDown"]],e=>e.month--],[[["Shift","ArrowRight"],["Shift","ArrowUp"]],e=>e.year++],[[["Shift","ArrowLeft"],["Shift","ArrowDown"]],e=>e.year--],[[["Alt","ArrowRight"],["Alt","ArrowUp"]],e=>e.year+=10],[[["Alt","ArrowLeft"],["Alt","ArrowDown"]],e=>e.year-=10],[["Control","Shift","ArrowUp"],(e,t)=>t.up()]])),O(this,"handleHotKey",(e=>{let t=this.hotKeys.get(e),i=h(this.getInitialFocusDate());t(i,this.dp);let{year:s,month:a,date:n}=i,r=o(new Date(s,a));r<n&&(n=r);let l=this.dp.getClampedDate(new Date(s,a,n));this.dp.setFocusDate(l,{viewDateTransition:!0})})),O(this,"isHotKeyPressed",(()=>{let e=!1,t=this.pressedKeys.size,i=e=>this.pressedKeys.has(e);for(let[s]of this.hotKeys){if(e)break;if(Array.isArray(s[0]))s.forEach((a=>{e||t!==a.length||(e=a.every(i)&&s)}));else{if(t!==s.length)continue;e=s.every(i)&&s}}return e})),O(this,"isArrow",(e=>e>=37&&e<=40)),O(this,"onKeyDown",(e=>{let{key:t,which:i}=e,{dp:s,dp:{focusDate:a},opts:n}=this;this.registerKey(t);let r=this.isHotKeyPressed();if(r)return e.preventDefault(),void this.handleHotKey(r);if(this.isArrow(i))return e.preventDefault(),void this.focusNextCell(t);if("Enter"===t){if(s.currentView!==n.minView)return void s.down();if(a){let e=s._checkIfDateIsSelected(a);return void(e?s._handleAlreadySelectedDates(e,a):s.selectDate(a))}}"Escape"===t&&this.dp.hide()})),O(this,"onKeyUp",(e=>{this.removeKey(e.key)})),this.dp=t,this.opts=i,this.init()}init(){this.bindKeyboardEvents()}bindKeyboardEvents(){let{$el:e}=this.dp;e.addEventListener("keydown",this.onKeyDown),e.addEventListener("keyup",this.onKeyUp)}destroy(){let{$el:e}=this.dp;e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("keyup",this.onKeyUp),this.hotKeys=null,this.pressedKeys=null}getInitialFocusDate(){let{focusDate:e,currentView:t,selectedDates:s,parsedViewDate:{year:a,month:n}}=this.dp,r=e||s[s.length-1];if(!r)switch(t){case i.days:r=new Date(a,n,(new Date).getDate());break;case i.months:r=new Date(a,n,1);break;case i.years:r=new Date(a,0,1)}return r}focusNextCell(e){let t=this.getInitialFocusDate(),{currentView:s}=this.dp,{days:a,months:n,years:r}=i,o=h(t),l=o.year,d=o.month,c=o.date;switch(e){case"ArrowLeft":s===a&&(c-=1),s===n&&(d-=1),s===r&&(l-=1);break;case"ArrowUp":s===a&&(c-=7),s===n&&(d-=3),s===r&&(l-=4);break;case"ArrowRight":s===a&&(c+=1),s===n&&(d+=1),s===r&&(l+=1);break;case"ArrowDown":s===a&&(c+=7),s===n&&(d+=3),s===r&&(l+=4)}let u=this.dp.getClampedDate(new Date(l,d,c));this.dp.setFocusDate(u,{viewDateTransition:!0})}registerKey(e){this.pressedKeys.add(e)}removeKey(e){this.pressedKeys.delete(e)}}let N={on(e,t){this.__events||(this.__events={}),this.__events[e]?this.__events[e].push(t):this.__events[e]=[t]},off(e,t){this.__events&&this.__events[e]&&(this.__events[e]=this.__events[e].filter((e=>e!==t)))},removeAllEvents(){this.__events={}},trigger(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];this.__events&&this.__events[e]&&this.__events[e].forEach((e=>{e(...i)}))}};function I(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}let P="",j="",B=!1;class R{static buildGlobalContainer(e){B=!0,P=n({className:e,id:e}),a("body").appendChild(P)}constructor(e,t){var r=this;if(I(this,"viewIndexes",[i.days,i.months,i.years]),I(this,"next",(()=>{let{year:e,month:t}=this.parsedViewDate;switch(this.currentView){case i.days:this.setViewDate(new Date(e,t+1,1));break;case i.months:this.setViewDate(new Date(e+1,t,1));break;case i.years:this.setViewDate(new Date(e+10,0,1))}})),I(this,"prev",(()=>{let{year:e,month:t}=this.parsedViewDate;switch(this.currentView){case i.days:this.setViewDate(new Date(e,t-1,1));break;case i.months:this.setViewDate(new Date(e-1,t,1));break;case i.years:this.setViewDate(new Date(e-10,0,1))}})),I(this,"_finishHide",(()=>{this.hideAnimation=!1,this._destroyComponents(),this.$container.removeChild(this.$datepicker)})),I(this,"setPosition",(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("function"==typeof(e=e||r.opts.position))return void(r.customHide=e({$datepicker:r.$datepicker,$target:r.$el,$pointer:r.$pointer,isViewChange:t,done:r._finishHide}));let i,s,{isMobile:a}=r.opts,n=r.$el.getBoundingClientRect(),o=r.$el.getBoundingClientRect(),h=r.$datepicker.offsetParent,l=r.$el.offsetParent,d=r.$datepicker.getBoundingClientRect(),c=e.split(" "),u=window.scrollY,p=window.scrollX,m=r.opts.offset,v=c[0],g=c[1];if(a)r.$datepicker.style.cssText="left: 50%; top: 50%";else{if(h===l&&h!==document.body&&(o={top:r.$el.offsetTop,left:r.$el.offsetLeft,width:n.width,height:r.$el.offsetHeight},u=0,p=0),h!==l&&h!==document.body){let e=h.getBoundingClientRect();o={top:n.top-e.top,left:n.left-e.left,width:n.width,height:n.height},u=0,p=0}switch(v){case"top":i=o.top-d.height-m;break;case"right":s=o.left+o.width+m;break;case"bottom":i=o.top+o.height+m;break;case"left":s=o.left-d.width-m}switch(g){case"top":i=o.top;break;case"right":s=o.left+o.width-d.width;break;case"bottom":i=o.top+o.height-d.height;break;case"left":s=o.left;break;case"center":/left|right/.test(v)?i=o.top+o.height/2-d.height/2:s=o.left+o.width/2-d.width/2}r.$datepicker.style.cssText=`left: ${s+p}px; top: ${i+u}px`}})),I(this,"_setInputValue",(()=>{let{opts:e,$altField:t,locale:{dateFormat:i}}=this,{altFieldDateFormat:s,altField:a}=e;a&&t&&(t.value=this._getInputValue(s)),this.$el.value=this._getInputValue(i)})),I(this,"_getInputValue",(e=>{let{selectedDates:t,opts:i}=this,{multipleDates:s,multipleDatesSeparator:a}=i;if(!t.length)return"";let n="function"==typeof e,r=n?e(s?t:t[0]):t.map((t=>this.formatDate(t,e)));return r=n?r:r.join(a),r})),I(this,"_checkIfDateIsSelected",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.days,s=!1;return r.selectedDates.some((i=>{let a=p(e,i,t);return s=a&&i,a})),s})),I(this,"_scheduleCallAfterTransition",(e=>{this._cancelScheduledCall(),e&&e(!1),this._onTransitionEnd=()=>{e&&e(!0)},this.$datepicker.addEventListener("transitionend",this._onTransitionEnd,{once:!0})})),I(this,"_cancelScheduledCall",(()=>{this.$datepicker.removeEventListener("transitionend",this._onTransitionEnd)})),I(this,"setViewDate",(e=>{if(!((e=b(e))instanceof Date))return;if(p(e,this.viewDate))return;let t=this.viewDate;this.viewDate=e;let{onChangeViewDate:s}=this.opts;if(s){let{month:e,year:t}=this.parsedViewDate;s({month:e,year:t,decade:this.curDecade})}this.trigger(i.eventChangeViewDate,e,t)})),I(this,"setFocusDate",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(!e||(e=b(e))instanceof Date)&&(r.focusDate=e,r.trigger(i.eventChangeFocusDate,e,t))})),I(this,"setCurrentView",(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r.viewIndexes.includes(e)){if(r.currentView=e,r.elIsInput&&r.visible&&r.setPosition(void 0,!0),r.trigger(i.eventChangeCurrentView,e),!r.views[e]){let t=r.views[e]=new T({dp:r,opts:r.opts,type:e});r.shouldUpdateDOM&&r.$content.appendChild(t.$el)}r.opts.onChangeView&&!t.silent&&r.opts.onChangeView(e)}})),I(this,"_updateLastSelectedDate",(e=>{this.lastSelectedDate=e,this.trigger(i.eventChangeLastSelectedDate,e)})),I(this,"destroy",(()=>{if(this.isDestroyed)return;let{showEvent:e,isMobile:t}=this.opts,i=this.$datepicker.parentNode;i&&i.removeChild(this.$datepicker),this.$el.removeEventListener(e,this._onFocus),this.$el.removeEventListener("blur",this._onBlur),window.removeEventListener("resize",this._onResize),t&&this._removeMobileAttributes(),this.keyboardNav&&this.keyboardNav.destroy(),this.views=null,this.nav=null,this.$datepicker=null,this.opts={},this.$customContainer=null,this.viewDate=null,this.focusDate=null,this.selectedDates=[],this.rangeDateFrom=null,this.rangeDateTo=null,this.isDestroyed=!0})),I(this,"update",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=w({},r.opts),{silent:a}=t;w(r.opts,e);let{timepicker:n,buttons:o,range:h,selectedDates:l,isMobile:d}=r.opts,c=r.visible||r.treatAsInline;r._createMinMaxDates(),r._limitViewDateByMaxMinDates(),r._handleLocale(),l&&(r.selectedDates=[],r.selectDate(l,{silent:a})),e.view&&r.setCurrentView(e.view,{silent:a}),r._setInputValue(),s.range&&!h?(r.rangeDateTo=!1,r.rangeDateFrom=!1):!s.range&&h&&r.selectedDates.length&&(r.rangeDateFrom=r.selectedDates[0],r.rangeDateTo=r.selectedDates[1]),s.timepicker&&!n?(c&&r.timepicker.destroy(),r.timepicker=!1,r.$timepicker.parentNode.removeChild(r.$timepicker)):!s.timepicker&&n&&r._addTimepicker(),!s.buttons&&o?r._addButtons():s.buttons&&!o?(r.buttons.destroy(),r.$buttons.parentNode.removeChild(r.$buttons)):c&&s.buttons&&o&&r.buttons.clearHtml().render(),!s.isMobile&&d?(r.treatAsInline||j||r._createMobileOverlay(),r._addMobileAttributes(),r.visible&&r._showMobileOverlay()):s.isMobile&&!d&&(r._removeMobileAttributes(),r.visible&&(j.classList.remove("-active-"),"function"!=typeof r.opts.position&&r.setPosition())),c&&(r.nav.update(),r.views[r.currentView].render(),r.currentView===i.days&&r.views[r.currentView].renderDayNames())})),I(this,"disableDate",((e,t)=>{(Array.isArray(e)?e:[e]).forEach((e=>{let i=b(e);if(!i)return;let s=t?"delete":"add";this.disabledDates[s](this.formatDate(i,"yyyy-MM-dd"));let a=this.getCell(i,this.currentViewSingular);a&&a.adpCell.render()}),[])})),I(this,"enableDate",(e=>{this.disableDate(e,!0)})),I(this,"isDateDisabled",(e=>{let t=b(e);return this.disabledDates.has(this.formatDate(t,"yyyy-MM-dd"))})),I(this,"isOtherMonth",(e=>{let{month:t}=h(e);return t!==this.parsedViewDate.month})),I(this,"isOtherYear",(e=>{let{year:t}=h(e);return t!==this.parsedViewDate.year})),I(this,"isOtherDecade",(e=>{let{year:t}=h(e),[i,s]=c(this.viewDate);return t<i||t>s})),I(this,"_onChangeSelectedDate",(e=>{let{silent:t}=e;setTimeout((()=>{this._setInputValue(),this.opts.onSelect&&!t&&this._triggerOnSelect()}))})),I(this,"_onChangeFocusedDate",(function(e){let{viewDateTransition:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return;let i=!1;t&&(i=r.isOtherMonth(e)||r.isOtherYear(e)||r.isOtherDecade(e)),i&&r.setViewDate(e),r.opts.onFocus&&r.opts.onFocus({datepicker:r,date:e})})),I(this,"_onChangeTime",(e=>{let{hours:t,minutes:i}=e,s=new Date,{lastSelectedDate:a,opts:{onSelect:n}}=this,r=a;a||(r=s);let o=this.getCell(r,this.currentViewSingular),h=o&&o.adpCell;h&&h.isDisabled||(r.setHours(t),r.setMinutes(i),a?(this._setInputValue(),n&&this._triggerOnSelect()):this.selectDate(r))})),I(this,"_onFocus",(e=>{this.visible||this.show()})),I(this,"_onBlur",(e=>{this.inFocus||!this.visible||this.opts.isMobile||this.hide()})),I(this,"_onMouseDown",(e=>{this.inFocus=!0})),I(this,"_onMouseUp",(e=>{this.inFocus=!1,this.$el.focus()})),I(this,"_onResize",(()=>{this.visible&&"function"!=typeof this.opts.position&&this.setPosition()})),I(this,"_onClickOverlay",(()=>{this.visible&&this.hide()})),I(this,"getViewDates",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.days;return T.getDatesFunction(e)(r)})),I(this,"isWeekend",(e=>this.opts.weekends.includes(e))),I(this,"getClampedDate",(e=>{let{minDate:t,maxDate:i}=this,s=e;return i&&m(e,i)?s=i:t&&v(e,t)&&(s=t),s})),this.$el=a(e),!this.$el)return;this.$datepicker=n({className:"air-datepicker"}),this.opts=w({},s,t),this.$customContainer=!!this.opts.container&&a(this.opts.container),this.$altField=a(this.opts.altField||!1);let{view:o,startDate:l}=this.opts;l||(this.opts.startDate=new Date),"INPUT"===this.$el.nodeName&&(this.elIsInput=!0),this.inited=!1,this.visible=!1,this.viewDate=b(this.opts.startDate),this.focusDate=!1,this.initialReadonly=this.$el.getAttribute("readonly"),this.customHide=!1,this.currentView=o,this.selectedDates=[],this.disabledDates=new Set,this.isDestroyed=!1,this.views={},this.keys=[],this.rangeDateFrom="",this.rangeDateTo="",this.timepickerIsActive=!1,this.treatAsInline=this.opts.inline||!this.elIsInput,this.init()}init(){let{opts:e,treatAsInline:t,opts:{inline:i,isMobile:s,selectedDates:n,keyboardNav:r,onlyTimepicker:o}}=this,h=a("body");(!B||B&&P&&!h.contains(P))&&!i&&this.elIsInput&&!this.$customContainer&&R.buildGlobalContainer(R.defaultGlobalContainerId),!s||j||t||this._createMobileOverlay(),this._handleLocale(),this._bindSubEvents(),this._createMinMaxDates(),this._limitViewDateByMaxMinDates(),this.elIsInput&&(i||this._bindEvents(),r&&!o&&(this.keyboardNav=new A({dp:this,opts:e}))),n&&this.selectDate(n,{silent:!0}),this.opts.visible&&!t&&this.show(),s&&!t&&this.$el.setAttribute("readonly",!0),t&&this._createComponents()}_createMobileOverlay(){j=n({className:"air-datepicker-overlay"}),P.appendChild(j)}_createComponents(){let{opts:e,treatAsInline:t,opts:{inline:i,buttons:s,timepicker:a,position:n,classes:r,onlyTimepicker:o,isMobile:h}}=this;this._buildBaseHtml(),this.elIsInput&&(i||this._setPositionClasses(n)),!i&&this.elIsInput||this.$datepicker.classList.add("-inline-"),r&&this.$datepicker.classList.add(...r.split(" ")),o&&this.$datepicker.classList.add("-only-timepicker-"),h&&!t&&this._addMobileAttributes(),this.views[this.currentView]=new T({dp:this,type:this.currentView,opts:e}),this.nav=new V({dp:this,opts:e}),a&&this._addTimepicker(),s&&this._addButtons(),this.$content.appendChild(this.views[this.currentView].$el),this.$nav.appendChild(this.nav.$el)}_destroyComponents(){for(let e in this.views)this.views[e].destroy();this.views={},this.nav.destroy(),this.timepicker&&this.timepicker.destroy()}_addMobileAttributes(){j.addEventListener("click",this._onClickOverlay),this.$datepicker.classList.add("-is-mobile-"),this.$el.setAttribute("readonly",!0)}_removeMobileAttributes(){j.removeEventListener("click",this._onClickOverlay),this.$datepicker.classList.remove("-is-mobile-"),this.initialReadonly||""===this.initialReadonly||this.$el.removeAttribute("readonly")}_createMinMaxDates(){let{minDate:e,maxDate:t}=this.opts;this.minDate=!!e&&b(e),this.maxDate=!!t&&b(t)}_addTimepicker(){this.$timepicker=n({className:"air-datepicker--time"}),this.$datepicker.appendChild(this.$timepicker),this.timepicker=new L({dp:this,opts:this.opts}),this.$timepicker.appendChild(this.timepicker.$el)}_addButtons(){this.$buttons=n({className:"air-datepicker--buttons"}),this.$datepicker.appendChild(this.$buttons),this.buttons=new H({dp:this,opts:this.opts}),this.$buttons.appendChild(this.buttons.$el)}_bindSubEvents(){this.on(i.eventChangeSelectedDate,this._onChangeSelectedDate),this.on(i.eventChangeFocusDate,this._onChangeFocusedDate),this.on(i.eventChangeTime,this._onChangeTime)}_buildBaseHtml(){let{inline:e}=this.opts;var t,i;this.elIsInput?e?(t=this.$datepicker,(i=this.$el).parentNode.insertBefore(t,i.nextSibling)):this.$container.appendChild(this.$datepicker):this.$el.appendChild(this.$datepicker),this.$datepicker.innerHTML='<i class="air-datepicker--pointer"></i><div class="air-datepicker--navigation"></div><div class="air-datepicker--content"></div>',this.$content=a(".air-datepicker--content",this.$datepicker),this.$pointer=a(".air-datepicker--pointer",this.$datepicker),this.$nav=a(".air-datepicker--navigation",this.$datepicker)}_handleLocale(){let{locale:e,dateFormat:t,firstDay:i,timepicker:s,onlyTimepicker:a,timeFormat:n,dateTimeSeparator:r}=this.opts;var o;this.locale=(o=e,JSON.parse(JSON.stringify(o))),t&&(this.locale.dateFormat=t),void 0!==n&&""!==n&&(this.locale.timeFormat=n);let{timeFormat:h}=this.locale;if(""!==i&&(this.locale.firstDay=i),s&&"function"!=typeof t){let e=h?r:"";this.locale.dateFormat=[this.locale.dateFormat,h||""].join(e)}a&&"function"!=typeof t&&(this.locale.dateFormat=this.locale.timeFormat)}_setPositionClasses(e){if("function"==typeof e)return void this.$datepicker.classList.add("-custom-position-");let t=(e=e.split(" "))[0],i=`air-datepicker -${t}-${e[1]}- -from-${t}-`;this.$datepicker.classList.add(...i.split(" "))}_bindEvents(){this.$el.addEventListener(this.opts.showEvent,this._onFocus),this.$el.addEventListener("blur",this._onBlur),this.$datepicker.addEventListener("mousedown",this._onMouseDown),this.$datepicker.addEventListener("mouseup",this._onMouseUp),window.addEventListener("resize",this._onResize)}_limitViewDateByMaxMinDates(){let{viewDate:e,minDate:t,maxDate:i}=this;i&&m(e,i)&&this.setViewDate(i),t&&v(e,t)&&this.setViewDate(t)}formatDate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.viewDate,t=arguments.length>1?arguments[1]:void 0;if(e=b(e),!(e instanceof Date))return;let i=t,s=this.locale,a=h(e),n=a.dayPeriod,r=c(e),o=R.replacer,l={T:e.getTime(),m:a.minutes,mm:a.fullMinutes,h:a.hours12,hh:a.fullHours12,H:a.hours,HH:a.fullHours,aa:n,AA:n.toUpperCase(),E:s.daysShort[a.day],EEEE:s.days[a.day],d:a.date,dd:a.fullDate,M:a.month+1,MM:a.fullMonth,MMM:s.monthsShort[a.month],MMMM:s.months[a.month],yy:a.year.toString().slice(-2),yyyy:a.year,yyyy1:r[0],yyyy2:r[1]};for(let[e,t]of Object.entries(l))i=o(i,k(e),t);return i}down(e){this._handleUpDownActions(e,"down")}up(e){this._handleUpDownActions(e,"up")}selectDate(e){let t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{currentView:a,parsedViewDate:n,selectedDates:r}=this,{updateTime:o}=s,{moveToOtherMonthsOnSelect:h,moveToOtherYearsOnSelect:l,multipleDates:d,range:c,autoClose:u,onBeforeSelect:p}=this.opts,v=r.length;if(Array.isArray(e))return e.forEach((e=>{this.selectDate(e,s)})),new Promise((e=>{setTimeout(e)}));if((e=b(e))instanceof Date){if(p&&!p({date:e,datepicker:this}))return Promise.resolve();if(a===i.days&&e.getMonth()!==n.month&&h&&(t=new Date(e.getFullYear(),e.getMonth(),1)),a===i.years&&e.getFullYear()!==n.year&&l&&(t=new Date(e.getFullYear(),0,1)),t&&this.setViewDate(t),d&&!c){if(v===d)return;this._checkIfDateIsSelected(e)||r.push(e)}else if(c)switch(v){case 1:r.push(e),this.rangeDateTo||(this.rangeDateTo=e),m(this.rangeDateFrom,this.rangeDateTo)&&(this.rangeDateTo=this.rangeDateFrom,this.rangeDateFrom=e),this.selectedDates=[this.rangeDateFrom,this.rangeDateTo];break;case 2:this.selectedDates=[e],this.rangeDateFrom=e,this.rangeDateTo="";break;default:this.selectedDates=[e],this.rangeDateFrom=e}else this.selectedDates=[e];return this.trigger(i.eventChangeSelectedDate,{action:i.actionSelectDate,silent:null==s?void 0:s.silent,date:e,updateTime:o}),this._updateLastSelectedDate(e),u&&!this.timepickerIsActive&&this.visible&&(d||c?c&&1===v&&this.hide():this.hide()),new Promise((e=>{setTimeout(e)}))}}unselectDate(e){let t=this.selectedDates,s=this;if((e=b(e))instanceof Date)return t.some(((a,n)=>{if(p(a,e))return t.splice(n,1),s.selectedDates.length?(s.rangeDateTo="",s.rangeDateFrom=t[0],s._updateLastSelectedDate(s.selectedDates[s.selectedDates.length-1])):(s.rangeDateFrom="",s.rangeDateTo="",s._updateLastSelectedDate(!1)),this.trigger(i.eventChangeSelectedDate,{action:i.actionUnselectDate,date:e}),!0}))}replaceDate(e,t){let s=this.selectedDates.find((t=>p(t,e,this.currentView))),a=this.selectedDates.indexOf(s);a<0||p(this.selectedDates[a],t,this.currentView)||(this.selectedDates[a]=t,this.trigger(i.eventChangeSelectedDate,{action:i.actionSelectDate,date:t,updateTime:!0}),this._updateLastSelectedDate(t))}clear(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.selectedDates=[],this.rangeDateFrom=!1,this.rangeDateTo=!1,this.lastSelectedDate=!1,this.trigger(i.eventChangeSelectedDate,{action:i.actionUnselectDate,silent:e.silent}),new Promise((e=>{setTimeout(e)}))}show(){let{onShow:e,isMobile:t}=this.opts;this._cancelScheduledCall(),this.visible||this.hideAnimation||this._createComponents(),this.setPosition(this.opts.position),this.$datepicker.classList.add("-active-"),this.visible=!0,e&&this._scheduleCallAfterTransition(e),t&&this._showMobileOverlay()}hide(){let{onHide:e,isMobile:t}=this.opts,i=this._hasTransition();this.visible=!1,this.hideAnimation=!0,this.$datepicker.classList.remove("-active-"),this.customHide&&this.customHide(),this.elIsInput&&this.$el.blur(),this._scheduleCallAfterTransition((t=>{!this.customHide&&(t&&i||!t&&!i)&&this._finishHide(),e&&e(t)})),t&&j.classList.remove("-active-")}_triggerOnSelect(){let e=[],t=[],{selectedDates:i,locale:s,opts:{onSelect:a,multipleDates:n,range:r}}=this,o=n||r,h="function"==typeof s.dateFormat;i.length&&(e=i.map(g),t=h?n?s.dateFormat(e):e.map((e=>s.dateFormat(e))):e.map((e=>this.formatDate(e,s.dateFormat)))),a({date:o?e:e[0],formattedDate:o?t:t[0],datepicker:this})}_handleAlreadySelectedDates(e,t){let{selectedDates:i,rangeDateFrom:s,rangeDateTo:a}=this,{range:n,toggleSelected:r}=this.opts,o=i.length,h="function"==typeof r?r({datepicker:this,date:t}):r,l=Boolean(n&&1===o&&e),d=l?g(t):t;n&&!h&&(2!==o&&this.selectDate(d),2===o&&p(s,a))||(h?this.unselectDate(d):this._updateLastSelectedDate(l?d:e))}_handleUpDownActions(e,t){if(!((e=b(e||this.focusDate||this.viewDate))instanceof Date))return;let i="up"===t?this.viewIndex+1:this.viewIndex-1;i>2&&(i=2),i<0&&(i=0),this.setViewDate(new Date(e.getFullYear(),e.getMonth(),1)),this.setCurrentView(this.viewIndexes[i])}getCell(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.day;if(!((e=b(e))instanceof Date))return;let{year:s,month:a,date:n}=h(e),r=`[data-year="${s}"]`,o=`[data-month="${a}"]`,l={[i.day]:`${r}${o}[data-date="${n}"]`,[i.month]:`${r}${o}`,[i.year]:`${r}`};return this.views[this.currentView]?this.views[this.currentView].$el.querySelector(l[t]):void 0}_showMobileOverlay(){j.classList.add("-active-")}_hasTransition(){return window.getComputedStyle(this.$datepicker).getPropertyValue("transition-duration").split(", ").reduce(((e,t)=>parseFloat(t)+e),0)>0}get shouldUpdateDOM(){return this.visible||this.treatAsInline}get parsedViewDate(){return h(this.viewDate)}get currentViewSingular(){return this.currentView.slice(0,-1)}get curDecade(){return c(this.viewDate)}get viewIndex(){return this.viewIndexes.indexOf(this.currentView)}get isFinalView(){return this.currentView===i.years}get hasSelectedDates(){return this.selectedDates.length>0}get isMinViewReached(){return this.currentView===this.opts.minView||this.currentView===i.days}get $container(){return this.$customContainer||P}static replacer(e,t,i){return e.replace(t,(function(e,t,s,a){return t+i+a}))}}var K;return I(R,"defaults",s),I(R,"version","3.5.3"),I(R,"defaultGlobalContainerId","air-datepicker-global-container"),K=R.prototype,Object.assign(K,N),t.default}()})); 1614/* End */ 1615; 1616; /* Start:"a:4:{s:4:"full";s:57:"/local/templates/calendario/js/scripts.js?177020583549469";s:6:"source";s:41:"/local/templates/calendario/js/scripts.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 1617// document.addEventListener("selectCallback", function (e) { 1618// const currentSelect = e.detail.select
1619// if (currentSelect?.dataset?.select) { 1620// const event = new Event('change'); 1621// currentSelect.dispatchEvent(event); 1622// } 1623// }); 1624 1625// $(document).on('change', 'select[data-select="true"]', (e) => { 1626// var SelectOption = e.target.selectedOptions[0].dataset.id; 1627// currentSelect.setAttribute('name',SelectOption); 1628// smartFilter.click(currentSelect) 1629// }) 1630 1631// function calendarCallback(selectedDates) { 1632// console.log("ÐÑбÑаннÑе даÑÑ:", selectedDates); 1633// } 1634 1635function addEvent(parent, evt, selector, handler) { 1636 parent.addEventListener(evt, function (event) { 1637 if (event.target.matches(selector + ', ' + selector + ' *') && handler) { 1638 handler.apply(event.target.closest(selector), arguments); 1639 } 1640 }, false); 1641} 1642 1643function actionFavorites(action, idItem, type = '', params = []) { 1644 BX.ajax.runComponentAction( 1645 'extyl:favorites', 1646 action, 1647 { 1648 mode: 'ajax', 1649 data: { 1650 id: idItem, 1651 type: type, 1652 params: params 1653 }, 1654 } 1655 ).then(function (json) { 1656 if (type === 'events') { 1657 if (action === 'addFavorites') { 1658 $('button.js-addFavorites[data-id="' + idItem + '"]').css('display', 'none'); 1659 $('button.js-removeFavorites[data-id="' + idItem + '"]').css('display', ''); 1660 changeCountInToText($('.js-countFavorites[data-id="' + idItem + '"] > span'), 1); 1661 } else if (action === 'removeFavorites') { 1662 let removeItem = $('.js-removeFavoritesItems').find('.js-removeFavoritesItem[data-id="' + idItem + '"]'); 1663 if (removeItem.length) { 1664 removeItem.remove(); 1665 } else { 1666 $('button.js-addFavorites[data-id="' + idItem + '"]').css('display', ''); 1667 $('button.js-removeFavorites[data-id="' + idItem + '"]').css('display', 'none'); 1668 changeCountInToText($('.js-countFavorites[data-id="' + idItem + '"] > span'), -1); 1669 } 1670 } 1671 } else if (type === 'articles') { 1672 if (action === 'addFavorites') { 1673 $('.actions-article__item.js-addFavorites[data-id="' + idItem + '"]').css('display', 'none'); 1674 $('.actions-article__item.js-removeFavorites[data-id="' + idItem + '"]').css('display', ''); 1675 changeCountInToText($('.js-countFavorites[data-id="' + idItem + '"] > p'), 1); 1676 } else if (action === 'removeFavorites') { 1677 $('.actions-article__item.js-addFavorites[data-id="' + idItem + '"]').css('display', ''); 1678 $('.actions-article__item.js-removeFavorites[data-id="' + idItem + '"]').css('display', 'none'); 1679 changeCountInToText($('.js-countFavorites[data-id="' + idItem + '"] > p'), -1); 1680 } 1681 1682 } 1683 }); 1684} 1685 1686function actionLike(action, idItem, type) { 1687 BX.ajax.runComponentAction( 1688 'extyl:favorites', 1689 action, 1690 { 1691 mode: 'ajax', 1692 data: { 1693 id: idItem, 1694 type: type 1695 }, 1696 } 1697 ).then(function (json) { 1698 if (type === 'articles') { 1699 if (action === 'addLike') { 1700 $('.actions-article__item.js-addLike[data-id="' + idItem + '"]').css('display', 'none'); 1701 $('.actions-article__item.js-removeLike[data-id="' + idItem + '"]').css('display', ''); 1702 changeCountInToText($('.card-article__action.js-countLike[data-id="' + idItem + '"] > p'), 1); 1703 } else if (action === 'removeLike') { 1704 $('.actions-article__item.js-addLike[data-id="' + idItem + '"]').css('display', ''); 1705 $('.actions-article__item.js-removeLike[data-id="' + idItem + '"]').css('display', 'none'); 1706 changeCountInToText($('.card-article__action.js-countLike[data-id="' + idItem + '"] > p'), -1); 1707 } 1708 1709 } 1710 }); 1711} 1712 1713function changeCountInToText($elements, index = 1) { 1714 if (!($elements instanceof $)) { 1715 console.log('ÐеÑвÑй паÑамеÑÑ Ð´Ð¾Ð»Ð¶ÐµÐ½ бÑÑÑ jQuery обÑекÑом'); 1716 return; 1717 } 1718 $elements.each(function() { 1719 const $element = $(this); 1720 let text = $element.text(); 1721 if (!isNaN(text)) { 1722 const number = parseInt(text, 10); 1723 $element.text(number + index); 1724 } 1725 }); 1726} 1727 1728function popupAuth() { 1729 if (document.getElementById('modalAuth').classList.contains('show')) { 1730 document.getElementById('modalAuth').classList.remove('show') 1731 document.getElementById('overlay').classList.remove('show') 1732 document.getElementsByTagName('body')[0].style.overflowY = ''; 1733 document.querySelector('body').style.paddingRight = '0'; 1734 document.querySelector('header.header').style.paddingRight = '0'; 1735 } else if (!document.querySelectorAll('.modal.show').length) { 1736 if (document.querySelector('.page')) { 1737 const dx = `${window.innerWidth - document.querySelector('.page').offsetWidth}px`; 1738 document.querySelector('body').style.paddingRight = dx; 1739 document.querySelector('header.header').style.paddingRight = dx ; 1740 } 1741 document.getElementsByTagName("body")[0].style.overflowY = 'hidden'; 1742 document.getElementById('modalAuth').classList.add('show') 1743 document.getElementById('overlay').classList.add('show') 1744 } 1745} 1746addEvent(document, 'click', '.overlay.show,.modal .close', popupAuth) 1747 1748function popupFeedback() { 1749 if (document.getElementById('modalFeedback').classList.contains('show')) { 1750 document.getElementById('modalFeedback').classList.remove('show') 1751 document.getElementById('overlay').classList.remove('show') 1752 document.getElementsByTagName('body')[0].style.overflowY = ''; 1753 document.querySelector('body').style.paddingRight = '0'; 1754 document.querySelector('header.header').style.paddingRight = '0'; 1755 } else if (!document.querySelectorAll('.modal.show').length) { 1756 if (document.querySelector('.page')) { 1757 const dx = `${window.innerWidth - document.querySelector('.page').offsetWidth}px`; 1758 document.querySelector('body').style.paddingRight = dx; 1759 document.querySelector('header.header').style.paddingRight = dx ; 1760 } 1761 document.getElementsByTagName("body")[0].style.overflowY = 'hidden'; 1762 document.getElementById('modalFeedback').classList.add('show') 1763 document.getElementById('overlay').classList.add('show') 1764 } 1765} 1766addEvent(document, 'click', '.popup-feedback-trigger, .overlay.show, .modal .close', popupFeedback) 1767 1768addEvent(document, 'click', '[data-js-feedback-submit]', onSubmitFeedback()) 1769 1770function onSubmitFeedback() { 1771 const form = document.getElementById('#modalFeedback form'); 1772} 1773 1774addEvent(document, 'click', '.filter-mobile__button', async function (e) { 1775 const filterMobile = document.querySelector(".filter-mobile"); 1776 if (filterMobile) { 1777 if (window.innerWidth < 992 && document.querySelector('.filter') && document.querySelector('.filter-mobile')) { 1778 document.querySelector('.filter-mobile').appendChild(document.querySelector('.filter')) 1779 } 1780 filterMobile.classList.toggle("open"); 1781 } 1782}) 1783 1784addEvent(document, 'click', '.js-apply-filter', async function (e) { 1785 const filterMobile = document.querySelector(".filter-mobile"); 1786 1787 if (e.target.classList.contains('modef')) { 1788 document.querySelector('#modef a').click() 1789 } else if (filterMobile) { 1790 filterMobile.classList.toggle("open"); 1791 } 1792}); 1793 1794function scrollTopCatalog() { 1795 const page = document.querySelector('#observer-catalog-js > div');
1796 const observer = new MutationObserver((record) => { 1797 page.scrollIntoView({block: "start", behavior: "smooth"}) 1798 }) 1799 1800 if (page) { 1801 observer.observe(page, { 1802 childList: true 1803 }) 1804 } 1805} 1806 1807/** 1808 * ÐÐµÐ½Ñ Ð¿Ð¾Ð»ÑзоваÑÐµÐ»Ñ Ð² Ñ ÐµÐ´ÐµÑе (мобайл) 1809 */ 1810class UserHeader { 1811 constructor() { 1812 this.container = document.querySelector('.js-user-header'); 1813 this.triggers = this.container && this.container.querySelectorAll('[data-toggle-menu]'); 1814 this.mediaQuery = window.matchMedia('(max-width: 991.98px)'); 1815 1816 this.data = { 1817 open: '_open', 1818 lock: '_lock', 1819 } 1820 1821 this.lock = false; 1822 1823 if (this.container) { 1824 this.init(); 1825 } 1826 } 1827 1828 init() { 1829 this.bindMethods(); 1830 this.addListenerTriggerClick(); 1831 this.addListenerResize(); 1832 } 1833 1834 bindMethods() { 1835 this.triggerClickHandler = this.triggerClickHandler.bind(this); 1836 this.onResize = this.onResize.bind(this); 1837 } 1838 1839 addListenerTriggerClick() { 1840 for (const el of this.triggers) { 1841 el.addEventListener('click', this.triggerClickHandler); 1842 } 1843 } 1844 triggerClickHandler(e) { 1845 e.preventDefault(); 1846 1847 this.onTriggerClick(e); 1848 } 1849 1850 onTriggerClick(e) { 1851 this.container.classList.toggle(this.data.open); 1852 this.lock = !this.lock; 1853 1854 this.toggleBodyLock(this.lock); 1855 } 1856 toggleBodyLock(flag) { 1857 if (flag) { 1858 document.body.classList.add(this.data.lock); 1859 } else { 1860 document.body.classList.remove(this.data.lock); 1861 } 1862 } 1863 1864 addListenerResize() { 1865 this.mediaQuery.addEventListener('change', this.onResize); 1866 } 1867 1868 onResize() { 1869 if (!this.mediaQuery.matches) { 1870 this.container.classList.remove(this.data.open); 1871 this.lock = false; 1872 1873 this.toggleBodyLock(this.lock); 1874 } 1875 } 1876} 1877 1878/** 1879 * ÐалендаÑÑ Ð² поле ввода 1880 */ 1881class Calendar { 1882 constructor(selector, control) { 1883 if (!selector) { 1884 return; 1885 } 1886 this.control = control; 1887 /** ÐонÑÐµÐ¹Ð½ÐµÑ */ 1888 this.container = selector; 1889 1890 /** ÐаннÑе */ 1891 this.data = { 1892 container: 'calendar', 1893 open: '_open', 1894 select: '_select', 1895 }; 1896 1897 /** ÐнпÑÑ */ 1898 this.input = this.container.querySelector('.js-calendar-input'); 1899 /** Ðнопка Ñ Ð¸ÐºÐ¾Ð½ÐºÐ¾Ð¹ календаÑÑ */ 1900 this.trigger = this.container.querySelector('.js-calendar-trigger'); 1901 1902 /** Флаг календаÑÑ Ñо вÑеменем */ 1903 this.withTime = false; 1904 1905 /** ÐаÑка Ð¿Ð¾Ð»Ñ Ð²Ð²Ð¾Ð´Ð° */ 1906 this.mask = null; 1907 /** ÐалендаÑÑ */ 1908 this.calendar = null; 1909 /** ÐнпÑÑ ÑаÑов */ 1910 this.inputHours = null; 1911 /** ÐнпÑÑ Ð¼Ð¸Ð½ÑÑ */ 1912 this.inputMinutes = null; 1913 /** ÐаÑка инпÑÑа ÑаÑов */ 1914 this.inputHoursMask = null; 1915 /** ÐаÑка инпÑÑа минÑÑ */ 1916 this.inputMinutesMask = null; 1917 1918 this.bindMethods(); 1919 } 1920 1921 /** 1922 * СвÑзÑваем меÑÐ¾Ð´Ñ 1923 */ 1924 bindMethods() { 1925 this.onDocClick = this.onDocClick.bind(this); 1926 } 1927 1928 /** 1929 * ÐÐ½Ð¸Ñ Ð²Ñемени 1930 */ 1931 initTime() { 1932 this.withTime = true; 1933 this.initHours(); 1934 this.initMinutes(); 1935 this.setTime(); 1936 } 1937 1938 /** 1939 * ÐобавлÑем ÑлÑÑаÑÐµÐ»Ñ ÐºÐ»Ð¸ÐºÐ° по докÑменÑÑ 1940 */ 1941 addListenerDocClick() { 1942 document.addEventListener('click', this.onDocClick); 1943 } 1944 /** 1945 * УбиÑаем ÑлÑÑаÑÐµÐ»Ñ ÐºÐ»Ð¸ÐºÐ° по докÑменÑÑ 1946 */ 1947 removeListenerDocClick() { 1948 document.removeEventListener('click', this.onDocClick); 1949 } 1950 /** 1951 * ÐобавлÑем ÑлÑÑаÑÐµÐ»Ñ ÐºÐ»Ð¸ÐºÐ° по иконке календаÑÑ 1952 */ 1953 addListenerTriggerClick() { 1954 this.trigger.addEventListener('click', this.onTriggerClick); 1955 } 1956 /** 1957 * ÐейÑÑвие по ÐºÐ»Ð¸ÐºÑ Ð½Ð° Ð¸ÐºÐ¾Ð½ÐºÑ ÐºÐ°Ð»ÐµÐ½Ð´Ð°ÑÑ 1958 */ 1959 onTriggerClick = (e) => { 1960 e.preventDefault(); 1961 e.stopPropagation(); 1962 1963 if (this.isOpen) { 1964 this.removeListenerDocClick(); 1965 } 1966 1967 if (this.withTime) { 1968 this.setDefaultValueWithTime(); 1969 } 1970 1971 this.container.classList.toggle(this.data.open); 1972 1973 if (this.isOpen) { 1974 setTimeout(() => { 1975 this.addListenerDocClick(); 1976 }, 1); 1977 } 1978 }; 1979 1980 /** 1981 * ÐниÑим маÑÐºÑ ÐºÐ°Ð»ÐµÐ½Ð´Ð°ÑÑ Ñо вÑеменем 1982 */ 1983 renderStaticMask() { 1984 this.mask = new Mask(this.input); 1985 this.mask.setCalStaticMask(); 1986 } 1987 /** 1988 * ÐниÑим календаÑÑ Ñо вÑеменем 1989 */
1990 renderStatic() { 1991 this.renderStaticMask(); 1992 this.calendar = new AirDatepicker(this.input, this.optionsStatic); 1993 this.addListenerTriggerClick(); 1994 } 1995 1996 /** 1997 * ÐниÑим инпÑÑ Ñ ÑаÑами 1998 */ 1999 initHours() { 2000 this.inputHours = this.container.querySelector('.js-cal-input-hours'); 2001 this.inputHours.setAttribute('placeholder', '00'); 2002 this.inputHoursMask = new Mask(this.inputHours); 2003 this.inputHoursMask.setTimeMask(0, 23); 2004 2005 this.inputHours.addEventListener('input', (e) => { 2006 const curInputHours = this.container.querySelector('input[name="hours"]'); 2007 curInputHours.value = e.target.value; 2008 // curInputHours.dispatchEvent(new Event('input')); 2009 // setTimeout(() => { 2010 // this.inputHours.focus(); 2011 // }, 2); 2012 }); 2013 2014 } 2015 /** 2016 * ÐниÑим инпÑÑ Ñ Ð¼Ð¸Ð½ÑÑами 2017 */ 2018 initMinutes() { 2019 this.inputMinutes = this.container.querySelector('.js-cal-input-minutes'); 2020 this.inputMinutes.setAttribute('placeholder', '00'); 2021 this.inputMinutesMask = new Mask(this.inputMinutes); 2022 this.inputMinutesMask.setTimeMask(0, 59); 2023 2024 this.inputMinutes.addEventListener('input', (e) => { 2025 const curInputMinutes = this.container.querySelector( 2026 'input[name="minutes"]' 2027 ); 2028 curInputMinutes.value = e.target.value; 2029 // curInputMinutes.dispatchEvent(new Event('input')); 2030 // setTimeout(() => { 2031 // this.inputMinutes.focus(); 2032 // }, 2); 2033 }); 2034 2035 } 2036 /** 2037 * УÑÑановка знаÑÐµÐ½Ð¸Ñ ÐºÐ°Ð»ÐµÐ½Ð´Ð°ÑÑ Ñо вÑеменем 2038 */ 2039 setDefaultValueWithTime() { 2040 if (this.mask.curMask.unmaskedValue !== '') { 2041 /** ÐоÑÑекÑÐ½Ð°Ñ Ð´Ð°Ñа */ 2042 let date = this.input.value.slice(0, 11); 2043 date = Calendar.replaceChars(date, 0, 3); 2044 date = Calendar.replaceChars(date, 1, 4); 2045 2046 this.setTime(); 2047 2048 if (this.mask.curMask.unmaskedValue.length > 11) { 2049 date += this.inputHours.value + ':'; 2050 date += this.inputMinutes.value; 2051 2052 const curInputHours = this.container.querySelector('input[name="hours"]'); 2053 const curInputMinutes = this.container.querySelector('input[name="minutes"]'); 2054 2055 curInputHours.value = this.inputHours.value; 2056 curInputHours.dispatchEvent(new Event('input')); 2057 2058 curInputMinutes.value = this.inputMinutes.value; 2059 curInputMinutes.dispatchEvent(new Event('input')); 2060 } 2061 2062 this.calendar.selectDate(date, { 2063 updateTime: true, 2064 }); 2065 this.calendar.setViewDate(date); 2066 2067 2068 } 2069 } 2070 2071 /** 2072 * УÑÑановка вÑемени 2073 */ 2074 setTime() { 2075 if (this.input.value.length > 11) { 2076 this.inputHours.value = this.input.value.slice(11, 13); 2077 this.inputHoursMask.curMask.updateValue(); 2078 this.inputMinutes.value = this.input.value.slice(14, 16); 2079 this.inputMinutesMask.curMask.updateValue(); 2080 } 2081 } 2082 /** 2083 * ÐейÑÑвие по ÐºÐ»Ð¸ÐºÑ Ð½Ð° докÑÐ¼ÐµÐ½Ñ 2084 */ 2085 onDocClick(e) { 2086 const { target } = e; 2087 2088 setTimeout(() => { 2089 if ( 2090 !target.classList.contains('air-datepicker-cell') && 2091 !target.closest('.air-datepicker') && 2092 !target.closest('.js-calendar-trigger') && 2093 this.isOpen 2094 ) { 2095 this.removeListenerDocClick(); 2096 this.container.classList.remove(this.data.open); 2097 2098 if (this.container.classList.contains(this.data.select)) { 2099 const curInputHours = this.container.querySelector('input[name="hours"]'); 2100 curInputHours.dispatchEvent(new Event('input')); 2101 2102 const curInputMinutes = this.container.querySelector('input[name="minutes"]'); 2103 curInputMinutes.dispatchEvent(new Event('input')); 2104 } 2105 } 2106 }, 1); 2107 2108 } 2109 2110 /** 2111 * ÐолÑÑаем наÑÑÑойки календаÑÑ Ñо вÑеменем 2112 */ 2113 get optionsStatic() { 2114 const THIS = this; 2115 2116 /** Ðаголовок вÑемени */ 2117 const titleTime = { 2118 content: 'ÐÑемÑ:', 2119 tagName: 'div', 2120 className: 'cal-time-title', 2121 }; 2122 /** ÐнпÑÑ ÑаÑов */ 2123 const inputHours = { 2124 tagName: 'input', 2125 className: 'cal-time-input js-cal-input-hours', 2126 }; 2127 /** РазделиÑÐµÐ»Ñ (двоеÑоÑие) */ 2128 const separatorTime = { 2129 content: ':', 2130 tagName: 'div', 2131 className: 'cal-time-separator', 2132 }; 2133 /** ÐнпÑÑ Ð¼Ð¸Ð½ÑÑ */ 2134 const inputMinutes = { 2135 tagName: 'input', 2136 className: 'cal-time-input js-cal-input-minutes', 2137 }; 2138 2139 return { 2140 classes: this.data.container, 2141 container: this.container, 2142 inline: true, 2143 toggleSelected: false, 2144 timepicker: true, 2145 timeFormat: 'HH:mm', 2146 dateTimeSeparator: ' ', 2147 buttons: [titleTime, inputHours, separatorTime, inputMinutes], 2148 onSelect(date, formattedDate, datepicker) {
2149 THIS.mask.curMask.updateValue(); 2150 THIS.input.focus(); 2151 THIS.input.blur(); 2152 THIS.container.classList.add(THIS.data.select); 2153 2154 if (THIS.inputHours.value === '' && THIS.inputMinutes.value === '') { 2155 THIS.setTime(); 2156 } 2157 }, 2158 }; 2159 } 2160 /** 2161 * ÐÑовеÑка на оÑкÑÑÑие календаÑÑ 2162 */ 2163 get isOpen() { 2164 return this.container.classList.contains(this.data.open); 2165 } 2166 2167 /** 2168 * ФоÑмаÑиÑование даÑÑ Ð² коÑÑекÑнÑÑ 2169 */ 2170 static replaceChars(string, from, to) { 2171 if (string[from] != undefined && string[to] != undefined) { 2172 var newString = Array.prototype.slice.call(string); 2173 2174 newString[from] = string[to]; 2175 newString[to] = string[from]; 2176 2177 return newString.join(''); 2178 } else { 2179 return string; 2180 } 2181 } 2182} 2183 2184/** 2185 * ÐагÑÑзка Ñайлов 2186 */ 2187class FileUploader { 2188 constructor() { 2189 const selectors = document.querySelectorAll('.js-file-uploader'); 2190 2191 for (const el of selectors) { 2192 if (!el.hasAttribute('data-inited')) { 2193 el.setAttribute('data-inited', true); 2194 this.init(el); 2195 } 2196 } 2197 } 2198 2199 /** 2200 * ÐниÑ. 2201 * ÐобавлÑем ÑлÑÑаÑÐµÐ»Ñ change на инпÑÑ. 2202 * ÐобавлÑем ÑлÑÑаÑÐµÐ»Ñ drop на облаÑÑÑ Ð´Ñопа. 2203 * @param {HTMLElement} el конÑÐµÐ¹Ð½ÐµÑ 2204 */ 2205 init(el) { 2206 const container = el; 2207 2208 /** @type {HTMLElement|null} облаÑÑÑ Ð´Ñопа */ 2209 const area = container.querySelector('.js-file-uploader-area'); 2210 2211 /** @type {HTMLInputElement|null} инпÑÑ */ 2212 const input = container.querySelector('.custom-uploader__input'); 2213 2214 /** @type {HTMLElement|null} кнопка ÑдалиÑÑ, еÑли по деÑолÑÑ ÐµÑÑÑ Ð°Ð²Ð°ÑÐ°Ñ */ 2215 const btnRemove = container.querySelector('.js-file-uploader-remove'); 2216 2217 /** @type {HTMLElement|null} кнопка ÑдалиÑÑ ÑÑаÑиÑÐ½Ð°Ñ */ 2218 const avaRemoveStatic = container.querySelector('.js-file-uploader-remove-static'); 2219 2220 /** @type {HTMLElement|null} облаÑÑÑ Ð·Ð°Ð³ÑÑзки аваÑаÑа */ 2221 const avaArea = container.querySelector('.js-file-uploader-avatar-area'); 2222 2223 /** @type {HTMLElement|null} аваÑÐ°Ñ */ 2224 const avatar = container.querySelector('.profile__avatar'); 2225 2226 /** @type {HTMLElement|null} пÑевÑÑ Ð°Ð²Ð°ÑаÑа */ 2227 const preview = container.querySelector('.js-file-uploader-preview'); 2228 2229 /** @type {Boolean} Ñлаг множеÑÑвенного Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ */ 2230 const isMultiple = input.hasAttribute('multiple'); 2231 2232 /** @type {Boolean} Ñлаг загÑÑзки аваÑаÑа(каÑÑинки) */ 2233 const isAvatar = container.classList.contains('_avatar'); 2234 2235 /** @type {HTMLElement} ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ñ ÑекÑÑом оÑибки */ 2236 const errorText = container.querySelector('.js-file-uploader-error'); 2237 2238 /** @type {Number} макÑималÑное кол-во Ñайлов поÑле Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ (Ñже оÑÑендеÑеннÑÑ ) */ 2239 const maxCountAcceptedFiles = Number( 2240 input.getAttribute('data-max-count-accepted-files') 2241 ); 2242 2243 /** @type {Number} макÑималÑное кол-во Ñайлов поÑле Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ (Ñже оÑÑендеÑеннÑÑ ) */ 2244 const maxCountOneTime = Number( 2245 input.getAttribute('data-max-count-one-time-files') 2246 ); 2247 2248 /** @type {Number} макÑималÑнÑй ÑÐ°Ð·Ð¼ÐµÑ Ð²ÑÐµÑ Ñайлов */ 2249 const maxSizeMb = Number(input.getAttribute('data-max-size-mb')); 2250 2251 /** @type {Number} макÑималÑнÑй ÑÐ°Ð·Ð¼ÐµÑ Ð¾Ð´Ð½Ð¾Ð³Ð¾ Ñайла */ 2252 const maxSizeOneFileMb = Number( 2253 input.getAttribute('data-max-size-one-file-mb') 2254 ); 2255 2256 /** @type {Array} маÑÑив допÑÑÑимÑÑ ÑаÑÑиÑений Ñайла */ 2257 let extensions = []; 2258 2259 if (isAvatar) { 2260 extensions = ['png', 'jpg', 'jpeg', 'gif']; 2261 } else { 2262 extensions = [ 2263 'png', 2264 'jpg', 2265 'jpeg', 2266 'pdf', 2267 'doc', 2268 'docx', 2269 'xls', 2270 'xlsx', 2271 'ppt', 2272 'pptx', 2273 ]; 2274 } 2275 if (!input.filesArray) { 2276 input.filesArray = []; 2277 } 2278 2279 /** оÑибка по обÑÐµÐ¼Ñ ÑазмеÑÑ Ð¿ÑинÑÑÑÑ Ñайлов */ 2280 let errorAcceptedSize = false; 2281 /** оÑибка по ÑазмеÑÑ Ð¾Ð´Ð½Ð¾Ð³Ð¾ добавлÑемого Ñайла */ 2282 let errorSizeOneFile = false;
2283 /** оÑибка по кол-Ð²Ñ Ð¿ÑинÑÑÑÑ Ñайлов */ 2284 let errorCountAcceptedFiles = false; 2285 /** оÑибка по кол-Ð²Ñ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð½ÑÑ Ñазом Ñайлов */ 2286 let errorCountOneTimeFiles = false; 2287 /** оÑибка по ÑаÑÑиÑÐµÐ½Ð¸Ñ */ 2288 let errorExtension = false; 2289 /** @type {Array} маÑÑив Ñайлов, огÑаниÑеннÑй по макÑималÑÐ½Ð¾Ð¼Ñ Ð´Ð¾Ð¿ÑÑÑÐ¸Ð¼Ð¾Ð¼Ñ ÐºÐ¾Ð»-Ð²Ñ Ð¸ кол-Ð²Ñ Ð·Ð° Ñаз */ 2290 let filesArray = []; 2291 /** Ð½ÐµÐ¿Ð¾Ð´Ñ Ð¾Ð´ÑÑие по ÑаÑÑиÑÐµÐ½Ð¸Ñ ÑÐ°Ð¹Ð»Ñ */ 2292 let notExtensionFiles = []; 2293 /** Ð½ÐµÐ¿Ð¾Ð´Ñ Ð¾Ð´ÑÑий по ÑазмеÑÑ Ñайл */ 2294 let notSizeOneFile = []; 2295 /** Ð½ÐµÐ¿Ð¾Ð´Ñ Ð¾Ð´ÑÑие по ÑазмеÑÑ Ð¿ÑинÑÑÑе ÑÐ°Ð¹Ð»Ñ */ 2296 let notSizeAcceptedFiles = []; 2297 /** обÑий ÑÐ°Ð·Ð¼ÐµÑ Ñайлов в ÐÐ */ 2298 let sizeInMB = Number(input.getAttribute('data-size')); 2299 /** Ð½ÐµÐ¿Ð¾Ð´Ñ Ð¾Ð´ÑÑие по ÑазмеÑÑ ÑÐ°Ð¹Ð»Ñ Ð² ÐÐ */ 2300 let notSizeAcceptedFilesMb = 0; 2301 /** ÑÐ°Ð·Ð¼ÐµÑ Ñайла */ 2302 let fileSize = 0; 2303 /** ÑкÑÑÑÑй инпÑÑ Ð´Ð»Ñ Ð¿Ð¾Ð´ÑвеÑÐ¶Ð´ÐµÐ½Ð¸Ñ ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ð°Ð²Ð°ÑаÑа */ 2304 let inputToRemove = null; 2305 2306 /** 2307 * ÐоказÑваем аваÑаÑ, ÑкÑÑваем облаÑÑÑ Ð·Ð°Ð³ÑÑзки аваÑаÑа 2308 */ 2309 function showAvatar() { 2310 if (avatar) { 2311 avatar.style.display = ''; 2312 } 2313 if (inputToRemove) { 2314 inputToRemove.remove(); 2315 }
2316 if (avaArea) { 2317 avaArea.style.display = 'none'; 2318 } 2319 2320 if (avaRemoveStatic) { 2321 avaRemoveStatic.style.visibility = ''; 2322 } 2323 } 2324 2325 /** 2326 * ÐоказÑваем облаÑÑÑ Ð·Ð°Ð³ÑÑзки аваÑаÑа, ÑкÑÑваем аваÑÐ°Ñ 2327 */ 2328 function showAvaArea() { 2329 if (avatar) { 2330 avatar.style.display = 'none'; 2331 } 2332 if (avaArea) { 2333 avaArea.style.display = ''; 2334 } 2335 if (avaRemoveStatic) { 2336 avaRemoveStatic.style.visibility = 'hidden'; 2337 } 2338 } 2339 /** 2340 * Удаление аваÑаÑа 2341 */ 2342 function removeAvatar() { 2343 if (preview && preview.src) { 2344 showAvaArea(); 2345 preview.src = ''; 2346 input.filesArray = []; 2347 input.value = ''; 2348 input.setAttribute('data-size', 0); 2349 inputToRemove = document.createElement('INPUT'); 2350 inputToRemove.classList.add('avatar-hidden-input'); 2351 inputToRemove.type = 'hidden'; 2352 inputToRemove.name = 'PERSONAL_PHOTO_del'; 2353 inputToRemove.value = 'Y'; 2354 container.appendChild(inputToRemove); 2355 } 2356 } 2357 2358 /** 2359 * Ð¥ÐµÐ½Ð´Ð»ÐµÑ ÐºÐ»Ð¸ÐºÐ° по кнопке ÑдалиÑÑ 2360 * @param {Event} e ÑобÑÑие 2361 */ 2362 function clickBtnRemoveHandler(e) { 2363 e.preventDefault(); 2364 removeAvatar(); 2365 } 2366 2367 /** 2368 * 2369 * @param {Object} items ÑÐ°Ð¹Ð»Ñ 2370 * @param {String} type Ñип ÑобÑÑÐ¸Ñ (change или drop) 2371 */ 2372 function prepareFiles(items, type) { 2373 const files = items; 2374 2375 sizeInMB = Number(input.getAttribute('data-size')); 2376 errorAcceptedSize = false; 2377 errorSizeOneFile = false; 2378 errorCountAcceptedFiles = false; 2379 errorCountOneTimeFiles = false; 2380 errorExtension = false; 2381 2382 filesArray = []; 2383 notExtensionFiles = []; 2384 notSizeOneFile = []; 2385 notSizeAcceptedFiles = []; 2386 2387 notSizeAcceptedFilesMb = 0; 2388 fileSize = 0; 2389
2390 errorText.innerHTML = ''; 2391 2392 if (isMultiple) { 2393 // ÐÑовеÑка на кол-во добавленнÑÑ Ñазом Ñайлов 2394 if (files.length > maxCountOneTime && !errorCountOneTimeFiles) { 2395 errorCountOneTimeFiles = true; 2396 errorText.innerHTML += `<p>ÐдновÑеменно можно загÑÑзиÑÑ Ð´Ð¾ ${maxCountOneTime} Ñайлов</p>`; 2397 FileUploader.addError(input); 2398 filesArray = Array.from(files).slice(0, maxCountOneTime + 1); 2399 } 2400 } 2401 2402 if (filesArray.length === 0) { 2403 filesArray = Array.from(files); 2404 } 2405 /** @type {Object} DataTransfer */ 2406 const dt = new DataTransfer(); 2407 2408 for (let i = 0; i < filesArray.length; i++) { 2409 let file; 2410 if (type === 'drop' && filesArray[i].kind === 'file') { 2411 file = filesArray[i].getAsFile(); 2412 } else if (type === 'change') { 2413 file = filesArray[i]; 2414 } 2415 fileSize = parseFloat((file.size / (1024 * 1024)).toFixed(2)); 2416 2417 if (fileSize > maxSizeOneFileMb && !errorSizeOneFile) { 2418 fileSize = 0; 2419 errorSizeOneFile = true; 2420 notSizeOneFile.push(` ${file.name}`); 2421 } 2422 2423 if (input.filesArray.length < maxCountAcceptedFiles) { 2424 sizeInMB += fileSize; 2425 } 2426 /** ÐопÑÑÑимÑй ÑÐ°Ð·Ð¼ÐµÑ */ 2427 const acceptSize = sizeInMB <= maxSizeMb; 2428 2429 /** РаÑÑиÑение Ñайла */ 2430 const extension = file.name.slice(file.name.lastIndexOf('.') + 1); 2431 /** ÐопÑÑÑимое ÑаÑÑиÑение */ 2432 const acceptExtension = extensions.includes(extension.toLowerCase()); 2433 2434 // ÐÑовеÑка на ÑÐ°Ð·Ð¼ÐµÑ Ñайлов 2435 if (!acceptSize && !errorAcceptedSize) { 2436 errorAcceptedSize = true; 2437 notSizeAcceptedFiles.push(` ${file.name}`); 2438 if (input.filesArray.length < maxCountAcceptedFiles) { 2439 notSizeAcceptedFilesMb += fileSize; 2440 } 2441 } 2442 2443 // ÐÑовеÑка на ÑаÑÑиÑение 2444 if (!acceptExtension && !errorExtension) { 2445 errorExtension = true; 2446 notExtensionFiles.push(` ${file.name}`); 2447 } 2448 2449 // ÐÑли Ð½ÐµÑ Ð¾Ñибок, добавлÑем Ñайл 2450 if ( 2451 !errorAcceptedSize && 2452 !errorSizeOneFile && 2453 !errorExtension && 2454 !errorCountOneTimeFiles 2455 ) { 2456 dt.items.add(file); 2457 } 2458 errorAcceptedSize = false; 2459 errorExtension = false; 2460 errorSizeOneFile = false; 2461 errorCountOneTimeFiles = false; 2462 } 2463 2464 // ÐÑовеÑка, еÑÑÑ Ð»Ð¸ Ð½ÐµÐ¿Ð¾Ð´Ñ Ð¾Ð´ÑÑий по ÑазмеÑÑ Ñайл 2465 if (notSizeOneFile.length > 0) { 2466 let text = notSizeOneFile.length === 1 ? 'Ñайла' : 'Ñайлов:';
2467 errorText.innerHTML += `<p>ÐÑевÑÑен ÑÐ°Ð·Ð¼ÐµÑ ${text} ${notSizeOneFile}</p>`; 2468 FileUploader.addError(input); 2469 } 2470 2471 // ÐÑовеÑка, еÑÑÑ Ð»Ð¸ Ð½ÐµÐ¿Ð¾Ð´Ñ Ð¾Ð´ÑÑие по ÑаÑÑиÑÐµÐ½Ð¸Ñ ÑÐ°Ð¹Ð»Ñ 2472 if (notExtensionFiles.length > 0) { 2473 let text = notExtensionFiles.length === 1 ? 'Ñайла' : 'Ñайлов:'; 2474 errorText.innerHTML += `<p>ÐевеÑнÑй ÑоÑÐ¼Ð°Ñ ${text} ${notExtensionFiles}</p>`; 2475 FileUploader.addError(input); 2476 } 2477 2478 // ÐÑовеÑка, еÑÑÑ Ð»Ð¸ Ð½ÐµÐ¿Ð¾Ð´Ñ Ð¾Ð´ÑÑие по обÑÐµÐ¼Ñ ÑазмеÑÑ ÑÐ°Ð¹Ð»Ñ 2479 if (notSizeAcceptedFiles.length > 0) { 2480 errorText.innerHTML += '<p>ÐÑевÑÑен обÑий ÑÐ°Ð·Ð¼ÐµÑ Ñайлов</p>'; 2481 FileUploader.addError(input); 2482 sizeInMB -= notSizeAcceptedFilesMb; 2483 } 2484 2485 // ÐовÑоÑÐ½Ð°Ñ Ð¿ÑовеÑка на кол-во Ñайлов Ð´Ð»Ñ ÑендеÑа ÑпиÑка 2486 for (const file of dt.files) { 2487 if (!isMultiple) { 2488 if (input.filesArray.length === 1) { 2489 input.filesArray.shift(); 2490 } 2491 } 2492 2493 // ÐÑевÑÑ ÐºÐ°ÑÑинки 2494 if (isAvatar && !isMultiple) { 2495 const curFile = input.files[0]; 2496 const reader = new FileReader(); 2497 reader.onloadend = function () { 2498 if (preview) { 2499 preview.src = reader.result; 2500 } 2501 showAvatar(); 2502 }; 2503 reader.readAsDataURL(curFile); 2504 } 2505 2506 if (isMultiple) { 2507 if (input.filesArray.length >= maxCountAcceptedFiles) { 2508 if (!errorCountAcceptedFiles) { 2509 errorCountAcceptedFiles = true;
2510 errorText.innerHTML += `<p>ÐÑ Ð¼Ð¾Ð¶ÐµÑе пÑикÑепиÑÑ Ð´Ð¾ ${maxCountAcceptedFiles} Ñайлов</p>`; 2511 } 2512 FileUploader.addError(input); 2513 break; 2514 } 2515 } 2516 2517 // ÐладÑм валиднÑй Ñайл в маÑÑив Ñайлов 2518 input.filesArray.push(file); 2519 } 2520 2521 // УÑÑанавливаем ÑекÑÑий обÑий ÑÐ°Ð·Ð¼ÐµÑ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð½ÑÑ Ñайлов 2522 input.setAttribute('data-size', sizeInMB); 2523 FileUploader.renderFilesList(input); 2524 if (!isAvatar) { 2525 input.value = ''; 2526 } 2527 } 2528 2529 /** 2530 * Ð¥ÐµÐ½Ð´Ð»ÐµÑ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð¸Ð½Ð¿ÑÑа 2531 * @param {Event} e ÑобÑÑие 2532 */ 2533 function changeHandler(e) { 2534 prepareFiles(input.files, e.type); 2535 } 2536 2537 /** 2538 * Ð¥ÐµÐ½Ð´Ð»ÐµÑ Ð´Ñопа Ñайла в облаÑÑÑ Ð´Ñопа 2539 * @param {Event} e ÑобÑÑие 2540 */ 2541 function dropHandler(e) { 2542 e.preventDefault(); 2543 2544 FileUploader.removeError(input); 2545 2546 container.classList.remove('_drag-over'); 2547 2548 if (e.dataTransfer.items) { 2549 // DataTransferItemList 2550 prepareFiles([...e.dataTransfer.items], e.type); 2551 } else { 2552 // DataTransfer 2553 prepareFiles([...e.dataTransfer.files], e.type); 2554 } 2555 } 2556 2557 /** 2558 * Ð¥ÐµÐ½Ð´Ð»ÐµÑ Ð¿ÐµÑеÑаÑÐºÐ¸Ð²Ð°Ð½Ð¸Ñ Ð½Ð°Ð´ облаÑÑÑÑ Ð´Ñопа 2559 * @param {Event} e ÑобÑÑие 2560 */ 2561 function dragOverHandler(e) { 2562 e.preventDefault(); 2563 container.classList.add('_drag-over'); 2564 } 2565 2566 /** 2567 * Ð¥ÐµÐ½Ð´Ð»ÐµÑ Ð¿ÐµÑеÑеÑÐºÐ¸Ð²Ð°Ð½Ð¸Ñ Ð²Ð½Ðµ облаÑÑи дÑопа. 2568 * СÑабаÑÑÐ²Ð°ÐµÑ Ð¿Ð¾Ñле dragOverHandler 2569 * @param {Event} e ÑобÑÑие 2570 */ 2571 function dragLeaveHandler(e) { 2572 container.classList.remove('_drag-over'); 2573 } 2574 2575 input.addEventListener('change', changeHandler); 2576 2577 if (area) { 2578 area.addEventListener('drop', dropHandler); 2579 area.addEventListener('dragover', dragOverHandler); 2580 area.addEventListener('dragleave', dragLeaveHandler); 2581 } 2582 2583 if (btnRemove) { 2584 btnRemove.addEventListener('click', clickBtnRemoveHandler); 2585 } 2586 2587 if (input.hasAttribute('has-value-default')) { 2588 showAvatar(); 2589 } else { 2590 showAvaArea(); 2591 } 2592 } 2593 2594 /** 2595 * Ð ÐµÐ½Ð´ÐµÑ Ð¾Ð´Ð½Ð¾Ð³Ð¾ Ñайла в ÑазмеÑÐºÑ 2596 * @param {Object} file обÑÐµÐºÑ Ñайла 2597 * @param {Number} index Ð¸Ð½Ð´ÐµÐºÑ Ñайла 2598 * @param {HTMLInputElement} input инпÑÑ 2599 * @returns {HTMLDivElement} блок Ñ Ñайлом 2600 */ 2601 static renderFile(file, index, input) { 2602 const container = document.createElement('div'); 2603 container.classList.add('custom-uploader__file'); 2604 2605 const fileName = document.createElement('div'); 2606 fileName.classList.add( 2607 'custom-uploader__file-name', 2608 'fs-18', 2609 'c-dark-green' 2610 ); 2611 fileName.innerHTML = file.name; 2612 2613 const fileSize = document.createElement('div'); 2614 fileSize.classList.add('custom-uploader__file-size', 'c-agat-grey'); 2615 fileSize.innerHTML = FileUploader.formatBytes(file.size); 2616 2617 const deleteIcon = document.createElement('button'); 2618 deleteIcon.type = 'button'; 2619 deleteIcon.classList.add('custom-uploader__file-delete'); 2620 deleteIcon.innerHTML = ` 2621 <svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg"> 2622 <path d="M7.30775 21.0002C6.81058 21.0002 6.385 20.8232 6.031 20.4692C5.677 20.1152 5.5 19.6896 5.5 19.1925V6.50022H5.25C5.0375 6.50022 4.85942 6.42831 4.71575 6.28447C4.57192 6.14064 4.5 5.96247 4.5 5.74997C4.5 5.53731 4.57192 5.35922 4.71575 5.21572C4.85942 5.07206 5.0375 5.00022 5.25 5.00022H9C9 4.75539 9.08625 4.54672 9.25875 4.37422C9.43108 4.20189 9.63967 4.11572 9.8845 4.11572H14.1155C14.3603 4.11572 14.5689 4.20189 14.7413 4.37422C14.9138 4.54672 15 4.75539 15 5.00022H18.75C18.9625 5.00022 19.1406 5.07214 19.2843 5.21597C19.4281 5.35981 19.5 5.53797 19.5 5.75047C19.5 5.96314 19.4281 6.14122 19.2843 6.28472C19.1406 6.42839 18.9625 6.50022 18.75 6.50022H18.5V19.1925C18.5 19.6896 18.323 20.1152 17.969 20.4692C17.615 20.8232 17.1894 21.0002 16.6923 21.0002H7.30775ZM17 6.50022H7V19.1925C7 19.2823 7.02883 19.3561 7.0865 19.4137C7.14417 19.4714 7.21792 19.5002 7.30775 19.5002H16.6923C16.7821 19.5002 16.8558 19.4714 16.9135 19.4137C16.9712 19.3561 17 19.2823 17 19.1925V6.50022ZM10.1543 17.5002C10.3668 17.5002 10.5448 17.4284 10.6885 17.2847C10.832 17.1409 10.9037 16.9627 10.9037 16.7502V9.25022C10.9037 9.03772 10.8318 8.85956 10.688 8.71572C10.5443 8.57206 10.3662 8.50022 10.1535 8.50022C9.941 8.50022 9.76292 8.57206 9.61925 8.71572C9.47575 8.85956 9.404 9.03772 9.404 9.25022V16.7502C9.404 16.9627 9.47583 17.1409 9.6195 17.2847C9.76333 17.4284 9.94158 17.5002 10.1543 17.5002ZM13.8465 17.5002C14.059 17.5002 14.2371 17.4284 14.3807 17.2847C14.5243 17.1409 14.596 16.9627 14.596 16.7502V9.25022C14.596 9.03772 14.5242 8.85956 14.3805 8.71572C14.2367 8.57206 14.0584 8.50022 13.8458 8.50022C13.6333 8.50022 13.4552 8.57206 13.3115 8.71572C13.168 8.85956 13.0962 9.03772 13.0962 9.25022V16.7502C13.0962 16.9627 13.1682 17.1409 13.312 17.2847C13.4557 17.4284 13.6338 17.5002 13.8465 17.5002Z" fill="currentColor"/> 2623 </svg> 2624 `; 2625 2626 container.append(fileName); 2627 container.append(fileSize); 2628 container.append(deleteIcon); 2629 2630 /** 2631 * Удаление Ñайла 2632 */ 2633 function deleteFile() { 2634 const form = deleteIcon.closest('.js-form'); 2635 2636 let sizeInMB = Number(input.getAttribute('data-size')); 2637 2638 for (let i = 0; i < input.filesArray.length; i++) { 2639 if (index === i) { 2640 sizeInMB -= parseFloat( 2641 (input.filesArray[i].size / (1024 * 1024)).toFixed(2) 2642 ); 2643 if (sizeInMB < 0) { 2644 sizeInMB = 0; 2645 } 2646 input.filesArray.splice(i, 1); 2647 input.setAttribute('data-size', sizeInMB); 2648 } 2649 } 2650 2651 input.value = ''; 2652 2653 FileUploader.renderFilesList(input); 2654 2655 const event = new Event('fileDeleted', { bubbles: true }); 2656 document.dispatchEvent(event); 2657 2658 const eventChangeForm = new Event('change', { bubbles: true }); 2659 form.dispatchEvent(eventChangeForm); 2660 } 2661 2662 /** 2663 * Ð¥ÐµÐ½Ð´Ð»ÐµÑ ÐºÐ»Ð¸ÐºÐ° по кнопке ÑдалиÑÑ Ñайл 2664 * @param {Event} e ÑобÑÑие 2665 */ 2666 function clickHandler(e) { 2667 e.preventDefault(); 2668 e.stopPropagation(); 2669 2670 deleteFile(); 2671 } 2672 2673 deleteIcon.addEventListener('click', clickHandler); 2674 2675 return container; 2676 } 2677 2678 /** 2679 * РендеÑим ÑпиÑок Ñайлов в ÑазмеÑкÑ, пÑокидÑÐ²Ð°Ñ ÑелекÑÐ¾Ñ Ð¸Ð½Ð¿ÑÑа 2680 * @param {HTMLInputElement} input инпÑÑ 2681 */
2682 static renderFilesList(input) { 2683 const container = input.closest('.js-file-uploader'); 2684 const filesContainer = container.querySelector('.custom-uploader__files'); 2685 filesContainer.innerHTML = ''; 2686 2687 for (let i = 0, len = input.filesArray.length; i < len; i++) { 2688 filesContainer.append( 2689 FileUploader.renderFile(input.filesArray[i], i, input) 2690 ); 2691 } 2692 } 2693 2694 /** 2695 * ÐÑиÑаем ÑпиÑок из ÑазмеÑки из ÑайлÑ, пÑокидÑÐ²Ð°Ñ ÑелекÑÐ¾Ñ Ð¸Ð½Ð¿ÑÑа 2696 * @param {HTMLInputElement} input инпÑÑ 2697 */ 2698 static clearList(input) { 2699 const container = input.closest('.js-file-uploader'); 2700 const filesContainer = container.querySelector('.custom-uploader__files'); 2701 filesContainer.innerHTML = ''; 2702 input.value = ''; 2703 input.filesArray = []; 2704 input.setAttribute('data-size', '0'); 2705 if (input.instance) { 2706 input.instance.interaction = true; 2707 } 2708 } 2709 2710 /** 2711 * ФоÑмиÑиÑÑем байÑÑ Ð² нÑжнÑй ÑоÑÐ¼Ð°Ñ 2712 * @param {Number} bytes Ð²ÐµÑ Ð² байÑÐ°Ñ 2713 * @param {Number} decimals деÑÑÑиÑнÑе дÑоби 2714 * @returns {String} ÑÑÑока в пÑимеÑном виде '5 ÐÐ' 2715 */ 2716 static formatBytes(bytes, decimals = 2) { 2717 if (bytes === 0) { 2718 return '0'; 2719 } else { 2720 let k = 1024; 2721 let dm = decimals < 0 ? 0 : decimals; 2722 let sizes = ['байÑ', 'ÐÐ', 'ÐÐ', 'ÐÐ', 'ТÐ']; 2723 let i = Math.floor(Math.log(bytes) / Math.log(k)); 2724 return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; 2725 } 2726 } 2727 2728 /** 2729 * ÐÑводим оÑÐ¸Ð±ÐºÑ 2730 * @param {HTMLInputElement} input инпÑÑ 2731 */ 2732 static addError(input) { 2733 setTimeout(() => { 2734 if (input.instance) { 2735 input.instance.addError(); 2736 } 2737 }, 100); 2738 } 2739 2740 /** 2741 * УбиÑаем оÑÐ¸Ð±ÐºÑ 2742 * @param {HTMLInputElement} input инпÑÑ 2743 */ 2744 static removeError(input) { 2745 if (input.instance) { 2746 input.instance.removeError(); 2747 } 2748 } 2749} 2750 2751/** 2752 * ÐаÑки полей ввода 2753 */ 2754class Mask { 2755 constructor(selector) { 2756 if (!selector) { 2757 return; 2758 } 2759 2760 this.selector = selector; 2761 2762 this.curMask = null; 2763 this.pattern = null; 2764 2765 this.init(); 2766 } 2767
2768 init() { 2769 this.bind(); 2770 this.addListeners(); 2771 } 2772 2773 bind() { 2774 this.onFocus = this.onFocus.bind(this); 2775 this.onBlur = this.onBlur.bind(this); 2776 } 2777 2778 addListeners() { 2779 this.selector.addEventListener('focus', this.onFocus); 2780 this.selector.addEventListener('blur', this.onBlur); 2781 } 2782 2783 setPhoneMask() { 2784 this.pattern = this.selector.dataset.mask; 2785 2786 this.curMask = new IMask(this.selector, { 2787 mask: this.pattern, 2788 placeholderChar: ' ', 2789 }); 2790 } 2791 2792 setTimeMask(min, max) { 2793 this.isTimeMask = true; 2794 2795 this.curMask = new IMask(this.selector, { 2796 mask: Number, 2797 min: min, 2798 max: max, 2799 }); 2800 2801 this.onFocus(); 2802 this.onBlur(); 2803 } 2804 2805 setDateMask() { 2806 this.curMask = new IMask(this.selector, { 2807 mask: 'DAY.MONTH.YEAR', 2808 blocks: { 2809 DAY: { 2810 mask: IMask.MaskedRange, 2811 from: 0, 2812 to: 31, 2813 }, 2814 MONTH: { 2815 mask: IMask.MaskedRange, 2816 from: 1, 2817 to: 12, 2818 }, 2819 YEAR: { 2820 mask: '0000', 2821 } 2822 }, 2823 }); 2824 } 2825 2826 2827 setCalStaticMask() { 2828 this.curMask = new IMask(this.selector, { 2829 mask: 'DAY.MONTH.YEAR HH:MM', 2830 blocks: { 2831 DAY: { 2832 mask: IMask.MaskedRange, 2833 from: 0, 2834 to: 31, 2835 }, 2836 MONTH: { 2837 mask: IMask.MaskedRange, 2838 from: 1, 2839 to: 12, 2840 }, 2841 YEAR: { 2842 mask: '0000', 2843 }, 2844 HH: { 2845 mask: IMask.MaskedRange, 2846 from: 0, 2847 to: 23, 2848 }, 2849 MM: { 2850 mask: IMask.MaskedRange, 2851 from: 0, 2852 to: 59, 2853 }, 2854 }, 2855 }); 2856 } 2857 2858 onFocus() { 2859 this.curMask.updateOptions({ 2860 lazy: false, 2861 }); 2862 } 2863 2864 onBlur() { 2865 if (this.curMask.unmaskedValue === '') { 2866 this.curMask.updateOptions({ 2867 lazy: true, 2868 }); 2869 } 2870 } 2871} 2872 2873/** 2874 * Ðоле ÑоÑÐ¼Ñ 2875 */ 2876class Field { 2877 constructor(field) { 2878 this.field = field; 2879 this.parent = this.field.closest('.field'); 2880 this.form = this.field.closest('.js-form'); 2881 this.radios = this.field.querySelectorAll('input[type="radio"]'); 2882 this.passwordField = 2883 this.form && this.form.querySelector('input[data-required="pass"]'); 2884 this.passwordRepeatField = 2885 this.form && 2886 this.form.querySelector('input[data-required="pass-repeat"]'); 2887 this.errorPassword = this.form.querySelector('.js-pass-error'); 2888 this.data = { 2889 error: '_error', 2890 correct: '_correct', 2891 patternEmail: /^[^\s@]+@[^\s@]+\.[^\s@]+$/, 2892 }; 2893 2894 this.options = null; 2895 2896 this.init(); 2897 } 2898
2899 init() { 2900 this.bindMethods(); 2901 this.addListeners(); 2902 } 2903 2904 bindMethods() { 2905 this.focusHandler = this.focusHandler.bind(this); 2906 this.blurHandler = this.blurHandler.bind(this); 2907 this.changeHandler = this.changeHandler.bind(this); 2908 } 2909 2910 addListeners() { 2911 if (this.field.dataset.required !== 'file') { 2912 this.field.addEventListener('focus', this.focusHandler); 2913 this.field.addEventListener('blur', this.blurHandler); 2914 } 2915 2916 this.field.addEventListener('change', this.changeHandler); 2917 } 2918 2919 focusHandler(e) { 2920 this.removeError(); 2921 } 2922 2923 blurHandler(e) { 2924 this.validation(); 2925 } 2926 2927 changeHandler(e) { 2928 this.removeError(); 2929 this.validation(); 2930 } 2931 2932 addError() { 2933 this.field.classList.add(this.data.error); 2934 if (this.parent) { 2935 this.parent.classList.add(this.data.error); 2936 } 2937 } 2938 2939 removeError() { 2940 this.field.classList.remove(this.data.error); 2941 if (this.parent) { 2942 this.parent.classList.remove(this.data.error); 2943 } 2944 } 2945 2946 addCorrectMessage() { 2947 this.field.classList.add(this.data.correct); 2948 if (this.parent) { 2949 this.parent.classList.add(this.data.correct); 2950 } 2951 } 2952 2953 removeCorrectMessage() { 2954 this.field.classList.remove(this.data.correct); 2955 if (this.parent) { 2956 this.parent.classList.remove(this.data.correct); 2957 } 2958 } 2959 2960 validation() { 2961 if (!this.isFieldDisabled) { 2962 switch (this.field.getAttribute('data-required')) { 2963 case 'text': 2964 if (this.field.value) { 2965 this.removeError(); 2966 this.addCorrectMessage(); 2967 return true; 2968 } 2969 break; 2970 case 'checkbox': 2971 if (this.field.checked) { 2972 this.removeError(); 2973 this.addCorrectMessage(); 2974 return true; 2975 } 2976 break; 2977 case 'tel': 2978 if (this.field.value !== '' && this.field.value.indexOf('_') === -1) { 2979 this.removeError(); 2980 this.addCorrectMessage(); 2981 return true; 2982 } 2983 break; 2984 case 'tel-mask': 2985 if ( 2986 // this.field.instanceMask.curMask.unmaskedValue === '' || 2987 (this.field.value[this.field.value.length - 1] !== ' ' && 2988 !this.parent.classList.contains(this.data.error)) 2989 ) { 2990 this.removeError(); 2991 return true; 2992 } 2993 break; 2994 case 'tel-mask-with-empty': 2995 if ( 2996 this.field.value !== '' && 2997 this.field.value[this.field.value.length - 1] !== ' ' 2998 ) { 2999 this.removeError(); 3000 return true; 3001 } 3002 break; 3003 case 'email': 3004 if ( 3005 this.field.value.toLowerCase().search(this.data.patternEmail) === 0 3006 ) { 3007 this.removeError(); 3008 this.addCorrectMessage(); 3009 return true; 3010 } 3011 break; 3012 case 'pass': 3013 if (this.field.value !== '') { 3014 this.removeError(); 3015 this.addCorrectMessage(); 3016 return true; 3017 } 3018 break; 3019 case 'pass-repeat': 3020 if ( 3021 this.field.value !== '' && 3022 this.field.value === this.passwordField.value 3023 ) { 3024 this.removeError(); 3025 this.addCorrectMessage(); 3026 return true; 3027 } 3028 break; 3029 case 'select': 3030 this.options = this.field.querySelectorAll( 3031 'option:not([data-placeholder])' 3032 ); 3033 for (let index = 0; index < this.options.length; index += 1) { 3034 const el = this.options[index]; 3035 if (el.selected) { 3036 this.removeError(); 3037 this.addCorrectMessage(); 3038 return true; 3039 } 3040 } 3041 break; 3042 case 'file': 3043 if ( 3044 !this.field.value || 3045 this.field.filesArray.length > 0 || 3046 this.field.hasAttribute('has-value-default') 3047 ) { 3048 this.removeError(); 3049 this.addCorrectMessage(); 3050 return true; 3051 } 3052 break; 3053 case 'radio': { 3054 if (this.isRadioChecked) { 3055 this.removeError(); 3056 this.addCorrectMessage(); 3057 return true; 3058 } 3059 3060 break; 3061 } 3062 case 'calendar': 3063 if ( 3064 this.field.value === '' || 3065 (this.field.value !== '' && 3066 this.field.value.indexOf('_') === -1 && 3067 !this.field.classList.contains('_error')) 3068 ) { 3069 this.removeError(); 3070 return true; 3071 } 3072 break; 3073 default: 3074 this.addCorrectMessage(); 3075 return true; 3076 } 3077 this.removeCorrectMessage(); 3078 this.addError(); 3079 return false; 3080 } 3081 return true; 3082 } 3083 3084 get isRadioChecked() { 3085 return [...this.radios].reduce((acc, radio) => { 3086 if (radio.checked) { 3087 return true; 3088 } 3089 return acc; 3090 }, false); 3091 } 3092 3093 get isFieldDisabled() { 3094 return this.field.hasAttribute('disabled'); 3095 } 3096} 3097 3098/** 3099 * ФоÑма 3100 */ 3101class Form { 3102 constructor(form) { 3103 this.form = form; 3104 this.fields = []; 3105 this.radioBox = []; 3106 this.data = []; 3107 this.reset = this.form.querySelector('.js-form-reset'); 3108 this.btnResetToDefault = this.form.querySelectorAll( 3109 '.js-form-reset-to-default' 3110 ); 3111 3112 this.init(); 3113 } 3114
3115 init() { 3116 this.bindMethods(); 3117 this.initFields(); 3118 this.addEventListeners(); 3119 } 3120 3121 bindMethods() { 3122 this.submitHandler = this.submitHandler.bind(this); 3123 this.resetHandler = this.resetHandler.bind(this); 3124 this.clickHandler = this.clickHandler.bind(this); 3125 this.validationForm = this.validationForm.bind(this); 3126 } 3127 3128 addEventListeners() { 3129 this.form.addEventListener('submit', this.submitHandler); 3130 3131 if (this.reset) { 3132 this.form.addEventListener('reset', this.resetHandler); 3133 } 3134 3135 for (const el of this.btnResetToDefault) { 3136 el.addEventListener('click', this.clickHandler); 3137 } 3138 } 3139 3140 clickHandler(e) { 3141 // e.preventDefault(); 3142 3143 this.setDefaultValues(); 3144 } 3145 3146 initFields() { 3147 const selectors = this.form.querySelectorAll( 3148 'input[data-required], textarea[data-required], select[data-required], [data-required="radio"]' 3149 ); 3150 for (const el of selectors) { 3151 const instance = new Field(el); 3152 el.instance = instance; 3153 this.fields.push(instance); 3154 } 3155 } 3156 3157 async submitHandler(e) { 3158 if (!this.validationForm()) { 3159 e.preventDefault(); 3160 } else if (this.form.getAttribute('id') === 'ajaxAuth') { 3161 e.preventDefault() 3162 const response = await fetch("/auth/ajax.php", { 3163 method: "POST", 3164 body: new FormData(this.form), 3165 }).then(response => response.text()) 3166 .then(data => { 3167 if (data) { 3168 this.form.innerHTML = data 3169 this.init() 3170 } else { 3171 location.reload() 3172 } 3173 }); 3174 } else if (this.form.getAttribute('id') === 'callAdvertising') { 3175 e.preventDefault(); 3176 BX.ajax.runComponentAction( 3177 'extyl:forms', 3178 'submitCallAdvertising', 3179 { 3180 mode: 'class', 3181 data: new FormData(this.form), 3182 } 3183 ).then((response) => { 3184 if (response.status === 'success') { 3185 window.location.href = '/thanks/' 3186 } else { 3187 console.log(response); 3188 } 3189 }).catch((error) => { 3190 console.log(error); 3191 }); 3192 } else if (this.form.getAttribute('id') === 'ajaxFeedback') { 3193 e.preventDefault(); 3194 BX.ajax.runComponentAction( 3195 'extyl:forms', 3196 'submitCallFeedback', 3197 { 3198 mode: 'class', 3199 data: new FormData(this.form), 3200 } 3201 ).then((response) => { 3202 if (response.status === 'success') { 3203 window.location.href = '/thanks/' 3204 } else { 3205 console.log(response); 3206 } 3207 }).catch((error) => { 3208 console.log(error); 3209 }); 3210 } 3211 } 3212 3213 resetHandler(e) { 3214 this.resetForm(); 3215 } 3216 3217 resetForm() { 3218 if (this.formWithFilters) { 3219 const inputSearch = this.form.querySelector('.js-search-filter-input'); 3220 SearchFilter.reset(inputSearch); 3221 3222 const checkboxesFilter = this.form.querySelectorAll( 3223 '.js-input-filter-page' 3224 ); 3225 CheckboxesFilter.reset(checkboxesFilter); 3226 } 3227 3228 if (this.formWithPassword) { 3229 const fields = this.fields.filter( 3230 (el) => 3231 el.field.dataset.required === 'pass' || 3232 el.field.dataset.required === 'pass-repeat' 3233 ); 3234 for (const field of fields) { 3235 field.removeError(); 3236 field.errorPassword.style.display = 'none'; 3237 } 3238 } 3239 } 3240 3241 validationForm() { 3242 return this.fields.reduce((accumulator, field) => { 3243 const resultValiudation = field.validation(); 3244 return accumulator ? resultValiudation : false; 3245 }, true); 3246 } 3247 3248 setDefaultValues() { 3249 for (const el of this.data) { 3250 const field = this.form.querySelector(`[name="${el.name}"]`); 3251 const value = el.value.replaceAll(' ', '\n'); 3252 field.value = value; 3253 3254 if (field.tagName === 'TEXTAREA') { 3255 FixFieldsHeight.calcHeight(field); 3256 } 3257 if (field.name === 'PERSONAL_PHOTO') { 3258 Form.setDefaultAvatar(field); 3259 } 3260 } 3261 3262 const containerAvatar = this.form.querySelector('.js-file-uploader._avatar'); 3263 if (containerAvatar) { 3264 const avatar = containerAvatar.querySelector('.profile__avatar'); 3265 const areaAvatar = containerAvatar.querySelector('.profile__avatar-area'); 3266 const inputAvatar = containerAvatar.querySelector('#input-avatar'); 3267 const srcPreviewAvatar = inputAvatar.getAttribute('data-preview'); 3268 const hiddenInput = containerAvatar.querySelector('.avatar-hidden-input'); 3269 const previewAvatar = containerAvatar.querySelector('.js-file-uploader-preview'); 3270 if (srcPreviewAvatar && srcPreviewAvatar !== '') { 3271 previewAvatar.src = srcPreviewAvatar; 3272 avatar.style.display = ''; 3273 areaAvatar.style.display = 'none'; 3274 if (hiddenInput) { 3275 hiddenInput.remove(); 3276 } 3277 } else { 3278 previewAvatar.src = ''; 3279 avatar.style.display = 'none'; 3280 areaAvatar.style.display = ''; 3281 inputAvatar.value = ''; 3282 inputAvatar.filesArray = []; 3283 if (hiddenInput) { 3284 hiddenInput.remove(); 3285 } 3286 } 3287 } 3288 } 3289 3290 get formWithFilters() { 3291 return this.form.classList.contains('js-form-with-filters'); 3292 } 3293 3294 get formWithPassword() { 3295 return this.form.classList.contains('js-form-with-password'); 3296 } 3297 3298 static setData(data, id) { 3299 document.getElementById(id).instance.data = data; 3300 } 3301 3302 static setDefaultAvatar(field) { 3303 const container = field.closest('.js-file-uploader'); 3304 const preview = container.querySelector('.js-file-uploader-preview'); 3305 const avaArea = container.querySelector('.js-file-uploader-avatar-area'); 3306 const avatar = container.querySelector('.profile__avatar');
3307 const dataset = preview.getAttribute('data-preview'); 3308 3309 if (dataset) { 3310 preview.src = preview.dataset.preview; 3311 avatar.style.display = ''; 3312 avaArea.style.display = 'none'; 3313 } else { 3314 preview.src = ''; 3315 avatar.style.display = 'none'; 3316 avaArea.style.display = ''; 3317 } 3318 field.value = ''; 3319 field.filesArray = []; 3320 field.setAttribute('data-size', 0); 3321 } 3322} 3323 3324/** 3325 * ÐÐ½Ð¸Ñ Ð¼Ð°Ñок ÑелеÑона 3326 */ 3327function initPhoneMasks() { 3328 const selectors = document.querySelectorAll('.js-mask-phone'); 3329 3330 for (const el of selectors) { 3331 if (!el.instanceMask) { 3332 const instance = new Mask(el); 3333 instance.setPhoneMask(); 3334 el.instanceMask = instance; 3335 } 3336 } 3337} 3338 3339/** 3340 * ÐÐ½Ð¸Ñ Ð¼Ð°Ñок даÑÑ 3341 */ 3342function initDateMasks() { 3343 const selectors = document.querySelectorAll('.js-mask-date'); 3344 3345 for (const el of selectors) { 3346 if (!el.instanceMask) { 3347 const instance = new Mask(el); 3348 instance.setDateMask(); 3349 el.instanceMask = instance; 3350 } 3351 } 3352} 3353 3354/** 3355 * ÐÐ½Ð¸Ñ ÐºÐ°Ð»ÐµÐ½Ð´Ð°ÑÑ Ð² поле ввода 3356 */ 3357function initCalendars() { 3358 const staticSelectors = document.querySelectorAll('.js-calendar-static'); 3359 3360 for (const el of staticSelectors) { 3361 const calendar = new Calendar(el); 3362 calendar.renderStatic(); 3363 calendar.initTime(); 3364 } 3365} 3366 3367/** 3368 * ÐÐ½Ð¸Ñ ÑоÑм 3369 */ 3370function initForms() { 3371 const selectors = document.querySelectorAll('.js-form'); 3372 for (const el of selectors) { 3373 const instance = new Form(el); 3374 el.instance = instance; 3375 } 3376} 3377 3378document.addEventListener('DOMContentLoaded', () => { 3379 scrollTopCatalog(); 3380 3381 // ÐÐ 3382 new UserHeader(); 3383 new FileUploader(); 3384 initPhoneMasks(); 3385 initDateMasks(); 3386 initCalendars(); 3387 initForms(); 3388 // ÐÐ 3389}) 3390 3391/* End */ 3392; 3393; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/calendario/js/datepicker.js?173504996321209";s:6:"source";s:44:"/local/templates/calendario/js/datepicker.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3394!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Datepicker=t()}(this,function(){"use strict";var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};function a(e,t){var n=(t||document).querySelectorAll(e);return Array.prototype.slice.call(n)}function r(e,t){var n=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;return n&&n.call(e,t)}function s(e,t,n){for(var i=n&&!n.contains(e);e&&!i;){if(r(e,t))return e;i=n&&!n.contains(e.parentNode),e=e.parentNode}return!1}function o(e,t){e.classList.add.apply(e.classList,t.split(" ").filter(Boolean))}function l(e,t){e.classList.remove.apply(e.classList,t.split(" ").filter(Boolean))}function h(e,t,n){void 0===n&&(n=!function(e,t){return t&&e.classList.contains(t)}(e,t)),t&&(n?o(e,t):l(e,t))}function d(e,t){return e instanceof Date&&(t=e.getMonth(),e=e.getFullYear()),[31,function(e){return e%4==0&&e%100!=0||e%400==0}(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]}function u(e,t,n){for(var i=0;i<t.length;i++){var a=e,r=t[i];if("year"==n?(a=a.getFullYear(),r=r.getFullYear()):"month"==n?(a=a.getMonth(),r=r.getMonth()):(a=a.getTime(),r=r.getTime()),a==r)return!0}return!1}function c(e,t){return e.getTime()-t.getTime()}function p(e){return!!e&&e instanceof Date&&!isNaN(e.getTime())}function f(e){return _(e,function(e){return e&&e.setHours(0,0,0,0),e})}function g(e,t){var n=e=new Date(e);e>(t=new Date(t))&&(e=t,t=n,n=e);for(var i=[new Date(n)];n<t;)n.setDate(n.getDate()+1),i.push(new Date(n));return i}function m(t){if("object"==(void 0===t?"undefined":e(t))&&null!==t){var n=Object.getPrototypeOf(t);return n===Object.prototype||null===n}return!1}
3394function v(t){for(var n=Array.prototype.slice.call(arguments,1),i=0;i<n.length;i++)for(var a in n[i])void 0!==t[a]&&"object"===e(n[i][a])&&null!==n[i][a]&&void 0===n[i][a].nodeName?(n[i][a]instanceof Date&&(t[a]=new Date(n[i][a].getTime())),Array.isArray(n[i][a])?t[a]=n[i][a].slice(0):t[a]=v(t[a],n[i][a])):t[a]=n[i][a];return t}function _(e,t,n){var i=[].concat(e).map(t,n);return 1===i.length?i[0]:i}function y(e,t){var n=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return t?n(t):n}var w={inline:!1,multiple:!1,ranged:!1,time:!1,openOn:"first",min:!1,max:!1,within:!1,without:!1,yearRange:5,weekStart:0,defaultTime:{start:[0,0],end:[12,0]},separator:",",serialize:function(e){var t=e.toLocaleDateString();if(this.get("time")){var n=e.toLocaleTimeString();return t+"@"+(n=n.replace(/(\d{1,2}:\d{2}):00/,"$1"))}return t},deserialize:function(e){return new Date(e)},toValue:!1,fromValue:!1,onInit:!1,onChange:!1,onRender:!1,i18n:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],time:["Time","Start","End"]},classNames:{node:"datepicker",wrapper:"datepicker__wrapper",inline:"is-inline",selected:"is-selected",disabled:"is-disabled",highlighted:"is-highlighted",otherMonth:"is-otherMonth",weekend:"is-weekend",today:"is-today"},templates:{container:['<div class="datepicker__container">',"<%= renderHeader() %>","<%= renderTimepicker() %>","<%= renderCalendar() %>","</div>"].join(""),header:['<header class="datepicker__header">','<a class="datepicker__prev<%= (hasPrev) ? "" : " is-disabled" %>" data-prev>‹</a>','<span class="datepicker__title"><%= renderMonthSelect() %></span>','<span class="datepicker__title"><%= renderYearSelect() %></span>','<a class="datepicker__next<%= (hasNext) ? "" : " is-disabled" %>" data-next>›</a>',"</header>"].join(""),timepicker:['<div class="datepicker__time">','<span class="datepicker__label"><%= label %></span>','<span class="datepicker__field"><%= renderHourSelect() %></span>:','<span class="datepicker__field"><%= renderMinuteSelect() %></span>','<span class="datepicker__field"><%= renderPeriodSelect() %></span>',"</div>"].join(""),calendar:['<table class="datepicker__cal">',"<thead>","<tr>","<% weekdays.forEach(function(name) { %>","<th><%= name %></th>","<% }); %>","</tr>","</thead>","<tbody>","<% days.forEach(function(day, i) { %>",'<%= (i % 7 == 0) ? "<tr>" : "" %>',"<%= renderDay(day) %>",'<%= (i % 7 == 6) ? "</tr>" : "" %>',"<% }); %>","</tbody>","</table>"].join(""),day:['<% classNames.push("datepicker__day"); %>','<td class="<%= classNames.join(" ") %>" data-day="<%= timestamp %>"><div>','<span class="datepicker__daynum"><%= daynum %></span>',"</div></td>"].join("")}};var b=function(){function e(n,i){var r=this;if(t(this,e),"string"==typeof n){if("#"!=n.substr(0,1))return a(n).map(function(e){return new r.constructor(e,i)});n=document.getElementById(n.substr(1))}n||(n=document.createElement("input")),"input"!==n.tagName.toLowerCase()||/input|hidden/i.test(n.type)||(n.type="text"),this._initDOM(n),this._initOptions(i),this._initEvents(),this.setValue(n.value||n.dataset.value||""),this._opts.onInit&&this._opts.onInit(n)}return n(e,[{key:"_initOptions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._opts={};var n=function(e,t){var n=t.classNames.inline;return this.node&&(h(this.node,n,e),this.wrapper.style.position=e?"":"absolute",this.wrapper.style.display=e?"":"none"),this._isOpen=e,e}.bind(this),i=function(e,t){var n=t.deserialize;return!!p(e=!!e&&_(e,n,this))&&e}.bind(this),a=function(e,t){var n=t.deserialize;return e.length&&(e=f(_(e,n,this)),e=[].concat(e).filter(p)),!!e.length&&e}.bind(this),r=function(e,t){var n=t.deserialize;if("string"!=typeof e||/^(first|last|today)$/.test(e)||p(e=n.call(this,e))||(e=new Date),!this._month){var i=e;"string"!=typeof i&&p(i)||(i=new Date),(i=f(new Date(i.getTime()))).setDate(1),this._month=i}return e}.bind(this),s=function(e){return Math.min(Math.max(e,0),6)}.bind(this),o=function(e,t){return m(e)?v({},e,t.defaultTime):{start:e.slice(0),end:e.slice(0)}}.bind(this),l=function(e,t){var n=e.node,i=e.inline,a=e.wrapper,r=t.inline;if(this.node)for(var s in e)switch(s){case"node":case"inline":this.node.className=n+(r?" "+i:"");break;case"wrapper":this.wrapper.className=a}return e}.bind(this),d=function(e){return"function"==typeof e&&e.bind(this)}.bind(this),u=function(e){for(var t in e)"select"!==t&&(this._renderers[t]=y(e[t]));return e}.bind(this);this._set={openOn:r,inline:n,weekstart:s,min:i,max:i,within:a,without:a,defaultTime:o,classNames:l,templates:u};["serialize","deserialize","onInit","onChange","onRender","setValue","getValue"].forEach(function(t){return e._set[t]=d}),this._renderers={select:y(['<span style="position:relative"><%= text %>','<select data-<%= type %>="<%= value %>" data-index="<%= index %>"','style="position:absolute;top:0;left:0;width:100%;height:100%;margin:0;opacity:0.005;cursor:pointer;">',"<% options.forEach(function(o) { %>",'<option value="<%= o.value %>"','<%= o.selected ? " selected" : "" %>','<%= o.disabled ? " disabled" : "" %>',"><%= o.text %></option>","<% }); %>","</select>","</span>"].join(""))},this.set(v({},this.constructor.defaults,function(e){var t=function(e){return e.trim()},n={};if(!e||!e.dataset)return n;for(var i in e.dataset){var a=e.dataset[i];/true|false/.test(a.toLowerCase())?a="true"==a.toLowerCase():"["==a[0]&&"]"==a.substr(-1)?a=_(a.substr(1,a.length-2).split(","),t):/^\d*$/.test(a)&&(a=parseInt(a,10)),n[i]=a}return n}(this._el),t))}},{key:"_initDOM",value:function(e){this.node||(this._el=e,this.node=document.createElement("div"),this.node.style.position="relative",this.wrapper=document.createElement("div"),this.wrapper.style.zIndex=9999,e.parentNode&&e.parentNode.insertBefore(this.node,e),this.node.appendChild(e),this.node.appendChild(this.wrapper))}},{key:"_initEvents",value:function(){var e=this;this._isInitialized||(this._highlighted=[],this._onmousedown=this._onmousedown.bind(this),this._onmousemove=this._onmousemove.bind(this),this._onmouseup=this._onmouseup.bind(this),this._onclick=this._onclick.bind(this),"input"!==this._el.tagName.toLowerCase()?this._el.addEventListener("click",function(){return e.toggle(
3394)}):this._el.addEventListener("focus",function(){return e.open()}),document.addEventListener("mousedown",function(t){e.node.contains(t.target)||e.hide()}),this.node.onselectstart=function(){return!1},this.node.addEventListener("mousedown",this._onmousedown),this.node.addEventListener("mousemove",this._onmousemove),this.node.addEventListener("mouseup",this._onmouseup),this.node.addEventListener("click",this._onclick),this._isInitialized=!0)}},{key:"_onmousedown",value:function(e){var t=this,n=this._opts,i=n.ranged,r=n.multiple,d=n.classNames,u=d.selected,c=d.highlighted,p=s(e.target,"[data-day]",this.wrapper),f=p?parseInt(p.dataset.day,10):null;f&&(i&&this._dragStart?this._onmousemove(e):(this._deselect=!i&&this.hasDate(new Date(f)),this._highlighted=[f],this._dragStart=f,r||a("[data-day]."+u,this.wrapper).forEach(function(e){l(e,u)}),a('[data-day="'+f+'"]',this.wrapper).forEach(function(e){h(e,u,!t._deselect),o(e,c)})))}},{key:"_onmousemove",value:function(e){var t=this,n=this._opts,i=n.ranged,r=n.multiple,d=n.classNames,u=d.selected,c=d.highlighted;if((i||r)&&(1===e.buttons||!e.buttons)){var p=s(e.target,"[data-day]",this.wrapper),f=p?parseInt(p.dataset.day,10):null;f&&this._dragStart&&(this._highlighted=g(this._dragStart,f).map(function(e){return e.getTime()}),this._isDragging=f!==this._dragStart,a("[data-day]."+c,this.wrapper).forEach(function(e){var n=new Date(parseInt(e.dataset.day,10));h(e,u,!i&&t.hasDate(n)),l(e,c)}),this._highlighted.forEach(function(e){a('[data-day="'+e+'"]',t.wrapper).forEach(function(e){h(e,u,!t._deselect),o(e,c)})}))}}},{key:"_onmouseup",value:function(e){var t=this._opts,n=t.ranged,i=t.multiple,r=t.classNames.highlighted;if(a("[data-day]."+r,this.wrapper).forEach(function(e){l(e,r)}),this._dragStart&&s(e.target,"[data-day]",this.node)){var o=this._highlighted.map(function(e){return new Date(e)});n||!i?this.setDate(o):this.toggleDate(o,!this._deselect),this.render(),i||n&&!this._isDragging||this.hide()}n&&!this._isDragging||(this._highlighted=[],this._dragStart=null),this._isDragging=!1}},{key:"_onclick",value:function(e){var t=this,n=e.target;n.hasAttribute("data-prev")?this.prev(n.dataset.prev):n.hasAttribute("data-next")?this.next(n.dataset.next):n.hasAttribute("data-year")&&!n.onchange?n.onchange=function(){var e=n.dataset.year,i=t._month.getFullYear();t._month.setFullYear(parseInt(n.value)-(e-i)),t.render()}:n.hasAttribute("data-month")&&!n.onchange?n.onchange=function(){t._month.setMonth(n.value-n.dataset.index),t.render()}:n.hasAttribute("data-hour")&&!n.onchange?n.onchange=function(){t.setTime(n.dataset.hour,n.value),n.parentNode.firstChild.textContent=n.selectedOptions[0].textContent}:n.hasAttribute("data-minute")&&!n.onchange?n.onchange=function(){t.setTime(n.dataset.minute,null,n.value),n.parentNode.firstChild.textContent=n.selectedOptions[0].textContent}:n.hasAttribute("data-period")&&!n.onchange&&(n.onchange=function(){var e=n.dataset.period,i="am"===n.value?-12:12;a('[data-hour="'+e+'"] option',t.wrapper).forEach(function(e){e.value=parseInt(e.value)+i}),t.setTime(e,(t._time?t._time[e][0]:0)+i),n.parentNode.firstChild.textContent=n.selectedOptions[0].textContent})}},{key:"set",value:function(e,t){if(e){if(m(e)){for(var n in this._noRender=!0,e.serialize&&(this.set("serialize",e.serialize),delete e.serialize),e.deserialize&&(this.set("deserialize",e.deserialize),delete e.deserialize),e)this.set(n,e[n]);this._noRender=!1,t=this._opts}else{var i=v({},this.constructor.defaults,this._opts);e in this._set&&(t=this._set[e](t,i)),m(t)&&(t=v({},i[e],t)),this._opts[e]=t}return this._isOpen&&this.wrapper&&this.render(),t}}},{key:"get",value:function(e){var t=this;if(arguments.length>1)return[].concat(Array.prototype.slice.call(arguments)).reduce(function(e,n){return e[n]=t.get(n),e},{});var n=this._opts[e];return m(n)&&(n=v({},n)),n}},{key:"open",value:function(e){var t=[].concat(this.getDate());"string"==typeof(e=e||this._opts.openOn||this._month)&&("first"===(e=e.toLowerCase())&&t.length?e=t[0]:"last"===e&&t.length?e=t[t.length-1]:"today"!==e&&(e=this._opts.deserialize(e))),p(e)||(e=new Date),this.setTime(!!this._selected.length),this.goToDate(e),this.render(),this.show()}},{key:"show",value:function(){if(!this._opts.inline){this.wrapper.style.display="block";var e=this.node.getBoundingClientRect(),t=this._el.getBoundingClientRect(),n=t.bottom-e.top+"px",i=e.bottom-t.top+"px";this.wrapper.style.top=n,this.wrapper.style.right="",this.wrapper.style.bottom="",this.wrapper.style.left=0;var a=this.wrapper.getBoundingClientRect(),r=a.right>window.innerWidth,s=a.bottom>window.innerHeight;this.wrapper.style.top=s?"":n,this.wrapper.style.right=r?0:"",this.wrapper.style.bottom=s?i:"",this.wrapper.style.left=r?"":0;var o=(a=this.wrapper.getBoundingClientRect()).right>=a.width,l=a.bottom>a.height;this.wrapper.style.top=s&&l?"":n,this.wrapper.style.right=r&&o?0:"",this.wrapper.style.bottom=s&&l?i:"",this.wrapper.style.left=r&&o?"":0,this._isOpen=!0}}},{key:"hide",value:function(){this._opts.inline||(this.wrapper.style.display="none",this._isOpen=!1)}},{key:"toggle",value:function(){this._isOpen?this.hide():this.open()}},{key:"next",value:function(e){var t=new Date(this._month.getTime());e=Math.max(e||1,1),t.setMonth(t.getMonth()+e),this.goToDate(t)}},{key:"prev",value:function(e){var t=new Date(this._month.getTime());e=Math.max(e||1,1),t.setMonth(t.getMonth()-e),this.goToDate(t)}},{key:"goToDate",value:function(e){(e=f(this._opts.deserialize(e))).setDate(1),this._month=e,this._isOpen&&this.render(),this._opts.onNavigate&&this._opts.onNavigate(e)}},{key:"hasDate",value:function(e){return e=f(p(e)?e:this._opts.deserialize(e)),!!this._selected&&this._selected.indexOf(e.getTime())>-1}},{key:"addDate",value:function(e){this.toggleDate(e,!0)}},{key:"removeDate",value:function(e){this.toggleDate(e,!1)}},{key:"toggleDate",value:function(e,t){var n=this,i=this._opts,a=i.ranged,r=i.multiple,s=i.deserialize,o=[].concat(e);o=(o=o.map(function(e){return p(e)?e:s(e)})).filter(function(e){return p(e)&&n.dateAllowed(e)}),a?o=(o=o.concat(this.getDate()).sort(c)).length?g(o[0],o.pop()):[]:r||(o=o.slice(0,1)),o.map(function(e){return f(e).getTime()}
3394).forEach(function(e){var i=n._selected.indexOf(e),s=i>-1;s||!1===t?s&&!0!==t&&n._selected.splice(i,1):a||r?n._selected.push(e):n._selected=[e]}),this._update()}},{key:"_update",value:function(){var e=this._opts.onChange;"input"===this._el.nodeName.toLowerCase()?this._el.value=this.getValue():this._el.dataset.value=this.getValue(),e&&e(this.getDate())}},{key:"getDate",value:function(){var e=this._opts,t=e.ranged,n=e.multiple,i=e.time,a=this._time?this._time.start:[0,0];if(this._selected=(this._selected||[]).sort(),n||t){var r=this._selected.map(function(e){return new Date(e)});if(i&&r.length&&(r[0].setHours(a[0],a[1]),r.length>1)){var s=this._time?this._time.end:[0,0];r[r.length-1].setHours(s[0],s[1])}return r}if(this._selected.length){var o=new Date(this._selected[0]);return o.setHours(a[0],a[1]),o}}},{key:"setDate",value:function(e){this._selected=[],this.addDate(e)}},{key:"setTime",value:function(e,t,n){var i=this._opts,a=i.time,r=i.defaultTime;a&&(!0!==e&&this._time||(this._time=v({},r)),e&&!0!==e&&("number"==typeof e&&(n=t,t=e,e="start"),e="end"===e?e:"start",t=!!t&&parseInt(t,10),n=!!n&&parseInt(n,10),t&&!isNaN(t)&&(this._time[e][0]=t),n&&!isNaN(n)&&(this._time[e][1]=n)),this._update())}},{key:"getValue",value:function(){var e=this._opts,t=e.ranged,n=e.separator,i=e.serialize,a=e.toValue,r=[].concat(this.getDate()||[]);t&&r.length>1&&(r=[r[0],r.pop()]);var s=r.map(i).join(n);return a&&(s=a(s,r)),s}},{key:"setValue",value:function(e){var t=this._opts,n=t.ranged,i=t.time,a=t.separator,r=t.serialize,s=t.fromValue;this._selected=[];var o=s?s(e):e.split(a).filter(Boolean).map(r);if(this.addDate(o),i&&o.length){var l=o.sort(c)[0];if(this.setTime("start",l.getHours(),l.getMinutes()),"ranged"===i||n){var h=o[o.length-1];this.setTime("end",h.getHours(),h.getMinutes())}}}},{key:"dateAllowed",value:function(e,t){var n=this._opts,i=n.min,a=n.max,r=n.within,s=n.without,o=n.deserialize,l=void 0,h=l=!0;return e=f(p(e)?e:o(e)),"month"==t?(h=!i||e.getMonth()>=i.getMonth(),l=!a||e.getMonth()<=a.getMonth()):"year"==t?(h=!i||e.getFullYear()>=i.getFullYear(),l=!a||e.getFullYear()<=a.getFullYear()):(h=!i||e>=i,l=!a||e<=a),h&&l&&(!s||!u(e,s,t))&&(!r||u(e,r,t))}},{key:"render",value:function(){var e=this,t=this._opts,n=t.ranged,a=t.time,r=t.onRender;if(!this._noRender&&this._renderers){var s={},o=function(t){return s[t]||(s[t]=e.getData(t))};this.wrapper.innerHTML=this._renderers.container({renderHeader:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e._renderHeader(o(t))},renderCalendar:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=o(t);return e._renderers.calendar(i({},n,{renderHeader:function(){return e._renderHeader(n)},renderDay:function(t){return e._renderers.day(t)}}))},renderTimepicker:function(){var t="";return a&&(t=e._renderTimepicker("start"),("ranged"===a||n)&&(t+=e._renderTimepicker("end"))),t}}),r&&r(this.wrapper.firstChild)}}},{key:"getData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this._opts,n=t.i18n,i=t.weekStart,a=t.serialize,r=t.min,s=t.max,o=t.classNames,l=o.selected,h=o.disabled,u=o.otherMonth,c=o.weekend,p=o.today,g=new Date(this._month.getTime());g.setMonth(g.getMonth()+e);var m=g.getMonth(),v=g.getFullYear(),_=new Date(g.getTime());_.setMonth(_.getMonth()+1),_.setDate(1);var y=new Date(g.getTime());y.setMonth(y.getMonth()-1),y.setDate(d(y));for(var w=[],b=g.getDay()-i;b<0;)b+=7;for(var k=d(v,m)+b;k%7;)k+=1;for(var D=f(new Date),x=0;x<k;x++){var M=new Date(v,m,x-b+1),T=M.getMonth(),N=M.getDay(),S=this.hasDate(M),C=!this.dateAllowed(M),E=T<m,z=T>m,O=!E&&!z,j=0===N||6===N,A=M.getTime()===D.getTime(),L=[];S&&L.push(l),C&&L.push(h),O||L.push(u),j&&L.push(c),A&&L.push(p),w.push({_date:M,date:a(M),daynum:M.getDate(),timestamp:M.getTime(),weekday:n.weekdays[N],isSelected:S,isDisabled:C,isPrevMonth:E,isNextMonth:z,isThisMonth:O,isWeekend:j,isToday:A,classNames:L})}return{_date:g,index:e,year:v,month:n.months[m],days:w,weekdays:n.weekdays,hasNext:!s||_<=s,hasPrev:!r||y>=r}}},{key:"_renderHeader",value:function(e){var t=this,n=this._opts,a=n.yearRange,r=n.i18n,s=e._date,o=e.index,l=e.year,h=s.getMonth();return this._renderers.header(i({},e,{renderMonthSelect:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o,n=new Date(s.getTime()),i=[],a=0;a<12;a++)n.setMonth(a),i.push({text:r.months[a],disabled:!t.dateAllowed(n,"month"),selected:a===h,value:a});return t._renderers.select({index:e,type:"month",text:r.months[h],value:h,options:i})},renderYearSelect:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o,n=new Date(s.getTime()),i=l-a,r=l+a,h=[];i<=r;i++)n.setFullYear(i),h.push({disabled:!t.dateAllowed(n,"year"),selected:i===l,value:i,text:i});return t._renderers.select({index:e,type:"year",text:l,value:l,options:h})}}))}},{key:"_renderTimepicker",value:function(e){var t=this,n=this._opts,i=n.ranged,a=n.time,r=n.i18n;if(a){this._time||this.setTime(!0);var s=this._time[e],o=r.time[0];return("ranged"===a||i)&&(o=r.time["start"===e?1:2]),this._renderers.timepicker({label:o,renderHourSelect:function(){for(var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=[],a=s[0],r=n?24:12,o=0;o<r;o++)i.push({text:n||o?o:"12",selected:a===o,disabled:!1,value:o});!n&&a>
3394=12?i.forEach(function(e){return e.selected=(e.value+=12)===a}):n||i.push(i.shift());var l=i.filter(function(e){return e.selected})[0].text;return t._renderers.select({index:0,type:"hour",value:e,options:i,text:l})},renderMinuteSelect:function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15,i=[],a=0;a<60;a+=n)i.push({text:a<10?"0"+a:a,selected:s[1]===a,disabled:!1,value:a});var r=i.filter(function(e){return e.selected})[0].text;return t._renderers.select({index:null,type:"minute",value:e,options:i,text:r})},renderPeriodSelect:function(){return t._renderers.select({index:null,type:"period",text:s[0]>=12?"PM":"AM",value:e,options:[{text:"AM",value:"am",selected:s[0]<12},{text:"PM",value:"pm",selected:s[0]>=12}]})}})}}}]),e}();return b.defaults=w,b}); 3395/* End */ 3396; 3397; /* Start:"a:4:{s:4:"full";s:58:"/local/templates/calendario/js/calendar.js?179137513910232";s:6:"source";s:42:"/local/templates/calendario/js/calendar.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3398// ÐалендаÑÑ ÑилÑÑÑа пеÑеÑоздаÑÑÑÑ Ð¿Ð¾Ñле каждой AJAX-пеÑезагÑÑзки ÑилÑÑÑа (initCalendar из main.calendar/to), 3399// поÑÑÐ¾Ð¼Ñ Ñ Ñаним ÑекÑÑий ÑкземплÑÑ, а ÑлÑÑаÑÐµÐ»Ñ ÑелекÑов меÑÑÑ/год веÑаем один Ñаз. 3400let filterDatepicker = null; 3401 3402function updateDatepicker() { 3403 const selectedMonth = parseInt(document.getElementById('monthSelect').value); 3404 const selectedYear = parseInt(document.getElementById('yearSelect').value); 3405 3406 filterDatepicker.goToDate(new Date(selectedYear, selectedMonth, 1)); 3407} 3408 3409document.addEventListener("selectCallback", function (e) { 3410 const id = e.detail.select.id; 3411 if (filterDatepicker && (id === 'monthSelect' || id === 'yearSelect')) { 3412 updateDatepicker(); 3413 } 3414}); 3415 3416let initCalendar = (predefinedDates = [], minDate = '') => { 3417 if (document.querySelector('.calender')) { 3418 let reinitSelectors = [ 3419 '#monthSelect', 3420 '#yearSelect', 3421 'select.sort', 3422 ]; 3423 3424 for (selector of reinitSelectors) { 3425 let mainSelect = document.querySelector(selector) 3426 if (mainSelect && !mainSelect.parentNode.classList.contains('_select-active')) { 3427 initSelects(selector) 3428 } 3429 } 3430 const months = [ 3431 'ЯнваÑÑ', 'ФевÑалÑ', 'ÐаÑÑ', 'ÐпÑелÑ', 'Ðай', 'ÐÑнÑ', 3432 'ÐÑлÑ', 'ÐвгÑÑÑ', 'СенÑÑбÑÑ', 'ÐкÑÑбÑÑ', 'ÐоÑбÑÑ', 'ÐекабÑÑ' 3433 ]; 3434 3435 let minDateToDatepicker = new Date(); 3436 if (minDate) { 3437 minDateToDatepicker = new Date(minDate); 3438 } else { 3439 minDateToDatepicker.setDate(minDateToDatepicker.getDate() - 1); 3440 } 3441 filterDatepicker = new Datepicker('#constrained', { 3442 min: minDateToDatepicker, 3443 multiple: true, 3444 inline: true, 3445 ranged: true, 3446 yearRange: 4, 3447 classNames: { 3448 otherMonth: 'other-month', 3449 }, 3450 templates: { 3451 container: [ 3452 '<div class="datepicker__container">', 3453 '<div class="datepicker__pane">', 3454 '<%= renderCalendar(0) %>', 3455 '</div>', 3456 '</div>' 3457 ].join('') 3458 }, 3459 i18n: { 3460 months: months, 3461 weekdays: ['пн', 'вÑ', 'ÑÑ', 'ÑÑ', 'пÑ', 'Ñб', 'вÑ'], 3462 weekdaysShort: ['пн', 'вÑ', 'ÑÑ', 'ÑÑ', 'пÑ', 'Ñб', 'вÑ'], 3463 }, 3464 weekStart: 1, 3465 border: true, 3466 3467 onInit: function () { 3468 window.startUdpate = false; 3469 window.startCheck = false; 3470 if (predefinedDates) { 3471 if (predefinedDates[0] && !predefinedDates[1]) { 3472 predefinedDates[1] = new Date((new Date()).getTime() + 2 * 365 * 24 * 60 * 60 * 1000); 3473 } 3474 window.startCheck = true; 3475 this.setDate(predefinedDates); 3476 3477 3478 if (predefinedDates.length > 0) { 3479 let first_time = predefinedDates[0].getTime() 3480 let last_time = predefinedDates[1].getTime() 3481 3482 if (first_time == last_time) 3483 this._dragStart = first_time 3484 } 3485 } 3486 }, 3487 3488 onChange: function (selectedDates) { 3489 const allSelectedDays = document.querySelectorAll('.datepicker__day.is-selected'); 3490 allSelectedDays.forEach(day => { 3491 day.classList.remove('color'); 3492 }); 3493 this.selectedDates = selectedDates; 3494 calendarCallback(selectedDates); 3495 }, 3496 onRender: function () { 3497 if (this.selectedDates && this.selectedDates.length > 0) { 3498 const firstDate = this.selectedDates[0]; 3499 const lastDate = this.selectedDates[this.selectedDates.length - 1]; 3500 3501 const firstDateCell = document.querySelector(`.datepicker__day[data-day="${firstDate.getTime()}"]`); 3502 const lastDateCell = document.querySelector(`.datepicker__day[data-day="${lastDate.getTime()}"]`); 3503 3504 // ÐобавлÑем клаÑÑ color 3505 if (firstDateCell) { 3506 firstDateCell.classList.add('color'); 3507 } 3508 if (lastDateCell) { 3509 lastDateCell.classList.add('color'); 3510 } 3511 } 3512 } 3513 }); 3514 3515 updateDatepicker(); 3516 } 3517 3518 function calendarCallback(selectedDates) { 3519 // if (window.innerWidth < 991) { 3520 // window.startCheck = true; 3521 // window.startUdpate = true; 3522 // } 3523 3524 if (window.startCheck && !window.startUdpate) { 3525 window.startUdpate = true; 3526 return; 3527 } 3528 3529 if (window.startUdpate) { 3530 let datesInput = document.querySelector('#constrained'); 3531 let dateFromInput = document.querySelector('input[data-calendar="from"]'); 3532 let dateToInput = document.querySelector('input[data-calendar="to"]'); 3533 // console.log('datesInput', datesInput); 3534 // console.log('dateFromInput', dateFromInput); 3535 // console.log('dateToInput', dateToInput); 3536 if (datesInput && dateFromInput && dateToInput) { 3537 let datesValue = datesInput.value.split(',') 3538 datesValue = datesValue.filter(item => item); 3539 3540 console.log('datesValue', datesValue); 3541 3542 if (datesValue.length > 0) { 3543 if (window.innerWidth > 991) { 3544 let calendarBlock = document.querySelector('.calender') 3545 if (calendarBlock) { 3546 calendarBlock.classList.add('sleep'); 3547 } 3548 } 3549 3550 if (datesValue.length == 1) { 3551 dateFromInput.value = datesValue[0] 3552 dateToInput.value = datesValue[0] 3553 window.oneDateSelect = true; 3554 } else { 3555 dateFromInput.value = datesValue[0] 3556 dateToInput.value = datesValue[1] 3557 } 3558 3559 if (window.innerWidth > 991) { 3560 window.startCheck = false;
3561 window.startUdpate = false; 3562 } 3563 smartFilter.keyup(dateFromInput) 3564 } 3565 } 3566 } 3567 } 3568} 3569 3570// BX.addCustomEvent('onAjaxSuccess', function(data) { 3571// setTimeout(() => { 3572// let calendarBlock = document.querySelector('.calender') 3573// if (calendarBlock && calendarBlock.classList.contains('sleep')) { 3574// calendarBlock.classList.remove('sleep'); 3575// } 3576// }, 1000); 3577// }) 3578 3579function initDisableEnterToFilterInput() { 3580 const inputs = document.querySelectorAll('input.js-date-input-from, input.js-date-input-to') 3581 if (inputs) { 3582 inputs.forEach(input => { 3583 input.addEventListener('keydown', function (event) { 3584 if (event.key === 'Enter') { 3585 // Ðе оÑпÑавлÑÑÑ ÑоÑÐ¼Ñ 3586 event.preventDefault(); 3587 input.blur(); 3588 } 3589 3590 }); 3591 }); 3592 } 3593} 3594 3595function isValidDateFormat(dateStr) { 3596 const regex = /^\d{2}\.\d{2}\.\d{4}$/; 3597 if (!regex.test(dateStr)) { 3598 return false; 3599 } 3600 3601 const [day, month, year] = dateStr.split('.').map(Number); 3602 3603 if (month < 1 || month > 12 || day < 1) { 3604 return false; 3605 } 3606 3607 const date = new Date(year, month - 1, day); 3608 3609 return ( 3610 date.getFullYear() === year && 3611 date.getMonth() === month - 1 && 3612 date.getDate() === day 3613 ); 3614} 3615 3616function setDateFrom(dateStr) { 3617 if (isValidDateFormat(dateStr)) { 3618 let dateFromInput = document.querySelector('input[data-calendar="from"]'); 3619 let dateToInput = document.querySelector('input[data-calendar="to"]'); 3620 dateFromInput.value = dateStr; 3621 if (dateToInput.value === '') { 3622 //dateToInput.value = dateStr; 3623 } 3624 smartFilter.keyup(dateFromInput); 3625 } else { 3626 document.querySelector('.js-date-input-from').value = ''; 3627 } 3628} 3629 3630function setDateTo(dateStr) { 3631 if (isValidDateFormat(dateStr)) { 3632 let dateFromInput = document.querySelector('input[data-calendar="from"]'); 3633 let dateToInput = document.querySelector('input[data-calendar="to"]'); 3634 dateToInput.value = dateStr; 3635 if (dateFromInput.value === '') { 3636 dateFromInput.value = dateStr; 3637 } 3638 smartFilter.keyup(dateToInput); 3639 } else { 3640 document.querySelector('.js-date-input-to').value = ''; 3641 } 3642} 3643 3644function copyDateValuesInInput() { 3645 let inputFrom = document.querySelector('.js-date-input-from'); 3646 let inputTo = document.querySelector('.js-date-input-to'); 3647 if (inputFrom) { 3648 inputFrom.value = document.querySelector('input[data-calendar="from"]').value; 3649 } 3650 if (inputTo) { 3651 inputTo.value = document.querySelector('input[data-calendar="to"]').value; 3652 } 3653} 3654 3655function addPeriodToThisDate(day) { 3656 const date = new Date(); 3657 const fromFormattedDate = date.toLocaleDateString('ru-RU', { 3658 day: '2-digit', 3659 month: '2-digit', 3660 year: 'numeric' 3661 }); 3662 3663 date.setDate(date.getDate() + day); 3664 const toFormattedDate = date.toLocaleDateString('ru-RU', { 3665 day: '2-digit', 3666 month: '2-digit', 3667 year: 'numeric' 3668 }); 3669 3670 document.querySelector('.js-date-input-from').value = fromFormattedDate; 3671 document.querySelector('input[data-calendar="from"]').value = fromFormattedDate; 3672 document.querySelector('.js-date-input-to').value = toFormattedDate; 3673 document.querySelector('input[data-calendar="to"]').value = toFormattedDate; 3674 smartFilter.keyup(document.querySelector('input[data-calendar="to"]')); 3675} 3676 3677/* End */ 3678;; /* /local/templates/calendario/js/app.js?176665359390465*/ 3679; /* /local/templates/calendario/js/lib/imask/imask.min.js?174790643859248*/ 3680; /* /local/templates/calendario/js/lib/air-datepicker/air-datepicker.js?174790643848711*/ 3681; /* /local/templates/calendario/js/scripts.js?177020583549469*/ 3682; /* /local/templates/calendario/js/datepicker.js?173504996321209*/ 3683; /* /local/templates/calendario/js/calendar.js?179137513910232*/ 3684 3685//# sourceMappingURL=template_a7f47ff2bfc4128b175993322ba71e53.map.js
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.